dedsudiyu 2 月之前
父節點
當前提交
71fc11c64b
共有 6 個文件被更改,包括 48 次插入39 次删除
  1. 1 5
      .env.development
  2. 1 5
      .env.production
  3. 7 7
      src/router/index.js
  4. 19 17
      src/utils/request.js
  5. 4 2
      src/views/home.vue
  6. 16 3
      src/views/login.vue

+ 1 - 5
.env.development

@@ -71,11 +71,7 @@ VUE_APP_BASE_LOCAL_API = '172.16.0.65/api'
 # VUE_APP_BASE_LOCAL_API = '192.168.1.24:8080'
 
 
-# #################### 认证平台版本退出接口 ####################
-
-VUE_APP_OUT_URL = 'http://lab.zjznai.com/labapp/cas/logout/school'
-
 # #################### 认证平台版本退出接口-PC端 ####################
 
-VUE_APP_OUT_URL_PC = 'http://lab.zjznai.com/labapp/auth/cas/logout'
+VUE_APP_OUT_URL = 'https://labcontrol.nwafu.edu.cn/api/auth/cas/logout'
 

+ 1 - 5
.env.production

@@ -50,11 +50,7 @@ VUE_APP_BASE_LOCAL_API = '172.16.0.65/api'
 # VUE_APP_BASE_LOCAL_API = '192.168.1.24:8080'
 
 
-# #################### 认证平台版本退出接口 ####################
-
-VUE_APP_OUT_URL = 'https://labcontrol.nwafu.edu.cn/api/auth/cas/logout/school'
-
 # #################### 认证平台版本退出接口-PC端 ####################
 
-VUE_APP_OUT_URL_PC = 'https://labcontrol.nwafu.edu.cn/api/auth/cas/logout'
+VUE_APP_OUT_URL = 'https://labcontrol.nwafu.edu.cn/api/auth/cas/logout'
 

+ 7 - 7
src/router/index.js

@@ -3,18 +3,18 @@ import Router from 'vue-router'
 Vue.use(Router)
 // 公共路由
 export const constantRoutes = [
+  // {
+  //   path: '/login',
+  //   component: (resolve) => require(['@/views/ssoLogin'], resolve),
+  //   hidden: true
+  // },
   {
-    path: '/login',
-    component: (resolve) => require(['@/views/ssoLogin'], resolve),
-    hidden: true
-  },
-  {
-    path: '/',
+    path: '/home',
     component: (resolve) => require(['@/views/home'], resolve),
     hidden: true
   },
   {
-    path: '/adminLogin',
+    path: '/',
     component: (resolve) => require(['@/views/login'], resolve),
     hidden: true
   },

+ 19 - 17
src/utils/request.js

@@ -135,25 +135,27 @@ service.interceptors.response.use(res => {
       }
     }
     else if (message.includes("Request failed with status code")) {
-      console.log('message',message);
       if(message.substr(message.length - 3) == 401){
-        removeToken();
-        MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
-            confirmButtonText: '确定',
-            showCancelButton:false,
-            closeOnClickModal:false,
-            cancelButtonText: '取消',
-            type: 'warning'
-          }
-        ).then(() => {
+        if(getToken()){
           removeToken();
-          if(localStorage.getItem('entranceJumpType') == 'PC'){
-            window.location.href = process.env.VUE_APP_OUT_URL_PC;
-          }else{
-            window.location.href = process.env.VUE_APP_OUT_URL;
-          }
-          return
-        }).catch(() => {});
+          MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
+              confirmButtonText: '确定',
+              showCancelButton:false,
+              closeOnClickModal:false,
+              cancelButtonText: '取消',
+              type: 'warning'
+            }
+          ).then(() => {
+            if(localStorage.getItem('entranceJumpType') == 'PC'){
+              window.location.href = process.env.VUE_APP_OUT_URL;
+            }else{
+              router.replace({
+                path: '/'
+              })
+            }
+            return
+          }).catch(() => {});
+        }
       }else{
         messageData = Message({
           message: message,

+ 4 - 2
src/views/home.vue

@@ -72,9 +72,11 @@
         }).then(() => {
           removeToken();
           if(localStorage.getItem('entranceJumpType') == 'PC'){
-            window.location.href = process.env.VUE_APP_OUT_URL_PC;
-          }else{
             window.location.href = process.env.VUE_APP_OUT_URL;
+          }else{
+            router.replace({
+              path: '/'
+            })
           }
         }).catch(() => {});
       },

+ 16 - 3
src/views/login.vue

@@ -51,7 +51,7 @@
   import Cookies from "js-cookie";
   import { login,authInfo,getCodeImg,getConfigByType,configInfo} from "@/api/login";
   import {Decrypt} from "@/utils/secret";
-  import { setToken } from '@/utils/auth'
+  import { setToken,getToken,removeToken } from '@/utils/auth'
   export default {
     name: "Login",
     data() {
@@ -105,7 +105,19 @@
       }
     },
     created() {
-      this.getCode();
+      let self = this;
+      if(getToken()){
+        Promise.all([
+          this.getExploitConfig(),
+          this.fullScreen(),
+        ]).then((result)=>{
+          setTimeout(function(){
+            self.$router.push({path:'/home'});
+          },300);
+        }).catch((error) => {})
+      }else{
+        this.getCode();
+      }
     },
     mounted(){
       this.configInfo();
@@ -207,6 +219,7 @@
         });
       },
       login(userInfo){
+        localStorage.setItem('entranceJumpType','SCHOOL');
         let self = this;
         const account = userInfo.username.trim()
         const password = md5(userInfo.password);
@@ -231,7 +244,7 @@
                 this.fullScreen(),
               ]).then((result)=>{
                 setTimeout(function(){
-                  self.$router.push({path:'/'});
+                  self.$router.push({path:'/home'});
                 },300);
               }).catch((error) => {})
             }