diff --git a/app.js b/app.js index 76e447e..255401f 100644 --- a/app.js +++ b/app.js @@ -7,13 +7,6 @@ App({ }); }, onLaunch(e) { - if (wx.getStorageSync('menuTop') != '' && wx.getStorageSync('menuHeight') != '') return - const button = wx.getMenuButtonBoundingClientRect(); - console.log(button); - wx.setStorageSync('menuTop', button.top) - wx.setStorageSync('menuHeight', button.height) - }, - onShow(){ const updateManager = wx.getUpdateManager(); updateManager.onCheckForUpdate(function (res) { @@ -22,21 +15,21 @@ App({ }); updateManager.onUpdateReady(function () { - wx.showModal({ - title: '更新提示', - content: '新版本已经准备好,是否重启应用?', - success: function (res) { - if (res.confirm) { - // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 - updateManager.applyUpdate() - } - } - }) + updateManager.applyUpdate() + }); updateManager.onUpdateFailed(function () { console.log('新版本下载失败'); // 处理下载失败 }); + if (wx.getStorageSync('menuTop') != '' && wx.getStorageSync('menuHeight') != '') return + const button = wx.getMenuButtonBoundingClientRect(); + console.log(button); + wx.setStorageSync('menuTop', button.top) + wx.setStorageSync('menuHeight', button.height) + }, + onShow(){ + }, globalData: { teamRefresh: 0, //团队首页是否刷新 diff --git a/app.json b/app.json index ceb8489..d663d1f 100644 --- a/app.json +++ b/app.json @@ -66,7 +66,9 @@ "parent/history-work/history-work", "team/rank/rank", "team/rank-team/rank-team", - "parent/history-train/history-train" + "parent/history-train/history-train", + "teacher/report-list/report-list", + "teacher/report-detail/report-detail" ] } ], diff --git a/pages/login/login.js b/pages/login/login.js index 07aeed2..9aeac04 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -3,7 +3,8 @@ const { post } = require('../../utils/http'); const { - getOpenId,getUserAccountWithToken + getOpenId, + getUserAccountWithToken } = require('../../utils/serve/user'); const tabService = require("../../utils/tab-serve") const utils = require("../../utils/utils") @@ -188,7 +189,7 @@ Page({ roleId: 2, key: teacherPhone, password: teacherPassword, - openId:opid.data + openId: opid.data }).then(res => { wx.hideLoading(); if (res.success) { @@ -212,7 +213,7 @@ Page({ }, }) - + }, // 家长学生姓名输入 @@ -255,28 +256,36 @@ Page({ wx.showLoading({ title: "登录中..." }); - post("User/Login", { - roleId: 3, - key: studentName, - password: studentId - }).then(res => { - wx.hideLoading(); - if (res.success) { - this.handleLoginSuccess(res.data.token); - } else { - wx.showToast({ - title: res.message || "登录失败", - icon: "none" + wx.login({ + success: async (loginData) => { + const opid = await getOpenId(loginData.code) + post("User/Login", { + roleId: 3, + key: studentName, + password: studentId, + openId: opid.data + }).then(res => { + wx.hideLoading(); + if (res.success) { + wx.setStorageSync('roleId', res.data.role_Id) + this.handleLoginSuccess(res.data.token); + } else { + wx.showToast({ + title: res.errorMsg || "登录失败", + icon: "none" + }); + } + }).catch(err => { + wx.hideLoading(); + wx.showToast({ + title: err.errorMsg || "网络错误", + icon: "none" + }); + console.error("家长登录失败:", err); }); - } - }).catch(err => { - wx.hideLoading(); - wx.showToast({ - title: "网络错误", - icon: "none" - }); - console.error("家长登录失败:", err); - }); + }, + }) + }, // 微信登录请求 diff --git a/pages/parent/report/report.js b/pages/parent/report/report.js index c3d39f8..3116143 100644 --- a/pages/parent/report/report.js +++ b/pages/parent/report/report.js @@ -3,6 +3,8 @@ const tabService = require("../../../utils/tab-serve"); import { getReport } from '../../../utils/serve/parent' +import { getClassRoomRecord } from '../../../utils/serve/teacher'; +import { getWeekdayWithValidation } from '../../../utils/utils'; Page({ /** @@ -10,14 +12,26 @@ Page({ */ data: { report: {}, - list: [] + list: [], + isTrainee:false, + pageIndex:1, + hasMore:true, + roomList:[] }, /** * 生命周期函数--监听页面加载 */ async onLoad(options) { - await this.getStudentReport() + if(wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 3 ){ + this.setData({ + isTrainee:true + },()=>{ + this.getTrainClass(true) + }) + }else{ + await this.getStudentReport() + } }, async getStudentReport() { @@ -43,6 +57,33 @@ Page({ }) }, + //获取教练课堂记录 刷新 加载更多 + async getTrainClass(refresh) { + if (!this.data.hasMore && !refresh) return //非刷新且没有 + const res = await getClassRoomRecord({ + pageIndex: this.data.pageIndex, + PageSize: 20, + }) + let newList = res.data.datas.map(item => { + return { + ...item, + time: getWeekdayWithValidation(Number(item.startingEndingTime.slice(0, 4)), Number(item.startingEndingTime.slice(5, 7)), Number(item.startingEndingTime.slice(8, 10))) + } + }) + this.setData({ + roomList: refresh ? newList : [...this.data.roomList, ...newList], + page: this.data.page + 1, + hasMore: res.data.total > (this.data.pageIndex) * 20, + }) + }, + + //查看报告详情 + goReportDetail(e){ + wx.navigateTo({ + url: '/subpackage/teacher/report-detail/report-detail?id='+e.currentTarget.id , + }) + }, + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -55,7 +96,11 @@ Page({ */ onShow() { tabService.updateIndex(this, 2) - + if(wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 5){ //学员 + this.setData({ + isTrainee:true + }) + } }, /** @@ -76,19 +121,34 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ async onPullDownRefresh() { - await this.getStudentReport() - wx.showToast({ - title: '刷新成功!', - icon: 'none' - }) - wx.stopPullDownRefresh() + if(this.data.isTrainee){ + this.setData({ + pageIndex:1, + hasMore:true + },()=>{ + this.getTrainClass(true) + wx.stopPullDownRefresh() + wx.showToast({ + title: '刷新成功', + icon: 'none' + }) + }) + }else{ + await this.getStudentReport() + wx.stopPullDownRefresh() + wx.showToast({ + title: '刷新成功!', + icon: 'none' + }) + } + }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { - + this.getTrainClass() }, /** diff --git a/pages/parent/report/report.json b/pages/parent/report/report.json index d889f80..684ad9c 100644 --- a/pages/parent/report/report.json +++ b/pages/parent/report/report.json @@ -6,5 +6,6 @@ "backgroundColorContent": "#f7f7f7", "backgroundColor": "#f7f7f7", "navigationStyle": "custom", - "enablePullDownRefresh": true + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 } \ No newline at end of file diff --git a/pages/parent/report/report.wxml b/pages/parent/report/report.wxml index fa1c69d..1770a4c 100644 --- a/pages/parent/report/report.wxml +++ b/pages/parent/report/report.wxml @@ -2,7 +2,7 @@ - + 健康身体 坚持运动 @@ -63,10 +63,10 @@ - 不及格 - 及格 - 良好 - 优秀 + 不及格 + 及格 + 良好 + 优秀 @@ -77,34 +77,42 @@ - + - 60 - 80 - 90 - - - - - {{item.score}} - - - - - - - + 60 + 80 + 90 + + + + + {{item.score}} + + + + + + + - - 不及格 - 及格 - 良好 - 优秀 - + + 不及格 + 及格 + 良好 + 优秀 + + + + {{item.startingEndingTime}}({{item.time}}) + + + 加载中... + 没有更多了哦~ + \ No newline at end of file diff --git a/pages/parent/report/report.wxss b/pages/parent/report/report.wxss index be40c1f..cdd4884 100644 --- a/pages/parent/report/report.wxss +++ b/pages/parent/report/report.wxss @@ -167,4 +167,17 @@ .right{ flex: 1; +} + +.card1{ + display: flex; + justify-content: space-between; + padding-right: 20rpx; +} + +.more{ + font-size: 26rpx; + color: #575555; + text-align: center; + margin-top: 50rpx; } \ No newline at end of file diff --git a/pages/student/my/my.js b/pages/student/my/my.js index 47e0bdf..7850bee 100644 --- a/pages/student/my/my.js +++ b/pages/student/my/my.js @@ -110,25 +110,25 @@ Page({ }) const account = await getUserAccount() - console.log(account) - let da = account.data.find(item => item.roleId == 2) - if(da){ - wx.login({ - success: async (loginData) => { - const opid = await getOpenId(loginData.code) - const canLogin = await postOpenId(opid.data, da.userId) - if (canLogin.data) { //当前登录教师,需要退出 - const logout = await deleteOpenId(da.userId) - that.sure() - } else { - that.sure() - } - }, - }) - }else{ - that.sure() - } + console.log('拿logincode') + wx.login({ + success: async (loginData) => { + wx.showLoading({ + title: '退出登录中', + }) + const opid = await getOpenId(loginData.code) + account.data.map(async (item) => { + if (item.roleId == 2 || item.roleId == 3 || item.roleId == 4 || item.roleId == 5) { + const canLogin = await postOpenId(opid.data, item.userId) + if (canLogin.data) { //当前登录教师或者家长,需要退出 + const logout = await deleteOpenId(item.userId) + } + } + }) + that.sure() + }, + }) } } }) diff --git a/pages/teacher/count/count.js b/pages/teacher/count/count.js index 1a0fa55..f240103 100644 --- a/pages/teacher/count/count.js +++ b/pages/teacher/count/count.js @@ -1,13 +1,17 @@ // pages/teacher/count/count.js +import uCharts from '../../../utils/chart/u-charts'; const { getClassList, getProjectList, getTongji, getStudentTongji, - getStudentList + getStudentList, + getClassRoomRecord, + getClassRoomReportDetails } = require("../../../utils/serve/teacher"); const tabService = require("../../../utils/tab-serve"); - +const app = getApp() +var uChartsInstance = {}; Page({ /** @@ -16,98 +20,282 @@ Page({ data: { classList: [], //班级列表 nowClass: {}, //当前选择班级 - page:1, - studentList:[], - hasMore:true, - projectList:[], - nowProject:{}, - gradeList:['不及格','及格','良好','优秀'], - nowGrade:'不及格', - num:0,//总人数 - rank:{} + page: 1, + studentList: [], + hasMore: true, + projectList: [], + nowProject: {}, + gradeList: ['不及格', '及格', '良好', '优秀'], + nowGrade: '不及格', + num: 0, //总人数 + rank: {}, + isTrainer: false, + courseList: [], //教练课堂记录 + nowCourse: {}, + showDialog: false, + clickCouse: {}, //选中的教练课程 + nowCourseDetail: {}, + cWidth: 330, + cHeight: 280, + pixelRatio: 2, }, + /** * 生命周期函数--监听页面加载 */ async onLoad(options) { - this.getClass() + wx.showLoading({ + title: '', + }) + if (wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4) { + await this.getTrainClass(true) + } else { + await this.getClass() + } + wx.hideLoading() + }, + + clickCouse(e) { + this.setData({ + clickCouse: e.currentTarget.dataset.item + }) + }, + + async sureClickCouse() { + const that = this + if (!this.data.clickCouse.id) return app.showToast('请选择课程后再确认哦~') + wx.showLoading({ + title: '加载中', + }) + const res = await getClassRoomReportDetails(this.data.clickCouse.id) + that.setData({ + nowCourse: this.data.clickCouse, + clickCouse: {}, + showDialog: false, + nowCourseDetail: res.data + },()=>{ + this.drawCharts(this) + }) + wx.hideLoading() + }, + + showDialog() { + this.setData({ + showDialog: true + }) + }, + + closeDialog() { + this.setData({ + showDialog: false + }) }, //获取班级列表 - async getClass(){ + async getClass() { const res = await getClassList() this.setData({ classList: res.data, nowClass: res.data[0] - },async ()=>{ + }, async () => { await this.getProject() this.getStudent() }) }, - + + //获取教练课堂记录 刷新 加载更多 + async getTrainClass(isRefresh) { + const that = this + let refresh = isRefresh && isRefresh.type != "scrolltolower" + console.log(isRefresh) + console.log('aaaaaaaaaaa',refresh) + if (!this.data.hasMore && !refresh) return //非刷新且没有 + const res = await getClassRoomRecord({ + pageIndex: this.data.page, + PageSize: 20, + }) + if(!this.data.nowCourse.id){ + const detail = await getClassRoomReportDetails(res.data.datas[0].id) + this.setData({ + nowCourseDetail:this.data.nowCourse.id ? this.data.nowCourseDetail: detail.data + },()=>{ + that.drawCharts(that) + }) + } + this.setData({ + courseList: refresh ? res.data.datas : [...this.data.courseList, ...res.data.datas], + page: this.data.page + 1, + hasMore: res.data.total > (this.data.page) * 20, + nowCourse: !this.data.nowCourse.id || refresh ? res.data.datas[0] : this.data.nowCourse, + }) + }, + //获取项目列表 - async getProject(){ + async getProject() { const res = await getProjectList(this.data.nowClass.gradeId) this.setData({ - projectList:res.data, - nowProject:res.data[0] + projectList: res.data, + nowProject: res.data[0] }) }, //获取学生列表 刷新 加载更多 - async getStudent(isRefresh){ - if(!this.data.hasMore && !isRefresh) return //非刷新且没有 + async getStudent(isRefresh) { + if (!this.data.hasMore && !isRefresh) return //非刷新且没有 const res = await getTongji({ - ClassId:this.data.nowClass.classId, - CategoryValue:this.data.nowProject.id || 2, - Rank:this.data.nowGrade , - PageIndex:isRefresh ? 1 : this.data.page, - PageSize:50 + ClassId: this.data.nowClass.classId, + CategoryValue: this.data.nowProject.id || 2, + Rank: this.data.nowGrade, + PageIndex: isRefresh ? 1 : this.data.page, + PageSize: 50 }) console.log(res.data.studentlist.total) this.setData({ - page:this.data.page + 1, - hasMore:res.data.studentlist.total > this.data.page * 50, - studentList:isRefresh?res.data.studentlist.datas: [...this.data.studentList,...res.data.studentlist.datas], - total:res.data.headTotal, - rank:res.data.rankDic + page: this.data.page + 1, + hasMore: res.data.studentlist.total > this.data.page * 50, + studentList: isRefresh ? res.data.studentlist.datas : [...this.data.studentList, ...res.data.studentlist.datas], + total: res.data.headTotal, + rank: res.data.rankDic }) }, - pickerChange(e){ + pickerChange(e) { const that = this this.setData({ - [e.currentTarget.dataset.key]:this.data[e.currentTarget.dataset.id][Number(e.detail.value)] - },async ()=>{ - if(e.currentTarget.dataset.key == 'nowClass'){ + [e.currentTarget.dataset.key]: this.data[e.currentTarget.dataset.id][Number(e.detail.value)] + }, async () => { + if (e.currentTarget.dataset.key == 'nowClass') { await that.getProject() } that.getStudent(true) }) }, - goDetail(e){ + goDetail(e) { wx.navigateTo({ - url: '/subpackage/teacher/count-detail/count-detail?id='+e.currentTarget.dataset.item.studentNo+'&classId='+this.data.nowClass.classId, + url: '/subpackage/teacher/count-detail/count-detail?id=' + e.currentTarget.dataset.item.studentNo + '&classId=' + this.data.nowClass.classId, }) }, + + drawCharts(that) { + const query = wx.createSelectorQuery().in(that); + console.log('重新绘图',that.data.nowCourseDetail) + query.select('#mycanvas').fields({ + node: true, + size: true + }).exec(res => { + if (res[0]) { + const canvas = res[0].node; + const ctx = canvas.getContext('2d'); + canvas.width = res[0].width * that.data.pixelRatio; + canvas.height = res[0].height * that.data.pixelRatio; + uChartsInstance['mycanvas'] = new uCharts({ + type: "line", + context: ctx, + width: that.data.cWidth * that.data.pixelRatio, + height: that.data.cHeight * that.data.pixelRatio, + categories: that.data.nowCourseDetail.heartRateTrend.axisX, + series: [{ + data: that.data.nowCourseDetail.heartRateTrend.axisY + }, ], + pixelRatio: that.data.pixelRatio, + animation: true, + background: "#FFFFFF", + color: that.data.chartType == 1 ? ["#FFA30C"] : that.data.chartType == 2 ? ["#6CB7FB"] : ["#FF4949"], + padding: [15, 15, 10, 0], + enableScroll: true, + // touchMoveLimit: 24, + legend: { + show: false, + fontColor: "#37b7e8" + }, + xAxis: { + disableGrid: true, + itemCount: 5, + scrollShow: true, + fontSize: 12, + lineHeight: 30, + axisLineColor: "#f1f1f1", + fontColor: "#000", + scrollColor: "#f6ecc9", + scrollBackgroundColor: "#F4F6F8" + }, + yAxis: { + gridType: "dash", + gridColor: "#F1F1F1", + // data: [{ + // min: 40, + // // axisLine: false, + // fontSize: 12 + // }] + }, + extra: { + line: { + type: "curve", + width: 2, + activeType: "hollow", + onShadow: true, + linearType: "custom", + }, + tooltip: { + showBox: false + } + } + }); + } else { + console.error("[uCharts]: 未获取到 context"); + } + }); + }, + tap(e) { + uChartsInstance[e.target.id].touchLegend(e); + uChartsInstance[e.target.id].showToolTip(e); + }, + + touchstart(e){ + uChartsInstance[e.target.id].scrollStart(e); + }, + touchmove(e){ + uChartsInstance[e.target.id].scroll(e); + }, + touchend(e){ + uChartsInstance[e.target.id].scrollEnd(e); + uChartsInstance[e.target.id].touchLegend(e); + uChartsInstance[e.target.id].showToolTip(e); + }, + + /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { - + const cWidth = 315 / 375 * wx.getWindowInfo().windowWidth;; + //这里的 500 对应 css .charts 的 height + const cHeight = 220 / 375 * wx.getWindowInfo().windowWidth; + console.log(wx.getWindowInfo()) + const pixelRatio = wx.getWindowInfo().pixelRatio + this.setData({ cWidth, cHeight ,pixelRatio}); }, /** * 生命周期函数--监听页面显示 */ onShow() { + this.setData({ + isTrainer: wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4 + }) tabService.updateIndex(this, 2) }, + goStudentList(e){ + wx.navigateTo({ + url: '/subpackage/teacher/report-list/report-list?studentNo='+e.currentTarget.dataset.item.studentNo, + }) + }, + /** * 生命周期函数--监听页面隐藏 */ @@ -126,7 +314,19 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { - + this.setData({ + page:1, + hasMore:true + },()=>{ + if(this.data.isTrainer){ + this.getTrainClass(true) + }else{ + this.getClass() + } + wx.stopPullDownRefresh() + app.showToast('刷新成功') + }) + }, /** diff --git a/pages/teacher/count/count.json b/pages/teacher/count/count.json index 295c322..6b8b0aa 100644 --- a/pages/teacher/count/count.json +++ b/pages/teacher/count/count.json @@ -1,8 +1,10 @@ { "usingComponents": { "mp-bar": "weui-miniprogram/navigation-bar/navigation-bar", - "mp-icon": "weui-miniprogram/icon/icon" + "mp-icon": "weui-miniprogram/icon/icon", + "mp-half-screen-dialog": "weui-miniprogram/half-screen-dialog/half-screen-dialog" }, + "enablePullDownRefresh": true, "backgroundColorContent": "#f7f7f7", "backgroundColor": "#f7f7f7", "navigationStyle": "custom", diff --git a/pages/teacher/count/count.wxml b/pages/teacher/count/count.wxml index 20d7e19..53292fe 100644 --- a/pages/teacher/count/count.wxml +++ b/pages/teacher/count/count.wxml @@ -2,57 +2,129 @@ - - - {{total}} - 总人数 + + + + {{total}} + 总人数 + + + + 不及格({{rank['不及格'] || 0}}) + + + + 及格({{rank['及格'] || 0}}) + + + + 良好({{rank['良好'] || 0}}) + + + + 优秀({{rank['优秀'] || 0}}) + - - - 不及格({{rank['不及格'] || 0}}) - - - - 及格({{rank['及格'] || 0}}) - - - - 良好({{rank['良好'] || 0}}) - - - - 优秀({{rank['优秀'] || 0}}) - - - - - {{nowClass.name}} - + + + {{nowClass.name}} + + + + + + {{nowProject.name || '暂无'}} + + + + + + {{nowGrade}} + + + + + + + + + {{item.studentName}} - - - {{nowProject.name || '暂无'}} - - - - - - {{nowGrade}} - - - - - - - - - {{item.studentName}} + - - + 暂无数据 ~~ + - 暂无数据 ~~ + + {{nowCourse.startingEndingTime}} + + + + + + 心率统计 + + + 次/分 + + + + + + + + + 最大心率 + 最小心率 + 平均心率 + 中高强度时长(分钟) + + + {{nowCourseDetail.maxHR || '- -'}} + {{nowCourseDetail.minHR || '- -'}} + {{nowCourseDetail.avgHR || '- -'}} + {{nowCourseDetail.highIntensity || '- -'}} + + + + + 学生列表 + + + + + + {{item.studentName}} + + + + + + + + + + + + + {{ item.startingEndingTime }} + + + + + + + 加载中... + 没有更多数据了 + + + + + + + + \ No newline at end of file diff --git a/pages/teacher/count/count.wxss b/pages/teacher/count/count.wxss index 415b5c9..b809678 100644 --- a/pages/teacher/count/count.wxss +++ b/pages/teacher/count/count.wxss @@ -68,7 +68,7 @@ background-color: #fff; display: flex; align-items: center; - justify-content: space-evenly; + justify-content: center; } .tab-item image{ @@ -81,4 +81,164 @@ .nothing{ margin-top: 100rpx; text-align: center; +} + +.pickerY{ + width: 80%; + margin: auto; + margin-top: 40rpx; +} + +.item2{ + justify-content: center; +} + +.table-t{ + display: flex; + margin: 0 30rpx; +} + +.table-t view{ + display: flex; + align-items: center; + justify-content: center; + height: 80rpx; + flex: 1; + font-size: 26rpx; + border: 2rpx solid rgba(0, 0, 0, 0.671); +} + +.no-b{ + border-bottom: none !important; +} + +.no-r{ + border-right: none !important; +} +.table-t view:last-child{ + flex: 2; +} + +.tp{ + margin-top: 50rpx; +} + +.title{ + font-weight: bold; + font-size: 28rpx; + display: flex; + align-items: center; + margin-top: 60rpx; + margin-left: 30rpx; +} + +.title-before{ + height: 24rpx; + border-radius: 6rpx; + width: 6rpx; + margin-right: 16rpx; + background:linear-gradient(180.00deg, rgb(38, 165, 246),rgba(38, 165, 246, 0) 100%) +} + +.footer{ + margin-bottom: 80rpx; + padding-top: 20rpx; + display: flex; +} + +.footer button{ + width: 35%; +} + +.footer button:last-child{ + background-color: #26A5F6; +} + +.modal-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; +} + +.modal-content { + width: 80%; + max-width: 500px; + background-color: #fff; + border-radius: 8px; + padding: 20px; + position: relative; +} + +.modal-scroll { + max-height: 60vh; + overflow-y: auto; +} + +.list-item { + width: 90%; + height: 70rpx; + border-radius: 20rpx; + box-shadow: 0 0 10rpx rgba(223, 222, 222, 0.986); + border: 2rpx solid #fff; + box-sizing: border-box; + margin: 0 auto; + margin-top: 30rpx; + display: flex; + align-items: center; + justify-content: center; + position: relative; +} + +.loading, +.no-more { + text-align: center; + padding: 10px; + color: #888; +} + +.close-button { + position: absolute; + top: 10px; + right: 10px; +} + +.isClick{ + border: 2rpx solid #26A5F6; +} + +.clickIcon{ + position: absolute; + top: 0; + right: 0; + background-color: #26A5F6; + border-radius: 0 20rpx 0 18rpx; + width: 60rpx; + display: flex; + align-items: center; + justify-content: center; + /* padding: 0 16rpx; */ +} + +.sex{ + width: 40rpx; + margin-left: 20rpx; + margin-right: 20rpx; + height: 40rpx; +} + +.charts{ + width: 330px; + height: 320px; +} + +.canvasCard{ + margin-top: 14rpx; + display: block; + font-size: 26rpx; } \ No newline at end of file diff --git a/pages/teacher/resource/resource.js b/pages/teacher/resource/resource.js index a79979b..723ba2a 100644 --- a/pages/teacher/resource/resource.js +++ b/pages/teacher/resource/resource.js @@ -15,10 +15,10 @@ Page({ * 生命周期函数--监听页面加载 */ async onLoad(options) { - const res = await getResourceType() - this.setData({ - isTrainer: wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4 - }) + // const res = await getResourceType() + // this.setData({ + // isTrainer: wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4 + // }) }, goList(e){ @@ -40,6 +40,9 @@ Page({ */ onShow() { tabService.updateIndex(this, 0) + this.setData({ + isTrainer: wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4 + }) }, /** diff --git a/pages/teacher/vedio/vedio.js b/pages/teacher/vedio/vedio.js index f4eb14d..5476ba2 100644 --- a/pages/teacher/vedio/vedio.js +++ b/pages/teacher/vedio/vedio.js @@ -25,7 +25,11 @@ Page({ /** * 生命周期函数--监听页面加载 */ - async onLoad(options) { + onLoad(options) { + this.load() + }, + + async load(isRefresh){ wx.showLoading({ title: '', }) @@ -36,9 +40,14 @@ Page({ detail:res.data[0], showVideo:res.data[0].levelList[0]['基本技能'][0]['actionList'][0] || {}, venueList:venue.data, - isTrainer: wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4 }) wx.hideLoading() + if(isRefresh){ + wx.showToast({ + title: '刷新成功', + icon:'none' + }) + } }, showSelect(e){ @@ -86,6 +95,9 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { + this.setData({ + isTrainer: wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4 + }) tabService.updateIndex(this, 3) }, @@ -107,7 +119,8 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { - + this.load(true) + wx.stopPullDownRefresh() }, /** diff --git a/pages/teacher/vedio/vedio.json b/pages/teacher/vedio/vedio.json index 6cab79c..bfd2869 100644 --- a/pages/teacher/vedio/vedio.json +++ b/pages/teacher/vedio/vedio.json @@ -3,6 +3,7 @@ "mp-bar": "weui-miniprogram/navigation-bar/navigation-bar", "mp-icon": "weui-miniprogram/icon/icon" }, + "enablePullDownRefresh": true, "backgroundColorContent": "#f7f7f7", "backgroundColor": "#f7f7f7", "navigationStyle": "custom" diff --git a/pages/teacher/work/workrecord/workrecord.wxml b/pages/teacher/work/workrecord/workrecord.wxml index b384c95..a990f13 100644 --- a/pages/teacher/work/workrecord/workrecord.wxml +++ b/pages/teacher/work/workrecord/workrecord.wxml @@ -47,9 +47,9 @@ - 没有更多数据了 + 没有更多了~ 加载中... - 暂无作业数据 + 暂无作业数据~ diff --git a/project.private.config.json b/project.private.config.json index 5018e3d..446f3e2 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -21,5 +21,24 @@ "useIsolateContext": true }, "libVersion": "3.7.12", - "condition": {} + "condition": { + "miniprogram": { + "list": [ + { + "name": "subpackage/teacher/report-detail/report-detail", + "pathName": "subpackage/teacher/report-detail/report-detail", + "query": "id=837&studentNo=Student_0005", + "scene": null, + "launchMode": "default" + }, + { + "name": "pages/student/my/my", + "pathName": "pages/student/my/my", + "query": "", + "launchMode": "default", + "scene": null + } + ] + } + } } \ No newline at end of file diff --git a/subpackage/teacher/report-detail/report-detail.js b/subpackage/teacher/report-detail/report-detail.js new file mode 100644 index 0000000..b479a73 --- /dev/null +++ b/subpackage/teacher/report-detail/report-detail.js @@ -0,0 +1,187 @@ +const { getStudentClassRoomReport } = require("../../../utils/serve/teacher"); +import uCharts from '../../../utils/chart/u-charts'; + +var uChartsInstance = {}; +// subpackage/teacher/report-detail/report-detail.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + reportDetail:{} + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + studentNo:options.studentNo, + classRoomId:options.id + },()=>{ + this.getReport() + }) + }, + + async getReport(){ + let params = { + classRoomId:this.data.classRoomId, + } + if(this.data.studentNo){ + params.studentNo = this.data.studentNo + } + const res = await getStudentClassRoomReport(params) + this.setData({ + reportDetail:res.data + },()=>{ + this.drawCharts(this) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + const cWidth = 315 / 375 * wx.getWindowInfo().windowWidth;; + //这里的 500 对应 css .charts 的 height + const cHeight = 220 / 375 * wx.getWindowInfo().windowWidth; + console.log(wx.getWindowInfo()) + const pixelRatio = wx.getWindowInfo().pixelRatio + this.setData({ cWidth, cHeight ,pixelRatio}); + }, + + drawCharts(that) { + const query = wx.createSelectorQuery().in(that); + console.log('重新绘图',that.data.reportDetail) + query.select('#mycanvas').fields({ + node: true, + size: true + }).exec(res => { + if (res[0]) { + const canvas = res[0].node; + const ctx = canvas.getContext('2d'); + canvas.width = res[0].width * that.data.pixelRatio; + canvas.height = res[0].height * that.data.pixelRatio; + uChartsInstance['mycanvas'] = new uCharts({ + type: "line", + context: ctx, + width: that.data.cWidth * that.data.pixelRatio, + height: that.data.cHeight * that.data.pixelRatio, + categories: that.data.reportDetail.heartRateTrend.axisX, + series: [{ + data: that.data.reportDetail.heartRateTrend.axisY + }, ], + pixelRatio: that.data.pixelRatio, + animation: true, + background: "#FFFFFF", + color: that.data.chartType == 1 ? ["#FFA30C"] : that.data.chartType == 2 ? ["#6CB7FB"] : ["#FF4949"], + padding: [15, 15, 10, 0], + enableScroll: true, + // touchMoveLimit: 24, + legend: { + show: false, + fontColor: "#37b7e8" + }, + xAxis: { + disableGrid: true, + itemCount: 5, + scrollShow: true, + fontSize: 12, + lineHeight: 30, + axisLineColor: "#f1f1f1", + fontColor: "#000", + scrollColor: "#f6ecc9", + scrollBackgroundColor: "#F4F6F8" + }, + yAxis: { + gridType: "dash", + gridColor: "#F1F1F1", + // data: [{ + // min: 40, + // // axisLine: false, + // fontSize: 12 + // }] + }, + extra: { + line: { + type: "curve", + width: 2, + activeType: "hollow", + onShadow: true, + linearType: "custom", + }, + tooltip: { + showBox: false + } + } + }); + } else { + console.error("[uCharts]: 未获取到 context"); + } + }); + }, + tap(e) { + uChartsInstance[e.target.id].touchLegend(e); + uChartsInstance[e.target.id].showToolTip(e); + }, + + touchstart(e){ + uChartsInstance[e.target.id].scrollStart(e); + }, + touchmove(e){ + uChartsInstance[e.target.id].scroll(e); + }, + touchend(e){ + uChartsInstance[e.target.id].scrollEnd(e); + uChartsInstance[e.target.id].touchLegend(e); + uChartsInstance[e.target.id].showToolTip(e); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + async onPullDownRefresh() { + await this.getReport() + wx.stopPullDownRefresh() + wx.showToast({ + title: '刷新成功', + icon:'none' + }) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/subpackage/teacher/report-detail/report-detail.json b/subpackage/teacher/report-detail/report-detail.json new file mode 100644 index 0000000..4ee0d0f --- /dev/null +++ b/subpackage/teacher/report-detail/report-detail.json @@ -0,0 +1,12 @@ +{ + "usingComponents": { + "mp-bar": "weui-miniprogram/navigation-bar/navigation-bar", + "mp-icon": "weui-miniprogram/icon/icon", + "mp-half-screen-dialog": "weui-miniprogram/half-screen-dialog/half-screen-dialog" + }, + "enablePullDownRefresh": true, + "backgroundColorContent": "#f7f7f7", + "backgroundColor": "#f7f7f7", + "navigationStyle": "custom", + "onReachBottomDistance": 50 +} diff --git a/subpackage/teacher/report-detail/report-detail.wxml b/subpackage/teacher/report-detail/report-detail.wxml new file mode 100644 index 0000000..740ab3b --- /dev/null +++ b/subpackage/teacher/report-detail/report-detail.wxml @@ -0,0 +1,53 @@ + + + + + + 心率统计 + + + 次/分 + + + + + + + + + 最大心率 + 最小心率 + 平均心率 + 中高强度时长(分钟) + + + {{reportDetail.maxHR || '- -'}} + {{reportDetail.minHR || '- -'}} + {{reportDetail.avgHR || '- -'}} + {{reportDetail.highIntensity || '- -'}} + + + + + 跳绳记录 + + + + + + + + + + + {{item.jumpType}} + + {{item.totalDuration}}s {{item.totalCount}}个 + + + + + + 暂无记录~ + + \ No newline at end of file diff --git a/subpackage/teacher/report-detail/report-detail.wxss b/subpackage/teacher/report-detail/report-detail.wxss new file mode 100644 index 0000000..5cda942 --- /dev/null +++ b/subpackage/teacher/report-detail/report-detail.wxss @@ -0,0 +1,341 @@ +.card{ + background-color: #fff; + box-shadow: 0 0 10rpx rgb(223, 222, 222); + border-radius: 20rpx; + margin: 28rpx 30rpx; + box-sizing: border-box; + display: flex; + padding: 24rpx 40rpx 24rpx 30rpx; + justify-content: space-between; +} + +.left{ + display: flex; + align-items: center; + font-size: 26rpx; +} + +.img{ + width: 60rpx; + height: 60rpx; + border-radius: 50%; + margin-right: 16rpx; +} + +.card1{ + padding: 56rpx 40rpx; + color: #333333; + font-size: 24rpx; + justify-content: space-between; + align-items: center; +} + +.num{ + font-weight: bold; + font-size: 60rpx; +} + +.all-item{ + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; +} + +.all-item image{ + width: 40rpx; + height: 40rpx; + margin-bottom: 20rpx; +} + +.tab{ + display: flex; + padding: 0 50rpx; + margin: 30rpx 0; + justify-content: space-between; +} + +.tab-item{ + /* padding: 8rpx 24rpx 8rpx 30rpx; */ + height: 54rpx; + box-sizing: border-box; + width: 100%; + border: 2rpx solid #26A5F6; + border-radius: 50rpx; + font-size: 24rpx; + color: #26A5F6; + background-color: #fff; + display: flex; + align-items: center; + justify-content: center; +} + +.tab-item image{ + width: 20rpx; + height: 20rpx; + margin-left: 16rpx; + margin-bottom: -2rpx; +} + +.nothing{ + margin-top: 100rpx; + text-align: center; +} + +.pickerY{ + width: 80%; + margin: auto; + margin-top: 40rpx; +} + +.item2{ + justify-content: center; +} + +.table-t{ + display: flex; + margin: 0 30rpx; +} + +.table-t view{ + display: flex; + align-items: center; + justify-content: center; + height: 80rpx; + flex: 1; + font-size: 26rpx; + border: 2rpx solid rgba(0, 0, 0, 0.671); +} + +.no-b{ + border-bottom: none !important; +} + +.no-r{ + border-right: none !important; +} +.table-t view:last-child{ + flex: 2; +} + +.tp{ + margin-top: 50rpx; +} + +.title{ + font-weight: bold; + font-size: 28rpx; + display: flex; + align-items: center; + margin-top: 60rpx; + margin-left: 30rpx; +} + +.title-before{ + height: 24rpx; + border-radius: 6rpx; + width: 6rpx; + margin-right: 16rpx; + background:linear-gradient(180.00deg, rgb(38, 165, 246),rgba(38, 165, 246, 0) 100%) +} + +.footer{ + margin-bottom: 80rpx; + padding-top: 20rpx; + display: flex; +} + +.footer button{ + width: 35%; +} + +.footer button:last-child{ + background-color: #26A5F6; +} + +.modal-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; +} + +.modal-content { + width: 80%; + max-width: 500px; + background-color: #fff; + border-radius: 8px; + padding: 20px; + position: relative; +} + +.modal-scroll { + max-height: 60vh; + overflow-y: auto; +} + +.list-item { + width: 90%; + height: 70rpx; + border-radius: 20rpx; + box-shadow: 0 0 10rpx rgba(223, 222, 222, 0.986); + border: 2rpx solid #fff; + box-sizing: border-box; + margin: 0 auto; + margin-top: 30rpx; + display: flex; + align-items: center; + justify-content: center; + position: relative; +} + +.loading, +.no-more { + text-align: center; + padding: 10px; + color: #888; +} + +.close-button { + position: absolute; + top: 10px; + right: 10px; +} + +.isClick{ + border: 2rpx solid #26A5F6; +} + +.clickIcon{ + position: absolute; + top: 0; + right: 0; + background-color: #26A5F6; + border-radius: 0 20rpx 0 18rpx; + width: 60rpx; + display: flex; + align-items: center; + justify-content: center; + /* padding: 0 16rpx; */ +} + +.sex{ + width: 40rpx; + margin-left: 20rpx; + margin-right: 20rpx; + height: 40rpx; +} + +.charts{ + width: 330px; + height: 320px; +} + +.canvasCard{ + margin-top: 14rpx; + display: block; + font-size: 26rpx; +} + +.homework-item { + background-color: #fff; + border-radius: 20rpx; + padding: 20rpx 30rpx; + box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); + box-sizing: border-box; + margin: 30rpx 30rpx; +} + +.homework-name { + font-size: 32rpx; + font-weight: bold; + color: #333; + margin-bottom: 10rpx; +} + +.homework-time { + margin-top: 20rpx; + font-size: 24rpx; + color: #999; + display: flex; + align-items: center; + /* justify-content: space-between; */ +} + +.homework-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 10rpx; +} + +.homework-status { + font-size: 24rpx; + padding: 6rpx 12rpx; + border-radius: 20rpx; +} + +.left{ + display: flex; + align-items: center; + +} + +.img-box{ + width: 110rpx; + height: 110rpx; + margin-right: 30rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 30rpx; + background-color: #EDF1FF; +} + +.jump-img{ + width: 60rpx; + height: 60rpx; +} + +.desc{ + font-weight: bold; + font-size: 28rpx; + display: flex; + flex-direction: column; + align-items: flex-start; + height: 110rpx; + justify-content: space-evenly; +} + +.statu{ + height: 40rpx; + display: flex; + align-items: center; + justify-content: center; + color: #fff; + font-size: 18rpx; + background-color: #287df6; + border-radius: 36rpx; + padding: 0 16rpx; +} + +.icon{ + width: 48rpx; + height: 48rpx; + border-radius: 50%; + background-color: #EDF1FF; + display: flex; + align-items: center; + justify-content: center; +} + +.no{ + font-size: 26rpx; + text-align: center; + margin-top: 30rpx; +} \ No newline at end of file diff --git a/subpackage/teacher/report-list/report-list.js b/subpackage/teacher/report-list/report-list.js new file mode 100644 index 0000000..6e77fa4 --- /dev/null +++ b/subpackage/teacher/report-list/report-list.js @@ -0,0 +1,124 @@ +// subpackage/teacher/report-list/report-list.js +import { + getClassRoomRecord +} from '../../../utils/serve/teacher' +import { + getWeekdayWithValidation +} from '../../../utils/utils' +Page({ + + /** + * 页面的初始数据 + */ + data: { + studentNo: '', + list: [], + pageIndex: 1, + haveMore:true, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + studentNo: options.studentNo, + }, () => { + this.getStudentClass(true) + }) + }, + + //查看报告详情 + goReportDetail(e){ + wx.navigateTo({ + url: '/subpackage/teacher/report-detail/report-detail?id='+e.currentTarget.id +'&studentNo='+this.data.studentNo, + }) + }, + + //获取教练课堂记录 刷新 加载更多 + async getStudentClass(isRefresh) { + const that = this + if (!this.data.haveMore && !isRefresh) return //非刷新且没有 + const res = await getClassRoomRecord({ + studentNo: this.data.studentNo, + pageIndex: this.data.pageIndex, + PageSize: 20, + }) + let newList = res.data.datas.map(item => { + return { + ...item, + time: getWeekdayWithValidation(Number(item.startingEndingTime.slice(0, 4)), Number(item.startingEndingTime.slice(5, 7)), Number(item.startingEndingTime.slice(8, 10))) + } + }) + + console.log(newList) + this.setData({ + list: isRefresh ? newList : [...this.data.list, ...newList], + pageIndex: this.data.pageIndex + 1, + haveMore: res.data.total > (this.data.pageIndex) * 20, + },()=>{ + console.log(this.data.list) + console.log(this.data.haveMore) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + this.setData({ + pageIndex:1, + haveMore:true + },()=>{ + this.getStudentClass(true) + wx.stopPullDownRefresh() + wx.showToast({ + title: '刷新成功', + }) + }) + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + console.log('下来加载') + this.getStudentClass() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/subpackage/teacher/report-list/report-list.json b/subpackage/teacher/report-list/report-list.json new file mode 100644 index 0000000..4ee0d0f --- /dev/null +++ b/subpackage/teacher/report-list/report-list.json @@ -0,0 +1,12 @@ +{ + "usingComponents": { + "mp-bar": "weui-miniprogram/navigation-bar/navigation-bar", + "mp-icon": "weui-miniprogram/icon/icon", + "mp-half-screen-dialog": "weui-miniprogram/half-screen-dialog/half-screen-dialog" + }, + "enablePullDownRefresh": true, + "backgroundColorContent": "#f7f7f7", + "backgroundColor": "#f7f7f7", + "navigationStyle": "custom", + "onReachBottomDistance": 50 +} diff --git a/subpackage/teacher/report-list/report-list.wxml b/subpackage/teacher/report-list/report-list.wxml new file mode 100644 index 0000000..cdd3d39 --- /dev/null +++ b/subpackage/teacher/report-list/report-list.wxml @@ -0,0 +1,11 @@ + + + + + + {{item.startingEndingTime}}({{item.time}}) + + + 加载中... + 没有更多了哦~ + \ No newline at end of file diff --git a/subpackage/teacher/report-list/report-list.wxss b/subpackage/teacher/report-list/report-list.wxss new file mode 100644 index 0000000..3da2981 --- /dev/null +++ b/subpackage/teacher/report-list/report-list.wxss @@ -0,0 +1,20 @@ +/* subpackage/teacher/report-list/report-list.wxss */ +.card{ + background-color: #fff; + box-shadow: 0 0 10rpx rgb(223, 222, 222); + border-radius: 20rpx; + margin: 28rpx 30rpx; + box-sizing: border-box; + display: flex; + padding: 40rpx 40rpx 40rpx 30rpx; + justify-content: space-between; + color: #131313; + font-size: 26rpx; + align-items: center; +} + +.more{ + font-size: 26rpx; + color: #131313; + text-align: center; +} \ No newline at end of file diff --git a/subpackage/train/user-report/user-report.js b/subpackage/train/user-report/user-report.js index 1491dc4..d8b84e2 100644 --- a/subpackage/train/user-report/user-report.js +++ b/subpackage/train/user-report/user-report.js @@ -56,13 +56,14 @@ Page({ }, onReady(){ - //这里的第一个 750 对应 css .charts 的 width - const cWidth = 380; - //这里的 500 对应 css .charts 的 height - const cHeight = 250; - const pixelRatio = wx.getWindowInfo().pixelRatio - this.setData({ cWidth, cHeight ,pixelRatio}); - this.getTotal(); + //这里的第一个 750 对应 css .charts 的 width + const cWidth = 380 / 750 * wx.getWindowInfo().windowWidth;; + //这里的 500 对应 css .charts 的 height + const cHeight = 250 / 750 * wx.getWindowInfo().windowWidth; + console.log(wx.getWindowInfo()) + const pixelRatio = wx.getWindowInfo().pixelRatio + this.setData({ cWidth, cHeight ,pixelRatio}); + this.getTotal(); }, drawCharts(id){ @@ -191,8 +192,10 @@ Page({ changeTabC: function(e) { this.setData({ chartType: e.currentTarget.id + },()=>{ + this.drawCharts('mycanvas'); }); - this.drawCharts('mycanvas'); + }, diff --git a/subpackage/user/check-status/check-status.js b/subpackage/user/check-status/check-status.js index 0a1dd44..bbb8d56 100644 --- a/subpackage/user/check-status/check-status.js +++ b/subpackage/user/check-status/check-status.js @@ -46,14 +46,14 @@ Page({ } = e.currentTarget.dataset wx.showModal({ title: '提醒', - content: '是否确认切换到' + (item.roleId == 1 ? '用户端' : item.roleId == 2 ? '教师端' : '家长端'), + content: '是否确认切换到' + (item.roleId == 1 ? '用户端' : item.roleId == 2 || item.roleId == 4 ? '教师端' : '家长端'), confirmColor: "#26A6F6", complete: async (res) => { if (res.confirm) { wx.showLoading({ title: '切换登录中', }) - if (item.roleId == 2) { //切换教师触发登录 + if (item.roleId == 2 || item.roleId == 3 || item.roleId == 4 || item.roleId == 5) { //切换教师家长触发登录 wx.login({ success: async (loginData) => { const opid = await getOpenId(loginData.code) diff --git a/utils/serve/teacher.js b/utils/serve/teacher.js index 9ad6c7f..1c3513c 100644 --- a/utils/serve/teacher.js +++ b/utils/serve/teacher.js @@ -84,6 +84,27 @@ export function getStudentTongji(data){ return http.get('Teacher/DataStatisticsDetails',data) } +/* +获取课堂记录 +*/ +export function getClassRoomRecord(data){ + return http.get('Teacher/ClassRoomRecord',data) +} + +/* +获取课堂详情 +*/ +export function getClassRoomReportDetails(classRoomId){ + return http.get('Teacher/ClassRoomReportDetails?classRoomId='+classRoomId) +} + +/* +获取学员课堂记录 +*/ +export function getStudentClassRoomReport(data){ + return http.get('Teacher/StudentClassRoomReport',data) +} + // /* // 获取资源类型 // */ diff --git a/utils/utils.js b/utils/utils.js index 14bf6c8..ebe11e5 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -35,6 +35,35 @@ async function refreshToken() { } } +/** + * 根据年月日获取星期几 + * @param {number} year - 年份,例如 2023 + * @param {number} month - 月份(1-12) + * @param {number} day - 日期(1-31) + * @returns {string} 星期几的名称或错误信息 + */ +function getWeekdayWithValidation(year, month, day) { + // 参数验证 + if (typeof year !== 'number' || typeof month !== 'number' || typeof day !== 'number') { + return '参数必须是数字'; + } + if (month < 1 || month > 12) { + return '月份必须在1到12之间'; + } + if (day < 1 || day > 31) { + return '日期必须在1到31之间'; + } + + try { + const date = new Date(year, month - 1, day); + const weekday = date.getDay(); + const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; + return weekdays[weekday]; + } catch (error) { + return '无效的日期'; + } +} + function formatDate(date, format) { if (!date) @@ -270,5 +299,6 @@ module.exports = { */ isEmptyArray, formatTimeStr, - refreshToken + refreshToken, + getWeekdayWithValidation }; \ No newline at end of file