Browse Source

add api

master
刘嘉炜 4 years ago
parent
commit
320816304a
  1. 2
      src/js/api.js
  2. 68
      src/pages/course/class_change/class_change.vue
  3. 15
      src/pages/course/student_list/student_list.vue
  4. 12
      src/pages/course/task_finish/task_finish.vue
  5. 57
      src/pages/course/task_info/task_info.vue

2
src/js/api.js

@ -21,9 +21,11 @@ API['course'] = {
getClassList: `${ORIGIN}/stadium/coach/getClassList`, // 小程序-班级列表 getClassList: `${ORIGIN}/stadium/coach/getClassList`, // 小程序-班级列表
getCourseStudentList: `${ORIGIN}/stadium/coach/getCourseStudentList`, // 小程序-学员列表 getCourseStudentList: `${ORIGIN}/stadium/coach/getCourseStudentList`, // 小程序-学员列表
SaveStudentComment: `${ORIGIN}/stadium/coach/SaveStudentComment`, // 小程序-学员点评保存 SaveStudentComment: `${ORIGIN}/stadium/coach/SaveStudentComment`, // 小程序-学员点评保存
shiftStudentClass: `${ORIGIN}/stadium/coach/shiftStudentClass`, // 小程序-学员调班
homeworkList: `${ORIGIN}/stadium/coach/homework/list`, // 小程序-作业列表 homeworkList: `${ORIGIN}/stadium/coach/homework/list`, // 小程序-作业列表
homeworkRecords: `${ORIGIN}/stadium/coach/homework/records`, // 小程序-作业完成列表 homeworkRecords: `${ORIGIN}/stadium/coach/homework/records`, // 小程序-作业完成列表
homeworkRemind: `${ORIGIN}/stadium/coach/homework/remind`, // 小程序-作业提醒 homeworkRemind: `${ORIGIN}/stadium/coach/homework/remind`, // 小程序-作业提醒
homeworkRecordInfo: `${ORIGIN}/stadium/coach/homework/recordInfo`, // 小程序-作业完成详情
homeworkAdd: `${ORIGIN}/stadium/coach/homework/add`, // 小程序-布置作业 homeworkAdd: `${ORIGIN}/stadium/coach/homework/add`, // 小程序-布置作业
} }

68
src/pages/course/class_change/class_change.vue

@ -1,28 +1,80 @@
<template> <template>
<view class="class-change"> <view class="class-change">
<view class="cc-user"> <view class="cc-user">
<image class="cu-avatar"></image>
<image class="cu-avatar" mode="aspectFit" :src="optionsQuery.user_avatar"></image>
<view>Adjoin</view> <view>Adjoin</view>
<image class="cu-icon"></image>
<image class="cu-icon" mode="aspectFit" :src="`/static/images/sex_${optionsQuery.user_gender-1}.png`"></image>
</view> </view>
<view class="cc-picker"> <view class="cc-picker">
<picker>
<picker mode="selector" range-key="class_name" :range="classList" @change="pickerChange">
<view> <view>
<input disabled placeholder="请选择班级" />
<image></image>
<input disabled placeholder="请选择班级" v-model="changeClassInfo.class_name"/>
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view> </view>
</picker> </picker>
</view> </view>
<view class="cc-fixed"> <view class="cc-fixed">
<view hover-class="hover-active">确定</view>
<view hover-class="hover-active" @click="confirmChange">确定</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util'
export default { export default {
data(){
return {
optionsQuery: {},
classList: [],
changeClassInfo: {}
}
},
onLoad(options){
let _query = util.jsonPar(options.query);
this.optionsQuery = _query;
this.getClassList(_query.course_id)
},
methods: {
confirmChange: util.debounce(function(){
let { changeClassInfo, optionsQuery } = this;
if(JSON.stringify(changeClassInfo) == '{}')return util.routeTo();
servers.get({
url: API.course.shiftStudentClass,
data: {
order_no: optionsQuery.order_no,
class_id: changeClassInfo.id
},
isDefaultGet: false
})
.then(res=>{
if(res.data.code ==0){
util.showNone(res.data.message || '操作成功!');
setTimeout(util.routeTo, 1200);
}else{
util.showNone(res.data.message || '操作失败!');
}
})
}, 300, 300),
pickerChange(e){
let { classList } = this;
this.changeClassInfo = classList[e.detail.value];
},
getClassList( course_id ){
servers.get({
url: API.course.getClassList,
data: { course_id, type: 1 },
failMsg: '加载失败!'
})
.then(res=>{
let _list = res.list || [];
this.classList = _list;
console.warn(res);
})
}
}
} }
</script> </script>
@ -40,7 +92,6 @@ export default {
>image{ >image{
flex-grow: 0; flex-grow: 0;
flex-shrink: 0; flex-shrink: 0;
background-color: skyblue;
} }
.cu-avatar{ .cu-avatar{
margin-right: 32upx; margin-right: 32upx;
@ -84,7 +135,6 @@ export default {
margin-left: 20upx; margin-left: 20upx;
width: 28upx; width: 28upx;
height: 28upx; height: 28upx;
background-color: skyblue;
} }
} }
} }

15
src/pages/course/student_list/student_list.vue

