Browse Source

feat(coach): 教练端学员信息页面

- 添加学员信息展示功能,包括头像、姓名、年龄等
- 实现作业列表展示,支持动态加载
- 添加体测报告列表展示,支持分页加载
- 优化页面布局和样式
master
liutong 1 year ago
parent
commit
5128f00a81
  1. 320
      pages/coach/student/info.vue

320
pages/coach/student/info.vue

@ -9,63 +9,63 @@
<!--学员信息-->
<view class="user_section">
<view class="box">
<vie class="left">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
<view class="btn_box">
<view class="left">
<image class="pic" :src="$util.img(studentsInfo.header)"></image>
<view class="btn_box" v-if="checkExpireTime(studentsInfo.expire_time)">
<view class="btn">即将到期</view>
</view>
</vie>
<vie class="right">
<veiw class="item">
<view class="name">黄明明</view>
</view>
<view class="right">
<view class="item">
<view class="name">{{studentsInfo.name}}</view>
<view class="age">
13岁
{{studentsInfo.age}}岁
</view>
</veiw>
<view class="item">
<view class="title">家长姓名:黄大呢</view>
</view>
<!-- <view class="item">-->
<!-- <view class="title">家长姓名:黄大呢</view>-->
<!-- </view>-->
<view class="item">
<view class="title">家长电话:18888888888</view>
<view class="title">电话:{{studentsInfo.phone}}</view>
</view>
</vie>
</view>
</view>
</view>
<!--课程信息-->
<view class="course_section">
<view class="main">
<view class="course_box">
<view class="item">
<view class="title">篮球少儿课程</view>
</view>
<view class="item">
<image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
<view class="name">包子皮</view>
</view>
<view class="item">
<view class="content">截止时间:2020.05:25</view>
</view>
<view class="item">
<view class="content">已上课时:24</view>
<view class="content">剩余课时:24</view>
</view>
<view class="tag">
出勤高
</view>
<view class="btn">
延课一周
</view>
</view>
</view>
<view class="bg_box bg_top"></view>
<view class="bg_box bg_bottom"></view>
</view>
<!-- <view class="course_section">-->
<!-- <view class="main">-->
<!-- <view class="course_box">-->
<!-- <view class="item">-->
<!-- <view class="title">篮球少儿课程</view>-->
<!-- </view>-->
<!-- <view class="item">-->
<!-- <image class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>-->
<!-- <view class="name">{{studentsInfo.name}}</view>-->
<!-- </view>-->
<!-- <view class="item">-->
<!-- <view class="content">截止时间:{{studentsInfo.expire_time}}</view>-->
<!-- </view>-->
<!-- <view class="item">-->
<!-- <view class="content">已上课时:{{studentsInfo.have_study_time}}</view>-->
<!-- <view class="content">剩余课时:{{studentsInfo.end_study_time}}</view>-->
<!-- </view>-->
<!-- <view class="tag">-->
<!-- 出勤高-->
<!-- </view>-->
<!-- <view class="btn">-->
<!-- 延课一周-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="bg_box bg_top"></view>-->
<!-- <view class="bg_box bg_bottom"></view>-->
<!-- </view>-->
<view class="main_section">
@ -75,91 +75,48 @@
<view :class="['item', tabType=='2' ? 'select':'']" @click="tabChange(2)">体侧报告</view>
</view>
<!--作业列表-->
<view v-if="tabType=='1'" class="section_1">
<view class="ul">
<view class="li" @click="opebViewWorkDetails({id :1})">
<view class="li"
v-for="(v,k) in assignmentsList"
:key="k"
@click="opebViewWorkDetails(v)">
<view class="left">
<view class="title">篮球少儿课</view>
<view class="date">上课时间:2020.05.30 15:30 - 17:30</view>
<view class="title">{{v.courses_name}}</view>
<view class="date">上课时间:{{v.submit_time}}</view>
</view>
<view class="right">
<view v-if="Atype==1" class="btn" style="background-color: #29D3B4;">作业完成</view>
<view v-else class="btn" style="background-color: #E2E2E2;">作业未提交</view>
</view>
</view>
<view class="li" @click="opebViewWorkDetails({id :1})">
<view class="left">
<view class="title">篮球少儿课</view>
<view class="date">上课时间:2020.05.30 15:30 - 17:30</view>
</view>
<view class="right">
<view v-if="Atype==1" class="btn" style="background-color: #29D3B4;">作业完成</view>
<view v-else class="btn" style="background-color: #E2E2E2;">作业未提交</view>
</view>
</view>
<view class="li" @click="opebViewWorkDetails({id :1})">
<view class="left">
<view class="title">篮球少儿课</view>
<view class="date">上课时间:2020.05.30 15:30 - 17:30</view>
</view>
<view class="right">
<view v-if="Atype==2" class="btn" style="background-color: #29D3B4;">作业完成</view>
<view v-else class="btn" style="background-color: #E2E2E2;">作业未提交</view>
</view>
</view>
<view class="li" @click="opebViewWorkDetails({id :1})">
<view class="left">
<view class="title">篮球少儿课</view>
<view class="date">上课时间:2020.05.30 15:30 - 17:30</view>
</view>
<view class="right">
<view v-if="Atype==1" class="btn" style="background-color: #29D3B4;">作业完成</view>
<view v-else class="btn" style="background-color: #E2E2E2;">作业未提交</view>
<view v-if="v.status==1" class="btn" style="background-color: #e2e2e2;">作业未提交</view>
<view v-else-if="v.status==2" class="btn" style="background-color: #a4adb3;">待批改</view>
<view v-else-if="v.status==3" class="btn" style="background-color: #29d3b4;">作业已完成</view>
</view>
</view>
</view>
</view>
<!--评测报告-->
<view v-if="tabType=='2'" class="section_2">
<view class="ul">
<view class="li" @click="openViewPhysicalExamination({id:1})">
<view class="top">
<view class="title">综合评分:96</view>
<view class="hint">打败了99%学员</view>
</view>
<view class="bottom">测试时间:2020.05.30</view>
</view>
<view class="li" @click="openViewPhysicalExamination({id:1})">
<view class="top">
<view class="title">综合评分:96</view>
<view class="hint">打败了99%学员</view>
</view>
<view class="bottom">测试时间:2020.05.30</view>
</view>
<view class="li" @click="openViewPhysicalExamination({id:1})">
<view class="top">
<view class="title">综合评分:96</view>
<view class="hint">打败了99%学员</view>
</view>
<view class="bottom">测试时间:2020.05.30</view>
</view>
<view class="li" @click="openViewPhysicalExamination({id:1})">
<view class="top">
<view class="title">综合评分:96</view>
<view class="hint">打败了99%学员</view>
</view>
<view class="bottom">测试时间:2020.05.30</view>
</view>
<view class="li" @click="openViewPhysicalExamination({id:1})">
<scroll-view
class="ul"
scroll-y="true"
:lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData"
style="height: 65vh;"
>
<view
class="li"
v-for="(v,k) in surveyList"
:key="k" @click="openViewPhysicalExamination(v)"
>
<view class="top">
<view class="title">综合评分:96</view>
<view class="hint">打败了99%学员</view>
<view class="title">综合评分:{{v.score}}</view>
<!-- <view class="hint">打败了99%学员</view>-->
</view>
<view class="bottom">测试时间:2020.05.30</view>
<view class="bottom">测试时间:{{v.create_time}}</view>
</view>
</view>
</scroll-view>
</view>
@ -174,7 +131,7 @@
</template>
<script>
// import user from '@/api/user.js';
import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue"
@ -184,14 +141,137 @@ export default {
},
data() {
return {
formData:{},
tabType:'1',//1=班级成员,2=作业任务
Atype:1,//1=作业完成,2=作业未提交
students_id:'',//学生id
studentsInfo:{},// 学生详情
assignmentsList:[],// 作业列表
loading:false,//加载状态
lowerThreshold: 100,//距离底部多远触发
isReachedBottom: false,//防止重复加载|true=不可加载|false=可加载
//筛选条件
filteredData:{
page:1,//当前页码
limit:10,//每页返回数据条数
total:10,//数据总条数
students_id: '',//学员id
},
surveyList:[],//体测报告列表
}
},
onLoad() {
onLoad(options) {
this.students_id = options.students_id//学生id
this.filteredData.students_id = options.students_id//学生id
},
onShow(){
this.init()//初始化
},
methods: {
//初始化
async init(){
//获取学生详情
await this.getStudentsInfo()
this.getSurveyList()
},
//获取学生详情
async getStudentsInfo(){
let data = {
students_id:this.students_id
}
let res = await memberApi.jlStudentsInfo(data)
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.studentsInfo = res.data//学生信息
this.assignmentsList = res.data.assignments_list//作业列表
},
// 检查 expire_time 是否大于等于当前时间 5 天
checkExpireTime(expireTime = '') {
if (!expireTime) {
return false
}
const expireDate = new Date(expireTime);
const currentDate = new Date();
// 计算天数差
const timeDifference = expireDate - currentDate;
const daysDifference = timeDifference / (1000 * 60 * 60 * 24);
if (daysDifference >= 5) {
return true
} else {
return false
}
},
//加载更多(下一页)
loadMoreData() {
//判断是否加载
if (!this.isReachedBottom) {
this.isReachedBottom = true;//设置为不可请求状态
this.getSurveyList();
}
},
//重置为第一页
async resetFilteredData() {
this.isReachedBottom = false; // 重置状态,以便下次触发加载更多
this.filteredData.page = 1//当前页码
this.filteredData.limit = 10//每页返回数据条数
this.filteredData.total = 10//数据总条数
},
//获取学生评测报告列表
async getSurveyList(){
this.loading = true
let data = {...this.filteredData}
//判断是否还有数据
if(this.filteredData.page * this.filteredData.limit > this.filteredData.total){
this.loading = false
uni.showToast({
title: '暂无更多',
icon: 'none'
})
return
}
if(data.page == 1){
this.surveyList = []
}
//学员-体测列表
let res = await memberApi.surveyList(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.surveyList = this.surveyList.concat(res.data.list.data); // 使用 concat 方法 将新数据追加到数组中
console.log('列表',this.surveyList)
this.filteredData.total = res.data.list.total
this.filteredData.page++
},
//切换tab
tabChange(tabType) {
this.tabType = tabType
@ -476,8 +556,8 @@ export default {
.ul{
display: flex;
flex-direction: column;
gap: 12rpx;
.li{
margin-bottom: 12rpx;
padding: 30rpx 20rpx;
border: 1px solid #29D3B4;
border-radius: 18rpx;

Loading…
Cancel
Save