diff --git a/pages/teacher/count/count.js b/pages/teacher/count/count.js
index 6f70659..34e99db 100644
--- a/pages/teacher/count/count.js
+++ b/pages/teacher/count/count.js
@@ -31,6 +31,8 @@ Page({
rank: {},
isTrainer: false,
courseList: [], //教练课堂记录
+ coursePage: 1,
+ courseHasMore: true,
nowCourse: {},
showDialog: false,
clickCouse: {}, //选中的教练课程
@@ -55,11 +57,17 @@ Page({
wx.showLoading({
title: '',
})
- if (wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4) {
+ const isTrainer = wx.getStorageSync('roleId') && wx.getStorageSync('roleId') == 4
+ this.setData({
+ isTrainer,
+ activeTab: isTrainer ? 0 : 1
+ })
+ if (isTrainer) {
await this.getTrainClass(true)
await this.getFitnessClasses()
} else {
await this.getClass()
+ await this.getTrainClass(true)
}
wx.hideLoading()
},
@@ -122,7 +130,9 @@ Page({
const avgHeart = d.avgHR || 0
const highDuration = `${d.highIntensity || 0}分钟`
const highRatio = `${d.highIntensityDurationRatio || 0}%`
- return { ...d, heartRange, avgHeart, highDuration, highRatio, _moderateHR: moderateHR, _highHR: highHR }
+ const heartRateTrend = d.heartRateTrend || { axisX: [], axisY: [] }
+ const studentTrainingRecordList = d.studentTrainingRecordList || []
+ return { ...d, heartRateTrend, studentTrainingRecordList, heartRange, avgHeart, highDuration, highRatio, _moderateHR: moderateHR, _highHR: highHR }
},
clickCouse(e) {
@@ -174,35 +184,40 @@ Page({
//获取教练课堂记录 刷新 加载更多
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 refresh = isRefresh && isRefresh.type != "scrolltolower"
+ const pageIndex = refresh ? 1 : this.data.coursePage
+ if (!this.data.courseHasMore && !refresh) return
if (refresh) this.setData({ courseLoading: true })
const res = await getClassRoomRecord({
- pageIndex: this.data.page,
+ pageIndex,
PageSize: 20,
})
- if(res.data.datas.length > 0){
- const detail = await getClassRoomReportDetails(this.data.nowCourse.id ? this.data.nowCourse.id : res.data.datas[0].id)
+ const courseList = res && res.data && res.data.datas ? res.data.datas : []
+ const total = res && res.data && res.data.total ? res.data.total : 0
+ const nextCourse = (!this.data.nowCourse.id || refresh) ? courseList[0] : this.data.nowCourse
+
+ if (nextCourse && nextCourse.id) {
+ const needReloadDetail = refresh || !this.data.nowCourseDetail || this.data.nowCourseDetail.courseId !== nextCourse.id
+ const detail = needReloadDetail ? await getClassRoomReportDetails(nextCourse.id) : null
this.setData({
- nowCourseDetail: this.data.nowCourse.id ? this.data.nowCourseDetail: this._buildCourseDetail(detail.data),
+ nowCourse: nextCourse,
+ nowCourseDetail: needReloadDetail ? { ...this._buildCourseDetail(detail.data), courseId: nextCourse.id } : this.data.nowCourseDetail,
courseLoading: false,
},()=>{
that.drawCharts(that)
})
- } else {
- if (refresh) this.setData({ courseLoading: false })
+ } else if (refresh) {
+ this.setData({ courseLoading: false, nowCourseDetail: {} })
}
+
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 && !this.data.nowCourse.id) || refresh ? res.data.datas[0] : this.data.nowCourse,
+ courseList: refresh ? courseList : [...this.data.courseList, ...courseList],
+ coursePage: pageIndex + 1,
+ courseHasMore: total > pageIndex * 20,
+ nowCourse: nextCourse || {},
})
},
- //获取项目列表
async getProject() {
if(!this.data.nowClass || !this.data.nowClass.gradeId) return
const res = await getProjectList(this.data.nowClass.gradeId)
@@ -254,8 +269,9 @@ Page({
drawCharts(that) {
+ if (!that.data.nowCourse.id || !that.data.nowCourseDetail || !that.data.nowCourseDetail.heartRateTrend) return
const query = wx.createSelectorQuery().in(that);
- console.log('重新绘图',that.data.nowCourseDetail)
+ console.log('????',that.data.nowCourseDetail)
query.select('#mycanvas').fields({
node: true,
size: true
@@ -424,7 +440,7 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
async onPullDownRefresh() {
- this.setData({ page: 1, hasMore: true })
+ this.setData({ page: 1, hasMore: true, coursePage: 1, courseHasMore: true })
if (this.data.isTrainer) {
if (this.data.activeTab === 0) {
await this.getTrainClass(true)
@@ -433,6 +449,7 @@ Page({
}
} else {
await this.getClass()
+ await this.getTrainClass(true)
}
wx.stopPullDownRefresh()
app.showToast('刷新成功')
diff --git a/pages/teacher/count/count.wxml b/pages/teacher/count/count.wxml
index e003424..9650e78 100644
--- a/pages/teacher/count/count.wxml
+++ b/pages/teacher/count/count.wxml
@@ -2,7 +2,17 @@
-
+
+
+
+ 课堂报告
+
+
+ 体测报告
+
+
+
+
{{total}}
@@ -55,23 +65,16 @@
- 暂无数据 ~~
-
-
-
-
-
-
- 课堂报告
-
-
- 体测报告
-
+
+ 暂无
+ 暂无体测报告数据
+
- {{nowCourse.startingEndingTime}}
+
+ {{nowCourse.startingEndingTime || '暂无课堂记录'}}
@@ -96,8 +99,16 @@
-
-
+
+
+
+ 暂无
+ 暂无课堂报告数据
+
+
+
+
+
心率统计
@@ -146,13 +157,19 @@
学生列表
-
-
-
- {{item.studentName}}
-
+
+
+
+
+ {{item.studentName}}
+
+
+
-
+
+
+ 暂无
+ 暂无学生课堂数据
@@ -167,8 +184,8 @@
- 加载中...
- 没有更多数据了
+ 加载中...
+ 没有更多数据了
\ No newline at end of file
diff --git a/pages/teacher/count/count.wxss b/pages/teacher/count/count.wxss
index d31ab9a..850b8e5 100644
--- a/pages/teacher/count/count.wxss
+++ b/pages/teacher/count/count.wxss
@@ -611,4 +611,143 @@
color: rgb(211, 13, 13);
font-size: 38rpx;
-}
\ No newline at end of file
+}
+
+/* ===== page polish ===== */
+.page-content {
+ min-height: 100vh;
+ /* background: #f5f8fb; */
+ padding-bottom: 48rpx;
+ box-sizing: border-box;
+}
+
+.section-title {
+ display: flex;
+ align-items: center;
+ margin: 44rpx 30rpx 18rpx;
+ font-size: 32rpx;
+ font-weight: 700;
+ color: #1f2d3d;
+}
+
+.section-title-line {
+ width: 8rpx;
+ height: 30rpx;
+ border-radius: 8rpx;
+ margin-right: 14rpx;
+ background: linear-gradient(180deg, #26A5F6 0%, #7bd46d 100%);
+}
+
+.card {
+ border-radius: 18rpx;
+ box-shadow: 0 10rpx 30rpx rgba(31, 45, 61, 0.07);
+ border: 1rpx solid rgba(38, 165, 246, 0.06);
+}
+
+.card1 {
+ margin-top: 24rpx;
+ padding: 44rpx 28rpx;
+ background: linear-gradient(135deg, #ffffff 0%, #eef8ff 100%);
+}
+
+.all-item {
+ min-width: 96rpx;
+ text-align: center;
+}
+
+.all-item view {
+ line-height: 1.35;
+}
+
+.tab {
+ padding: 0 30rpx;
+ gap: 16rpx;
+}
+
+.tab picker {
+ flex: 1;
+}
+
+.tab-item {
+ min-width: 0;
+ height: 62rpx;
+ padding: 0 18rpx;
+ box-shadow: 0 6rpx 18rpx rgba(38, 165, 246, 0.08);
+}
+
+.pickerY {
+ width: auto;
+ margin: 18rpx 30rpx 0;
+ height: 68rpx;
+ font-size: 26rpx;
+ font-weight: 600;
+}
+
+.title {
+ margin-top: 42rpx;
+ color: #1f2d3d;
+}
+
+.canvasCard {
+ padding: 28rpx 24rpx 18rpx;
+}
+
+.charts {
+ margin: 0 auto;
+}
+
+.stat-grid {
+ justify-content: space-between;
+}
+
+.stat-card {
+ border-radius: 18rpx;
+ min-height: 150rpx;
+}
+
+.fitness-student-card {
+ border-radius: 18rpx;
+ box-shadow: 0 10rpx 26rpx rgba(31, 45, 61, 0.08);
+}
+
+.loading-dot {
+ width: 18rpx;
+ height: 18rpx;
+ border-radius: 50%;
+ margin-bottom: 16rpx;
+ background: #26A5F6;
+ box-shadow: -28rpx 0 0 rgba(38, 165, 246, 0.35), 28rpx 0 0 rgba(38, 165, 246, 0.35);
+}
+
+
+.report-empty {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ margin: 34rpx 30rpx;
+ min-height: 300rpx;
+ background: #fff;
+ border-radius: 18rpx;
+ box-shadow: 0 10rpx 30rpx rgba(31, 45, 61, 0.07);
+ color: #9aa7b2;
+ font-size: 26rpx;
+}
+
+.report-empty-small {
+ min-height: 180rpx;
+}
+
+.report-empty-icon {
+ width: 96rpx;
+ height: 96rpx;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-bottom: 20rpx;
+ background: #eef8ff;
+ color: #26A5F6;
+ font-size: 24rpx;
+ font-weight: 600;
+}
diff --git a/subpackage/teacher/count-detail/count-detail.wxml b/subpackage/teacher/count-detail/count-detail.wxml
index 4cfc09c..9e1305d 100644
--- a/subpackage/teacher/count-detail/count-detail.wxml
+++ b/subpackage/teacher/count-detail/count-detail.wxml
@@ -19,7 +19,7 @@
项目
- 成绩(最好)
+ 成绩(最新)
分数
等级
diff --git a/utils/http.js b/utils/http.js
index be161d2..8b7a069 100644
--- a/utils/http.js
+++ b/utils/http.js
@@ -1,7 +1,7 @@
-const ipAddress = "https://wechatapi.yuedongsports.com/"; // 根据实际情况修改
-// const ipAddress = "https://wechatapi-qa.yuedongsports.com/"; // 根据实际情况修改
+// const ipAddress = "https://wechatapi.yuedongsports.com/"; // 根据实际情况修改
+const ipAddress = "https://wechatapi-qa.yuedongsports.com/"; // 根据实际情况修改
// const ipAddress = "http://192.168.0.146:9993/"; // 根据实际情况修改
-// const ipAddress = "http://localhost:9993/"; // 根据实际情况修改
+// const ipAddress = "http://localhost:9995/"; // 根据实际情况修改
function getToken() {
return wx.getStorageSync('token'); // 获取存储的 token