Browse Source

add api

master
刘嘉炜 4 years ago
parent
commit
3ef24779d1
  1. 71
      src/pages/course/student_list/student_list.vue
  2. 3
      src/pages/course/student_review/student_review.vue
  3. 39
      src/pages/course/task/task.vue
  4. 2
      src/pages/course/task_publish/task_publish.vue
  5. 2
      src/pages/index/index.vue
  6. 5
      src/pages/time/select/select.vue

71
src/pages/course/student_list/student_list.vue

@ -22,20 +22,24 @@
</view>
</view>
<view class="si-btns">
<block v-if="getCourseType(e.course_order.course.kind) === 1">
<view hover-class="hover-active" v-if="e.is_show_call_name_button" @click="rollCallBtn(e)">点名</view>
<view hover-class="hover-active" @click="toTaskList(e)">作业</view>
</block>
<view hover-class="hover-active" @click="toReview(e)">点评</view>
<view hover-class="hover-active" @click="toShift(e)">调班</view>
<view hover-class="hover-active" @click="toShift(e)" v-if="getCourseType(e.course_order.course.kind) === 0">调班</view>
</view>
</view>
</view>
<view class="l-mask" v-if="false">
<view class="l-mask" v-if="rollCallInfo!==null">
<view class="m-modal">
<view class="m-tit">确定点名吗? 学员信息如下</view>
<view class="m-line"><text>学员: </text>张三</view>
<view class="m-line"><text>上课时间: </text>2020-08-22 10:30~11:30</view>
<view class="m-line"><text>当前次数/课程次数: </text>12/15</view>
<view class="m-line"><text>学员: </text>{{rollCallInfo.course_order.name || '-'}} </view>
<view class="m-line"><text>上课时间: </text>{{rollCallInfo.duration_data.date || '-'}} {{rollCallInfo.duration_data.start_duration || '-'}}~{{rollCallInfo.duration_data.end_duration || '-'}}</view>
<view class="m-line"><text>当前次数/课程次数: </text>{{rollCallInfo.course_order.number || 0}}/{{rollCallInfo.course_order.course.number || 0}}</view>
<view class="m-btns">
<view hover-class="hover-active">取消</view>
<view hover-class="hover-active">确定</view>
<view hover-class="hover-active" @click="cancelRollCall">取消</view>
<view hover-class="hover-active" @click="confirmRollCall">确定</view>
</view>
</view>
</view>
@ -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);

3
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() {

39
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];
})
}
}

2
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,

2
src/pages/index/index.vue

@ -56,7 +56,7 @@
{
id: '2',
name: '我的时间',
path: '',
path: '/pages/time/select/select',
},
{
id: '3',

5
src/pages/time/select/select.vue

@ -4,14 +4,14 @@
<picker>
<view>
<input value="2020年5月16日" />
<image></image>
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
<text></text>
<picker>
<view>
<input value="2020年5月16日" />
<image></image>
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
</view>
@ -116,7 +116,6 @@ export default {
flex-shrink: 0;
width: 16upx;
height: 16upx;
background-color: skyblue;
}
}
}

Loading…
Cancel
Save