dedsudiyu месяцев назад: 2
Родитель
Сommit
a572e05a5b
4 измененных файлов с 51 добавлено и 57 удалено
  1. 2 3
      .env.development
  2. 3 2
      .env.production
  3. 45 52
      src/utils/request.js
  4. 1 0
      src/views/index.vue

+ 2 - 3
.env.development

@@ -57,9 +57,8 @@ VUE_APP_BASE_LOCAL_API = '172.16.0.65/api'
 
 # #################### 认证平台版本退出接口 ####################
 
-VUE_APP_OUT_URL = 'http://192.168.1.43/labSystem/cas/logout/college'
+VUE_APP_OUT_URL = 'http://lab.zjznai.com/labapp/cas/logout/college'
 
 # #################### 认证平台版本退出接口-PC端 ####################
 
-VUE_APP_OUT_URL_PC = 'http://192.168.1.43/labSystem/auth/logout'
-
+VUE_APP_OUT_URL_PC = 'http://lab.zjznai.com/labapp/auth/cas/logout'

+ 3 - 2
.env.production

@@ -40,11 +40,12 @@ VUE_APP_BASE_LOCAL_API = '192.168.1.8/api'
 
 # #################### 认证平台版本退出接口 ####################
 
-VUE_APP_OUT_URL = 'http://192.168.1.43/labSystem/cas/logout/college'
+VUE_APP_OUT_URL = 'http://lab.zjznai.com/labapp/cas/logout/college'
 
 # #################### 认证平台版本退出接口-PC端 ####################
 
-VUE_APP_OUT_URL_PC = 'http://192.168.1.43/labSystem/auth/logout'
+VUE_APP_OUT_URL_PC = 'http://lab.zjznai.com/labapp/auth/cas/logout'
+
 
 
 

+ 45 - 52
src/utils/request.js

@@ -69,42 +69,37 @@ serviceAxios.interceptors.response.use(res => {
         const code = res.data.code || 200;
         // 获取错误信息
         if(code == 5002){
-            if(getToken()){
-                removeToken();
-                MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
-                        confirmButtonText: '确定',
-                        showCancelButton:false,
-                        closeOnClickModal:false,
-                        cancelButtonText: '取消',
-                        type: 'warning'
-                    }
-                ).then(() => {
-                    if(localStorage.getItem('entranceJumpType') == 'SCHOOL'){
-                        window.location.href = process.env.VUE_APP_OUT_URL;
-                    }else if(localStorage.getItem('entranceJumpType') == 'PC'){
-                        window.location.href = process.env.VUE_APP_OUT_URL_PC;
-                    }
-                }).catch(() => {});
-            }
+            removeToken();
+            MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
+                    confirmButtonText: '确定',
+                    showCancelButton:false,
+                    closeOnClickModal:false,
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }
+            ).then(() => {
+                if(localStorage.getItem('entranceJumpType') == 'SCHOOL'){
+                    window.location.href = process.env.VUE_APP_OUT_URL;
+                }else if(localStorage.getItem('entranceJumpType') == 'PC'){
+                    window.location.href = process.env.VUE_APP_OUT_URL_PC;
+                }
+            }).catch(() => {});
         }else if (code == 5005) {
-            if(getToken()){
-                //无权限
-                removeToken();
-                MessageBox.confirm('没有相关权限,请联系管理员', '系统提示', {
-                        confirmButtonText: '确定',
-                        showCancelButton:false,
-                        closeOnClickModal:false,
-                        cancelButtonText: '取消',
-                        type: 'warning'
-                    }
-                ).then(() => {
-                    if(localStorage.getItem('entranceJumpType') == 'SCHOOL'){
-                        window.location.href = process.env.VUE_APP_OUT_URL;
-                    }else if(localStorage.getItem('entranceJumpType') == 'PC'){
-                        window.location.href = process.env.VUE_APP_OUT_URL_PC;
-                    }
-                }).catch(() => {});
-            }
+            removeToken();
+            MessageBox.confirm('没有相关权限,请重新登录', '系统提示', {
+                    confirmButtonText: '确定',
+                    showCancelButton:false,
+                    closeOnClickModal:false,
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }
+            ).then(() => {
+                if(localStorage.getItem('entranceJumpType') == 'SCHOOL'){
+                    window.location.href = process.env.VUE_APP_OUT_URL;
+                }else if(localStorage.getItem('entranceJumpType') == 'PC'){
+                    window.location.href = process.env.VUE_APP_OUT_URL_PC;
+                }
+            }).catch(() => {});
         }else if(code == 5007){
             return res.data
         }else if (code != 200) {
@@ -139,23 +134,21 @@ serviceAxios.interceptors.response.use(res => {
         }
         else if (message.includes("Request failed with status code")) {
             if(message.substr(message.length - 3) == 401){
-                if(getToken()){
-                    removeToken();
-                    MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
-                            confirmButtonText: '确定',
-                            showCancelButton:false,
-                            closeOnClickModal:false,
-                            cancelButtonText: '取消',
-                            type: 'warning'
-                        }
-                    ).then(() => {
-                        if(localStorage.getItem('entranceJumpType') == 'SCHOOL'){
-                            window.location.href = process.env.VUE_APP_OUT_URL;
-                        }else if(localStorage.getItem('entranceJumpType') == 'PC'){
-                            window.location.href = process.env.VUE_APP_OUT_URL_PC;
-                        }
-                    }).catch(() => {});
-                }
+                removeToken();
+                MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
+                        confirmButtonText: '确定',
+                        showCancelButton:false,
+                        closeOnClickModal:false,
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }
+                ).then(() => {
+                    if(localStorage.getItem('entranceJumpType') == 'SCHOOL'){
+                        window.location.href = process.env.VUE_APP_OUT_URL;
+                    }else if(localStorage.getItem('entranceJumpType') == 'PC'){
+                        window.location.href = process.env.VUE_APP_OUT_URL_PC;
+                    }
+                }).catch(() => {});
             }else{
                 messageData = Message({
                     message: message,

+ 1 - 0
src/views/index.vue

@@ -17,6 +17,7 @@ import courtyardHome from "./courtyardManage/courtyardHome.vue";
       }
     },
     created () {
+
     },
     mounted () {
     },