update:学生&教练报告

This commit is contained in:
ltx 2025-06-13 14:39:20 +08:00
parent 574d1477f0
commit b3b3adf61b
29 changed files with 1575 additions and 205 deletions

27
app.js
View File

@ -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, //团队首页是否刷新

View File

@ -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"
]
}
],

View File

@ -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);
});
},
})
},
// 微信登录请求

View File

@ -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()
},
/**

View File

@ -6,5 +6,6 @@
"backgroundColorContent": "#f7f7f7",
"backgroundColor": "#f7f7f7",
"navigationStyle": "custom",
"enablePullDownRefresh": true
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}

View File

@ -2,7 +2,7 @@
<view class="page-content" style="padding: 0 30rpx; padding-bottom: 300rpx;box-sizing: border-box;">
<mp-bar background="linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%)" title="报告" color="#fff" back="{{false}}"></mp-bar>
<view class="top">
<view class="top" wx:if="{{!isTrainee}}">
<view class="tit">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/heart.png" class="heart" />
健康身体 坚持运动
@ -63,10 +63,10 @@
</view>
<view class="grade-box">
<view >不及格</view>
<view >及格</view>
<view >良好</view>
<view >优秀</view>
<view>不及格</view>
<view>及格</view>
<view>良好</view>
<view>优秀</view>
</view>
</view>
@ -77,34 +77,42 @@
</view>
<view class="with">
<image src="{{item.imgUrl}}" class="image-icon"/>
<image src="{{item.imgUrl}}" class="image-icon" />
<view class="right">
<view class="score-box">
<text>60</text>
<text>80</text>
<text>90</text>
</view>
<view class="progress-box">
<view class="progress {{item.grade}}" style="width: {{item.width}};">
<text></text>
<text>{{item.score}}</text>
</view>
</view>
<view class="score-box">
<view class="cut-box"></view>
<view class="cut-box"></view>
<view class="cut-box"></view>
</view>
<text>60</text>
<text>80</text>
<text>90</text>
</view>
<view class="progress-box">
<view class="progress {{item.grade}}" style="width: {{item.width}};">
<text></text>
<text>{{item.score}}</text>
</view>
</view>
<view class="score-box">
<view class="cut-box"></view>
<view class="cut-box"></view>
<view class="cut-box"></view>
</view>
<view class="grade-box">
<view >不及格</view>
<view >及格</view>
<view >良好</view>
<view >优秀</view>
</view>
<view class="grade-box">
<view>不及格</view>
<view>及格</view>
<view>良好</view>
<view>优秀</view>
</view>
</view>
</view>
</view>
</view>
<view wx:else>
<view class="card card1" wx:for="{{roomList}}" wx:key="id" bind:tap="goReportDetail" id="{{item.id}}">
<view>{{item.startingEndingTime}}{{item.time}}</view>
<mp-icon icon="arrow" size="{{13}}" color="#ccc"></mp-icon>
</view>
<view class="more" wx:if="{{haveMore}}">加载中...</view>
<view class="more" wx:else>没有更多了哦~</view>
</view>
</view>

View File

@ -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;
}

View File

@ -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()
},
})
}
}
})

View File

@ -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('刷新成功')
})
},
/**

View File

@ -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",

View File

@ -2,57 +2,129 @@
<view class="page-content">
<mp-bar background="linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%)" title="统计" color="#fff" back="{{false}}"></mp-bar>
<view class="card card1">
<view class="all-item">
<view class="num">{{total}}</view>
<view>总人数</view>
<block wx:if="{{!isTrainer}}">
<view class="card card1">
<view class="all-item">
<view class="num">{{total}}</view>
<view>总人数</view>
</view>
<view class="all-item">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/cccc.png" mode="" />
<view>不及格({{rank['不及格'] || 0}})</view>
</view>
<view class="all-item">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/dddd.png" mode="" />
<view>及格({{rank['及格'] || 0}})</view>
</view>
<view class="all-item">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/ssss.png" mode="" />
<view>良好({{rank['良好'] || 0}})</view>
</view>
<view class="all-item">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/jjjj.png" mode="" />
<view>优秀({{rank['优秀'] || 0}})</view>
</view>
</view>
<view class="all-item">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/cccc.png" mode="" />
<view>不及格({{rank['不及格'] || 0}})</view>
</view>
<view class="all-item">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/dddd.png" mode="" />
<view>及格({{rank['及格'] || 0}})</view>
</view>
<view class="all-item">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/ssss.png" mode="" />
<view>良好({{rank['良好'] || 0}})</view>
</view>
<view class="all-item">
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/jjjj.png" mode="" />
<view>优秀({{rank['优秀'] || 0}})</view>
</view>
</view>
<view class="tab">
<picker style="width: 30%;" range="{{classList}}" range-key="name" bindchange="pickerChange" data-id="classList" data-key="nowClass">
<view class="tab-item">{{nowClass.name}}
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/downn-b.png" mode="" />
<view class="tab">
<picker style="width: 30%;" range="{{classList}}" range-key="name" bindchange="pickerChange" data-id="classList" data-key="nowClass">
<view class="tab-item">{{nowClass.name}}
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/downn-b.png" mode="" />
</view>
</picker>
<picker style="width: 30%;" range="{{projectList}}" range-key="name" bindchange="pickerChange" data-id="projectList" data-key="nowProject">
<view class="tab-item">{{nowProject.name || '暂无'}}
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/downn-b.png" mode="" />
</view>
</picker>
<picker style="width: 30%;" range="{{gradeList}}" bindchange="pickerChange" data-id="gradeList" data-key="nowGrade">
<view class="tab-item">{{nowGrade}}
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/downn-b.png" mode="" />
</view>
</picker>
</view>
<view class="card" wx:for="{{studentList}}" wx:key="studentNo" data-item="{{item}}" bind:tap="goDetail">
<view class="left">
<image src="{{item.photo == '' ? 'https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/room/avater.png': item.photo}}" class="img" />
{{item.studentName}}
</view>
</picker>
<picker style="width: 30%;" range="{{projectList}}" range-key="name" bindchange="pickerChange" data-id="projectList" data-key="nowProject">
<view class="tab-item">{{nowProject.name || '暂无'}}
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/downn-b.png" mode="" />
</view>
</picker>
<picker style="width: 30%;" range="{{gradeList}}" bindchange="pickerChange" data-id="gradeList" data-key="nowGrade">
<view class="tab-item">{{nowGrade}}
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/downn-b.png" mode="" />
</view>
</picker>
</view>
<view class="card" wx:for="{{studentList}}" wx:key="studentNo" data-item="{{item}}" bind:tap="goDetail">
<view class="left">
<image src="{{item.photo == '' ? 'https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/room/avater.png': item.photo}}" class="img" />
{{item.studentName}}
<mp-icon icon="arrow" size="{{13}}" color="#8c8c8c"></mp-icon>
</view>
<mp-icon icon="arrow" size="{{13}}" color="#8c8c8c"></mp-icon>
</view>
<view wx:if="{{studentList.length == 0}}" class="nothing">暂无数据 ~~</view>
</block>
<view wx:if="{{studentList.length == 0}}" class="nothing">暂无数据 ~~</view>
<block wx:else>
<view class="tab-item pickerY" bind:tap="showDialog">{{nowCourse.startingEndingTime}}
<image src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/downn-b.png" mode="" />
</view>
<view class="title">
<view class="title-before"></view>心率统计
</view>
<view class="card canvasCard" >
<view>次/分</view>
<view class="charts" style="width: {{cWidth}}px;height: {{cHeight}}px;">
<canvas canvas-id="mycanvas" type="2d" id="mycanvas" style="width: {{cWidth}}px;height: {{cHeight}}px;" bindtouchstart="touchstart" bindtouchmove="touchmove" bindtouchend="touchend" />
</view>
</view>
<view class="tp">
<view class="table-t">
<view class="no-b no-r">最大心率</view>
<view class="no-b no-r">最小心率</view>
<view class="no-b no-r">平均心率</view>
<view class="no-b">中高强度时长(分钟)</view>
</view>
<view class="table-t">
<view class="no-r">{{nowCourseDetail.maxHR || '- -'}}</view>
<view class="no-r">{{nowCourseDetail.minHR || '- -'}}</view>
<view class="no-r">{{nowCourseDetail.avgHR || '- -'}}</view>
<view>{{nowCourseDetail.highIntensity || '- -'}}</view>
</view>
</view>
<view class="title">
<view class="title-before"></view>学生列表
</view>
<view class="card" wx:for="{{nowCourseDetail.studentTrainingRecordList}}" wx:key="studentNo" data-item="{{item}}" bind:tap="goStudentList">
<view class="left">
<image src="{{item.photo == '' ? 'https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/room/avater.png': item.photo}}" class="img" />
{{item.studentName}}
<image class="sex" src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/report-icon/sex_{{item.sex}}.png" mode=""/>
<!-- {{item.age}}岁 -->
</view>
<mp-icon icon="arrow" size="{{13}}" color="#8c8c8c"></mp-icon>
</view>
<mp-half-screen-dialog bindbuttontap="buttontap" show="{{showDialog}}" title="课堂记录">
<view slot="desc">
<scroll-view class="modal-scroll" scroll-y bindscrolltolower="getTrainClass" lower-threshold="50">
<view class="list">
<view wx:for="{{courseList}}" wx:key="id" class="list-item {{clickCouse.id == item.id ? 'isClick':''}}" bind:tap="clickCouse" data-item="{{item}}">
{{ item.startingEndingTime }}
<view class="clickIcon" wx:if="{{clickCouse.id == item.id}}">
<mp-icon icon="done" color="#fff" size="{{14}}"></mp-icon>
</view>
</view>
</view>
<!-- 加载更多提示 -->
<view wx:if="{{haveMore}}" class="loading">加载中...</view>
<view wx:if="{{!haveMore}}" class="no-more">没有更多数据了</view>
</scroll-view>
</view>
<view slot="footer" class="footer">
<button bind:tap="closeDialog">取消</button>
<button type="primary" bind:tap="sureClickCouse">确定</button>
</view>
</mp-half-screen-dialog>
</block>
</view>

View File

@ -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;
}

View File

@ -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
})
},
/**

View File

@ -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()
},
/**

View File

@ -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"

View File

@ -47,9 +47,9 @@
</block>
<!-- 加载更多提示 -->
<view wx:if="{{!hasMore && homeworkList.length > 0}}" class="load-more-text">没有更多数据了</view>
<view wx:if="{{!hasMore && homeworkList.length > 0}}" class="load-more-text">没有更多了~</view>
<view wx:if="{{hasMore}}" class="load-more-text">加载中...</view>
<view wx:if="{{homeworkList.length === 0 && !isLoading}}" class="empty-tip">暂无作业数据</view>
<view wx:if="{{homeworkList.length === 0 && !isLoading}}" class="empty-tip">暂无作业数据~</view>
</view>
</scroll-view>
<!-- 作业列表 -->

View File

@ -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
}
]
}
}
}

View File

@ -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() {
}
})

View File

@ -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
}

View File

@ -0,0 +1,53 @@
<!--subpackage/teacher/report-detail/report-detail.wxml-->
<view class="page-content">
<mp-bar background="linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%)" title="统计" color="#fff"></mp-bar>
<view class="title">
<view class="title-before"></view>心率统计
</view>
<view class="card canvasCard">
<view>次/分</view>
<view class="charts" style="width: {{cWidth}}px;height: {{cHeight}}px;">
<canvas canvas-id="mycanvas" type="2d" id="mycanvas" style="width: {{cWidth}}px;height: {{cHeight}}px;" bindtouchstart="touchstart" bindtouchmove="touchmove" bindtouchend="touchend" />
</view>
</view>
<view class="tp">
<view class="table-t">
<view class="no-b no-r">最大心率</view>
<view class="no-b no-r">最小心率</view>
<view class="no-b no-r">平均心率</view>
<view class="no-b">中高强度时长(分钟)</view>
</view>
<view class="table-t">
<view class="no-r">{{reportDetail.maxHR || '- -'}}</view>
<view class="no-r">{{reportDetail.minHR || '- -'}}</view>
<view class="no-r">{{reportDetail.avgHR || '- -'}}</view>
<view>{{reportDetail.highIntensity || '- -'}}</view>
</view>
</view>
<view class="title">
<view class="title-before"></view>跳绳记录
</view>
<view class="homework-item" wx:for="{{reportDetail.jumpRecordList}}" wx:key="index">
<view class="top">
<view class="left">
<view class="img-box">
<image class="jump-img" src="https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/static/teacher/icon/Rope-Skipping.png" mode="" />
</view>
<view class="desc">
<view class="statu">
{{item.jumpType}}
</view>
<view>{{item.totalDuration}}s <text style="margin-left: 30rpx;">{{item.totalCount}}个</text></view>
</view>
</view>
</view>
</view>
<view wx:if="{{reportDetail.jumpRecordList.length <= 0}}" class="no">暂无记录~</view>
</view>

View File

@ -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;
}

View File

@ -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() {
}
})

View File

@ -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
}

View File

@ -0,0 +1,11 @@
<!--subpackage/train/report-list/report-list.wxml-->
<view class="page-content">
<mp-bar background="linear-gradient(190deg, #49a5fc 0%, #f7f7f7 800rpx, #f7f7f7 100%)" title="课程列表" color="#fff"></mp-bar>
<view class="card" wx:for="{{list}}" wx:key="index" bind:tap="goReportDetail" id="{{item.id}}">
<view>{{item.startingEndingTime}}{{item.time}}</view>
<mp-icon icon="arrow" size="{{13}}" color="#ccc"></mp-icon>
</view>
<view class="more" wx:if="{{haveMore}}">加载中...</view>
<view class="more" wx:else>没有更多了哦~</view>
</view>

View File

@ -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;
}

View File

@ -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');
},

View File

@ -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)

View File

@ -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)
}
// /*
// 获取资源类型
// */

View File

@ -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
};