支付接口调整

This commit is contained in:
X1627315083
2024-03-28 15:11:57 +08:00
parent 214995bdfb
commit b1edfe567a
5 changed files with 26 additions and 14 deletions

View File

@@ -23,9 +23,19 @@ function WriteCookie(name) {
document.cookie = "expires=" + now.toUTCString() + ";Path=/";
// document.write("Setting Cookies : " + "name=" + cookievalue );
}
function clonAllCookie(){
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
}
}
export {
setCookie,
getCookie,
WriteCookie
WriteCookie,
clonAllCookie
}

View File

@@ -2,7 +2,7 @@ import axios from 'axios'
// import qs from 'qs'
// import message from '@/components/public/message/src'
import router from '@/router/index'
import {getCookie} from '@/tool/cookie'
import {getCookie,clonAllCookie} from '@/tool/cookie'
// import cookie from '@/tools/cookie.js'
axios.defaults.timeout = 60000; //响应时间
@@ -87,6 +87,7 @@ axios.interceptors.response.use((res) =>{
}, function(error) {
if(error?.response?.status === 401 && router.currentRoute._value.name != 'setIdentification'){//如果是记录浏览器页面就不跳转login
router.replace('/login')
clonAllCookie()
return Promise.reject()
}
let data_new = error?.response?.data