diff --git a/api/course.js b/api/course.js index 1f076e4..bcec03a 100644 --- a/api/course.js +++ b/api/course.js @@ -38,4 +38,43 @@ export const getCourseGrades = (semester_id) => { semesterId: semester_id } }) +} + +export const getStudentsGrade = () => { + return request({ + url: "/course/grade/students", + method: "get", + data: {} + }) +} + +export const getGradeForParent = (openid) => { + return request({ + url: "/course/grade/parent", + method: "get", + data: { + openid + } + }) +} + +export const getSemestersForParent = (openid) => { + return request({ + url: "/course/semesters/parent", + method: "get", + data: { + openid + } + }) +} + +export const getSemesterGradesForParent = (openid, semester_id) => { + return request({ + url: "/course/grade/semester/parent", + method: "get", + data: { + openid, + semesterId: semester_id + } + }) } \ No newline at end of file diff --git a/api/message.js b/api/message.js index 30eb4b9..0dae0db 100644 --- a/api/message.js +++ b/api/message.js @@ -17,4 +17,25 @@ export const markMessage = (messageId) => { messageId } }) -} \ No newline at end of file +} + +export const createMessageAndSend = (openid, title, context) => { + return request({ + url: "/message/", + method: "post", + data: { + title, + context + } + }).then(messageId => { + return request({ + url: "/message/receiver", + method: "post", + data: { + messageId, + openid + } + }) + }) +} + diff --git a/app.json b/app.json index 542faec..d71505d 100644 --- a/app.json +++ b/app.json @@ -13,7 +13,9 @@ "pages/my-students/my-students", "pages/students-grade-analyse/students-grade-analyse", "pages/my-health/my-health", - "pages/my-honors/my-honors" + "pages/my-honors/my-honors", + "pages/robot/robot", + "pages/my-children/my-children" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/child-supervisor/child-supervisor.js b/pages/child-supervisor/child-supervisor.js index a6124d9..8d581e1 100644 --- a/pages/child-supervisor/child-supervisor.js +++ b/pages/child-supervisor/child-supervisor.js @@ -62,5 +62,9 @@ Page({ */ onShareAppMessage: function () { + }, + + bindSend() { + } }) \ No newline at end of file diff --git a/pages/child-supervisor/child-supervisor.wxml b/pages/child-supervisor/child-supervisor.wxml index 65eee2a..9e97646 100644 --- a/pages/child-supervisor/child-supervisor.wxml +++ b/pages/child-supervisor/child-supervisor.wxml @@ -18,7 +18,7 @@ - 发送 + 发送 diff --git a/pages/index/index.js b/pages/index/index.js index a1c7245..1c74f47 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -281,4 +281,11 @@ Page({ url: '/pages/my-honors/my-honors' }) }, + bindMyChildren(e) { + let query = e.currentTarget.dataset['index'] + // 跳转 + wx.navigateTo({ + url: '/pages/my-children/my-children?openid=' + query + }) + } }) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 4987694..3e18615 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -32,9 +32,8 @@ - 8 - + {{item.nickName}} 我的孩子 @@ -42,7 +41,6 @@ - 8 {{item.nickName}} @@ -63,42 +61,42 @@ - + 问答机器人 8 详细信息 - + 我的成绩 New - + 我的荣誉 New - + 我的健康 New - + 我的学生 New - + 学生成绩分析 New diff --git a/pages/my-grade/my-grade.js b/pages/my-grade/my-grade.js index 11a7565..d15b44c 100644 --- a/pages/my-grade/my-grade.js +++ b/pages/my-grade/my-grade.js @@ -1,6 +1,6 @@ // pages/my-grade/my-grade.js -import {getGrade, getSemesters, getSemesterGrades, getCourseGrades} from '../../api/course' +import {getGrade, getSemesters, getSemesterGrades, getCourseGrades, getGradeForParent, getSemestersForParent, getSemesterGradesForParent} from '../../api/course' Page({ @@ -13,6 +13,7 @@ Page({ showSemester: false, targetSemesterInfo: {}, targetCoursesInfo: [], + targetOpenid: '', showIndex: 0 }, @@ -20,28 +21,56 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - getGrade().then(res => { - console.log(res) - if(res.failedCourse === 0 && res.passedCourse === 0) { - this.setData({ - recordNotFound: true - }) - } - else { - this.setData({ - gradeInfo: res - }) - } - }).then(res => { - return getSemesters().then(res => { + if(options.isParent === 'true') { + this.setData({ + isParent: true, + targetOpenid: options.openid + }) + getGradeForParent(options.openid).then(res => { console.log(res) - this.setData({ - semestersInfo: res + if(res.failedCourse === 0 && res.passedCourse === 0) { + this.setData({ + recordNotFound: true + }) + } + else { + this.setData({ + gradeInfo: res + }) + } + }).then(res => { + return getSemestersForParent(options.openid).then(res => { + console.log(res) + this.setData({ + semestersInfo: res + }) }) }) - }).catch(err => { - console.log(err) - }) + } else { + getGrade().then(res => { + console.log(res) + if(res.failedCourse === 0 && res.passedCourse === 0) { + this.setData({ + recordNotFound: true + }) + } + else { + this.setData({ + gradeInfo: res + }) + } + }).then(res => { + return getSemesters().then(res => { + console.log(res) + this.setData({ + semestersInfo: res + }) + }) + }).catch(err => { + console.log(err) + }) + } + }, /** @@ -104,23 +133,44 @@ Page({ onClickSemesterItem(e) { let index = parseInt(e.currentTarget.dataset['index']) - getSemesterGrades(this.data.semestersInfo[index].id).then(res => { - console.log(res) - this.setData({ - targetSemesterInfo: res - }) - return Promise.resolve(this.data.semestersInfo[index].id) - }).then(sem_id => { - return getCourseGrades(sem_id).then(res => { + if(this.data.isParent) { + getSemesterGradesForParent(this.data.targetOpenid, this.data.semestersInfo[index].id).then(res => { console.log(res) this.setData({ - targetCoursesInfo: res + targetSemesterInfo: res + }) + return Promise.resolve(this.data.semestersInfo[index].id) + }).then(sem_id => { + return getCourseGrades(sem_id).then(res => { + console.log(res) + this.setData({ + targetCoursesInfo: res + }) + }) + }).then(res => { + this.setData({ + showSemester: true, }) }) - }).then(res => { - this.setData({ - showSemester: true, + } else { + getSemesterGrades(this.data.semestersInfo[index].id).then(res => { + console.log(res) + this.setData({ + targetSemesterInfo: res + }) + return Promise.resolve(this.data.semestersInfo[index].id) + }).then(sem_id => { + return getCourseGrades(sem_id).then(res => { + console.log(res) + this.setData({ + targetCoursesInfo: res + }) + }) + }).then(res => { + this.setData({ + showSemester: true, + }) }) - }) + } } }) \ No newline at end of file diff --git a/pages/my-grade/my-grade.wxml b/pages/my-grade/my-grade.wxml index 053654f..8bc16cf 100644 --- a/pages/my-grade/my-grade.wxml +++ b/pages/my-grade/my-grade.wxml @@ -1,8 +1,10 @@ - 我的成绩 - 我在学校学习生活的概况 + 我的成绩 + 孩子的成绩 + 我在学校学习生活的概况 + 孩子在学校学习生活的概况 {{targetSemesterInfo.semester}} @@ -119,7 +121,7 @@ - 未找到您的成绩记录 + 未找到成绩记录 diff --git a/pages/my-health/my-health.js b/pages/my-health/my-health.js index 99f969c..38298f0 100644 --- a/pages/my-health/my-health.js +++ b/pages/my-health/my-health.js @@ -1,11 +1,18 @@ // pages/my-health/my-health.js +import {getStepsToday, saveSteps, getStepsMonth, getStepsForParent} from '../../api/step' + +const app = getApp() + Page({ /** * 页面的初始数据 */ data: { - + userDocument:{}, + stepsInfo: {}, + monthStepsInfo: [], + recordNotFound: false }, /** @@ -13,6 +20,45 @@ Page({ */ onLoad: function (options) { + if(options.isParent === 'true') { + getStepsForParent(options.openid).then(res =>{ + console.log(res) + this.setData({ + stepsInfo: res, + monthStepsInfo: res.stepList + }) + if(res.recordCount === 0) { + this.setData({ + recordNotFound: true + }) + } + }) + } else { + const that = this + new Promise((resolve, reject) =>{ + wx.getWeRunData({ + success (res) { + // 拿 encryptedData 到开发者后台解密开放数据 + const encryptedData = res.encryptedData + // 或拿 cloudID 通过云调用直接获取开放数据 + const cloudID = res.cloudID + // iv + const iv = res.iv + + saveSteps(encryptedData, iv).then(res => { + console.log(res) + that.setData({ + stepsInfo: res, + monthStepsInfo: res.stepList + }) + resolve(res) + }) + } + }) + }).then(res => { + + }) + } }, /** diff --git a/pages/my-health/my-health.json b/pages/my-health/my-health.json index 8835af0..207522e 100644 --- a/pages/my-health/my-health.json +++ b/pages/my-health/my-health.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "i-spin": "../../dist/spin/index" + } } \ No newline at end of file diff --git a/pages/my-health/my-health.wxml b/pages/my-health/my-health.wxml index bd3c191..1ef6699 100644 --- a/pages/my-health/my-health.wxml +++ b/pages/my-health/my-health.wxml @@ -1,8 +1,50 @@ - 我的健康 - 我今日的健康信息 + 孩子的健康 + 我的健康 + 微信运动健康信息 - + + + + + + + {{stepsInfo.realName}} + + + + + + {{stepsInfo.count}} + + + + {{stepsInfo.updateTime}} + + + + {{stepsInfo.averageSteps}} + + + + {{stepsInfo.recordCount}} + + + + + + 健康记录列表 + + +

记录时间 {{item.timestamp}}

+ + 步数 {{item.step}} + +
+
+
+
+ 未找到健康记录
diff --git a/pages/my-honors/my-honors.js b/pages/my-honors/my-honors.js index 452288f..dd3d3b8 100644 --- a/pages/my-honors/my-honors.js +++ b/pages/my-honors/my-honors.js @@ -19,23 +19,37 @@ Page({ honorTitle: "", toast: false, hideToast: true, + isParent: false }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ - userDocument: app.globalData.userDocument - }) - console.log(this.data) - getHonors(app.globalData.userBaseInfo.openid) - .then(res => { - console.log(res) + if(options.isParent === 'true') { this.setData({ - honorsInfo: res + isParent: true }) - }) + getHonors(options.openid) + .then(res => { + console.log(res) + this.setData({ + honorsInfo: res + }) + }) + } else { + this.setData({ + userDocument: app.globalData.userDocument + }) + console.log(this.data) + getHonors(app.globalData.userBaseInfo.openid) + .then(res => { + console.log(res) + this.setData({ + honorsInfo: res + }) + }) + } }, /** diff --git a/pages/my-honors/my-honors.json b/pages/my-honors/my-honors.json index 8835af0..207522e 100644 --- a/pages/my-honors/my-honors.json +++ b/pages/my-honors/my-honors.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "i-spin": "../../dist/spin/index" + } } \ No newline at end of file diff --git a/pages/my-honors/my-honors.wxml b/pages/my-honors/my-honors.wxml index e139c4d..156a4f4 100644 --- a/pages/my-honors/my-honors.wxml +++ b/pages/my-honors/my-honors.wxml @@ -1,6 +1,7 @@ - 我的荣誉 + 我的荣誉 + 孩子荣誉 科研竞赛社会工作等情况 @@ -54,22 +55,18 @@ - - {{userDocument.realName}} + + {{honorsInfo.length}} - - - {{honorsInfo.length}} - 0 - 添加荣誉 + 添加荣誉 diff --git a/pages/students-grade-analyse/students-grade-analyse.js b/pages/students-grade-analyse/students-grade-analyse.js index f702245..d988581 100644 --- a/pages/students-grade-analyse/students-grade-analyse.js +++ b/pages/students-grade-analyse/students-grade-analyse.js @@ -1,18 +1,25 @@ // pages/students-grade-analyse/students-grade-analyse.js +import {getStudentsGrade} from '../../api/course' + Page({ /** * 页面的初始数据 */ data: { - + studentsGradeInfo: {} }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + getStudentsGrade().then(res =>{ + console.log(res) + this.setData({ + studentsGradeInfo: res + }) + }) }, /** diff --git a/pages/students-grade-analyse/students-grade-analyse.wxml b/pages/students-grade-analyse/students-grade-analyse.wxml index f4b8b07..eec2fb3 100644 --- a/pages/students-grade-analyse/students-grade-analyse.wxml +++ b/pages/students-grade-analyse/students-grade-analyse.wxml @@ -10,25 +10,25 @@ - 254 + {{studentsGradeInfo.studentsNumber}} - 75.6 + {{studentsGradeInfo.weightedAverage}} - 2.85 + {{studentsGradeInfo.gpa}} - 12 + {{studentsGradeInfo.failedRecord}} - 5 + {{studentsGradeInfo.semesterListSize}} @@ -50,21 +50,9 @@ 学期概况 - + - 2019-2020学年春季学期 - - - - - - 2020-2021学年秋季学期 - - - - - - 2020-2021学年春季学期 + {{item}}