Browse Source

绑定学员

master
unknown 12 months ago
parent
commit
69e623d5d8
  1. 17
      components/commentItem/commentItem.vue
  2. 5
      config/api.js
  3. 12
      pages.json
  4. 69
      pages/recordEntry/student/addStudent/addStudent.vue
  5. 138
      pages/recordEntry/student/addStudent/searchStudent.vue
  6. 2
      pages/tabbar/operateTrain/index.vue
  7. 1
      pages/tabbar/statistics/comp/comp.scss
  8. 6
      pages/tabbar/statistics/comp/examinCoach.vue
  9. 4
      pages/tabbar/statistics/comp/topUserInfo.vue
  10. 16
      pages/tabbar/student/index.vue

17
components/commentItem/commentItem.vue

@ -7,7 +7,7 @@
<view class="date">{{ $u.timeFormat(item.createTime, 'yyyy-mm-dd')}}</view>
</view>
<view class="starBox">
<u-rate active-color="#1989FA" inactive-color="#1989FA" gutter="1" :size="16" :value="4" :readonly="true"></u-rate>
<u-rate active-color="#1989FA" inactive-color="#1989FA" gutter="1" :size="16" :value="item.stars" :readonly="true"></u-rate>
<view class="num">{{item.stars}}</view>
</view>
<view class="text">{{item.description}}</view>
@ -19,6 +19,10 @@
<view class="imgBox" v-if="item.images&&item.images.length">
<u-album :urls="item.images" :multipleSize="'160rpx'"></u-album>
</view>
<view class="vdo" v-if="item.videoUrl">
<video :src="item.videoUrl" objectFit="fill"></video>
</view>
</view>
</view>
@ -76,4 +80,15 @@
margin-right: 24rpx;
}
}
.vdo {
margin-top: 12rpx;
width: 360rpx;
height: 296rpx;
border-radius: 8rpx;
overflow: hidden;
video {
width: 100%;
height: 100%;
}
}
</style>

5
config/api.js

