This commit is contained in:
xiaoshan
2023-12-19 12:04:04 +08:00
parent 0607e03b8e
commit b6cbbb2f7e
6 changed files with 902 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ const request = config => {
}
console.log(getToken());
// get请求映射params参数
console.log(config.params);
if (config.params) {
let url = config.url + '?' + tansParams(config.params)
url = url.slice(0, -1)
@@ -29,6 +30,7 @@ const request = config => {
header: config.header,
dataType: 'json'
}).then(response => {
console.log(response);
let [error, res] = response
if (error) {
toast('后端接口连接异常')
@@ -36,7 +38,7 @@ const request = config => {
return
}
const code = res.data.code || 200
const msg = errorCode[code] || res.data.msg || errorCode['default']
const msg = errorCode[code] || res.data.message || res.data.msg || errorCode['default']
if (code === 401 || code === 402) {
showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
if (res.confirm) {