From 6d04b37c804ad6754c021831a5e92cb9ebe052e4 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Mon, 22 Feb 2021 18:06:19 +0800 Subject: [PATCH] add api --- src/js/api.js | 4 + src/pages/approve/list/list.vue | 4 +- src/pages/approve/record/record.vue | 2 +- src/pages/course/class_list/class_list.vue | 1 - src/pages/course/list/list.vue | 104 +++++++++++++++--- src/pages/course/roll_call/roll_call.vue | 8 +- src/pages/index/index.vue | 4 +- src/pages/shift/application/application.vue | 160 ++++++++++++++++++++++++++-- 8 files changed, 256 insertions(+), 31 deletions(-) diff --git a/src/js/api.js b/src/js/api.js index 60952cb..9142958 100644 --- a/src/js/api.js +++ b/src/js/api.js @@ -14,10 +14,14 @@ export const API = { coach_feedback: `${ORIGIN}/upload/file/coach_feedback`, // 上传文件 - 教练反馈 task_publish: `${ORIGIN}/upload/file/task_publish`, // 上传文件 - 布置作业 student_review: `${ORIGIN}/upload/file/student_review`, // 上传文件 - 学员点评 + getCoachList: `${ORIGIN}/stadium/coach/getCoachList`, // 小程序-某个品牌的教练列表 + getShiftWorkClassTimes: `${ORIGIN}/stadium/coach/getShiftWorkClassTimes`, // 小程序-教练换班-未进行的课程时间 } API['course'] = { + + addCoachBooking: `${ORIGIN}/stadium/coach/addCoachBooking`, // 小程序-成班课教练预约课程 courseList: `${ORIGIN}/stadium/coach/courseList`, // 小程序-课程列表 getClassList: `${ORIGIN}/stadium/coach/getClassList`, // 小程序-班级列表 getCourseStudentList: `${ORIGIN}/stadium/coach/getCourseStudentList`, // 小程序-学员列表 diff --git a/src/pages/approve/list/list.vue b/src/pages/approve/list/list.vue index 5916f7d..a719749 100644 --- a/src/pages/approve/list/list.vue +++ b/src/pages/approve/list/list.vue @@ -47,11 +47,11 @@ - + 原因: {{e.for_leave_reason || '-'}} - + 展开 diff --git a/src/pages/approve/record/record.vue b/src/pages/approve/record/record.vue index 16989a7..d791f2d 100644 --- a/src/pages/approve/record/record.vue +++ b/src/pages/approve/record/record.vue @@ -45,7 +45,7 @@ - + 原因: {{e.for_leave_reason || '-'}} diff --git a/src/pages/course/class_list/class_list.vue b/src/pages/course/class_list/class_list.vue index 1326fa8..04d4c71 100644 --- a/src/pages/course/class_list/class_list.vue +++ b/src/pages/course/class_list/class_list.vue @@ -48,7 +48,6 @@ export default { }, methods: { toRollCall(e){ - return util.showNone('开发中'); console.warn(e); let { optionsQuery } = this; let _query = { diff --git a/src/pages/course/list/list.vue b/src/pages/course/list/list.vue index f390e3c..abdd679 100644 --- a/src/pages/course/list/list.vue +++ b/src/pages/course/list/list.vue @@ -19,7 +19,7 @@ - 预约上课 + 预约上课 班级 详情 @@ -42,18 +42,18 @@ 选择班级 - + - + 选择日期 - + - + @@ -61,16 +61,16 @@ 选择时间 - + - + - - + - + @@ -78,7 +78,7 @@ 取消 - 确定 + 确定 @@ -100,12 +100,67 @@ export default { curTabIdx: 0, courseList: [], isOrderCourseModal: false, + orderClassList: [], // 预约上课班级列表 + orderInfo: { // 预约信息 + classInfo: { + id: '', + class_name: '', + }, + date: '', + startTime: '', + endTime: '', + } } }, onLoad(){ this.getCourseList({}); }, methods: { + orderModalConfirm: util.debounce(function(){ + let { orderInfo } = this; + util.showLoad(); + this.isOrderCourseModal = false; + servers.post({ + url: API.course.addCoachBooking, + data: { + course_id: orderInfo.classInfo.course_id, + class_id: orderInfo.classInfo.id, + date: orderInfo.date || '', + start_duration: orderInfo.startTime || '', + end_duration: orderInfo.endTime || '' + }, + isDefaultGet: false + }) + .then(res=>{ + util.hideLoad(); + if(res.data.code == 0){ + util.showNone(res.data.message || '操作成功!'); + }else{ + util.showNone(res.data.message || '操作失败!'); + } + }) + }, 300, 300), + modalStartTime(e){ + console.warn(e); + this.orderInfo.startTime = e.detail.value; + this.$nextTick(_=>this.$forceUpdate()); + }, + modalEndTime(e){ + console.warn(e); + this.orderInfo.endTime = e.detail.value; + this.$nextTick(_=>this.$forceUpdate()); + }, + modalDateChange(e){ + console.warn(e); + this.orderInfo.date = e.detail.value; + this.$nextTick(_=>this.$forceUpdate()); + }, + // + modalClassChange(e){ + let { orderClassList } = this; + this.orderInfo.classInfo = orderClassList[e.detail.value]; + this.$nextTick(_=>this.$forceUpdate()); + }, // 体验 toExInfo(){ util.routeTo(`/pages/course/experience/experience`, 'nT'); @@ -118,9 +173,32 @@ export default { } util.routeTo(`/pages/course/class_list/class_list?query=${util.jsonStr(_query)}`, 'nT'); }, - orderCourseBtn(){ - this.isOrderCourseModal = true; - }, + orderCourseBtn: util.debounce(function(e){ + this.orderInfo = { // 预约信息 + classInfo: { + id: '', + class_name: '', + }, + date: '', + startTime: '', + endTime: '', + } + util.showLoad(); + servers.get({ + url: API.course.getClassList, + data: { + course_id: e.id, + type: 0, // 0教练的班级,1换班的班级 + }, + failMsg: '加载班级失败!' + }) + .then(res=>{ + util.hideLoad(); + this.orderClassList = res.list || []; + this.isOrderCourseModal = true; + }) + + }, 300, 300), // 课程类型映射 成班课(0)/私教课(1); getCourseType(type = ''){ return ['成班课', '私教课'].findIndex(e=>e===type); diff --git a/src/pages/course/roll_call/roll_call.vue b/src/pages/course/roll_call/roll_call.vue index f3b5089..07d104e 100644 --- a/src/pages/course/roll_call/roll_call.vue +++ b/src/pages/course/roll_call/roll_call.vue @@ -3,10 +3,10 @@ {{optionsQuery.course_name || '-'}} - + @@ -58,8 +58,6 @@ export default { getUserList({ course_id, class_id, - name= '', - mobile= '', page= 1, page_size= 15, }){ @@ -68,8 +66,6 @@ export default { data: { course_id, class_id, // 班级id,无班级传0 - name, - mobile, page, page_size, }, diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 0596de6..1cac65d 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -66,7 +66,7 @@ { id: '4', name: '场地管理', - path: '', + path: '/pages/time/select/select', }, { id: '5', @@ -82,7 +82,7 @@ { id: '7', name: '换班申请', - path: '', + path: '/pages/shift/application/application', }, ]; diff --git a/src/pages/shift/application/application.vue b/src/pages/shift/application/application.vue index e7e204c..d4809fc 100644 --- a/src/pages/shift/application/application.vue +++ b/src/pages/shift/application/application.vue @@ -3,10 +3,30 @@ 注:私教课以及用户预约的课程不可换班 我的换班 - - - - + + + + + + + + + + + + + + + + + + + + + + + + 换班需要换班教练的时间为空闲。 @@ -18,8 +38,137 @@ @@ -50,7 +199,7 @@ export default { } .a-ipts{ padding-top: 24upx; - >view{ + .i-view{ margin: 0 auto 24upx; width: 538upx; height: 88upx; @@ -69,7 +218,6 @@ export default { flex-shrink: 0; width: 28upx; height: 28upx; - background-color: skyblue; } }