diff --git a/src/App.vue b/src/App.vue index f1c4b1d6..1a6dcc13 100644 --- a/src/App.vue +++ b/src/App.vue @@ -34,7 +34,7 @@ import {USER_PERMISSION, VALIDATE_TOKEN} from "@/api/apis"; const store = useStore(); const isLogin = ref(false); -console.log("版本3.3.1------------"); +console.log("版本3.3.2------------"); // 监听关闭浏览器 diff --git a/src/api/config.js b/src/api/config.js index dc624903..a8b7f4dd 100644 --- a/src/api/config.js +++ b/src/api/config.js @@ -9,6 +9,8 @@ import {message} from "ant-design-vue"; import axios from "axios"; import router from "@/router"; +import {REFRESH_TOKEN_API} from "@/api/ThirdApi"; +import {boeRequest} from "@/api/request"; // import { getCookie } from '../api/method' // const Qs = require("qs"); @@ -57,13 +59,15 @@ http.interceptors.response.use( return response; } if (code === 1000) { - (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? - router.push({path: 'login', query: { returnUrl: router.currentRoute.value.fullPath }}) : - (window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath)) + window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath) // TODO token过期后退出登录 清空当前用户标记 - 为了刷新页面使用 localStorage.removeItem('refreshPage') return Promise.reject(response); } + if (code === 1001) { + window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath) + return Promise.reject(response); + } show ? message.error(msg):message.error('系统接口数据异常,请联系管理员'); console.log("api %o", msg); return Promise.reject(response); diff --git a/src/api/confign.js b/src/api/confign.js index dcb886c6..58172cd6 100644 --- a/src/api/confign.js +++ b/src/api/confign.js @@ -49,7 +49,7 @@ http.interceptors.response.use( message.error('token过期请重新登陆'); } if (code === 1000) { - (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: 'login'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL) + window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath) return Promise.reject(response); } // show && message.error(msg); diff --git a/src/api/configz.js b/src/api/configz.js index 165fb064..89cdcd8d 100644 --- a/src/api/configz.js +++ b/src/api/configz.js @@ -51,7 +51,7 @@ http.interceptors.response.use( message.error('token过期请重新登陆'); } if (code === 1000) { - (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: 'login'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL) + window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath) return Promise.reject(response); } // show && message.error(msg); diff --git a/src/api/request.js b/src/api/request.js index 2efe7524..1d1e30f8 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -495,9 +495,7 @@ export async function request(_url, params) { return res; } if (res.code === 1000 || res.code === 1002) { - (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? - router.push({path: 'login', query: { returnUrl: router.currentRoute.value.fullPath }}) : - (window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath)) + window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath) localStorage.removeItem('refreshPage') return Promise.reject(res); }else if(res.code=== 1001){ diff --git a/src/components/NavTop.vue b/src/components/NavTop.vue index c6f27b51..345f6d7f 100644 --- a/src/components/NavTop.vue +++ b/src/components/NavTop.vue @@ -90,7 +90,7 @@ const logOut = async () => { store.replaceState(createStore({state: {openpages: []}}).state); localStorage.clear(); sessionStorage.clear(); - (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: '/login'}) : (window.location.href = window.location.protocol + process.env.VUE_APP_LOGIN_URL) + window.location.href = window.location.protocol + process.env.VUE_APP_LOGIN_URL };