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> </view>
<view class="si-btns"> <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="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>
</view> </view>
<view class="l-mask" v-if="false">
<view class="l-mask" v-if="rollCallInfo!==null">
<view class="m-modal"> <view class="m-modal">
<view class="m-tit">确定点名吗? 学员信息如下</view> <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 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> </view>
</view> </view>
@ -51,6 +55,7 @@ export default {
return { return {
optionsQuery: {}, optionsQuery: {},
studentList: [], studentList: [],
rollCallInfo: null,
} }
}, },
onLoad(options){ onLoad(options){
@ -62,6 +67,56 @@ export default {
}) })
}, },
methods: { 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){ phoneCall(num){
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: num || '-' phoneNumber: num || '-'
@ -94,6 +149,7 @@ export default {
course_id, course_id,
class_id, class_id,
}){ }){
util.showLoad();
servers.get({ servers.get({
url: API.course.getCourseStudentList, url: API.course.getCourseStudentList,
data: { data: {
@ -103,6 +159,7 @@ export default {
failMsg: '加载失败!', failMsg: '加载失败!',
}) })
.then(res=>{ .then(res=>{
util.hideLoad();
let _list = res.list || []; let _list = res.list || [];
this.studentList = _list; this.studentList = _list;
console.warn(res); console.warn(res);

3
src/pages/course/student_review/student_review.vue

@ -77,6 +77,7 @@ export default {
let { descTxt, imageList, optionsQuery } = this; let { descTxt, imageList, optionsQuery } = this;
console.warn(descTxt, 'descTxtdescTxtdescTxt') console.warn(descTxt, 'descTxtdescTxtdescTxt')
if(descTxt == '')return util.showNone('请输入'); if(descTxt == '')return util.showNone('请输入');
util.showLoad();
servers.post({ servers.post({
url: API.course.SaveStudentComment, url: API.course.SaveStudentComment,
data: { data: {
@ -89,6 +90,7 @@ export default {
isDefaultGet: false, isDefaultGet: false,
}) })
.then(e=>{ .then(e=>{
util.hideLoad();
if(e.data.code == 0){ if(e.data.code == 0){
console.warn(e); console.warn(e);
util.showNone(e.data.message || '操作成功!'); util.showNone(e.data.message || '操作成功!');
@ -97,6 +99,7 @@ export default {
util.showNone(e.data.message || '操作失败!'); util.showNone(e.data.message || '操作失败!');
} }
}) })
.catch(util.hideLoad)
}, 300, 300), }, 300, 300),
// //
imgSelect() { imgSelect() {

39
src/pages/course/task/task.vue

@ -35,12 +35,24 @@ export default {
taskList: [], 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: { methods: {
onLoad(options){ onLoad(options){
let _query = util.jsonPar(options.query); let _query = util.jsonPar(options.query);
this.optionsQuery = _query; this.optionsQuery = _query;
this.getHomeworkList({ this.getHomeworkList({
course_id: _query.course_id,
user_id: _query.user_id,
class_id: _query.class_id,
}) })
}, },
toPublish(){ toPublish(){
@ -54,15 +66,21 @@ export default {
homework_id: e.id, homework_id: e.id,
...optionsQuery, ...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'); util.routeTo(`/pages/course/task_finish/task_finish?query=${util.jsonStr(_query)}`, 'nT');
}, },
// (0)/(1);
getCourseType(type = ''){
return ['成班课', '私教课'].findIndex(e=>e===type);
},
getHomeworkList({ getHomeworkList({
course_id= '', course_id= '',
user_id= '', user_id= '',
class_id= '', class_id= '',
page= '',
page_size= '',
page= 1,
page_size= 15,
}){ }){
util.showLoad();
servers.get({ servers.get({
url: API.course.homeworkList, url: API.course.homeworkList,
data: { data: {
@ -74,9 +92,20 @@ export default {
}, },
failMsg: '加载失败!' failMsg: '加载失败!'
}).then(res=>{ }).then(res=>{
util.hideLoad();
let _list = res.list || []; 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: { data: {
course_id: optionsQuery.course_id, course_id: optionsQuery.course_id,
user_id: optionsQuery.user_id || '', user_id: optionsQuery.user_id || '',
class_id: optionsQuery.class_id,
class_id: optionsQuery.class_id || '',
description: desc, description: desc,
video_url: videoSrc, video_url: videoSrc,
images: imgArr, images: imgArr,

2
src/pages/index/index.vue

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

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

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

Loading…
Cancel
Save