From cbcf59983771616ba3185a4d9cfa9cc641af836c Mon Sep 17 00:00:00 2001 From: "1213317725@qq.com" <1213317725@qq.com> Date: Fri, 27 Jun 2025 18:29:27 +0800 Subject: [PATCH] 1 --- pages/coach/course/info_list.vue | 271 ++++++++++++++++--------------- pages/coach/home/index.vue | 161 +++++++----------- 2 files changed, 198 insertions(+), 234 deletions(-) diff --git a/pages/coach/course/info_list.vue b/pages/coach/course/info_list.vue index 323858d..6161a81 100644 --- a/pages/coach/course/info_list.vue +++ b/pages/coach/course/info_list.vue @@ -12,11 +12,11 @@ 添加学员 - 上课中 + 上课中 - 已结束 + 已结束 - 未开始 + 未开始 @@ -35,6 +35,10 @@ {{v.name}} + 来源:{{v.source}} + 一访情况:{{v['school_six_speed'].first_visit_time}} + 一访时间:{{v['school_six_speed'].first_visit_status}} + 课程截止时间:{{v.end_date}} @@ -209,59 +213,60 @@ //教练端-课程详情 async getCourseInfo() { - // let res = await apiRoute.courseInfo({ - // id: this.course_id - // }) - // if (res.code != 1) { - // uni.showToast({ - // title: res.msg, - // icon: 'none' - // }) - // return - // } - // this.courseInfo = res.data - // console.log('课程详情', this.courseInfo) + let res = await apiRoute.courseInfo({ + id: this.course_id + }) + if (res.code != 1) { + uni.showToast({ + title: res.msg, + icon: 'none' + }) + return + } + console.log('课程详情', res.data) + this.courseInfo = res.data + // 使用模拟数据 - this.courseInfo = { - id: this.course_id || '1', - course_date: '2025-07-25', - time_slot: '14:00-15:30', - status: 'pending', - venue: { - venue_name: '总部校区 305教室', - capacity: 20 - }, - course: { - course_name: '少儿英语基础班' - }, - coach: { - name: '王教练' - }, - student_courses: [ - { - student_id: '1001', - name: '张三', - avatar: '', - start_date: '2025-07-25', - end_date: '2025-10-25', - status: 'pending' - }, - { - student_id: '1002', - name: '李四', - avatar: '', - start_date: '2025-07-25', - end_date: '2025-10-25', - status: 'pending' - } - ], - groupedByStatus1: [], // 待批改 - groupedByStatus2: [], // 未提交 - groupedByStatus3: [] // 已提交 - }; + // this.courseInfo = { + // id: this.course_id || '1', + // course_date: '2025-07-25', + // time_slot: '14:00-15:30', + // status: 'pending', + // venue: { + // venue_name: '总部校区 305教室', + // capacity: 20 + // }, + // course: { + // course_name: '少儿英语基础班' + // }, + // coach: { + // name: '王教练' + // }, + // student_courses: [ + // { + // student_id: '1001', + // name: '张三', + // avatar: '', + // start_date: '2025-07-25', + // end_date: '2025-10-25', + // status: 'pending' + // }, + // { + // student_id: '1002', + // name: '李四', + // avatar: '', + // start_date: '2025-07-25', + // end_date: '2025-10-25', + // status: 'pending' + // } + // ], + // groupedByStatus1: [], // 待批改 + // groupedByStatus2: [], // 未提交 + // groupedByStatus3: [] // 已提交 + // }; - console.log('课程详情(模拟数据)', this.courseInfo); + // console.log('课程详情(模拟数据)', this.courseInfo); }, //切换标签 @@ -292,97 +297,97 @@ //获取添加学员列表 async addStudent() { - // let res = await apiRoute.addStudentList({ - // id: this.course_id - // }) - // if (res.code != 1) { - // uni.showToast({ - // title: res.msg, - // icon: 'none' - // }) - // return - // } - // this.StudentList = res.data - // if (this.StudentList.length == 0) { - // uni.showToast({ - // title: '暂无可填加的学员', - // icon: 'none' - // }) - // return - // } else { - // this.show = true - // } + let res = await apiRoute.addStudentList({ + id: this.course_id + }) + if (res.code != 1) { + uni.showToast({ + title: res.msg, + icon: 'none' + }) + return + } + this.StudentList = res.data + if (this.StudentList.length == 0) { + uni.showToast({ + title: '暂无可填加的学员', + icon: 'none' + }) + return + } else { + this.show = true + } // 使用模拟数据 - this.StudentList = [ - { - text: '张三', - value: '1001' - }, - { - text: '李四', - value: '1002' - }, - { - text: '王五', - value: '1003' - }, - { - text: '赵六', - value: '1004' - }, - { - text: '钱七', - value: '1005' - } - ]; - this.show = true; + // this.StudentList = [ + // { + // text: '张三', + // value: '1001' + // }, + // { + // text: '李四', + // value: '1002' + // }, + // { + // text: '王五', + // value: '1003' + // }, + // { + // text: '赵六', + // value: '1004' + // }, + // { + // text: '钱七', + // value: '1005' + // } + // ]; + // this.show = true; }, async change(e) { this.show = false - // let res = await apiRoute.addStudent({ - // student_id: e.value, - // schedule_id: this.course_id, - // time_slot: this.courseInfo.time_slot, - // course_date: this.courseInfo.course_date - // }) - // if (res.code != 1) { - // uni.showToast({ - // title: res.msg, - // icon: 'none' - // }) - // return - // } - // this.init() + let res = await apiRoute.addStudent({ + student_id: e.value, + schedule_id: this.course_id, + time_slot: this.courseInfo.time_slot, + course_date: this.courseInfo.course_date + }) + if (res.code != 1) { + uni.showToast({ + title: res.msg, + icon: 'none' + }) + return + } + this.init() // 使用模拟数据,直接添加到学生列表中 - const selectedStudent = this.StudentList.find(student => student.value === e.value); - if (!selectedStudent) return; + // const selectedStudent = this.StudentList.find(student => student.value === e.value); + // if (!selectedStudent) return; - // 添加新学生到签到列表 - if (!this.courseInfo.student_courses) { - this.courseInfo.student_courses = []; - } + // // 添加新学生到签到列表 + // if (!this.courseInfo.student_courses) { + // this.courseInfo.student_courses = []; + // } - // 创建当前日期和未来日期(课程结束日期) - const now = new Date(); - const futureDate = new Date(); - futureDate.setMonth(futureDate.getMonth() + 3); // 设置为3个月后 + // // 创建当前日期和未来日期(课程结束日期) + // const now = new Date(); + // const futureDate = new Date(); + // futureDate.setMonth(futureDate.getMonth() + 3); // 设置为3个月后 - // 添加新学生 - this.courseInfo.student_courses.push({ - student_id: e.value, - name: selectedStudent.text, - avatar: '', // 默认头像 - start_date: now.toISOString().split('T')[0], - end_date: futureDate.toISOString().split('T')[0], - status: 'pending' // 待上课状态 - }); + // // 添加新学生 + // this.courseInfo.student_courses.push({ + // student_id: e.value, + // name: selectedStudent.text, + // avatar: '', // 默认头像 + // start_date: now.toISOString().split('T')[0], + // end_date: futureDate.toISOString().split('T')[0], + // status: 'pending' // 待上课状态 + // }); - uni.showToast({ - title: '添加学员成功', - icon: 'success' - }); + // uni.showToast({ + // title: '添加学员成功', + // icon: 'success' + // }); }, cancel() { this.show = false diff --git a/pages/coach/home/index.vue b/pages/coach/home/index.vue index 7e21637..bdf4265 100644 --- a/pages/coach/home/index.vue +++ b/pages/coach/home/index.vue @@ -14,13 +14,13 @@ - 课程:{{ v.courses_name }} - 时间:{{ v.date_time }} {{ v.time_slot.split(',')[0] }}-{{ v.time_slot.split(',')[1] }} + 课程:{{ v.course_name }} + 时间:{{ v.date_time }} {{ v.time_slot }} 地点:{{ v.address }} - + 已签到学生({{ v.sign_count }}/{{ v.students_count }}) @@ -44,15 +44,22 @@ 上课中 - - 待上课 + style="background:#fad24e;">待开始 + + 待上课 + + + 上课中 + @@ -73,7 +80,7 @@ - + 班级:{{v.class_name}} - 时间:{{v.send_time}} - 课程:{{v.courses_name}} + 时间:{{v.create_time}} + 课程:{{v.course_name}} @@ -114,9 +121,9 @@ - {{item.name}} + {{item.service_name}} {{item.description}} - 创建时间:{{item.create_time}} + 创建时间:{{item.created_at}} {{item.status === 1 ? '进行中' : '已结束'}} @@ -168,76 +175,28 @@ export default { //初始化 async init(){ await this.getInfo() - await this.getServiceList() // 获取服务列表 + // await this.getServiceList() // 获取服务列表 }, //获取首页信息 async getInfo(){ // 注释掉API调用,使用模拟数据 - // let res = await memberApi.jlIndex({}) - // if(res.code != 1){ - // uni.showToast({ - // title: res.msg, - // icon: 'none' - // }) - // return - // } - // this.infoData = res.data + let res = await memberApi.jlIndex({}) + if(res.code != 1){ + uni.showToast({ + title: res.msg, + icon: 'none' + }) + return + } + let course_list = res.data.course_list + let task_list = res.data.task_list + this.serviceList = res.data.service_list // 使用模拟数据 this.infoData = { - course_list: [ - { - id: 1, - courses_name: '少儿英语基础班', - date_time: '2025-07-20', - time_slot: '15:30,17:00', - address: '总部校区 305教室', - status: 0, - sign_count: 0, - students_count: 15 - }, - { - id: 2, - courses_name: '少儿英语进阶班', - date_time: '2025-07-21', - time_slot: '14:00,15:30', - address: '西区校区 203教室', - status: 1, - sign_count: 12, - students_count: 18 - }, - { - id: 3, - courses_name: '少儿英语口语班', - date_time: '2025-07-22', - time_slot: '10:00,11:30', - address: '东区校区 102教室', - status: 0, - sign_count: 0, - students_count: 10 - } - ], - task_list: [ - { - id: 1, - wc_count: 8, - student_count: 15, - rate: 53, - class_name: '英语基础1班', - send_time: '2025-07-18', - courses_name: '少儿英语基础班' - }, - { - id: 2, - wc_count: 15, - student_count: 18, - rate: 83, - class_name: '英语进阶2班', - send_time: '2025-07-17', - courses_name: '少儿英语进阶班' - } - ] + course_list: course_list, + task_list: task_list } }, @@ -264,29 +223,29 @@ export default { // } // 使用模拟数据 - this.serviceList = [ - { - id: 1, - name: '一对一辅导服务', - description: '针对学生个人情况定制的一对一辅导计划,帮助学生快速提高成绩。', - create_time: '2025-07-15', - status: 1 - }, - { - id: 2, - name: '小组课程服务', - description: '3-5人小组课程,提供互动学习环境,培养学生团队协作能力。', - create_time: '2025-07-20', - status: 0 - }, - { - id: 3, - name: '课后辅导服务', - description: '针对课后作业和复习提供专业辅导,巩固课堂所学知识。', - create_time: '2025-07-01', - status: 1 - } - ] + // this.serviceList = [ + // { + // id: 1, + // name: '一对一辅导服务', + // description: '针对学生个人情况定制的一对一辅导计划,帮助学生快速提高成绩。', + // create_time: '2025-07-15', + // status: 1 + // }, + // { + // id: 2, + // name: '小组课程服务', + // description: '3-5人小组课程,提供互动学习环境,培养学生团队协作能力。', + // create_time: '2025-07-20', + // status: 0 + // }, + // { + // id: 3, + // name: '课后辅导服务', + // description: '针对课后作业和复习提供专业辅导,巩固课堂所学知识。', + // create_time: '2025-07-01', + // status: 1 + // } + // ] }, //打开-发布作业页