diff --git a/api/apiRoute.js b/api/apiRoute.js index f4c10f3..bca749c 100644 --- a/api/apiRoute.js +++ b/api/apiRoute.js @@ -78,6 +78,18 @@ export default { async getStatisticsInfo(data = {}) { return await http.get('/class/Statistics/info', data); }, + //获取服务详情 + async getServiceDetail(data = {}) { + return await http.get('/service/detail', data); + }, + //获取服务列表 + async getServiceList(data = {}) { + return await http.get('/service/list', data); + }, + //完成服务 + async completeService(data = {}) { + return await http.post('/service/complete', data); + }, //添加作业 async jlPublishJob(data = {}) { return await http.get('/class/jlPublishJob/add', data); @@ -359,7 +371,9 @@ export default { async reimbursement_info(data = {}) { return await http.get('/personnel/reimbursement_info', data); }, - + async schedule_del(data = {}) { + return await http.post('/course/schedule_del', data); + } } \ No newline at end of file diff --git a/common/axios.js b/common/axios.js index f391540..42f1b0f 100644 --- a/common/axios.js +++ b/common/axios.js @@ -59,14 +59,33 @@ const responseInterceptor = (response) => { } return data; } else if (data.code === 401) { - // 未授权或token过期 + // 未授权或token过期,清除所有用户缓存信息 + // 清除token uni.removeStorageSync("token"); + // 清除用户信息 + uni.removeStorageSync("userInfo"); + // 清除用户类型 uni.removeStorageSync("userType"); + // 清除用户角色 + uni.removeStorageSync("userRoles"); + // 清除过期时间 uni.removeStorageSync("expires_time"); - uni.showToast({ - title: data.msg || '登录已过期,请重新登录', - icon: 'none' - }); + // 清除底部菜单选中状态 + uni.removeStorageSync("tabBerIndex"); + + // 检查是否是从登录页退出的请求 + const pages = getCurrentPages(); + const currentPage = pages[pages.length - 1]; + const isFromLoginPage = currentPage && currentPage.route && currentPage.route.includes('/pages/student/login/login'); + + // 如果不是从登录页退出的请求,才显示提示信息 + if (!isFromLoginPage) { + uni.showToast({ + title: data.msg || '登录已过期,请重新登录', + icon: 'none' + }); + } + setTimeout(() => { uni.reLaunch({ url: '/pages/student/login/login?code=401' diff --git a/common/util.js b/common/util.js index 1ae1fc6..ffe868f 100644 --- a/common/util.js +++ b/common/util.js @@ -209,11 +209,19 @@ function loginOut() { uni.removeStorageSync('userInfo') //清除用户类型 uni.removeStorageSync('userType') - + //清除用户角色 + uni.removeStorageSync('userRoles') + //清除过期时间 + uni.removeStorageSync('expires_time') //底部菜单选中 uni.removeStorageSync('tabBerIndex') + + // 重置Vuex中的用户信息和登录状态 + // 注意:在非组件环境中无法直接访问store,需要在组件中调用 + // 这里不做store的更新,而是在组件中使用时更新 - uni.navigateTo({ + // 直接跳转到登录页,不显示任何提示信息 + uni.reLaunch({ url: '/pages/student/login/login' }) } diff --git a/components/AQ/AQTabber.vue b/components/AQ/AQTabber.vue index 337fa1e..567c155 100644 --- a/components/AQ/AQTabber.vue +++ b/components/AQ/AQTabber.vue @@ -77,7 +77,7 @@ }, { text: "数据", - urlPath: '/pages/market/data/index', //自定义页面跳转路径 + urlPath: '/pages/market/data/statistics', //自定义页面跳转路径 iconPath: util.img('/uniapp_src/static/images/tabbar/timetable.png'), selectedIconPath: util.img('/uniapp_src/static/images/tabbar/timetables.png'), }, @@ -104,8 +104,8 @@ selectedIconPath: util.img("/uniapp_src/static/images/tabbar/timetables.png") }, { - text: "班级", - urlPath: '/pages/coach/class/list', //自定义页面跳转路径 + text: "我的学员", + urlPath: '/pages/coach/student/student_list', //自定义页面跳转路径 iconPath: util.img('/uniapp_src/static/images/tabbar/banji.png'), selectedIconPath: util.img("/uniapp_src/static/images/tabbar/banjis.png") }, diff --git a/components/uni-nav-bar/uni-nav-bar.vue b/components/uni-nav-bar/uni-nav-bar.vue index 262b9f4..7eb8e74 100644 --- a/components/uni-nav-bar/uni-nav-bar.vue +++ b/components/uni-nav-bar/uni-nav-bar.vue @@ -119,11 +119,11 @@ font-size: 34rpx; /* #endif */ /* #ifndef APP-PLUS */ - font-size: $uni-font-size-lg; + font-size: $font-size-lg; /* #endif */ } .uni-nav-bar-right-text { - font-size: $uni-font-size-base; + font-size: $font-size-base; } .uni-navbar { @@ -133,7 +133,7 @@ .uni-navbar__content { position: relative; width: 750rpx; - background-color: $uni-bg-color; + background-color: $bg-color; overflow: hidden; } diff --git a/components/uni-popup/uni-popup.vue b/components/uni-popup/uni-popup.vue index 3625c9f..7e35881 100644 --- a/components/uni-popup/uni-popup.vue +++ b/components/uni-popup/uni-popup.vue @@ -222,7 +222,7 @@ bottom: 0; left: 0; right: 0; - background-color: $uni-bg-color-mask; + background-color: $bg-color-mask; opacity: 0; } diff --git a/pages.json b/pages.json index 604cf58..cd75c8f 100644 --- a/pages.json +++ b/pages.json @@ -229,19 +229,12 @@ } }, - - - - - - { "path": "pages/coach/home/index", "style": { - "navigationBarTitleText": "首页", - "navigationStyle": "custom", - "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" + "navigationBarTitleText": "待办", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" } }, { @@ -266,9 +259,8 @@ "path": "pages/coach/course/list", "style": { "navigationBarTitleText": "课表", - "navigationStyle": "custom", - "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" } }, { @@ -334,13 +326,28 @@ "navigationBarTextStyle": "white" } }, + { + "path": "pages/coach/student/student_list", + "style": { + "navigationBarTitleText": "我的学员", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/coach/student/student_detail", + "style": { + "navigationBarTitleText": "学员详情", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, { "path": "pages/coach/my/index", "style": { "navigationBarTitleText": "我的", - "navigationStyle": "custom", - "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" } }, { @@ -348,7 +355,7 @@ "style": { "navigationBarTitleText": "到课统计", "navigationStyle": "default", - "navigationBarBackgroundColor": "#292929", + "navigationBarBackgroundColor": "#29d3b4", "navigationBarTextStyle": "white" } }, @@ -356,8 +363,7 @@ "path": "pages/coach/my/due_soon", "style": { "navigationBarTitleText": "即将到期", - "navigationStyle": "default", - "navigationBarBackgroundColor": "#292929", + "navigationBarBackgroundColor": "#29d3b4", "navigationBarTextStyle": "white" } }, @@ -366,7 +372,7 @@ "style": { "navigationBarTitleText": "授课统计", "navigationStyle": "default", - "navigationBarBackgroundColor": "#292929", + "navigationBarBackgroundColor": "#29d3b4", "navigationBarTextStyle": "white" } }, @@ -433,27 +439,6 @@ "navigationBarTextStyle": "black" } }, - - - - { - "path": "pages/market/clue/writing_followUp", - "style": { - "navigationBarTitleText": "添加跟进", - "navigationStyle": "default", - "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" - } - }, - { - "path": "pages/market/clue/new_task", - "style": { - "navigationBarTitleText": "转交跟进任务", - "navigationStyle": "default", - "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" - } - }, { "path": "pages/market/clue/add_clues", "style": { @@ -626,6 +611,14 @@ "navigationBarBackgroundColor": "#292929", "navigationBarTextStyle": "white" } + }, + { + "path": "pages/coach/my/service_detail", + "style": { + "navigationBarTitleText": "服务详情", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "black" + } } diff --git a/pages/coach/course/info_list.vue b/pages/coach/course/info_list.vue index f6eef69..323858d 100644 --- a/pages/coach/course/info_list.vue +++ b/pages/coach/course/info_list.vue @@ -3,7 +3,8 @@ - 时间:{{courseInfo.course_date}} + 日期:{{courseInfo.course_date}} + 时间:{{courseInfo.time_slot}} 地点:{{courseInfo.venue.venue_name}} 课程:{{courseInfo.course.course_name}} 教练:{{courseInfo.coach.name}} @@ -20,7 +21,7 @@ - 签到情况 + 学员情况 作业情况 @@ -30,7 +31,7 @@ 暂无数据 - + {{v.name}} @@ -39,7 +40,9 @@ - 请假 + 请假 + + 已签到 @@ -206,18 +209,59 @@ //教练端-课程详情 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 + // } + // this.courseInfo = res.data + // console.log('课程详情', this.courseInfo) + + // 使用模拟数据 + 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); }, //切换标签 @@ -227,9 +271,12 @@ //打开课时详情页 openViewCourseInfo(item) { - this.$navigateTo({ - url: '/pages/coach/course/info' - }) + // this.$navigateTo({ + // url: '/pages/coach/course/info' + // }) + uni.navigateTo({ + url: `/pages/market/clue/clue_info?resource_sharing_id=25` + }); }, // 作业情况 @@ -245,44 +292,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; }, 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 + // 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; + + // 添加新学生到签到列表 + if (!this.courseInfo.student_courses) { + this.courseInfo.student_courses = []; } - this.init() - + + // 创建当前日期和未来日期(课程结束日期) + 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' // 待上课状态 + }); + + uni.showToast({ + title: '添加学员成功', + icon: 'success' + }); }, cancel() { this.show = false @@ -310,32 +410,57 @@ }) this.init() } else { - uni.showToast({ - title: '学员不存在', - icon: 'none' - }) + // uni.showToast({ + // title: '学员不存在', + // icon: 'none' + // }) } this.written_show = false } }, - isWithinOneHourBefore(time_slot) { - // 取出开始时间 - const [startStr] = time_slot.split('-'); - const [hours, minutes] = startStr.split(':').map(Number); - - // 设置开始时间 - const startTime = new Date(); - startTime.setHours(hours, minutes, 0, 0); - - // 设置一小时前的时间点 - const oneHourBeforeStart = new Date(startTime.getTime() - 60 * 60 * 1000); - - // 当前时间 - const now = new Date(); - - // 判断当前时间是否在 [一小时前, 开始时间) 之间 - return now >= oneHourBeforeStart && now < startTime; + isWithinTimeSlot(time_slot) { + const [startStr, endStr] = time_slot.split('-'); + const [startHours, startMinutes] = startStr.split(':').map(Number); + const [endHours, endMinutes] = endStr.split(':').map(Number); + + const now = new Date(); + const startTime = new Date(now.getFullYear(), now.getMonth(), now.getDate(), startHours, startMinutes); + const endTime = new Date(now.getFullYear(), now.getMonth(), now.getDate(), endHours, endMinutes); + + return now >= startTime && now < endTime; + }, + signIn(student_id) { + uni.showToast({ + title: '签到成功', + icon: 'success' + }); + + // 在实际应用中,这里应该调用签到API + // 例如: + // apiRoute.studentSignIn({ + // student_id: student_id, + // course_id: this.course_id, + // }).then(res => { + // if (res.code == 1) { + // uni.showToast({ + // title: '签到成功', + // icon: 'success' + // }); + // this.init(); + // } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none' + // }); + // } + // }); + + // 更新当前学生的状态(模拟) + const studentIndex = this.courseInfo.student_courses.findIndex(s => s.student_id === student_id); + if (studentIndex !== -1) { + this.courseInfo.student_courses[studentIndex].status = 'signed'; + } } } } @@ -491,13 +616,27 @@ border-radius: 50%; line-height: 90rpx; font-size: 26rpx; - background-color: rgba(254, 250, 131, 0.62); - color: rgba(255, 255, 255, 1); text-align: center; - border: 0rpx solid rgba(254, 250, 131, 0.62); + border: 0rpx; //旋转45° transform: rotate(-30deg); } + + .leave-tag { + background-color: rgba(254, 250, 131, 0.62); + color: rgba(255, 255, 255, 1); + } + + .signin-tag { + background-color: #1cd188; + color: #FFFFFF; + } + + .signed-tag { + background-color: #a4adb3; + color: #FFFFFF; + transform: none; + } } } diff --git a/pages/coach/course/list.vue b/pages/coach/course/list.vue index 987078e..31752bc 100644 --- a/pages/coach/course/list.vue +++ b/pages/coach/course/list.vue @@ -1,11 +1,6 @@