From 3ef24779d10779ee54e6d31acdea803d10da9553 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Fri, 26 Feb 2021 18:12:12 +0800 Subject: [PATCH] add api --- src/pages/course/student_list/student_list.vue | 71 +++++++++++++++++++--- src/pages/course/student_review/student_review.vue | 3 + src/pages/course/task/task.vue | 39 ++++++++++-- src/pages/course/task_publish/task_publish.vue | 2 +- src/pages/index/index.vue | 2 +- src/pages/time/select/select.vue | 5 +- 6 files changed, 105 insertions(+), 17 deletions(-) diff --git a/src/pages/course/student_list/student_list.vue b/src/pages/course/student_list/student_list.vue index c64f0f4..ce30feb 100644 --- a/src/pages/course/student_list/student_list.vue +++ b/src/pages/course/student_list/student_list.vue @@ -22,20 +22,24 @@ + + 点名 + 作业 + 点评 - 调班 + 调班 - + 确定点名吗? 学员信息如下 - 学员: 张三 - 上课时间: 2020-08-22 10:30~11:30 - 当前次数/课程次数: 12/15 + 学员: {{rollCallInfo.course_order.name || '-'}} + 上课时间: {{rollCallInfo.duration_data.date || '-'}} {{rollCallInfo.duration_data.start_duration || '-'}}~{{rollCallInfo.duration_data.end_duration || '-'}} + 当前次数/课程次数: {{rollCallInfo.course_order.number || 0}}/{{rollCallInfo.course_order.course.number || 0}} - 取消 - 确定 + 取消 + 确定 @@ -51,6 +55,7 @@ export default { return { optionsQuery: {}, studentList: [], + rollCallInfo: null, } }, onLoad(options){ @@ -62,6 +67,56 @@ export default { }) }, methods: { + toTaskList(e){ + let { optionsQuery } = this; + let _query = { + ...optionsQuery, + user_id: e.course_order.user_id + // class_id: e.id, + // class_name: e.class_name, + } + util.routeTo(`/pages/course/task/task?query=${util.jsonStr(_query)}`, 'nT'); + }, + confirmRollCall: util.debounce(function(){ + let { rollCallInfo } = this; + util.showLoad(); + servers.post({ + url: API.course.checkOrder, + data: { + order_nos: [rollCallInfo.course_order.order_no], + duration_id: rollCallInfo.duration_data.id + }, + isDefaultGet: false, + }) + .then(res=>{ + util.hideLoad(); + if(res.data.code == 0){ + util.showNone(res.data.message || '操作成功!'); + this.rollCallInfo = null; + setTimeout(_=>{ + let { optionsQuery } = this; + this.studentList = []; + this.getStudentList({ + course_id: optionsQuery.course_id, + class_id: optionsQuery.class_id || 0, + }) + }) + }else{ + util.showNone(res.data.message || '操作失败!'); + } + }) + .catch(util.hideLoad) + }, 300, 300), + cancelRollCall(){ + this.rollCallInfo = null; + }, + rollCallBtn(e){ + this.rollCallInfo = e; + }, + // 课程类型映射 成班课(0)/私教课(1); + getCourseType(type = ''){ + return ['成班课', '私教课'].findIndex(e=>e===type); + }, phoneCall(num){ uni.makePhoneCall({ phoneNumber: num || '-' @@ -94,6 +149,7 @@ export default { course_id, class_id, }){ + util.showLoad(); servers.get({ url: API.course.getCourseStudentList, data: { @@ -103,6 +159,7 @@ export default { failMsg: '加载失败!', }) .then(res=>{ + util.hideLoad(); let _list = res.list || []; this.studentList = _list; console.warn(res); diff --git a/src/pages/course/student_review/student_review.vue b/src/pages/course/student_review/student_review.vue index 49f7dc1..7812125 100644 --- a/src/pages/course/student_review/student_review.vue +++ b/src/pages/course/student_review/student_review.vue @@ -77,6 +77,7 @@ export default { let { descTxt, imageList, optionsQuery } = this; console.warn(descTxt, 'descTxtdescTxtdescTxt') if(descTxt == '')return util.showNone('请输入'); + util.showLoad(); servers.post({ url: API.course.SaveStudentComment, data: { @@ -89,6 +90,7 @@ export default { isDefaultGet: false, }) .then(e=>{ + util.hideLoad(); if(e.data.code == 0){ console.warn(e); util.showNone(e.data.message || '操作成功!'); @@ -97,6 +99,7 @@ export default { util.showNone(e.data.message || '操作失败!'); } }) + .catch(util.hideLoad) }, 300, 300), // 从相册选择图片 imgSelect() { diff --git a/src/pages/course/task/task.vue b/src/pages/course/task/task.vue index 8bc457d..2abf754 100644 --- a/src/pages/course/task/task.vue +++ b/src/pages/course/task/task.vue @@ -35,12 +35,24 @@ export default { taskList: [], } }, + onReachBottom(){ + let { page, optionsQuery } = this; + this.getHomeworkList({ + course_id: optionsQuery.course_id, + user_id: optionsQuery.user_id, + class_id: optionsQuery.class_id, + page: ++page, + }) + + }, methods: { onLoad(options){ let _query = util.jsonPar(options.query); this.optionsQuery = _query; this.getHomeworkList({ - + course_id: _query.course_id, + user_id: _query.user_id, + class_id: _query.class_id, }) }, toPublish(){ @@ -54,15 +66,21 @@ export default { homework_id: e.id, ...optionsQuery, }; + if(e._courseType === 1)return util.routeTo(`/pages/course/task_info/task_info?query=${util.jsonStr(_query)}`, 'nT'); util.routeTo(`/pages/course/task_finish/task_finish?query=${util.jsonStr(_query)}`, 'nT'); }, + // 课程类型映射 成班课(0)/私教课(1); + getCourseType(type = ''){ + return ['成班课', '私教课'].findIndex(e=>e===type); + }, getHomeworkList({ course_id= '', user_id= '', class_id= '', - page= '', - page_size= '', + page= 1, + page_size= 15, }){ + util.showLoad(); servers.get({ url: API.course.homeworkList, data: { @@ -74,9 +92,20 @@ export default { }, failMsg: '加载失败!' }).then(res=>{ + util.hideLoad(); let _list = res.list || []; - this.taskList = _list; - console.warn('作业作业---->', res); + _list = _list.map(e=>{ + return { + ...e, + _courseType: this.getCourseType(res.courseKind) + } + }) + console.warn('作业作业---->', _list); + if(page == 1)return this.taskList = _list; + if(_list.length<=0)return util.showNone(`没有更多!`); + this.page = page; + this.taskList = [...this.taskList, ..._list]; + }) } } diff --git a/src/pages/course/task_publish/task_publish.vue b/src/pages/course/task_publish/task_publish.vue index e784cb1..3fd0a60 100644 --- a/src/pages/course/task_publish/task_publish.vue +++ b/src/pages/course/task_publish/task_publish.vue @@ -68,7 +68,7 @@ export default { data: { course_id: optionsQuery.course_id, user_id: optionsQuery.user_id || '', - class_id: optionsQuery.class_id, + class_id: optionsQuery.class_id || '', description: desc, video_url: videoSrc, images: imgArr, diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index d77da89..1ab2d0b 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -56,7 +56,7 @@ { id: '2', name: '我的时间', - path: '', + path: '/pages/time/select/select', }, { id: '3', diff --git a/src/pages/time/select/select.vue b/src/pages/time/select/select.vue index e768a80..06bb3c2 100644 --- a/src/pages/time/select/select.vue +++ b/src/pages/time/select/select.vue @@ -4,14 +4,14 @@ - + - + @@ -116,7 +116,6 @@ export default { flex-shrink: 0; width: 16upx; height: 16upx; - background-color: skyblue; } } }