fix(router): 修复首页未获取用户信息的问题
- 在路由守卫中增加判断,当进入 Home 页面时,如果用户已登录但未获取用户信息,则自动获取用户信息 - 优化了用户体验,确保用户在访问首页时能够及时加载个人相关数据
This commit is contained in:
@@ -35,6 +35,8 @@ router.beforeEach((to, from, next) => {
|
||||
//数据大屏进行的独立页面跳转
|
||||
let {query, hash} = to
|
||||
next({name: "数据大屏入口", query, hash})
|
||||
} else if (to.name == "Home" && user.token && !user.info?.id) {
|
||||
dispatch("getUserInfo").then(() => next())
|
||||
} else if (user.token) {
|
||||
to.name == "init" ? next({name: "Home"}) : next()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user