学员端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

99 lines
2.0 KiB

<template>
<view class="main">
<u-sticky>
<view class="searchBox">
<u-search placeholder="请输入教练姓名" v-model="params.name" :show-action="false" @search="searchFn"> </u-search>
</view>
</u-sticky>
<view class="ul">
<view class="li" v-for="(item,index) in list" :key="index" @click="chooseClick(item)">
<view class="leftT">{{item.name}}</view>
<view class="rigthT">{{item.mobile}}</view>
</view>
</view>
<u-loadmore :status="status" v-if="list.length>30" :icon-type="'flower'" />
</view>
</template>
<script>
import { coachPage } from '@/config/api.js'
export default {
data() {
return {
keyword: '',
trainingSchoolId: '',
list: [],
params: {
pageNo: 1,
pageSize: 20,
schoolId: '',
name: ''
},
status: 'loading',
}
},
onLoad(options) {
this.params.schoolId = options.schoolId
this.coachPageFn()
},
onReachBottom() {
if(status=='nomore') return
this.coachPageFn()
},
methods: {
chooseClick(item) {
uni.$emit('upDateCoachItem', item)
uni.navigateBack()
},
searchFn() {
this.list = []
this.params.pageNo = 1
this.status = 'loading'
this.coachPageFn()
},
// 获取教练
async coachPageFn() {
const {data:res} = await coachPage(this.params)
this.list.push(...res.list)
this.params.pageNo ++
this.total = res.total
if(this.list.length>=this.total) {
this.status = 'nomore'
}
console.log('获取教练')
console.log(this.list)
},
}
}
</script>
<style lang="scss" scoped>
.main {
background-color: #f8f8f8;
.searchBox {
background-color: #fff;
padding: 16rpx 32rpx;
}
}
.ul {
width: 100%;
border-bottom: 10rpx solid #f8f8f8;
font-size: 30rpx;
padding: 0 32rpx;
color: #333333;
background-color: #fff;
.li {
width: 100%;
height: 98rpx;
line-height: 98rpx;
display: flex;
font-size: 30rpx;
justify-content: space-between;
align-center: center;
border-bottom: 1px solid #F5F7FA;
}
}
</style>