diff --git a/api/account.js b/api/account.js new file mode 100644 index 0000000..3de4512 --- /dev/null +++ b/api/account.js @@ -0,0 +1,19 @@ +import request from '../utils/request.js' + +export const getSupervisorsProfile = () => { + return request({ + url: "/account/supervisors", + method: "get", + data: { + } + }) +} + +export const getChildrenProfile = () => { + return request({ + url: "/account/children", + method: "get", + data: { + } + }) +} \ No newline at end of file diff --git a/api/document.js b/api/document.js index 72306f0..cb0db76 100644 --- a/api/document.js +++ b/api/document.js @@ -29,4 +29,58 @@ export const bindDocument = (documentCode) => { documentCode } }) +} + +export const checkParents = () => { + return request({ + url: "/document/parents/check", + method: "get", + data: { + } + }) +} + +export const getParents = () => { + return request({ + url: "/document/parents", + method: "get", + data: { + } + }) +} + +export const checkChildren = () => { + return request({ + url: "/document/children/check", + method: "get", + data: { + } + }) +} + +export const getChildren = () => { + return request({ + url: "/document/children", + method: "get", + data: { + } + }) +} + +export const checkSupervisors = () => { + return request({ + url: "/document/supervisors/check", + method: "get", + data: { + } + }) +} + +export const getSupervisors = () => { + return request({ + url: "/document/supervisors", + method: "get", + data: { + } + }) } \ No newline at end of file diff --git a/app.json b/app.json index d445529..542faec 100644 --- a/app.json +++ b/app.json @@ -9,7 +9,11 @@ "pages/my-grade/my-grade", "pages/child-supervisor/child-supervisor", "pages/announcement/announcement", - "pages/message/message" + "pages/message/message", + "pages/my-students/my-students", + "pages/students-grade-analyse/students-grade-analyse", + "pages/my-health/my-health", + "pages/my-honors/my-honors" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/account-relation-info/account-relation-info.js b/pages/account-relation-info/account-relation-info.js index 8d97cbf..1b6972f 100644 --- a/pages/account-relation-info/account-relation-info.js +++ b/pages/account-relation-info/account-relation-info.js @@ -1,18 +1,66 @@ // pages/account-relation-info/account-relation-info.js +import {checkParents, checkChildren, getParents, getChildren, checkSupervisors, getSupervisors} from '../../api/document' + Page({ /** * 页面的初始数据 */ data: { - + parentsInfo: [], + childrenInfo: [], + supervisorsInfo: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + checkParents().then(res => { + if(res === true) { + return Promise.resolve(res) + } else { + return Promise.reject(res) + } + }).then(res => { + return getParents() + }).then(res => { + this.setData({ + parentsInfo: res + }) + }).catch(err => { + + }).then(res => { + return checkChildren().then(res=>{ + if(res === true) { + return Promise.resolve(res) + } else { + return Promise.reject(res) + } + }) + }).then(res => { + return getChildren().then(res => { + this.setData({ + childrenInfo: res + }) + }) + }).catch(err => { + }).then(res => { + return checkSupervisors().then(res=>{ + if(res === true) { + return Promise.resolve(res) + } else { + return Promise.reject(res) + } + }) + }).then(res => { + return getSupervisors().then(res => { + this.setData({ + supervisorsInfo: res + }) + }) + }) }, /** diff --git a/pages/account-relation-info/account-relation-info.wxml b/pages/account-relation-info/account-relation-info.wxml index 874321f..10a2759 100644 --- a/pages/account-relation-info/account-relation-info.wxml +++ b/pages/account-relation-info/account-relation-info.wxml @@ -4,34 +4,34 @@ 关系信息 我与其他账号的关系 - + - - 李xx + + {{item.realName}} - + {{item.gender === "U" ? "未知" : item.gender === "M" ? "男" : "女" }} - 2018 + {{item.gradeYear}} - 软件工程 + {{item.major}} - 软件学院 + {{item.college}} - 已绑定 + {{item.connected ? "已绑定" : "未绑定"}} @@ -39,34 +39,22 @@ - + - 李ok + {{item.realName}} - - - - - Guangdong - - - - Shenzhen - - - - 13600000000 + {{item.gender === "U" ? "未知" : item.gender === "M" ? "男" : "女" }} - 已绑定 + {{item.connected ? "已绑定" : "未绑定"}} @@ -74,30 +62,34 @@ - + - 高xy + {{item.realName}} - + {{item.gender === "U" ? "未知" : item.gender === "M" ? "男" : "女" }} - - supervisor@nwpu.edu.cn + + {{item.gradeYear}} - - 13600000000 + + {{item.major}} + + + + {{item.college}} - 已绑定 + {{item.connected ? "已绑定" : "未绑定"}} diff --git a/pages/bind-document/bind-document.js b/pages/bind-document/bind-document.js index 43832a0..c1a6cda 100644 --- a/pages/bind-document/bind-document.js +++ b/pages/bind-document/bind-document.js @@ -3,6 +3,8 @@ import {searchDocument, bindDocument} from '../../api/document' import {attachRole} from '../../api/user' +const app = getApp() + Page({ /** @@ -136,12 +138,12 @@ Page({ toast: false, hideToast: false, }); - // 绑定成功后,跳转进入小程序首页 - wx.navigateTo({ - url: '/pages/index/index' - }) + // 绑定成功后,跳转进入小程序首页 + wx.navigateTo({ + url: '/pages/index/index' + }) }, 300); - }, 2000); + }, 3000); }).catch(err =>{ console.log(err) diff --git a/pages/child-supervisor/child-supervisor.wxml b/pages/child-supervisor/child-supervisor.wxml index 7ec79f6..65eee2a 100644 --- a/pages/child-supervisor/child-supervisor.wxml +++ b/pages/child-supervisor/child-supervisor.wxml @@ -21,5 +21,5 @@ 发送 - + diff --git a/pages/index/index.js b/pages/index/index.js index 579109a..a1c7245 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -2,6 +2,7 @@ import {getDocument} from '../../api/document' import {login, checkProfile, setProfile, getProfile} from '../../api/user' +import {getSupervisorsProfile, getChildrenProfile} from '../../api/account' // 获取应用实例 const app = getApp() @@ -17,6 +18,8 @@ Page({ unrecoverable: false, refresh: false, unrecoverableInfo: '', + childrenInfo: [], + supervisorsInfo: [] }, handleLogin() { @@ -161,7 +164,24 @@ Page({ }) } }) + }).then(res => { + return getChildrenProfile() + }).then(res => { + this.setData({ + childrenInfo: res + }) + }).then(res => { + return getSupervisorsProfile() + }).then(res => { + this.setData({ + supervisorsInfo: res + }) }).catch(err => { + console.log(err) + this.setData({ + loading: false, + unrecoverable: true + }) console.log("账户基本信息未设置") }).finally(() => { this.setData({ @@ -237,4 +257,28 @@ Page({ url: '/pages/message/message' }) }, + bindMyStudents() { + // 跳转 + wx.navigateTo({ + url: '/pages/my-students/my-students' + }) + }, + bindStudentsGradeAnalyse() { + // 跳转 + wx.navigateTo({ + url: '/pages/students-grade-analyse/students-grade-analyse' + }) + }, + bindMyHealth() { + // 跳转 + wx.navigateTo({ + url: '/pages/my-health/my-health' + }) + }, + bindMyHonors() { + // 跳转 + wx.navigateTo({ + url: '/pages/my-honors/my-honors' + }) + }, }) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 3895fc7..254a263 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -29,24 +29,24 @@ 功能 - + - + 8 - 我的孩子 - 摘要信息 + {{item.nickName}} + 我的孩子 - + - + 8 - 孩子的辅导员 - 摘要信息 + {{item.nickName}} + 孩子的辅导员 @@ -77,30 +77,30 @@ - + 我的荣誉 New - + 我的健康 New - + 我的学生 New - + - 学生的成绩 + 学生成绩分析 New @@ -113,6 +113,6 @@ - 您的账号已被封禁 + 您的账号不被允许使用服务 diff --git a/pages/my-health/my-health.js b/pages/my-health/my-health.js new file mode 100644 index 0000000..99f969c --- /dev/null +++ b/pages/my-health/my-health.js @@ -0,0 +1,66 @@ +// pages/my-health/my-health.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/my-health/my-health.json b/pages/my-health/my-health.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/my-health/my-health.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/my-health/my-health.wxml b/pages/my-health/my-health.wxml new file mode 100644 index 0000000..bd3c191 --- /dev/null +++ b/pages/my-health/my-health.wxml @@ -0,0 +1,8 @@ + + + + 我的健康 + 我今日的健康信息 + + + diff --git a/pages/my-health/my-health.wxss b/pages/my-health/my-health.wxss new file mode 100644 index 0000000..09f6b9d --- /dev/null +++ b/pages/my-health/my-health.wxss @@ -0,0 +1 @@ +/* pages/my-health/my-health.wxss */ \ No newline at end of file diff --git a/pages/my-honors/my-honors.js b/pages/my-honors/my-honors.js new file mode 100644 index 0000000..82b73c4 --- /dev/null +++ b/pages/my-honors/my-honors.js @@ -0,0 +1,66 @@ +// pages/my-honors/my-honors.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/my-honors/my-honors.json b/pages/my-honors/my-honors.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/my-honors/my-honors.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/my-honors/my-honors.wxml b/pages/my-honors/my-honors.wxml new file mode 100644 index 0000000..e979595 --- /dev/null +++ b/pages/my-honors/my-honors.wxml @@ -0,0 +1,2 @@ + +pages/my-honors/my-honors.wxml diff --git a/pages/my-honors/my-honors.wxss b/pages/my-honors/my-honors.wxss new file mode 100644 index 0000000..b60d8e9 --- /dev/null +++ b/pages/my-honors/my-honors.wxss @@ -0,0 +1 @@ +/* pages/my-honors/my-honors.wxss */ \ No newline at end of file diff --git a/pages/my-students/my-students.js b/pages/my-students/my-students.js new file mode 100644 index 0000000..822e667 --- /dev/null +++ b/pages/my-students/my-students.js @@ -0,0 +1,66 @@ +// pages/my-student/my-students.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/my-students/my-students.json b/pages/my-students/my-students.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/my-students/my-students.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/my-students/my-students.wxml b/pages/my-students/my-students.wxml new file mode 100644 index 0000000..9088bfd --- /dev/null +++ b/pages/my-students/my-students.wxml @@ -0,0 +1,45 @@ + + + + 我的学生 + 我管理的学生们 + + + +
+ + + + + + +
+ 取消 +
+ + + + 实时搜索文本 + + + + + 实时搜索文本 + + + + + 实时搜索文本 + + + + + 实时搜索文本 + + + +
+
\ No newline at end of file diff --git a/pages/my-students/my-students.wxss b/pages/my-students/my-students.wxss new file mode 100644 index 0000000..6f27201 --- /dev/null +++ b/pages/my-students/my-students.wxss @@ -0,0 +1 @@ +/* pages/my-student/my-students.wxss */ \ No newline at end of file diff --git a/pages/students-grade-analyse/students-grade-analyse.js b/pages/students-grade-analyse/students-grade-analyse.js new file mode 100644 index 0000000..f702245 --- /dev/null +++ b/pages/students-grade-analyse/students-grade-analyse.js @@ -0,0 +1,66 @@ +// pages/students-grade-analyse/students-grade-analyse.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/students-grade-analyse/students-grade-analyse.json b/pages/students-grade-analyse/students-grade-analyse.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/students-grade-analyse/students-grade-analyse.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/students-grade-analyse/students-grade-analyse.wxml b/pages/students-grade-analyse/students-grade-analyse.wxml new file mode 100644 index 0000000..f4b8b07 --- /dev/null +++ b/pages/students-grade-analyse/students-grade-analyse.wxml @@ -0,0 +1,75 @@ + + + + 学生成绩分析 + 我管理的学生的学业成绩情况 + + + + + + + + 254 + + + + + + 75.6 + + + + 2.85 + + + + 12 + + + + 5 + + + + 反映问题 + + + + + 功能 + + + + 需要关注的学生 + + + + + + + 学期概况 + + + + 2019-2020学年春季学期 + + + + + + 2020-2021学年秋季学期 + + + + + + 2020-2021学年春季学期 + + + + + + + + diff --git a/pages/students-grade-analyse/students-grade-analyse.wxss b/pages/students-grade-analyse/students-grade-analyse.wxss new file mode 100644 index 0000000..d4dc3ce --- /dev/null +++ b/pages/students-grade-analyse/students-grade-analyse.wxss @@ -0,0 +1 @@ +/* pages/students-grade-analyse/students-grade-analyse.wxss */ diff --git a/utils/request.js b/utils/request.js index 8b376b9..1048e20 100644 --- a/utils/request.js +++ b/utils/request.js @@ -14,11 +14,9 @@ const refresh_token = app => { method: 'get' }).then(res => { // 设置登录信息 - const userInfo = app.globalData.userInfo - userInfo.token = res.token + app.globalData.userBaseInfo.token = res.token resolve(true) }).catch(err => { - console.log(err) // 清空登录信息 app.globalData.login = false app.globalData.userInfo = {}