From 791e70f228a6878d02d1b664588bdccf983b8811 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期一, 31 八月 2026 16:20:53 +0800
Subject: [PATCH] feat: 数据导入页重构——选择数据类型/模板下载并排/失败明细表格/导入进度抽屉侧栏

---
 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..6316dc6 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 = sessionStorage.getItem('token')
+  if (to.path === '/login') {
+    next(token ? '/dashboard' : undefined)
+  } else {
+    next(token ? undefined : '/login')
+  }
+})
+
+export default router

--
Gitblit v1.9.1