@ -69,12 +69,21 @@ export default {
user_id: e.user_id, user_id: e.user_id,
user_name: e.name, user_name: e.name,
...optionsQuery, ...optionsQuery,
}
}
util.routeTo(`/pages/course/student_review/student_review?query=${util.jsonStr(_query)}`, 'nT'); util.routeTo(`/pages/course/student_review/student_review?query=${util.jsonStr(_query)}`, 'nT');
}, },
toShift(){
toShift(e){
let { optionsQuery } = this; let { optionsQuery } = this;
util.routeTo(`/pages/course/class_change/class_change`, 'nT');
let _query = {
order_no: e.order_no,
user_id: e.user_id,
user_name: e.name,
user_gender: e.gender,
user_avatar: e.user_info.avatar_url,
...optionsQuery,
}
console.warn(e);
util.routeTo(`/pages/course/class_change/class_change?query=${util.jsonStr(_query)}`, 'nT');
}, },
getStudentList({ getStudentList({
course_id, course_id,

12
src/pages/course/task_finish/task_finish.vue

@ -12,7 +12,7 @@
</picker> </picker>
</view> --> </view> -->
<view class="ctf-list"> <view class="ctf-list">
<view class="cl-item" v-for="(e, i) in finishList" :key="i" @click="toTaskInfo">
<view class="cl-item" v-for="(e, i) in finishList" :key="i" @click="toTaskInfo(e)">
<view class="ci-time"></view> <view class="ci-time"></view>
<view class="ci-content"> <view class="ci-content">
<view class="cc-user"> <view class="cc-user">
@ -81,8 +81,14 @@ export default {
}) })
}, 300, 300), }, 300, 300),
toTaskInfo(){
util.routeTo(`/pages/course/task_info/task_info`, 'nT');
toTaskInfo(e){
let { optionsQuery } = this;
let _query = {
...optionsQuery,
homework_record_id: e.record.id,
user_name: e.order.name
}
util.routeTo(`/pages/course/task_info/task_info?query=${util.jsonStr(_query)}`, 'nT');
}, },
getFinishList({ getFinishList({
homework_id= '', homework_id= '',

57
src/pages/course/task_info/task_info.vue

@ -1,11 +1,11 @@
<template> <template>
<view class="task-info"> <view class="task-info">
<block>
<block v-if="false">
<view class="i-header"> <view class="i-header">
<picker> <picker>
<view class="top-bar"><text>12</text></view> <view class="top-bar"><text>12</text></view>
</picker> </picker>
<picker class="select-picker">
<picker class="select-picker" disabled>
<view> <view>
<input disabled value="小小李木子" /> <input disabled value="小小李木子" />
<image></image> <image></image>
@ -21,17 +21,17 @@
</view> </view>
</block> </block>
<view class="ti-section"> <view class="ti-section">
<block v-if="false">
<block>
<view class="s-name"> <view class="s-name">
<view>羽毛球课包学会(带体验课)</view> <view>羽毛球课包学会(带体验课)</view>
<view>一班</view> <view>一班</view>
</view> </view>
<view class="s-user"> <view class="s-user">
<view>学员名称:</view> <view>学员名称:</view>
<picker class="select-picker">
<picker class="select-picker" disabled>
<view> <view>
<input disabled value="小小李木子" />
<image></image>
<input disabled v-model="optionsQuery.user_name" />
<!-- <image></image> -->
</view> </view>
</picker> </picker>
</view> </view>
@ -39,23 +39,57 @@
<view class="s-detail"> <view class="s-detail">
<view>完成情况</view> <view>完成情况</view>
<view>作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容村上春树吃餐</view>
<view>{{ taskInfo.completion || '-' }}</view>
</view> </view>
<view class="s-addr"> <view class="s-addr">
<view>视频链接</view> <view>视频链接</view>
<view>htttp//ksjksjksj.cocfcwqcwq</view>
<view>复制</view>
<view>{{ taskInfo.video_url || '-' }}</view>
<view @click="copyUrl">复制</view>
</view> </view>
<view class="s-imgs"> <view class="s-imgs">
<image v-for="i in 5" :key="i"></image>
<image v-for="(e,i) in taskInfo.images" :key="i" mode="aspectFit" :src="e"></image>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { API } from '../../../js/api'
import { servers } from '../../../js/server'
import util from '../../../utils/util'
export default { export default {
data(){
return {
taskInfo: {},
optionsQuery: {},
}
},
onLoad(options){
let _query = util.jsonPar(options.query);
this.optionsQuery = _query;
console.warn('query' , _query)
this.getTaskInfo(_query.homework_record_id);
},
methods: {
copyUrl(){
let { taskInfo } = this;
uni.setClipboardData({
data: taskInfo.video_url,
})
},
getTaskInfo( homework_record_id ){
servers.get({
url: API.course.homeworkRecordInfo,
data: {
homework_record_id
},
failMsg: '加载失败!'
})
.then(res=>{
this.taskInfo = res;
})
}
}
} }
</script> </script>
@ -145,7 +179,6 @@ export default {
width: 200upx; width: 200upx;
height: 200upx; height: 200upx;
border-radius: 10upx; border-radius: 10upx;
background-color: skyblue;
&:not(:nth-child(3n)){ &:not(:nth-child(3n)){
margin-right: 44upx; margin-right: 44upx;
} }

Loading…
Cancel
Save