Browse Source

feat(student): 添加学生端体测报告功能

- 新增体测报告列表和详情接口
- 实现学生首页体测数据展示- 添加体测数据列表和详情页面
master
liutong 1 year ago
parent
commit
8f4f042da4
  1. 16
      api/apiRoute.js
  2. 2
      pages/coach/student/physical_examination.vue
  3. 40
      pages/student/index/index.vue
  4. 164
      pages/student/index/physical_examination.vue

16
api/apiRoute.js

@ -462,6 +462,22 @@ export default {
}) })
}, },
//学生端-体测报告-列表
xy_physicalTest(data = {}) {
let url = '/xy/physicalTest'
return http.get(url, data).then(res => {
return res;
})
},
//学生端-体测报告-详情
xy_physicalTestInfo(data = {}) {
let url = '/xy/physicalTest/info'
return http.get(url, data).then(res => {
return res;
})
},

2
pages/coach/student/physical_examination.vue

@ -1,4 +1,4 @@
<!--体测数据--> <!--体测数据-详情页-->
<template> <template>
<view class="overall"> <view class="overall">
<view class="date">{{$util.formatToDateTime(surveyInfo.create_time,'Y-m-d')}}</view> <view class="date">{{$util.formatToDateTime(surveyInfo.create_time,'Y-m-d')}}</view>

40
pages/student/index/index.vue