@ -78,6 +78,11 @@ export const siteCarPage = (params) => http.get('business/site-car/page', {param
export const studentOwner = (params) => http.get('business/student-record/owner', {params})
// 获得学员档案记录列表
export const studentList = (params) => http.get('business/student-record/page', {params})
// 绑定教练
export const studentBindCoach = (data) => http.post('business/student-record/bindCoach', data)

12
pages.json

@ -179,11 +179,19 @@
"style": {
"navigationBarTitleText": "添加学员",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}
},
{
"path": "student/addStudent/searchStudent",
"style": {
"navigationBarTitleText": "搜索学员",
"navigationStyle": "custom",
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}
}
]
},
{

69
pages/recordEntry/student/addStudent/addStudent.vue

@ -3,21 +3,26 @@
<topNavbar title="选择学员"></topNavbar>
<view class="pad">
<view class="searchBox">
<searchRow placeholder="搜索学员姓名、学员手机号"></searchRow>
<searchRow placeholder="搜索学员姓名、学员手机号" @click.native="$goPage('/pages/recordEntry/student/addStudent/searchStudent')"></searchRow>
</view>
<view class="ul">
<view class="li" v-for="(item,index) in list" :key="index">
<view class="li" v-for="(item,index) in list" :key="index" @click="chooseSudent(item)">
<view class="icon">
<image src="@/static/images/index/radio_cli.png" mode=""></image>
<!-- <image src="@/static/images/index/radio.png" mode=""></image> -->
<image src="@/static/images/index/radio_cli.png" mode="" v-if="studentIds.indexOf(item.id)!=-1"></image>
<image src="@/static/images/index/radio_nor.png" mode="" v-else></image>
</view>
<view class="name">{{item.name}}</view>
</view>
</view>
<view style="padding-bottom: 100rpx;" v-if="list.length>6">
<u-loadmore :status="status" />
</view>
<nodata v-if="!list.length&&status=='nomore'"></nodata>
<view class="btn_row">
<view class="btnBorder">已选学员4</view>
<view class="btnBg">确认学员</view>
<view class="btnBorder">已选学员{{studentIds.length}}</view>
<view class="btnBg" @click="studentBindCoachFn">确认学员</view>
</view>
</view>
@ -26,7 +31,7 @@
</template>
<script>
import { studentList } from '@/config/api.js'
import { studentList, studentBindCoach } from '@/config/api.js'
export default {
data() {
return {
@ -38,20 +43,65 @@
status: 0,
},
total: 40,
list: []
list: [],
status: 'loading',
studentIds: []
}
},
onLoad() {
uni.$on('addSearchSudent',(ids)=>{
console.log('监听不到?')
this.studentIds = [...new Set([...this.studentIds,...ids])]
})
this.params.schoolId = this.vuex_schoolId
// this.params.coachId = this.vuex_coachId
this.studentListFn()
},
onPullDownRefresh() {
this.initList()
},
onReachBottom() {
if(this.total>this.list.length) {
this.studentListFn()
}
},
methods: {
initList() {
this.params.pageNo = 1
this.list = []
this.studentListFn()
},
async studentListFn() {
const {data: res} = await studentList(this.params)
this.params.pageNo ++
this.total = res.total
this.list.push(...res.list)
if(this.list.length>=this.total) this.status = 'nomore'
},
chooseSudent(item) {
let index = this.studentIds.indexOf(item.id)
if(index==-1) {
this.studentIds.push(item.id)
}else {
this.studentIds.splice(index,1)
}
},
async studentBindCoachFn() {
if(!this.studentIds.length) return this.$u.toast('请搜索并选择学员')
let obj = {
"studentIds": this.studentIds,
"coachId": this.vuex_coachId,
// "coachName": this.vuex_
}
const res = await studentBindCoach(obj)
if(res.code==0) {
this.$u.toast('绑定学员成功')
setTimeout(()=>{
uni.switchTab({
url: '/pages/tabbar/student/index'
})
},1500)
}
}
}
}
@ -72,7 +122,6 @@
}
.ul {
width: 100%;
padding-bottom: 120rpx;
.li {
display: flex;
align-items: center;

138
pages/recordEntry/student/addStudent/searchStudent.vue

@ -0,0 +1,138 @@
<template>
<view class="pageBgImg">
<topNavbar title="选择学员"></topNavbar>
<view class="pad">
<view class="searchBox">
<searchRow placeholder="搜索学员姓名、学员手机号" @searchFn="searchFn"></searchRow>
</view>
<view class="ul">
<view class="li" v-for="(item,index) in list" :key="index" @click="chooseSudent(item)">
<view class="icon">
<image src="@/static/images/index/radio_cli.png" mode="" v-if="studentIds.indexOf(item.id)!=-1"></image>
<image src="@/static/images/index/radio_nor.png" mode="" v-else></image>
</view>
<view class="name">{{item.name}}</view>
</view>
</view>
<view style="padding-bottom: 100rpx;" v-if="list.length>6">
<u-loadmore :status="status" />
</view>
<nodata v-if="!list.length&&status=='nomore'"></nodata>
<view class="btn_row">
<view class="btnBg" @click="addSearchSudent">确认学员</view>
</view>
</view>
</view>
</template>
<script>
import { studentList, studentBindCoach } from '@/config/api.js'
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 40,
schoolId: '',
coachId: '',
status: 0,
},
total: 40,
list: [],
status: 'loading',
studentIds: []
}
},
onLoad() {
this.params.schoolId = this.vuex_schoolId
},
onPullDownRefresh() {
this.initList()
},
onReachBottom() {
if(this.total>this.list.length) {
this.studentListFn()
}
},
methods: {
initList() {
this.params.pageNo = 1
this.list = []
this.studentListFn()
},
async studentListFn() {
const {data: res} = await studentList(this.params)
this.params.pageNo ++
this.total = res.total
this.list.push(...res.list)
if(this.list.length>=this.total) this.status = 'nomore'
},
searchFn(val) {
this.params.keyWord = val
this.initList()
},
chooseSudent(item) {
let index = this.studentIds.indexOf(item.id)
if(index==-1) {
this.studentIds.push(item.id)
}else {
this.studentIds.splice(index,1)
}
},
addSearchSudent() {
if(!this.studentIds.length) return this.$u.toast('请搜索并选择学员')
uni.$emit('addSearchSudent',this.studentIds )
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.btn_row {
position: fixed;
bottom: 0;
left: 0;
padding: 10rpx 0 40rpx 0rpx;
z-index: 9;
width: 100%;
}
.searchBox {
padding: 20rpx 0;
}
.ul {
width: 100%;
.li {
display: flex;
align-items: center;
height: 108rpx;
background: #FFFFFF;
border-radius: 16rpx;
border: 2rpx solid rgba(25,137,250,0.2);
margin-bottom: 20rpx;
padding: 0 20rpx;
.icon {
width: 32rpx;
height: 32rpx;
}
.name {
padding: 0 20rpx;
}
}
}
.btn_row {
display: flex;
justify-content: center;
.btnBorder {
width: 40%;
}
.btnBg {
width: 56%;
}
}
</style>

2
pages/tabbar/operateTrain/index.vue

@ -55,7 +55,7 @@
:minDate="1587524800000"
@confirm="confirmDatePicker"
@cancel="cancelDate"
cancelText="所有日期"
cancelText="不限日期"
@close="showDatePicker=false"
></u-datetime-picker>

1
pages/tabbar/statistics/comp/comp.scss

@ -31,6 +31,7 @@
.tag {
min-width: 112rpx;
height: 44rpx;
padding: 0 20rpx;
background: #82AFDD;
border-radius: 22rpx;
font-size: 20rpx;

6
pages/tabbar/statistics/comp/examinCoach.vue

@ -1,13 +1,13 @@
<template>
<view class="content">
<view class="userInfo">
<view class="tit">Hi,大乔教练</view>
<view class="tit">Hi,{{ vuex_userInfo.user.nickname }}</view>
<view class="flex userRow">
<view class="schoolIcon">
<image src="@/static/images/index/ic_jiaxiao.png" mode=""></image>
</view>
<view class="schoolName oneRowText">翔力驾校</view>
<view class="tag">考场教练</view>
<view class="schoolName oneRowText">缺字段</view>
<view class="tag">{{identity}}</view>
</view>
</view>
<view class="card priceBox">

4
pages/tabbar/statistics/comp/topUserInfo.vue

@ -5,8 +5,8 @@
<view class="schoolIcon">
<image src="@/static/images/index/ic_jiaxiao.png" mode=""></image>
</view>
<view class="schoolName oneRowText">翔力驾校</view>
<view class="tag">合作教练</view>
<view class="schoolName oneRowText">没字段</view>
<view class="tag">{{identity}}</view>
</view>
</view>
</template>

16
pages/tabbar/student/index.vue

@ -89,11 +89,12 @@
:visibleItemCount="4"
:closeOnClickOverlay="false"
@confirm="confirmDatePicker"
@cancel="showDatePicker=false"
@cancel="cancelDate"
cancelText="不限日期"
></u-datetime-picker>
<u-picker :show="showCar" :columns="carArr" keyName="lab" @confirm="confirmCar" @cancel="showCar=false"></u-picker>
<u-picker :show="showClass" :columns="classArr" keyName="lab" @confirm="confirmClass" @cancel="showClass=false"></u-picker>
<u-picker :show="showClass" :columns="classArr" keyName="name" @confirm="confirmClass" @cancel="showClass=false"></u-picker>
</view>
</template>
@ -142,6 +143,7 @@
this.params.schoolId = this.vuex_schoolId
this.studentRecordPageFn()
this.studentOwnerFn()
this.schoolClass()
},
methods: {
searchFn(val) {
@ -153,6 +155,13 @@
this.count = res
console.log(res)
},
cancelDate() {
this.showDatePicker=false
this.params.startTime = ''
this.params.endTime = ''
this.screen.timer = '预约时间'
this.listInit()
},
confirmDatePicker(val) {
this.showDatePicker = false
@ -182,7 +191,8 @@
},
//
async schoolClass() {
const {data: res} = await schoolClass({id: this.vuex_userInfo.shoolId})
const {data: res} = await schoolClass({id: this.vuex_schoolId,pageNo: 1,pageSize: 100})
this.classArr = res.list
},
listInit() {
this.params.pageNo = 1

Loading…
Cancel
Save