Browse Source

add api

master
刘嘉炜 4 years ago
parent
commit
af14b544a4
  1. 1
      src/js/api.js
  2. 109
      src/pages/approve/list/list.vue
  3. 40
      src/pages/approve/record/record.vue
  4. 14
      src/pages/course/class_list/class_list.vue
  5. 78
      src/pages/course/roll_call/roll_call.vue
  6. 7
      src/pages/course/student_list/student_list.vue
  7. 5
      src/pages/course/task_finish/task_finish.vue
  8. BIN
      src/static/images/no_result.png
  9. BIN
      src/static/images/selected_c97.png

1
src/js/api.js

@ -32,6 +32,7 @@ API['course'] = {
API['approve'] = {
getApproveList: `${ORIGIN}/stadium/coach/getApproveList`, // 小程序-课程列表
handleApprove: `${ORIGIN}/stadium/coach/handleApprove`, // 小程序-处理审批
}
export default { ORIGIN, API };

109
src/pages/approve/list/list.vue

@ -4,51 +4,52 @@
<view @click="tabChange(0)">
<view :class="['t-txt', tabIdx==0?'active':'']">
<text>预约审批</text>
<view class="t-label">99</view>
<!-- <view class="t-label">99</view> -->
</view>
</view>
<view @click="tabChange(1)">
<view :class="['t-txt', tabIdx==1?'active':'']">
<text>请假审批</text>
<view class="t-label">99</view>
<!-- <view class="t-label">99</view> -->
</view>
</view>
<view @click="tabChange(2)">
<view :class="['t-txt', tabIdx==2?'active':'']">
<text>换班审批</text>
<view class="t-label">99</view>
<!-- <view class="t-label">99</view> -->
</view>
</view>
</view>
<view class="l-bar">
<view>审核人数:3</view>
<view>审核人数: 0</view>
<view @click="toRecord">审批记录</view>
</view>
<view class="l-null" v-if="false">
<image></image>
<view class="l-null" v-if="approveList.length<=0">
<image mode="aspectFit" src="/static/images/no_result.png"></image>
<view>抱歉没有相关课程订单信息...</view>
</view>
<view class="l-list" v-else>
<view class="l-item">
<view class="l-item" v-for="(e,i) in approveList" :key="i" @click="selectItem(i)">
<view class="l-content">
<view class="c-user">
<image></image>
<view>胡可课</view>
<image :src="e.user_data.avatar_url" mode="aspectFit"></image>
<view>{{e.user_name || '-'}}</view>
</view>
<view class="c-content">
<view class="c-name">羽毛球课程(羽毛球课)</view>
<view class="c-name">{{e.course_name || '-'}}</view>
<view class="c-times">
<view v-for="(e, i) in approveList" :key="i">2020-08-22 10:30</view>
<view v-for="(k, j) in e.duration_list" :key="j">{{k || '-'}}</view>
</view>
</view>
<view class="c-status">
<view class="s-icon" v-if="true"></view>
<view class="s-txt s-active" v-else>通过</view>
<image class="s-img" v-if="e.defineSelected" mode="aspectFit" src="/static/images/selected_c97.png"></image>
<view class="s-icon" v-else></view>
<!-- <view class="s-txt s-active" v-else>通过</view> -->
</view>
</view>
<view class="l-reason">
<view>原因:</view>
<view>作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内容作业内</view>
<view>{{e.for_leave_reason || '-'}}</view>
</view>
<view class="l-unfold">
<view>
@ -61,12 +62,13 @@
<view class="l-bot-bar">
<view class="bb-select">
<view></view>
<text>全选</text>
<image v-if="isSelectAll" mode="aspectFit" src="/static/images/selected_c97.png"></image>
<view v-else></view>
<text @click="selectAll">全选</text>
</view>
<view class="bb-btns">
<view hover-class="hover-active">不同意</view>
<view hover-class="hover-active">同意</view>
<view hover-class="hover-active" @click="handleApprove(2)">不同意</view>
<view hover-class="hover-active" @click="handleApprove(1)">同意</view>
</view>
</view>
</view>
@ -80,6 +82,12 @@ import { mapState } from 'vuex';
export default {
computed: {
...mapState([ 'storeInfo' ]),
isSelectAll(){
let { approveList } = this;
if(approveList.length<=0)return false;
let bolArr = approveList.map(e=>!!e.defineSelected);
return !bolArr.includes(false);
}
},
data(){
return {
@ -91,14 +99,58 @@ export default {
this.getApproveList();
},
methods: {
selectAll(){
let { isSelectAll } = this;
let _list = [...this.approveList];
if(_list.length<=0)return
console.warn(this.isSelectAll)
this.approveList = _list.map(e=>{
return {
...e,
defineSelected: !this.isSelectAll,
}
})
console.warn(this.approveList)
},
selectItem(index){
let _list = [...this.approveList];
_list[index].defineSelected = !_list[index].defineSelected;
this.approveList = _list;
},
handleApprove: util.debounce(function(status){
let { approveList } = this;
let _selectedArr = approveList.filter(ele=>{
return ele.defineSelected
})
if(_selectedArr.length<=0)return;
servers.post({
url: API.approve.handleApprove,
data: {
status,
approve_ids: _selectedArr.map(item=>item.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),
tabChange(i){
this.approveList = [];
this.tabIdx = i;
this.getApproveList(i);
},
toRecord(){
util.routeTo(`/pages/approve/record/record`,'nT');
},
getApproveList(approve_type = 0){
let { storeInfo } = this;
util.showLoad();
servers.get({
url: API.approve.getApproveList,
data: {
@ -109,7 +161,8 @@ export default {
failMsg: '加载失败!'
})
.then(res=>{
let _list = res.list || [];
util.hideLoad();
let _list = res.list || [{},{}];
this.approveList = _list;
console.warn('approve list --->', res);
})
@ -178,7 +231,6 @@ export default {
.l-bar{
padding: 0 50upx;
height: 92upx;
background-color: yellowgreen;
@include centerFlex(space-between);
>view{
font-size: 28upx;
@ -197,6 +249,7 @@ export default {
.l-list{
padding: 0 24upx;
.l-item{
margin-bottom: 24upx;
padding: 24upx;
background-color: #fff;
.l-content{
@ -211,7 +264,6 @@ export default {
width: 100upx;
height: 100upx;
border-radius: 50%;
background-color: skyblue;
}
>view{
max-width: 120upx;
@ -242,10 +294,10 @@ export default {
height: 36upx;
border: 2upx solid #9a9a9d;
border-radius: 50%;
>image{
width: 100%;
height: 100%;
}
.s-img{
width: 36upx;
height: 36upx;
}
.s-txt{
font-size: 28upx;
@ -301,7 +353,6 @@ export default {
display: block;
width: 346upx;
height: 346upx;
background-color: skyblue;
}
>view{
text-align: center;
@ -327,12 +378,18 @@ export default {
color: #333;
@include centerFlex(flex-start);
>view{
margin-right: 14upx;
width: 36upx;
height: 36upx;
border-radius: 50%;
border: 2upx solid #9a9a9d;
}
>image{
width: 36upx;
height: 36upx;
}
>text{
margin-left: 14upx;
}
}
.bb-btns{

40
src/pages/approve/record/record.vue

@ -4,24 +4,24 @@
<view @click="tabChange(0)">
<view :class="['t-txt', tabIdx==0?'active':'']">
<text>预约审批</text>
<view class="t-label">99</view>
<!-- <view class="t-label">99</view> -->
</view>
</view>
<view @click="tabChange(1)">
<view :class="['t-txt', tabIdx==1?'active':'']">
<text>请假审批</text>
<view class="t-label">99</view>
<!-- <view class="t-label">99</view> -->
</view>
</view>
<view @click="tabChange(2)">
<view :class="['t-txt', tabIdx==2?'active':'']">
<text>换班审批</text>
<view class="t-label">99</view>
<!-- <view class="t-label">99</view> -->
</view>
</view>
</view>
<view class="r-list">
<view class="l-item">
<view class="l-item" v-for="(e, i) in approveList" :key="i">
<view class="l-content">
<view class="c-user">
<image></image>
@ -55,17 +55,46 @@
</template>
<script>
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util';
import { mapState } from 'vuex';
export default {
computed: {
...mapState([ 'storeInfo' ]),
},
data(){
return {
tabIdx: 0
tabIdx: 0,
approveList: [],
}
},
onLoad(){
this.getApproveList();
},
methods: {
tabChange(i){
this.tabIdx = i;
},
getApproveList(approve_type = 0){
let { storeInfo } = this;
util.showLoad();
servers.get({
url: API.approve.getApproveList,
data: {
approve_type,
stadium_id: storeInfo.id,
is_approve_record: 1
},
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
let _list = res.list || [{},{}];
this.approveList = _list;
console.warn('approve list --->', res);
})
}
}
}
</script>
@ -125,6 +154,7 @@ export default {
.r-list{
padding: 0 24upx;
.l-item{
margin-bottom: 24upx;
padding: 24upx;
background-color: #fff;
.l-content{

14
src/pages/course/class_list/class_list.vue

@ -19,7 +19,7 @@
<view hover-class="hover-active" @click="toStudentLst(e)">学员</view>
<block v-if="e.class_status == 1 || true">
<view hover-class="hover-active">点名</view>
<view hover-class="hover-active" @click="toRollCall(e)">点名</view>
<view hover-class="hover-active" @click="toTask(e)">作业</view>
</block>
@ -47,6 +47,18 @@ export default {
this.getClassList(_query.course_id)
},
methods: {
toRollCall(e){
return util.showNone('开发中');
console.warn(e);
let { optionsQuery } = this;
let _query = {
...optionsQuery,
class_id: e.id,
class_name: e.class_name,
}
console.log(e,'eeeeee')
util.routeTo(`/pages/course/roll_call/roll_call?query=${util.jsonStr(_query)}`, 'nT');
},
toTask(e){
let { optionsQuery } = this;
let _query = {

78
src/pages/course/roll_call/roll_call.vue

@ -1,29 +1,31 @@
<template>
<view class="roll-call">
<picker>
<view class="top-bar"><text>12</text></view>
<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="i in 10" :key="i">
<view class="ri-selected"></view>
<image class="ri-avatar"></image>
<view class="rl-item" v-for="(e, i) in studentList" :key="i">
<view class="ri-selected">
<image mode="aspectFit" src="/static/images/selected_c97.png"></image>
</view>
<image class="ri-avatar" mode="aspectFit" :src="e.user_info.avatar_url"></image>
<view class="ri-content">
<view class="rc-info">
<view class="ri-name">
<view>Adjoin</view>
<image></image>
<view>{{e.name || '-'}}</view>
<image mode="aspectFit" :src="`/src/static/images/sex_${e.gender-1}.png`"></image>
</view>
<view class="ri-phone">
<view>12345679083</view>
<image></image>
<view>{{e.mobile || '-'}}</view>
<image mode="aspectFit" src="/static/images/phone_c33.png"></image>
</view>
</view>
<view class="rc-tip">
<view>剩余次数: 10</view>
<view>剩余次数: {{e.number || 0}}</view>
<view>未点名</view>
</view>
</view>
@ -33,8 +35,55 @@
</template>
<script>
import { API } from '../../../js/api'
import { servers } from '../../../js/server'
import util from '../../../utils/util'
export default {
data(){
return {
optionsQuery: {},
studentList: [],
}
},
onLoad(options){
console.warn(util.jsonPar(options.query));
let _query = util.jsonPar(options.query) || {};
this.optionsQuery = _query;
this.getUserList({
course_id: _query.course_id,
class_id: _query.class_id,
})
},
methods: {
getUserList({
course_id,
class_id,
name= '',
mobile= '',
page= 1,
page_size= 15,
}){
servers.get({
url: API.course.getCourseStudentList,
data: {
course_id,
class_id, // id0
name,
mobile,
page,
page_size,
},
failMsg: '加载失败!'
})
.then(res=>{
let _list = res.list || [];
if(page == 1)return this.studentList = _list;
if(_list.length <=0)return util.showNone('没有更多!');
this.studentList = [...this.studentList, ..._list];
})
},
}
}
</script>
@ -77,7 +126,10 @@ export default {
margin-right: 26upx;
width: 40upx;
height: 40upx;
background-color: skyblue;
>image{
width: 100%;
height: 100%;
}
}
.ri-avatar{
flex-shrink: 0;
@ -86,7 +138,6 @@ export default {
width: 116upx;
height: 116upx;
border-radius: 50%;
background-color: skyblue;
}
.ri-content{
flex-grow: 1;
@ -108,7 +159,6 @@ export default {
margin-left: 12upx;
width: 36upx;
height: 36upx;
background-color: skyblue;
}
}
.ri-phone{

7
src/pages/course/student_list/student_list.vue

@ -15,7 +15,7 @@
</view>
<view class="si-phone">
<view>{{e.mobile || '-'}}</view>
<image mode="aspectFit" src="/static/images/phone_c33.png"></image>
<image mode="aspectFit" src="/static/images/phone_c33.png" @click="phoneCall(e.mobile)"></image>
</view>
</view>
<view class="sc-lave">剩余次数: {{e.number || 0}}</view>
@ -62,6 +62,11 @@ export default {
})
},
methods: {
phoneCall(num){
uni.makePhoneCall({
phoneNumber: num || '-'
})
},
toReview(e){
let { optionsQuery } = this;
let _query = {

5
src/pages/course/task_finish/task_finish.vue

@ -62,12 +62,13 @@ export default {
methods: {
remindAll: util.debounce(function(){
let { optionsQuery, finishList } = this;
console.warn(optionsQuery)
console.warn(optionsQuery, 'optionsQuery')
console.warn(finishList, 'finishList')
servers.post({
url: API.course.homeworkRemind,
data: {
homework_id: optionsQuery.homework_id,
homework_record_ids: finishList.map(e=>e.id),
homework_record_ids: finishList.map(e=>e.record.id),
},
isDefaultGet: false,
})

BIN
src/static/images/no_result.png

After

Width: 346  |  Height: 346  |  Size: 2.1 KiB

BIN
src/static/images/selected_c97.png

After

Width: 44  |  Height: 40  |  Size: 497 B

Loading…
Cancel
Save