dedsudiyu hace 2 meses
padre
commit
6ce8c1cbc0

+ 1 - 5
.env.development

@@ -55,10 +55,6 @@ VUE_APP_BASE_LOCAL_API = '172.16.0.65/api'
 # VUE_APP_BASE_LOCAL_API = '192.168.1.20:8080'
 
 
-# #################### 认证平台版本退出接口 ####################
-
-VUE_APP_OUT_URL = 'http://lab.zjznai.com/labapp/cas/logout/college'
-
 # #################### 认证平台版本退出接口-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

@@ -38,13 +38,9 @@ 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/college'
-
 # #################### 认证平台版本退出接口-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'
 
 
 

+ 2 - 10
src/router/index.js

@@ -20,15 +20,7 @@ import VideoSurveillance from '../views/videoSurveillance/index.vue';
 
 const router = [
     {
-      path: '/login',
-      component: ssoLogin,
-      name: 'ssoLogin',
-      meta: {
-         title: '实验室安全智能监测与控制系统',
-      },
-    },
-    {
-      path: '/adminLogin',
+      path: '/',
       component: login,
       name: 'login',
       meta: {
@@ -36,7 +28,7 @@ const router = [
       },
     },
     {
-      path: '/',
+      path: '/home',
       component: index,
       name: 'index',
       meta: {

+ 54 - 45
src/utils/request.js

@@ -69,39 +69,45 @@ serviceAxios.interceptors.response.use(res => {
         const code = res.data.code || 200;
         // 获取错误信息
         if(code == 5002){
-            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;
-                }
-            }).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: '/'
+                        })
+                    }
+                }).catch(() => {});
+            }
         }else if (code == 5005) {
-            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;
-                }
-            }).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: '/'
+                        })
+                    }
+                }).catch(() => {});
+            }
         }else if(code == 5007){
             return res.data
         }else if (code != 200) {
@@ -136,22 +142,25 @@ serviceAxios.interceptors.response.use(res => {
         }
         else if (message.includes("Request failed with status code")) {
             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;
-                    }
-                }).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: '/'
+                            })
+                        }
+                    }).catch(() => {});
+                }
             }else{
                 messageData = Message({
                     message: message,

+ 4 - 2
src/views/courtyardManage/courtyardHome.vue

@@ -518,9 +518,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(() => {
                 });

+ 15 - 2
src/views/login.vue

@@ -51,7 +51,7 @@
     import Cookies from "js-cookie";
     import { login,authInfo,getCodeImg,getConfigByType,configInfo,getInfo } from "@/api/login";
     import {Decrypt} from "@/utils/secret";
-    import { setToken } from '@/utils/auth'
+    import { setToken,getToken,removeToken } from '@/utils/auth'
 
     export default {
         name: "Login",
@@ -107,7 +107,20 @@
             }
         },
         created() {
-            this.getCode();
+            let self = this;
+            if(getToken()){
+                Promise.all([
+                    this.getExploitConfig(),
+                    this.getInfo(),
+                    this.fullScreen(),
+                ]).then((result)=>{
+                    setTimeout(function(){
+                        self.$router.push({path:'/home'});
+                    },300);
+                }).catch((error) => {})
+            }else{
+                this.getCode();
+            }
         },
         mounted(){
             this.configInfo();