Browse Source

feat(student): 学生端首页数据展示优化

- 添加体测信息和课程预告数据获取及展示
- 优化作业列表显示逻辑,仅展示有附件的作业- 调整页面样式,提升用户体验
master
liutong 1 year ago
parent
commit
3cfb842e2b
  1. 4
      components/AQ/AQTabber.vue
  2. 65
      pages/student/index/index.vue

4
components/AQ/AQTabber.vue

@ -44,7 +44,7 @@
}, },
created() { created() {
console.log(123) // console.log(123)
this.init() this.init()
}, },
@ -146,7 +146,7 @@
] ]
break; break;
} }
console.log(111,this.tabBar) // console.log(111,this.tabBar)
}, },
openView(e) { openView(e) {
console.log('点击跳转', e) console.log('点击跳转', e)

65
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="@/static/images/index/score.png" class="overlay-image"></image> <image src="@/static/images/index/score.png" class="overlay-image"></image>
<view class="card-con-txt1-left-txt top">90</view> <view class="card-con-txt1-left-txt top">{{memberIndexData.tx.score}}</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;">数据测评时间:2020.03.12</view> <view style="color: #AAAAAA;padding: 5rpx;">数据测评时间:{{$util.formatToDateTime(memberIndexData.tx.create_time,'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;">123</view> <view style="font-size: 48rpx;color: #29d3b4;">{{memberIndexData.tx.height * 100}}</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;">45</view> <view style="font-size: 48rpx;color: #29d3b4;">{{memberIndexData.tx.weight}}</view>
<view style="color: #AAAAAA;font-size: 30rpx;">体重(KG)</view> <view style="color: #AAAAAA;font-size: 30rpx;">体重(KG)</view>
</view> </view>
</view> </view>
@ -56,10 +56,10 @@
<view class="upcomin-classes-div-con-centre" <view class="upcomin-classes-div-con-centre"
style="width: 2rpx;height: 60rpx;background-color: #fff;margin-left: 25rpx;"></view> style="width: 2rpx;height: 60rpx;background-color: #fff;margin-left: 25rpx;"></view>
<view style="margin-left: 25rpx;"> <view style="margin-left: 25rpx;">
<view>5/28 周五 15:30 - 17:30</view> <view>{{$util.formatToDateTime(memberIndexData.kcyg.date_time,'m-d')}} {{memberIndexData.kcyg.weekday}} {{memberIndexData.kcyg.time_slot[0]}}-{{memberIndexData.kcyg.time_slot[1]}}</view>
<view>301室 篮球少儿课程</view> <view>{{memberIndexData.kcyg.address}} {{memberIndexData.kcyg.courses_name}}</view>
</view> </view>
<view class="upcomin-classes-div-con-right" @click="openViewWorkDetails({id:1})"> <view class="upcomin-classes-div-con-right" @click="openViewWorkDetails(memberIndexData.kcyg)">
详情 详情
</view> </view>
</view> </view>
@ -101,7 +101,7 @@
<view class="item" v-for="(v,k) in assignmentsList" :key="k" @click="openViewWorkDetails(v)"> <view class="item" v-for="(v,k) in assignmentsList" :key="k" @click="openViewWorkDetails(v)">
<view class="multi-line-ellipsis text-style" v-html="v.content_text"></view> <view class="multi-line-ellipsis text-style" v-html="v.content_text"></view>
<view style="width: 92%;margin: auto;border-radius: 15rpx;"> <view style="width: 92%;margin: auto;border-radius: 15rpx;" v-if="v.student_file">
<video v-if="v.student_file_type == 2" style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)"></video> <video v-if="v.student_file_type == 2" style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)"></video>
<image v-else style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)" mode="aspectFit"></image> <image v-else style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)" mode="aspectFit"></image>
</view> </view>
@ -139,10 +139,28 @@
member_info: [], member_info: [],
assignmentsList: [],//作业列表 assignmentsList: [],//作业列表
jobAssignmentsInfo: [],//待完成的作业 jobAssignmentsInfo: [],//待完成的作业
memberIndexData:{
tx:{//体测信息
height: '', // 身高(单位:米)
weight: '', // 体重(单位:公斤)
score: '', // 综合评分
create_time: '' // 体测时间
},
kcyg: { // 课程预告信息
id: '', // 课程ID
date_time: "", // 课程日期
time_slot: "", // 课程时间段
address: "", // 课程地点
courses_name: "", // 课程名称
date_md: "", // 课程日期(月/日格式)
weekday: "" // 课程星期
}
},//首页数据
} }
}, },
onLoad() { onLoad() {
this.member_init()
}, },
onShow(){ onShow(){
this.init() this.init()
@ -150,10 +168,30 @@
methods: { methods: {
//初始化 //初始化
async init(){ async init(){
this.member_init()
this.getMemberIndex()
this.getList() this.getList()
this.getJobAssignmentsInfo() this.getJobAssignmentsInfo()
}, },
async getMemberIndex(){
let res = await memberApi.memberIndex({})
if(res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
// console.log('首页',res)
if(res.data.kcyg.time_slot){
res.data.kcyg.time_slot = res.data.kcyg.time_slot.split(',');
}
this.memberIndexData = res.data
},
//获取作业列表 //获取作业列表
async getList(){ async getList(){
let data = { let data = {
@ -170,6 +208,7 @@
return return
} }
this.assignmentsList = res.data.data this.assignmentsList = res.data.data
// console.log('作业列表',this.assignmentsList)
}, },
//获取待提交的作业列表 //获取待提交的作业列表
@ -189,7 +228,7 @@
} }
this.jobAssignmentsInfo = res.data.data this.jobAssignmentsInfo = res.data.data
console.log('待提交的作业',this.jobAssignmentsInfo) // console.log('待提交的作业',this.jobAssignmentsInfo)
}, },
//获取学员信息 //获取学员信息
@ -226,7 +265,7 @@
try { try {
// 等待上传文件的返回结果 // 等待上传文件的返回结果
let uploadRes = await this.uploadFile(type) let uploadRes = await this.uploadFile(type)
console.log('上传结果', uploadRes) // console.log('上传结果', uploadRes)
// 检查上传结果 // 检查上传结果
if (!uploadRes.data.path) { if (!uploadRes.data.path) {
@ -279,7 +318,7 @@
// sizeType: ['compressed'], // sizeType: ['compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: async (res) => { success: async (res) => {
console.log('文件选择结果:', res); // 打印 res 检查是否有 tempFilePaths // console.log('文件选择结果:', res); // 打印 res 检查是否有 tempFilePaths
const tempFilePath = res.tempFilePath; // 直接获取视频文件路径 const tempFilePath = res.tempFilePath; // 直接获取视频文件路径
// console.log('上传的文件',tempFilePath) // console.log('上传的文件',tempFilePath)
@ -312,7 +351,7 @@
}, },
success: (e) => { success: (e) => {
let res = JSON.parse(e.data.replace(/\ufeff/g, "") || "{}") let res = JSON.parse(e.data.replace(/\ufeff/g, "") || "{}")
console.log('上传成功2', res) // console.log('上传成功2', res)
if (res.code == 1) { if (res.code == 1) {
resolve({ resolve({
code: 1, code: 1,

Loading…
Cancel
Save