From 3375029b1f14275a9c2f3f92c9a6f377f37e7f3c Mon Sep 17 00:00:00 2001 From: liangweihao <734499798@qq.com> Date: Mon, 21 Jul 2025 22:59:53 +0800 Subject: [PATCH] jump to dashboard --- frontend/src/router/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index f5aceab..efb7df7 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -75,9 +75,15 @@ router.beforeEach(async ( const title = to.meta.title as string document.title = `${title} - AI` + const authStore = useAuthStore() + // 用户已登录,重定向到dashboard + if (to.path === '/' && authStore.isLoggedIn) { + next({ name: 'Dashboard' }) + return + } + // 检查是否需要用户认证 if (to.meta.requiresAuth) { - const authStore = useAuthStore() if (!authStore.isLoggedIn) { next('/') return @@ -92,7 +98,7 @@ router.beforeEach(async ( } } - next('/dashboard') + next() }) export default router \ No newline at end of file