Browse Source

feat(student): 添加我的教练功能- 新增我的教练页面,展示学生对应的教练列表

- 实现教练列表的数据加载和展示逻辑- 添加跳转到我的教练页面的功能
- 更新 API 路由,增加获取学生教练列表的接口
master
liutong 10 months ago
parent
commit
7707ea3eb7
  1. 7
      api/apiRoute.js
  2. 9
      pages.json
  3. 4
      pages/student/login/login.vue
  4. 9
      pages/student/my/my.vue
  5. 211
      pages/student/my/my_coach.vue

7
api/apiRoute.js

@ -538,6 +538,13 @@ export default {
return res; return res;
}) })
}, },
//学生端-学生课程安排-获取学生排课的全部场地列表
xy_personCourseScheduleGetMyCoach(data = {}) {
let url = '/xy/personCourseSchedule/getMyCoach'
return http.get(url, data).then(res => {
return res;
})
},

9
pages.json

@ -36,6 +36,15 @@
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
}, },
{
"path": "pages/student/my/my_coach",
"style": {
"navigationBarTitleText": "我的教练",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#29d3b4",
"navigationBarTextStyle": "white"
}
},
{ {
"path": "pages/student/login/forgot", "path": "pages/student/login/forgot",

4
pages/student/login/login.vue

@ -277,8 +277,8 @@ export default {
this.password1= '123123' // this.password1= '123123' //
}else{ }else{
// //
this.user= '15335526445' // this.user= '13042409890' //
this.password1= '123123' // this.password1= '13042409890' //
} }
}, },

9
pages/student/my/my.vue

@ -64,7 +64,7 @@
<view class="section_box"> <view class="section_box">
<view class="item"> <view class="item">
<view>我的教练</view> <view @click="openViewMyCoach()">我的教练</view>
<view></view> <view></view>
</view> </view>
<!-- <view class="item">--> <!-- <view class="item">-->
@ -160,6 +160,13 @@
url: `/pages/common/my_message` url: `/pages/common/my_message`
}) })
}, },
//-
openViewMyCoach(){
uni.navigateTo({
url: `/pages/student/my/my_coach`
})
},
} }
} }
</script> </script>

211
pages/student/my/my_coach.vue

@ -0,0 +1,211 @@
<!--我的教练-列表-->
<template>
<view class="main_box">
<scroll-view scroll-y="true" :lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData" style="height: 100%;padding-top:50rpx;padding-bottom: 50rpx">
<!-- <view class="data_hint" v-if="!this.tableList.length">暂无更多数据</view>-->
<view class="main_section" v-for="(v,k) in tableList" :key="k">
<view class="left">
<!-- 头像-->
<image :src="v.head_img ? v.head_img : $util.img('/uniapp_src/static/images/common/yong_hu.png')" class="pic"></image>
</view>
<view class="right">
<view class="title">姓名{{v.name}}</view>
<view class="title">电话{{v.phone}}</view>
</view>
</view>
</scroll-view>
<!-- 加载状态-->
<!-- <fui-loading :isFixed="true" srcCol="/static/icon-img/loading_white.png" text="正在加载..." v-if="loading"></fui-loading>-->
</view>
</template>
<script>
import apiRoute from '@/api/apiRoute.js';
import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue"
export default {
components: {
AQTabber,
},
data() {
return {
loading:false,//
lowerThreshold: 100,//
isReachedBottom: false,//|true=|false=
memberInfo:{id:''},//
//
filteredData:{
page:1,//
limit:10,//
total:10,//
resources_id:'',//id
},
tableList:[],//
}
},
onLoad(options) {},
onShow() {
this.init()//
},
//
async onPullDownRefresh() {
//
await this.resetFilteredData()
await this.getList()
},
methods: {
//
async init() {
await this.getMemberInfo();
await this.getList();
},
//
async resetFilteredData() {
this.isReachedBottom = false; // 便
this.filteredData.page = 1//
this.filteredData.limit = 10//
this.filteredData.total = 10//
},
//
async getMemberInfo() {
let res = await apiRoute.xy_memberInfo({})
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.memberInfo = res.data
this.filteredData.resources_id = res.data.id
},
//()
loadMoreData() {
return //
//
if (!this.isReachedBottom) {
this.isReachedBottom = true;//
this.getList();
}
},
//
loadData() {
setTimeout(() => {
this.isReachedBottom = false; // 便
}, 1000);
},
//
async getList(){
this.loading = true
let data = {...this.filteredData}
//
if ((this.filteredData.page - 1) * this.filteredData.limit >= this.filteredData.total) {
this.loading = false
uni.showToast({
title: '暂无更多',
icon: 'none'
})
return
}
if(data.page == 1){
this.tableList = []
}
let res = await apiRoute.xy_personCourseScheduleGetMyCoach(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.tableList = this.tableList.concat(res.data.data); // 使 concat
console.log('列表',this.tableList)
this.filteredData.total = res.data.total
this.filteredData.page++
},
}
}
</script>
<style lang="less" scoped>
.main_box {
width: 100%;
height: 100%;
overflow: auto;
background: #292929;
}
.data_hint{
margin-top: 100rpx;
font-size: 30rpx;
text-align: center;
color: #fff;
}
.main_section{
width: 92%;
border-radius: 15rpx;
background-color: #404045;
margin: 20rpx auto;
padding: 30rpx;
color: #fff;
display: flex;
align-items: center;
.left{
display: flex;
flex-direction: column;
align-items: center;
.pic{
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
}
.right{
margin-left: 20rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
}
.title{
font-size: 32rpx;
}
.con{
color: #D7D7D7;
font-size: 26rpx;
margin-top: 20rpx;
}
.current-venue{
border-radius: 8rpx;
border: 2rpx #F59A23 solid;
width: 120rpx;
text-align: center;
color: #F59A23;
position: absolute;
top: 10%;
right: 3%;
}
</style>
Loading…
Cancel
Save