Forráskód Böngészése

选择题判分路由 以及退出逻辑调整

dengshaobo 1 hete
szülő
commit
580e5225ef
3 módosított fájl, 20 hozzáadás és 15 törlés
  1. 6 1
      src/router/index.ts
  2. 1 1
      src/utils/request.ts
  3. 13 13
      src/views/layout/components/header.vue

+ 6 - 1
src/router/index.ts

@@ -11,9 +11,14 @@ const routes: Array<RouteRecordRaw> = [
   },
   {
     path: '/login',
+    name: '',
+    component: () => import('../views/login/login.vue')
+  },
+  {
+    path: '/logins',
     name: 'Login',
     component: () => import('../views/login/login_other.vue')
-  },
+  },//工作台三方跳转
   //主页面
   {
     path: '/main',

+ 1 - 1
src/utils/request.ts

@@ -44,7 +44,7 @@ service.interceptors.response.use(
         return response;
       }else if (res.code === 401) {
         // 跳转登录页
-        window.location.href = '/'
+        window.location.href = '/login'
       }else
       {
         return res

+ 13 - 13
src/views/layout/components/header.vue

@@ -157,20 +157,20 @@ const loginOutFn = async () => {
     localStorage.removeItem('userInfo')
     console.log("打印当前环境import.meta.env.MODE",import.meta.env.MODE);
     //增加环境判断 
-    if(import.meta.env.MODE == 'development') {
-      // window.location.href = 'http://localhost:8080'
-      router.push('/')
-    }
-    else if(import.meta.env.MODE == 'test')
-    {
-      window.location.href = 'https://index.k12100.net'
-    }
-    else if(import.meta.env.MODE == 'production')
-    {
-      window.location.href = 'https://www.k12100.com'
-    }
+    // if(import.meta.env.MODE == 'development') {
+    //   // window.location.href = 'http://localhost:8080'
+    //   router.push('/')
+    // }
+    // else if(import.meta.env.MODE == 'test')
+    // {
+    //   window.location.href = 'https://index.k12100.net'
+    // }
+    // else if(import.meta.env.MODE == 'production')
+    // {
+    //   window.location.href = 'https://www.k12100.com'
+    // }
     
-    // router.push('/login')
+    router.push('/login')
   }else {
     ElMessage.error(res.msg)
   }