init
This commit is contained in:
17
app/README.md
Normal file
17
app/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# K12Study App
|
||||
|
||||
`app` 目录用于微信小程序项目骨架,占位承接家长端、学生端或轻量移动端能力。
|
||||
|
||||
## 当前结构
|
||||
|
||||
- `src/app.*`: 小程序全局入口
|
||||
- `src/pages/home`: 首页占位
|
||||
- `src/pages/profile`: 我的页占位
|
||||
- `src/api`: 调用后端 `/api/auth`、`/api/upms` 的接口封装预留
|
||||
- `src/utils/request.js`: 小程序请求基础封装
|
||||
|
||||
## 使用方式
|
||||
|
||||
1. 使用微信开发者工具打开 [project.config.json](/f:/Project/K12study/app/project.config.json)
|
||||
2. 确认 `miniprogramRoot` 指向 `src`
|
||||
3. 按实际环境修改 `src/utils/request.js` 中的 `BASE_URL`
|
||||
9
app/package.json
Normal file
9
app/package.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "k12study-app",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"dev": "echo Open this project with WeChat DevTools",
|
||||
"lint": "echo Add miniprogram lint rules when business code grows"
|
||||
}
|
||||
}
|
||||
16
app/project.config.json
Normal file
16
app/project.config.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"description": "K12Study 微信小程序骨架",
|
||||
"compileType": "miniprogram",
|
||||
"miniprogramRoot": "src/",
|
||||
"srcMiniprogramRoot": "src/",
|
||||
"appid": "touristappid",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"enhance": true,
|
||||
"postcss": true,
|
||||
"minified": false
|
||||
},
|
||||
"simulatorType": "wechat",
|
||||
"libVersion": "trial"
|
||||
}
|
||||
13
app/src/api/auth.js
Normal file
13
app/src/api/auth.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const { request } = require("../utils/request");
|
||||
|
||||
function login(data) {
|
||||
return request({
|
||||
url: "/api/auth/login",
|
||||
method: "POST",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
login
|
||||
};
|
||||
12
app/src/api/upms.js
Normal file
12
app/src/api/upms.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const { request } = require("../utils/request");
|
||||
|
||||
function getRouteMeta() {
|
||||
return request({
|
||||
url: "/api/upms/routes",
|
||||
method: "GET"
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getRouteMeta
|
||||
};
|
||||
5
app/src/app.js
Normal file
5
app/src/app.js
Normal file
@@ -0,0 +1,5 @@
|
||||
App({
|
||||
globalData: {
|
||||
userInfo: null
|
||||
}
|
||||
});
|
||||
14
app/src/app.json
Normal file
14
app/src/app.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/home/index",
|
||||
"pages/profile/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "K12Study",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#f5f7fb"
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json"
|
||||
}
|
||||
17
app/src/app.wxss
Normal file
17
app/src/app.wxss
Normal file
@@ -0,0 +1,17 @@
|
||||
page {
|
||||
background: #f5f7fb;
|
||||
color: #1f2937;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 32rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 12rpx 40rpx rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
6
app/src/pages/home/index.js
Normal file
6
app/src/pages/home/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
Page({
|
||||
data: {
|
||||
title: "K12Study 小程序骨架",
|
||||
description: "这里先放首页占位,后续可扩展为家长端或学生端入口。"
|
||||
}
|
||||
});
|
||||
3
app/src/pages/home/index.json
Normal file
3
app/src/pages/home/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
6
app/src/pages/home/index.wxml
Normal file
6
app/src/pages/home/index.wxml
Normal file
@@ -0,0 +1,6 @@
|
||||
<view class="page">
|
||||
<view class="card">
|
||||
<view>{{title}}</view>
|
||||
<view style="margin-top: 16rpx; color: #64748b;">{{description}}</view>
|
||||
</view>
|
||||
</view>
|
||||
3
app/src/pages/home/index.wxss
Normal file
3
app/src/pages/home/index.wxss
Normal file
@@ -0,0 +1,3 @@
|
||||
view {
|
||||
line-height: 1.6;
|
||||
}
|
||||
6
app/src/pages/profile/index.js
Normal file
6
app/src/pages/profile/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
Page({
|
||||
data: {
|
||||
title: "我的",
|
||||
description: "这里预留账号中心、学校切换、消息入口等能力。"
|
||||
}
|
||||
});
|
||||
3
app/src/pages/profile/index.json
Normal file
3
app/src/pages/profile/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的"
|
||||
}
|
||||
6
app/src/pages/profile/index.wxml
Normal file
6
app/src/pages/profile/index.wxml
Normal file
@@ -0,0 +1,6 @@
|
||||
<view class="page">
|
||||
<view class="card">
|
||||
<view>{{title}}</view>
|
||||
<view style="margin-top: 16rpx; color: #64748b;">{{description}}</view>
|
||||
</view>
|
||||
</view>
|
||||
3
app/src/pages/profile/index.wxss
Normal file
3
app/src/pages/profile/index.wxss
Normal file
@@ -0,0 +1,3 @@
|
||||
view {
|
||||
line-height: 1.6;
|
||||
}
|
||||
4
app/src/sitemap.json
Normal file
4
app/src/sitemap.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"desc": "K12Study sitemap",
|
||||
"rules": []
|
||||
}
|
||||
21
app/src/utils/request.js
Normal file
21
app/src/utils/request.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const BASE_URL = "http://localhost:8088";
|
||||
|
||||
function request(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
url: `${BASE_URL}${options.url}`,
|
||||
method: options.method || "GET",
|
||||
data: options.data,
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
...(options.header || {})
|
||||
},
|
||||
success: (response) => resolve(response.data),
|
||||
fail: reject
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
request
|
||||
};
|
||||
Reference in New Issue
Block a user