From 715e9e12d8eaa4439110e224afaae7b3ddbd3e6d Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期四, 27 八月 2026 14:52:57 +0800
Subject: [PATCH] feat: 登录行为验证码(3D 立体图形按序点击)+ AppHeader 登出与上下布局 + 态势图构想记录(08-27 会话)
---
traffic-audit-web/src/router/index.js | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/traffic-audit-web/src/router/index.js b/traffic-audit-web/src/router/index.js
index 2540f38..0971ecf 100644
--- a/traffic-audit-web/src/router/index.js
+++ b/traffic-audit-web/src/router/index.js
@@ -3,7 +3,7 @@
Vue.use(Router)
-export default new Router({
+const router = new Router({
routes: [
{ path: '/', redirect: '/login' },
{ path: '/login', name: 'Login', component: () => import('@/views/Login.vue') },
@@ -17,3 +17,14 @@
{ path: '/users', name: 'UserManage', component: () => import('@/views/UserManage.vue') }
]
})
+
+router.beforeEach((to, from, next) => {
+ const token = localStorage.getItem('token')
+ if (to.path === '/login') {
+ next(token ? '/dashboard' : undefined)
+ } else {
+ next(token ? undefined : '/login')
+ }
+})
+
+export default router
--
Gitblit v1.9.1