Browse Source

refactor(student): 优化学生首页代码结构

- 移除了未使用的 memberIndexData 对象
- 删除了冗余的 getMemberIndex 方法
- 简化了页面初始化逻辑
master
liutong 1 year ago
parent
commit
db53cbe471
  1. 69
      pages/student/index/index.vue

69
pages/student/index/index.vue

@ -157,24 +157,6 @@
assignmentsList: [],//作业列表
jobAssignmentsInfo: [],//待完成的作业
memberIndexData:{
tx:{//体测信息
height: '', // 身高(单位:米)
weight: '', // 体重(单位:公斤)
score: '', // 综合评分
create_time: '' // 体测时间
},
kcyg: { // 课程预告信息
id: '', // 课程ID
date_time: "", // 课程日期
time_slot: "", // 课程时间段
address: "", // 课程地点
courses_name: "", // 课程名称
date_md: "", // 课程日期(月/日格式)
weekday: "" // 课程星期
}
},//首页数据
path_arr:{
'1':'/pages/coach/home/index',//教练
'2':'/pages/market/index/index',//销售
@ -205,7 +187,6 @@
await this.member_init()
await this.getPhysicalTestList()
await this.getPersonCourseScheduleList()
this.getMemberIndex()
this.getList()
this.getJobAssignmentsInfo()
},
@ -259,56 +240,6 @@
}
},
async openViewHome_COPY(){
//获取当前页面路径
let pages = getCurrentPages();
//当前页面路径
this.thisPath = '/' + pages[0].route
//获取缓存用户登陆类型
let userType = String(uni.getStorageSync('userType'))
this.openPath = this.path_arr[userType]
console.log(
'跳转',
this.thisPath,
userType,
this.path_arr[userType]
)
if(this.thisPath != this.openPath){
console.log('打印1')
//跳转tabBar首页-页面
uni.setStorageSync('tabBerIndex', 0)
uni.navigateTo({
url: this.openPath
})
return
}else{
//页面正确的情况下->执行学生页面初始化
this.init()
}
},
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(){
let data = {

Loading…
Cancel
Save