diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 1a372be..3f18f16 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -492,6 +492,16 @@ router.beforeEach(async (to, _from, next) => { return } + // 根路径:检查公众端登录状态,已登录则跳转活动大厅,未登录则跳转公众端登录页 + if (to.path === "/") { + if (localStorage.getItem("public_token")) { + next({ path: "/p/activities", replace: true }) + } else { + next({ path: "/p/login", replace: true }) + } + return + } + const authStore = useAuthStore() const tenantCodeFromUrl = extractTenantCodeFromPath(to.path)