@ -29,18 +29,18 @@
<view class="card-con-txt1"> <view class="card-con-txt1">
<view class="card-con-txt1-left"> <view class="card-con-txt1-left">
<image :src="$util.img('/uniapp_src/static/images/index/score.png')" class="overlay-image"></image> <image :src="$util.img('/uniapp_src/static/images/index/score.png')" class="overlay-image"></image>
<view class="card-con-txt1-left-txt top">{{memberIndexData.tx.score}}</view> <view class="card-con-txt1-left-txt top">{{physicalTestInfo.calculateChildHealthScore}}</view>
<view class="card-con-txt1-left-txt top1">综合评分</view> <view class="card-con-txt1-left-txt top1">综合评分</view>
</view> </view>
<view class="card-con-txt1-right"> <view class="card-con-txt1-right">
<view style="color: #AAAAAA;padding: 5rpx;">数据测评时间:{{$util.formatToDateTime(memberIndexData.tx.create_time,'Y-m-d')}}</view> <view style="color: #AAAAAA;padding: 5rpx;">数据测评时间:{{$util.formatToDateTime(physicalTestInfo.created_at,'Y-m-d')}}</view>
<view style="display: flex;justify-content: space-around;margin-top: 20rpx;"> <view style="display: flex;justify-content: space-around;margin-top: 20rpx;">
<view> <view>
<view style="font-size: 48rpx;color: #29d3b4;">{{memberIndexData.tx.height * 100}}</view> <view style="font-size: 48rpx;color: #29d3b4;">{{physicalTestInfo.height}}</view>
<view style="color: #AAAAAA;font-size: 30rpx;">身高(CM)</view> <view style="color: #AAAAAA;font-size: 30rpx;">身高(CM)</view>
</view> </view>
<view> <view>
<view style="font-size: 48rpx;color: #29d3b4;">{{memberIndexData.tx.weight}}</view> <view style="font-size: 48rpx;color: #29d3b4;">{{physicalTestInfo.weight}}</view>
<view style="color: #AAAAAA;font-size: 30rpx;">体重(KG)</view> <view style="color: #AAAAAA;font-size: 30rpx;">体重(KG)</view>
</view> </view>
</view> </view>
@ -170,6 +170,13 @@
}, },
thisPath:'',//当前页面的路径(默认'') thisPath:'',//当前页面的路径(默认'')
openPath:'',//正确的跳转路径(默认'') openPath:'',//正确的跳转路径(默认'')
physicalTestInfo:{
created_at:'',//测评时间
calculateChildHealthScore:'0',//综合评分
height:'0',//身高
weight:'0',//体重
},//体测报告详情
} }
}, },
onLoad() { onLoad() {
@ -186,11 +193,36 @@
//学生页面初始化 //学生页面初始化
async init(){ async init(){
await this.member_init() await this.member_init()
await this.getPhysicalTestList()
this.getMemberIndex() this.getMemberIndex()
this.getList() this.getList()
this.getJobAssignmentsInfo() this.getJobAssignmentsInfo()
}, },
//获取体测列表
async getPhysicalTestList(){
let params = {
page: 1,//当前页码
limit: 1,//每页返回数据条数
total: 1,//数据总条数
resource_id:this.member_info.id,//学生资源表id
}
let res = await apiRoute.xy_physicalTest(params)
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
}
console.log('tc',res.data)
let arr = res.data.data
if(arr.length){
this.physicalTestInfo = arr[0]
}
},
async openViewHome_COPY(){ async openViewHome_COPY(){

164
pages/student/index/physical_examination.vue

@ -1,4 +1,4 @@
<!--体测数据-详情--> <!--体测数据-列表详情-->
<template> <template>
<view class="overall"> <view class="overall">
@ -46,95 +46,95 @@
</template> </template>
<script> <script>
import memberApi from '@/api/member.js'; import apiRoute from '@/api/apiRoute.js';
export default { export default {
data() { data() {
return { return {
loading:false,//加载状态 loading: false,//加载状态
lowerThreshold: 100,//距离底部多远触发 lowerThreshold: 100,//距离底部多远触发
isReachedBottom: false,//防止重复加载|true=不可加载|false=可加载 isReachedBottom: false,//防止重复加载|true=不可加载|false=可加载
//筛选条件 //筛选条件
filteredData:{ filteredData: {
page:1,//当前页码 page: 1,//当前页码
limit:10,//每页返回数据条数 limit: 10,//每页返回数据条数
total:10,//数据总条数 total: 10,//数据总条数
students_id: '',//学员id students_id: '',//学员id
},
tableList:[],//表格数据
}
},
onLoad(options) {
this.filteredData.students_id = options.students_id//学员id
},
onShow(){
this.init()
},
methods: {
//初始化
async init(){
this.getList()
},
//加载更多(下一页)
loadMoreData() {
//判断是否加载
if (!this.isReachedBottom) {
this.isReachedBottom = true;//设置为不可请求状态
this.getList();
}
}, },
//重置为第一页
async resetFilteredData() {
this.isReachedBottom = false; // 重置状态,以便下次触发加载更多
this.filteredData.page = 1//当前页码 tableList: [],//表格数据
this.filteredData.limit = 10//每页返回数据条数 }
this.filteredData.total = 10//数据总条数 },
}, onLoad(options) {
this.filteredData.students_id = options.students_id//学员id
},
onShow() {
this.init()
},
methods: {
//初始化
async init() {
this.getList()
},
//获取-学员-体测列表 //加载更多(下一页)
async getList(){ loadMoreData() {
this.loading = true //判断是否加载
if (!this.isReachedBottom) {
this.isReachedBottom = true;//设置为不可请求状态
this.getList();
}
},
//重置为第一页
async resetFilteredData() {
this.isReachedBottom = false; // 重置状态,以便下次触发加载更多
let data = {...this.filteredData} this.filteredData.page = 1//当前页码
this.filteredData.limit = 10//每页返回数据条数
this.filteredData.total = 10//数据总条数
},
//判断是否还有数据 //获取-学员-体测列表
if ((this.filteredData.page - 1) * this.filteredData.limit >= this.filteredData.total) { async getList() {
this.loading = false this.loading = true
uni.showToast({
title: '暂无更多',
icon: 'none'
})
return
}
if(data.page == 1){ let data = {...this.filteredData}
this.tableList = []
}
//学员-体测列表 //判断是否还有数据
let res = await memberApi.surveyList(data) if ((this.filteredData.page - 1) * this.filteredData.limit >= this.filteredData.total) {
this.loading = false this.loading = false
this.isReachedBottom = false; uni.showToast({
if (res.code != 1){ title: '暂无更多',
uni.showToast({ icon: 'none'
title: res.msg, })
icon: 'none' return
}) }
return
} if (data.page == 1) {
this.tableList = []
this.tableList = this.tableList.concat(res.data.list.data); // 使用 concat 方法 将新数据追加到数组中 }
// console.log('列表',this.tableList) //学员-体测列表
this.filteredData.total = res.data.list.total let res = await apiRoute.surveyList(data)
this.filteredData.page++ 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.list.data); // 使用 concat 方法 将新数据追加到数组中
// console.log('列表',this.tableList)
this.filteredData.total = res.data.list.total
this.filteredData.page++
},
}
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

Loading…
Cancel
Save