diff --git a/pages/coach/class/info.vue b/pages/coach/class/info.vue index 6358800..70def45 100644 --- a/pages/coach/class/info.vue +++ b/pages/coach/class/info.vue @@ -107,30 +107,42 @@ - + - + - 课程:篮球少儿课 + 课程:{{v.courses_name}} - 时间:2024-05-25 15:20 - 17:30 + 时间:{{v.date}} - 地点:xxx体育馆 302室 + 地点:{{v.address}} - 应到学员(34) + 应到学员({{v.max_students}}) 查看 - 已签到学生(15/34) + 已签到学生({{v.has_sign_count}}/{{v.max_students}}) 查看 @@ -144,117 +156,20 @@ - + + 未开始 - - - - - - - - - - - - - - - 课程:篮球少儿课 - - - 时间:2024-05-25 15:20 - 17:30 - - - 地点:xxx体育馆 302室 - - - - - 应到学员(34) - - 查看 - - - - - 已签到学生(15/34) - - 查看 - - - - - 作业完成率(80%) - - 查看 - - - + + 上课中 - - - 上课中 - - - - - - - - - - - - 课程:篮球少儿课 - - - 时间:2024-05-25 15:20 - 17:30 - - - 地点:xxx体育馆 302室 - + + 已结束 - - - 应到学员(34) - - 查看 - - - - - 已签到学生(15/34) - - 查看 - - - - - 作业完成率(80%) - - 查看 - - - - - - - - - - - - - - 已结束 - - - + @@ -274,11 +189,24 @@ export default { data() { return { class_id:'',//班级id - courseInfoList:{},//课程计划数据 classInfo:{},//班级数据 classMemberList:{},//班级成员 tabType:'1',//1=班级成员,2=课程计划 + + + loading: false,//加载状态 + lowerThreshold: 100,//距离底部多远触发 + isReachedBottom: false,//防止重复加载|true=不可加载|false=可加载 + + //筛选条件 + filteredData: { + page: 1,//当前页码 + limit: 10,//每页返回数据条数 + total: 10,//数据总条数 + class_id: '',//班级id + }, + courseList:[],//课程计划数据 } }, onLoad(options) { @@ -287,13 +215,19 @@ export default { onShow() { this.init() }, + //下拉刷新 + async onPullDownRefresh() { + //重置为第一页 + await this.loadData() + await this.getCourseList() + }, methods: { async init(){ // member/course_list//课程列表 // member/class_info//班级详情+成员详情 this.getClassInfo()//获取班级详情 - // this.getCourseList()//获取课程列表 + await this.getCourseList()//获取课程列表 }, @@ -312,23 +246,63 @@ export default { this.classMemberList = res.data.students_list }, + + //加载更过(下一页) + loadMoreData() { + //判断是否加载 + if (!this.isReachedBottom) { + this.isReachedBottom = true;//设置为不可请求状态 + this.getCourseList(); + } + }, + //重置为第一页 + async loadData() { + this.isReachedBottom = false; // 重置状态,以便下次触发加载更多 + + this.filteredData.page = 1//当前页码 + this.filteredData.limit = 10//每页返回数据条数 + this.filteredData.total = 10//数据总条数 + }, //教练端-获取课程列表 async getCourseList(){ - let data = { - page:0, - limit:12, - class_id:this.class_id, + + let data = {...this.filteredData} + data.class_id = this.class_id + + console.log(12123,this.courseList) + + if(data.page == 1){ + this.courseList = [] } + + //判断是否还有数据 + if (this.filteredData.page * this.filteredData.limit > this.filteredData.total || this.filteredData.limit > this.filteredData.total) { + this.loading = false + uni.showToast({ + title: '暂无更多', + icon: 'none' + }) + return + } + let res = await memberApi.courseList(data) - if(res.code != 1){ + this.loading = false + this.isReachedBottom = false; + if (res.code != 1) { uni.showToast({ title: res.msg, icon: 'none' }) return } - this.courseInfo = res.data - console.log('获取课程列表',this.courseInfo) + + + this.courseList = this.courseList.concat(res.data.list.data)// 使用 concat 方法 将新数据追加到数组中 + + this.filteredData.total = res.data.list.total + console.log('获取课程列表',this.courseList) + this.filteredData.page++ + },