1
This commit is contained in:
@@ -72,7 +72,7 @@ class Http {
|
||||
this.store.commit('user/setToken', '')
|
||||
}
|
||||
if (window.rootVue && window.rootVue.$router) {
|
||||
window.rootVue.$router.push({ name: 'login' })
|
||||
window.rootVue.$router.push({ path: '/login' }) // 使用 path 而不是 name
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
@@ -245,11 +245,12 @@ export default class uiTool {
|
||||
let curRoutes = uiTool.menuToRoute(menus, ParentView, Page404)
|
||||
|
||||
// 合并权限路由,保留默认 home 路由
|
||||
const homeRoute = mainRoute.children.find(r => r.name === 'home')
|
||||
const hasHome = curRoutes.some(r => r.name === 'home')
|
||||
const homeRoute = mainRoute.children.find(r => r.path === '/home')
|
||||
// 检查权限路由中是否有首页(基于 path 判断)
|
||||
const hasHome = curRoutes.some(r => r.path === '/home' || r.path === 'home')
|
||||
|
||||
if (hasHome) {
|
||||
// 如果权限路由中有 home,使用权限路由的 home
|
||||
// 如果权限路由中有 home,使用权限路由的 home(不添加默认首页)
|
||||
mainRoute.children = curRoutes
|
||||
} else {
|
||||
// 如果权限路由中没有 home,保留默认 home 并添加其他路由
|
||||
|
||||
Reference in New Issue
Block a user