Browse Source

add api

master
刘嘉炜 4 years ago
parent
commit
6d04b37c80
  1. 4
      src/js/api.js
  2. 4
      src/pages/approve/list/list.vue
  3. 2
      src/pages/approve/record/record.vue
  4. 1
      src/pages/course/class_list/class_list.vue
  5. 102
      src/pages/course/list/list.vue
  6. 8
      src/pages/course/roll_call/roll_call.vue
  7. 4
      src/pages/index/index.vue
  8. 158
      src/pages/shift/application/application.vue

4
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`, // 小程序-学员列表

4
src/pages/approve/list/list.vue

@ -47,11 +47,11 @@
<!-- <view class="s-txt s-active" v-else>通过</view> -->
</view>
</view>
<view class="l-reason">
<view class="l-reason" v-if="e.approve_type == 1">
<view>原因:</view>
<view>{{e.for_leave_reason || '-'}}</view>
</view>
<view class="l-unfold">
<view class="l-unfold" v-if="e.approve_type == 1">
<view>
<text>展开</text>
<image mode="aspectFit" src="/static/images/arrow_c874.png"></image>

2
src/pages/approve/record/record.vue

@ -45,7 +45,7 @@
</view>
</view>
<view class="l-reason">
<view class="l-reason" v-if="e.approve_type == 1">
<view>原因:</view>
<view>{{e.for_leave_reason || '-'}}</view>
</view>

1
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 = {

102
src/pages/course/list/list.vue

@ -19,7 +19,7 @@
</view>
<view class="cl-btns">
<block v-if="getCourseType(e.kind) === 0">
<view hover-class="hover-active" @click="orderCourseBtn">预约上课</view>
<view hover-class="hover-active" @click="orderCourseBtn(e)">预约上课</view>
<view hover-class="hover-active" @click="toClass(e)">班级</view>
</block>
<view hover-class="hover-active" v-if="getCourseType(e.kind) === 1">详情</view>
@ -42,18 +42,18 @@
<view class="cl-modal">
<view class="cm-line">
<view>选择班级</view>
<picker>
<picker mode="selector" :range="orderClassList" range-key="class_name" @change="modalClassChange">
<view class="cl-frame">
<input disabled placeholder="请选择班级" />
<input disabled placeholder="请选择班级" v-model="orderInfo.classInfo.class_name" />
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image>
</view>
</picker>
</view>
<view class="cm-line">
<view>选择日期</view>
<picker mode="date">
<picker mode="date" @change="modalDateChange">
<view class="cl-frame">
<input disabled placeholder="请选择日期" />
<input disabled placeholder="请选择日期" v-model="orderInfo.date" />
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image>
</view>
</picker>
@ -61,16 +61,16 @@
<view class="cm-line">
<view>选择时间</view>
<view class="cl-content">
<picker mode="time">
<picker mode="time" @change="modalStartTime">
<view class="cc-frame">
<input disabled placeholder="请选择时间"/>
<input disabled placeholder="请选择时间" v-model="orderInfo.startTime"/>
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image>
</view>
</picker>
<view>-</view>
<picker mode="time">
<picker mode="time" @change="modalEndTime">
<view class="cc-frame">
<input disabled placeholder="请选择时间"/>
<input disabled placeholder="请选择时间" v-model="orderInfo.endTime"/>
<image mode="aspectFit" src="/static/images/arrow_cb2.png"></image>
</view>
</picker>
@ -78,7 +78,7 @@
</view>
<view class="cm-btns">
<view hover-class="hover-active" @click="isOrderCourseModal = false">取消</view>
<view hover-class="hover-active" @click="isOrderCourseModal = false">确定</view>
<view hover-class="hover-active" @click="orderModalConfirm" >确定</view>
</view>
</view>
</view>
@ -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, // 01
},
failMsg: '加载班级失败!'
})
.then(res=>{
util.hideLoad();
this.orderClassList = res.list || [];
this.isOrderCourseModal = true;
})
}, 300, 300),
// (0)/(1);
getCourseType(type = ''){
return ['成班课', '私教课'].findIndex(e=>e===type);

8
src/pages/course/roll_call/roll_call.vue

@ -3,10 +3,10 @@
<picker>
<view class="top-bar"><text>{{optionsQuery.course_name || '-'}}</text></view>
</picker>
<!-- <view class="rc-time">
<view class="rc-time">
<view>课程时间: 2020/12/19 13:00~14:15</view>
<view>5/2</view>
</view> -->
</view>
<view class="rc-list">
<view class="rl-item" v-for="(e, i) in studentList" :key="i">
<view class="ri-selected">
@ -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, // id0
name,
mobile,
page,
page_size,
},

4
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',
},
];

158
src/pages/shift/application/application.vue

@ -3,10 +3,30 @@
<view class="a-warn">私教课以及用户预约的课程不可换班</view>
<view class="a-tit">我的换班</view>
<view class="a-ipts">
<view v-for="i in 4" :key="i">
<input placeholder="请选择课程" />
<image></image>
<picker :range="courseList" range-key="name" @change="courseChange">
<view class="i-view">
<input placeholder="请选择课程" disabled v-model="selectInfo.courseInfo.name" />
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
<picker :range="classList" range-key="class_name" @change="classChange">
<view class="i-view">
<input placeholder="请选择班级" disabled v-model="selectInfo.classInfo.class_name" />
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
<picker :range="coachList" range-key="name" @change="coachChange">
<view class="i-view">
<input placeholder="请选择换班教练" disabled v-model="selectInfo.coachInfo.name" />
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
<picker :range="timeList" range-key="_time" @change="timeChange">
<view class="i-view">
<input placeholder="请选择换班时间" disabled />
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
</view>
<view class="a-tip">
<view>换班需要换班教练的时间为空闲</view>
@ -18,8 +38,137 @@
</template>
<script>
import { mapState } from 'vuex';
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util';
export default {
computed: {
...mapState([ 'storeInfo' ]),
},
data(){
return {
courseList: [], //
classList: [], //
coachList: [], //
timeList: [], //
selectInfo: {
courseInfo: {
name: ''
},
classInfo: {
class_name: ''
},
coachInfo: {
name: ''
},
dateInfo: {
_time: ''
}
}
}
},
onLoad(){
this.getCourseList({});
},
methods: {
timeChange(e){
},
coachChange(e){
let { coachList, selectInfo } = this;
let _coachInfo = coachList[e.detail.value] || {};
this.selectInfo.coachInfo = _coachInfo;
this.getShiftWorkClassTimes(selectInfo.courseInfo.id);
},
classChange(e){
let { classList } = this;
let _classInfo = classList[e.detail.value] || {};
this.selectInfo.classInfo = _classInfo;
this.getCoachList();
},
courseChange(e){
let { courseList } = this;
let _courseInfo = courseList[e.detail.value] || {};
this.selectInfo.courseInfo = _courseInfo;
this.getClassList( _courseInfo.id );
},
//
getShiftWorkClassTimes(courseId){
util.showLoad();
servers.get({
url: API.getShiftWorkClassTimes,
data: { courseId },
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
let _list = res || [];
this.timeList = _list.map(e=>{
return {
...e,
_time: `${e.date} ${e.start_duration}`
}
});
console.warn(_list)
})
},
//
getCoachList(){
util.showLoad();
servers.get({
url: API.getCoachList,
data: { },
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
let _list = res.list || [];
this.coachList = _list;
console.warn(_list)
})
},
//
getClassList( course_id ){
util.showLoad();
servers.get({
url: API.course.getClassList,
data: { course_id, type: 0 },
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
let _list = res.list || [];
this.classList = _list;
console.warn(_list)
})
},
//
getCourseList({
is_experience_class = 0,
kind = '',
}){
let { storeInfo } = this;
util.showLoad();
servers.get({
url: API.course.courseList,
data: {
stadium_id: storeInfo.id,
is_experience_class,
kind,
},
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
let _list = res.list || [];
this.courseList = _list;
})
}
}
}
</script>
@ -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;
}
}

Loading…
Cancel
Save