mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 13:56:45 +08:00
--fix bug 系统报错提示
This commit is contained in:
@@ -51,9 +51,8 @@ http.interceptors.response.use(
|
|||||||
(response) => {
|
(response) => {
|
||||||
// console.log('response', response)
|
// console.log('response', response)
|
||||||
const {
|
const {
|
||||||
data: {code, msg, show},
|
data: {code, msg ,show},
|
||||||
} = response;
|
} = response;
|
||||||
console.log('code', code)
|
|
||||||
if (code === 0 || code === 200) {
|
if (code === 0 || code === 200) {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@@ -65,7 +64,7 @@ http.interceptors.response.use(
|
|||||||
localStorage.removeItem('refreshPage')
|
localStorage.removeItem('refreshPage')
|
||||||
return Promise.reject(response);
|
return Promise.reject(response);
|
||||||
}
|
}
|
||||||
show && message.error(msg);
|
show ? message.error(msg):message.error('系统接口数据异常,请联系管理员');
|
||||||
console.log("api %o", msg);
|
console.log("api %o", msg);
|
||||||
return Promise.reject(response);
|
return Promise.reject(response);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import {isRef, reactive, ref, toRefs, unref, watch, watchEffect} from "vue";
|
import {isRef, reactive, ref, toRefs, unref, watch, watchEffect} from "vue";
|
||||||
import {getCookieForName, throttle} from "@/api/method";
|
import {getCookieForName, throttle} from "@/api/method";
|
||||||
import JSONBigInt from "json-bigint";
|
import JSONBigInt from "json-bigint";
|
||||||
|
import router from "@/router";
|
||||||
|
import {message} from "ant-design-vue";
|
||||||
|
|
||||||
const JSONBigIntStr = JSONBigInt({ storeAsString: true });
|
const JSONBigIntStr = JSONBigInt({ storeAsString: true });
|
||||||
|
|
||||||
@@ -346,5 +348,18 @@ export async function request(_url, params) {
|
|||||||
return res.text();
|
return res.text();
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
return JSONBigIntStr.parse(res);
|
return JSONBigIntStr.parse(res);
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0 || res.code === 200) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
if (res.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))
|
||||||
|
localStorage.removeItem('refreshPage')
|
||||||
|
return Promise.reject(res);
|
||||||
|
}
|
||||||
|
res.show ? message.error(res.msg):message.error('系统接口数据异常,请联系管理员');
|
||||||
|
return Promise.reject(res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user