--fix bug 系统报错提示

This commit is contained in:
yuping
2023-03-24 03:50:10 +08:00
parent 0651540b69
commit 6337b811cd
2 changed files with 17 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
import {isRef, reactive, ref, toRefs, unref, watch, watchEffect} from "vue";
import {getCookieForName, throttle} from "@/api/method";
import JSONBigInt from "json-bigint";
import router from "@/router";
import {message} from "ant-design-vue";
const JSONBigIntStr = JSONBigInt({ storeAsString: true });
@@ -346,5 +348,18 @@ export async function request(_url, params) {
return res.text();
}).then(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);
});
}