Browse Source

refactor(student): 优化学员首页跳转逻辑

- 添加 path_arr 对象,定义不同用户类型的首页路径
- 实现 openViewHome 方法,用于检测和重定向到正确的首页
- 在页面显示时调用 openViewHome,确保用户始终跳转到对应的首页
master
liutong 12 months ago
parent
commit
6cc1e5663b
  1. 39
      pages/student/index/index.vue

39
pages/student/index/index.vue

@ -157,13 +157,21 @@
weekday: "" // weekday: "" //
} }
},// },//
path_arr:{
'1':'/pages/coach/home/index',//
'2':'/pages/market/index/index',//
'3':'/pages/student/index/index',//
},
thisPath:'',//('')
openPath:'',//('')
} }
}, },
onLoad() { onLoad() {
}, },
onShow(){ onShow(){
this.init() this.openViewHome()//-
}, },
methods: { methods: {
// //
@ -174,6 +182,35 @@
this.getJobAssignmentsInfo() this.getJobAssignmentsInfo()
}, },
//-
async openViewHome(){
//
let pages = getCurrentPages();
//
this.thisPath = '/' + pages[0].route
//
let userType = String(uni.getStorageSync('userType'))
this.openPath = this.path_arr[userType]
if(this.thisPath != this.openPath){
//tabBar-
uni.setStorageSync('tabBerIndex', 0)
uni.navigateTo({
url: this.openPath
})
}else{
//
this.init()
}
console.log(123123123123,this.thisPath,userType,this.path_arr[userType])
},
async getMemberIndex(){ async getMemberIndex(){
let res = await memberApi.memberIndex({}) let res = await memberApi.memberIndex({})
if(res.code != 1){ if(res.code != 1){

Loading…
Cancel
Save