fix: 修改独立窗口样式
This commit is contained in:
@@ -66,7 +66,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
loadStart()
|
||||
if (getAccessToken()) {
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
next({ path: '/dashboard' }) // 已登录时访问登录页,重定向到首页
|
||||
} else {
|
||||
// 获取所有字典
|
||||
const dictStore = useDictStoreWithOut()
|
||||
@@ -105,10 +105,22 @@ router.beforeEach(async (to, from, next) => {
|
||||
// 修复跳转时不带参数的问题
|
||||
const redirect = decodeURIComponent(redirectPath as string)
|
||||
const { paramsObject: query } = parseURL(redirect)
|
||||
const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect, query }
|
||||
|
||||
// 如果重定向路径是根路径或不存在的路径,改为首页
|
||||
const finalRedirect = (redirect === '/' || redirect === '/index') ? '/dashboard' : redirect
|
||||
console.log('Permission guard - first time setting user, redirecting to:', finalRedirect) // 调试日志
|
||||
const nextData = to.path === finalRedirect ? { ...to, replace: true } : { path: finalRedirect, query }
|
||||
next(nextData)
|
||||
} else {
|
||||
next()
|
||||
// 即使用户信息已设置,也要检查是否需要重定向到首页
|
||||
if (to.path === '/' || (to.path === '/login' && from.query.redirect)) {
|
||||
// 从登录页跳转过来,或者访问根路径,重定向到首页
|
||||
console.log('Permission guard - redirecting to dashboard from:', to.path) // 调试日志
|
||||
next({ path: '/dashboard', replace: true })
|
||||
} else {
|
||||
console.log('Permission guard - allowing navigation to:', to.path) // 调试日志
|
||||
next()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user