Browse Source

add api

master
刘嘉炜 4 years ago
parent
commit
1c06a0ad73
  1. 2
      src/js/api.js
  2. 24
      src/pages/course/experience/experience.vue
  3. 189
      src/pages/shift/application/application.vue
  4. 60
      src/pages/shift/record/record.vue

2
src/js/api.js

@ -16,6 +16,8 @@ export const API = {
student_review: `${ORIGIN}/upload/file/student_review`, // 上传文件 - 学员点评
getCoachList: `${ORIGIN}/stadium/coach/getCoachList`, // 小程序-某个品牌的教练列表
getShiftWorkClassTimes: `${ORIGIN}/stadium/coach/getShiftWorkClassTimes`, // 小程序-教练换班-未进行的课程时间
addShiftWorkRecord: `${ORIGIN}/stadium/coach/addShiftWorkRecord`, // 小程序-教练换班-申请换班
getShiftWorkList: `${ORIGIN}/stadium/coach/getShiftWorkList`, // 小程序-教练换班记录
}

24
src/pages/course/experience/experience.vue

@ -1,11 +1,12 @@
<template>
<view class="course-experience">
<view class="e-tab">
<view><image></image><text>未报价</text></view>
<view><image></image><text>未报价</text></view>
<view><text>未报价</text></view>
<view class="active"><text>已报价</text></view>
<!-- <view><image></image><text>未报价</text></view> -->
</view>
<view class="e-unfold">
<view><text>全部展开</text><image></image></view>
<!-- <view><text>全部展开</text><image></image></view> -->
</view>
<view class="e-list">
<view class="l-item" v-for="i in 5" :key="i">
@ -41,10 +42,10 @@
<text>课程一</text>羽毛球技能技巧大班大班大班大班大班
</view>
</view>
<view class="i-unfold">
<!-- <view class="i-unfold">
<text>展开</text>
<image></image>
</view>
</view> -->
</view>
</view>
<view class="e-fixed-bar">
@ -59,8 +60,18 @@
<script>
export default {
data(){
return {
}
},
onLoad(){
},
methods: {
}
}
</script>
<style lang="scss">
@ -88,6 +99,9 @@ export default {
height: 56upx;
background-color: skyblue;
}
&.active{
color: $themeColor;
}
}
}
.e-unfold{

189
src/pages/shift/application/application.vue

@ -21,19 +21,30 @@
<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 />
<!-- <picker :range="timeList" range-key="_time" @change="timeChange"> -->
<view class="i-view" @click="showTimeModal">
<input placeholder="请选择换班时间" disabled v-model="selectedTimeTxt" />
<image mode="aspectFit" src="/static/images/triangle_c33.png"></image>
</view>
</picker>
<!-- </picker> -->
</view>
<view class="a-tip">
<view>换班需要换班教练的时间为空闲</view>
<view>换班后您的时间为空闲记得前往我的时间</view>
<view>管理您的时间哦</view>
</view>
<view class="fixed-bot-btn"><view hover-class="hover-active">提交换班申请</view></view>
<view class="a-mask" v-if="isShowTimeModal">
<view class="m-content">
<scroll-view class="c-list" scroll-y="">
<view v-for="(e, i) in timeList" :key="i" :class="['l-item', tempSelectTimeID.includes(e.id)?'active':'']" @click="timeSelect(e)">{{e._time || '-'}}</view>
</scroll-view>
<view class="c-btns">
<view hover-class="hover-active" @click="isShowTimeModal = false">取消</view>
<view hover-class="hover-active" @click="confirmTimeSelected">确定</view>
</view>
</view>
</view>
<view class="fixed-bot-btn"><view hover-class="hover-active" @click="submitBtn">提交换班申请</view></view>
</view>
</template>
@ -45,6 +56,11 @@ import util from '../../../utils/util';
export default {
computed: {
...mapState([ 'storeInfo' ]),
selectedTimeTxt(){
let { selectTimeIDS, timeList } = this;
let txtArr = timeList.filter(e=>selectTimeIDS.includes(e.id)).map(e=>e._time);
return txtArr.join(',') || '';
}
},
data(){
return {
@ -52,6 +68,9 @@ export default {
classList: [], //
coachList: [], //
timeList: [], //
selectTimeIDS: [], //
tempSelectTimeID: [], //
isShowTimeModal: false,
selectInfo: {
courseInfo: {
name: ''
@ -72,25 +91,115 @@ export default {
this.getCourseList({});
},
methods: {
timeChange(e){
submitBtn: util.debounce(function(){
let { courseInfo, classInfo, coachInfo, dateInfo } = this.selectInfo;
let { selectTimeIDS } = this;
if(!courseInfo.id || !classInfo.id || !coachInfo.id || selectTimeIDS.length<=0 )return util.showNone('请选择完整!');
util.showLoad();
servers.post({
url: API.addShiftWorkRecord,
data: {
course_id: courseInfo.id,
class_id: classInfo.id,
accept_coach_id: coachInfo.id,
course_duration_ids: selectTimeIDS,
},
isDefaultGet: false,
})
.then(res=>{
util.hideLoad();
if(res.data.code == 0){
util.showModal({
title: '提示',
content: res.data.message || '操作成功!',
success: ele=>{
if(ele.confirm)util.routeTo(`/pages/shift/record/record`, 'nT')
}
})
}else{
util.showModal({
title: '提示',
content: res.data.message || '操作失败!'
})
}
})
.catch(util.hideLoad)
}, 300, 300),
showTimeModal(){
this.isShowTimeModal = true;
this.tempSelectTimeID = [...this.selectTimeIDS];
},
timeSelect(e){
let { tempSelectTimeID } = this;
this.tempSelectTimeID = tempSelectTimeID.includes(e.id) ?
tempSelectTimeID.filter(el=>el!=e.id) :
[...tempSelectTimeID, e.id];
},
confirmTimeSelected(){
this.selectTimeIDS = [...this.tempSelectTimeID];
this.isShowTimeModal = false;
},
//
timeChange(e){
console.warn(e)
let { timeList, selectInfo } = this;
if(!selectInfo.coachInfo.id)return util.showNone('请选择教练!');
let _timeInfo = timeList[e.detail.value] || {};
this.selectInfo = {
...selectInfo,
dateInfo: _timeInfo
};
},
//
coachChange(e){
let { coachList, selectInfo } = this;
if(!selectInfo.classInfo.id)return util.showNone('请选择班级!');
let _coachInfo = coachList[e.detail.value] || {};
this.selectInfo.coachInfo = _coachInfo;
this.selectInfo = {
...selectInfo,
coachInfo: _coachInfo,
dateInfo: {
_time: ''
}
};
this.getShiftWorkClassTimes(selectInfo.courseInfo.id);
},
//
classChange(e){
let { classList } = this;
let { classList, selectInfo } = this;
if(!selectInfo.courseInfo.id)return util.showNone('请选择课程!');
let _classInfo = classList[e.detail.value] || {};
this.selectInfo.classInfo = _classInfo;
this.selectInfo = {
...selectInfo,
classInfo: _classInfo,
coachInfo: {
name: ''
},
dateInfo: {
_time: ''
}
};
this.getCoachList();
},
//
courseChange(e){
let { courseList } = this;
let _courseInfo = courseList[e.detail.value] || {};
this.selectInfo.courseInfo = _courseInfo;
this.selectInfo = {
courseInfo: _courseInfo,
classInfo: {
class_name: ''
},
coachInfo: {
name: ''
},
dateInfo: {
_time: ''
}
};
this.getClassList( _courseInfo.id );
},
@ -113,7 +222,6 @@ export default {
_time: `${e.date} ${e.start_duration}`
}
});
console.warn(_list)
})
},
//
@ -174,6 +282,64 @@ export default {
<style lang="scss">
@import "~style/public.scss";
.a-mask{
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 10;
background-color: rgba($color: #000000, $alpha: .5);
.m-content{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 80%;
height: 800upx;
border-radius: 10upx;
background-color: #fff;
padding: 24upx;
.c-list{
margin-bottom: 24upx;
height: 600upx;
.l-item{
margin-bottom: 12upx;
height: 80upx;
border: 2upx solid #d8d8d8;
color: #333;
line-height: 76upx;
text-align: center;
font-size: 36upx;
border-radius: 10upx;
&.active{
border-color: $themeColor;
color: $themeColor;
}
}
}
.c-btns{
@include centerFlex(center);
>view{
margin: 0 24upx;
width: 200upx;
height: 88upx;
line-height: 88upx;
text-align: center;
border-radius: 44upx;
background-color: $themeColor;
font-size: 32upx;
color: #fff;
border: 2upx solid $themeColor;
&:first-child{
color: $themeColor;
background-color: #fff;
}
}
}
}
}
page{
background-color: #fff;
}
@ -234,4 +400,5 @@ export default {
.fixed-bot-btn{
border-top: 2upx solid #D8D8D8;
}
</style>

60
src/pages/shift/record/record.vue

@ -1,37 +1,76 @@
<template>
<view class="shift-record">
<view class="r-list">
<view class="l-item" v-for="i in 10" :key="i">
<view class="i-status active">已提交</view>
<view class="l-item" v-for="(e, i) in recordList" :key="i">
<view :class="['i-status', e.status==1?'active':e.status==2?'red':''] ">
{{
e.status == 0? '已提交':
e.status == 1? '已通过':
e.status == 2? '已拒绝':'-'
}}
</view>
<view class="i-top">
<view class="i-line">
<view>课程名称:</view>
<view>
<view>篮球初级课</view>
<view>{{e.course_name || '-'}}</view>
</view>
</view>
<view class="i-line">
<view>班级:</view>
<view>
<view>{{e.class_name || '-'}}</view>
</view>
</view>
<view class="i-line">
<view>换班教练:</view>
<view>
<view>{{e.accept_coach_data.name || '-'}}</view>
</view>
</view>
</view>
<view class="i-bot">
<view class="i-line">
<view>课程名称:</view>
<view>换班时间:</view>
<view>
<view>2020/08/22 10:30~12:30</view>
<view>2020/08/22 10:30~12:30</view>
<view v-for="(k,j) in e.duration_data" :key="j">{{k.date || '-'}} {{k.start_duration || '-'}}</view>
</view>
</view>
</view>
<view class="i-unfold">
<!-- <view class="i-unfold">
<text>展开</text>
<image></image>
</view>
</view> -->
</view>
</view>
</view>
</template>
<script>
import { API } from '../../../js/api'
import { servers } from '../../../js/server'
export default {
data(){
return {
recordList: [],
}
},
onLoad(){
this.getRecordList();
},
methods: {
getRecordList(){
servers.get({
url: API.getShiftWorkList,
data: {},
failMsg: '加载失败!'
})
.then(res=>{
let _list = res.list || [];
this.recordList = _list;
})
}
}
}
</script>
@ -55,6 +94,9 @@ export default {
&.active{
color: $themeColor;
}
&.red{
color: #FF4444;
}
}
.i-top{
padding-bottom: 20upx;

Loading…
Cancel
Save