From f7e1556ed7f36be893eb2d1ea34e27393a8d9811 Mon Sep 17 00:00:00 2001 From: wuhongjian Date: Thu, 23 Jun 2022 14:52:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9token=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/public/index.html | 18 +++++++++--------- front/src/utils/request.js | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/front/public/index.html b/front/public/index.html index 3ccfd971..feceaf8f 100644 --- a/front/public/index.html +++ b/front/public/index.html @@ -2,7 +2,7 @@ * @Author: hisense.wuhongjian * @Date: 2022-03-29 16:45:25 * @LastEditors: hisense.wuhongjian - * @LastEditTime: 2022-06-22 18:46:16 + * @LastEditTime: 2022-06-23 14:37:03 * @Description: 告诉大家这是什么 --> @@ -33,10 +33,10 @@ // window.SITE_CONFIG['frontUrl'] = 'http://15.72.183.90:7008/document/#/devModelFile/'; // window.SITE_CONFIG['apiURL'] = 'http://15.72.183.90:8000/renren-admin'; // 包头 - window.SITE_CONFIG['backUrl'] = 'http://10.110.205.1:8001'; - window.SITE_CONFIG['previewUrl'] = 'http://10.110.205.1:8002/'; - window.SITE_CONFIG['frontUrl'] = 'http://10.110.205.1:8002/document/#/devModelFile/'; - window.SITE_CONFIG['apiURL'] = 'http://10.110.205.1:8000/renren-admin'; + // window.SITE_CONFIG['backUrl'] = 'http://10.110.205.1:8001'; + // window.SITE_CONFIG['previewUrl'] = 'http://10.110.205.1:8002/'; + // window.SITE_CONFIG['frontUrl'] = 'http://10.110.205.1:8002/document/#/devModelFile/'; + // window.SITE_CONFIG['apiURL'] = 'http://10.110.205.1:8000/renren-admin'; // 西海岸版本 // window.SITE_CONFIG['backUrl'] = 'http://10.134.135.9:9797'; @@ -49,10 +49,10 @@ // window.SITE_CONFIG['frontUrl'] = 'http://15.2.21.238:9796/document/#/devModelFile/'; // window.SITE_CONFIG['apiURL'] = 'http://15.2.21.238:8888/renren-admin'; // 穿透版本 - // window.SITE_CONFIG['backUrl'] = 'http://124.222.94.39:9797'; - // window.SITE_CONFIG['previewUrl'] = 'http://124.222.94.39:9796/'; - // window.SITE_CONFIG['frontUrl'] = 'http://124.222.94.39:9796/document/#/devModelFile/'; - // window.SITE_CONFIG['apiURL'] = 'http://124.222.94.39:8888/renren-admin'; + window.SITE_CONFIG['backUrl'] = 'http://124.222.94.39:9797'; + window.SITE_CONFIG['previewUrl'] = 'http://124.222.94.39:9796/'; + window.SITE_CONFIG['frontUrl'] = 'http://124.222.94.39:9796/document/#/devModelFile/'; + window.SITE_CONFIG['apiURL'] = 'http://124.222.94.39:8888/renren-admin'; diff --git a/front/src/utils/request.js b/front/src/utils/request.js index b9b36c15..ed1a4e87 100644 --- a/front/src/utils/request.js +++ b/front/src/utils/request.js @@ -90,6 +90,27 @@ instance.interceptors.response.use( console.log('接口返回', response) console.log('接口返回headers', response.headers) console.log('接口返回REDIRECT', response.headers.redirect) + if (response.headers.redirect === '/#/login') { + var keys = document.cookie.match(/[^ =;]+(?=\=)/g) + if (keys) { + for (var i = keys.length; i--; ) { + document.cookie = + keys[i] + '=0;path=/;expires=' + new Date(0).toUTCString() //清除当前域名下的,例如:m.kevis.com + document.cookie = + keys[i] + + '=0;path=/;domain=' + + document.domain + + ';expires=' + + new Date(0).toUTCString() //清除当前域名下的,例如 .m.kevis.com + document.cookie = + keys[i] + + '=0;path=/;domain=kevis.com;expires=' + + new Date(0).toUTCString() //清除一级域名下的或指定的,例如 .kevis.com + } + } + console.log('已清除') + location.reload() + } response['Access-Control-Expose-Headers'] = 'redirect' const { code, message } = response.data if (response.headers.token) {