From 60c18631eee7032859b18cb7435c1de12e83d0ae Mon Sep 17 00:00:00 2001
From: YM <479443481@qq.com>
Date: 星期五, 17 五月 2024 16:21:12 +0800
Subject: [PATCH] 401

---
 src/views/login.vue       |    2 +-
 src/plugin/axios/index.ts |    2 +-
 src/router/index.ts       |   12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/plugin/axios/index.ts b/src/plugin/axios/index.ts
index 6ff4491..908ae59 100644
--- a/src/plugin/axios/index.ts
+++ b/src/plugin/axios/index.ts
@@ -34,7 +34,7 @@
   },
   (error) => {
     let msg = '璇锋眰鍙戠敓閿欒';
-    if (error.response && error.response.status == 401) {
+    if ((error.response && error.response.status == 401) || error.code == "ERR_NETWORK") {
       localStorage.clear()
       router.replace({
         path: '/login'
diff --git a/src/router/index.ts b/src/router/index.ts
index 3a6e220..4c1125e 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -7,11 +7,6 @@
   history: createWebHashHistory(import.meta.env.BASE_URL),
   routes: [
     {
-      path: '/login',
-      name: 'login',
-      component: Login
-    },
-    {
       path: '/',
       component: Layout,
       children: [
@@ -25,9 +20,14 @@
           path: '/dictionary',
           name: 'dictionary',
           meta: { auth: true },
-          component: () =>import('@/views/components/dictionary.vue')
+          component: () => import('@/views/components/dictionary.vue')
         }
       ]
+    },
+    {
+      path: '/login',
+      name: 'login',
+      component: Login
     }
   ]
 })
diff --git a/src/views/login.vue b/src/views/login.vue
index f602796..b69f592 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -69,7 +69,7 @@
             if (route.query.redirect) {
               router.push(route.query.redirect)
             } else {
-              router.push('/')
+              router.push('/home')
             }
           } else if (res.data.isError) {
             ElMessage.error(res.data.errorDescription)

--
Gitblit v1.9.1