修改token失效问题

This commit is contained in:
wuhongjian 2022-06-23 14:52:50 +08:00
parent cd42aa29af
commit f7e1556ed7
2 changed files with 30 additions and 9 deletions

View File

@ -2,7 +2,7 @@
* @Author: hisense.wuhongjian * @Author: hisense.wuhongjian
* @Date: 2022-03-29 16:45:25 * @Date: 2022-03-29 16:45:25
* @LastEditors: hisense.wuhongjian * @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-06-22 18:46:16 * @LastEditTime: 2022-06-23 14:37:03
* @Description: 告诉大家这是什么 * @Description: 告诉大家这是什么
--> -->
<!DOCTYPE html> <!DOCTYPE html>
@ -33,10 +33,10 @@
// window.SITE_CONFIG['frontUrl'] = 'http://15.72.183.90:7008/document/#/devModelFile/'; // 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['apiURL'] = 'http://15.72.183.90:8000/renren-admin';
// 包头 // 包头
window.SITE_CONFIG['backUrl'] = 'http://10.110.205.1:8001'; // window.SITE_CONFIG['backUrl'] = 'http://10.110.205.1:8001';
window.SITE_CONFIG['previewUrl'] = 'http://10.110.205.1:8002/'; // 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['frontUrl'] = 'http://10.110.205.1:8002/document/#/devModelFile/';
window.SITE_CONFIG['apiURL'] = 'http://10.110.205.1:8000/renren-admin'; // window.SITE_CONFIG['apiURL'] = 'http://10.110.205.1:8000/renren-admin';
// 西海岸版本 // 西海岸版本
// window.SITE_CONFIG['backUrl'] = 'http://10.134.135.9:9797'; // 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['frontUrl'] = 'http://15.2.21.238:9796/document/#/devModelFile/';
// window.SITE_CONFIG['apiURL'] = 'http://15.2.21.238:8888/renren-admin'; // 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['backUrl'] = 'http://124.222.94.39:9797';
// window.SITE_CONFIG['previewUrl'] = 'http://124.222.94.39:9796/'; 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['frontUrl'] = 'http://124.222.94.39:9796/document/#/devModelFile/';
// window.SITE_CONFIG['apiURL'] = 'http://124.222.94.39:8888/renren-admin'; window.SITE_CONFIG['apiURL'] = 'http://124.222.94.39:8888/renren-admin';
</script> </script>
<link href="./leaflet/libs/leaflet/1.3.1/leaflet.css" rel="stylesheet"> <link href="./leaflet/libs/leaflet/1.3.1/leaflet.css" rel="stylesheet">

View File

@ -90,6 +90,27 @@ instance.interceptors.response.use(
console.log('接口返回', response) console.log('接口返回', response)
console.log('接口返回headers', response.headers) console.log('接口返回headers', response.headers)
console.log('接口返回REDIRECT', response.headers.redirect) 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' response['Access-Control-Expose-Headers'] = 'redirect'
const { code, message } = response.data const { code, message } = response.data
if (response.headers.token) { if (response.headers.token) {