优化翻译

This commit is contained in:
2026-03-19 14:43:08 +08:00
parent f63616e735
commit db0e420a8f
6 changed files with 113 additions and 33 deletions

View File

@@ -209,8 +209,23 @@ function handleLoginStatus(
userStore: ReturnType<typeof useUserStore>,
next: NavigationGuardNext
): boolean {
// 已登录或访问登录页或静态路由,直接放行
if (userStore.isLogin || to.path === RoutesAlias.Login || isStaticRoute(to.path)) {
// 已登录或访问登录页,直接放行
if (userStore.isLogin || to.path === RoutesAlias.Login) {
return true
}
// 未登录时访问根路径(首页),重定向到登录页
if (to.path === '/') {
userStore.logOut()
next({
name: 'Login',
query: { redirect: to.fullPath }
})
return false
}
// 其他静态路由(注册、忘记密码、错误页等)放行
if (isStaticRoute(to.path)) {
return true
}