mirror of
https://gitee.com/chu1204505056/vue-admin-beautiful.git
synced 2025-05-02 04:46:33 +08:00
fix content-type error
This commit is contained in:
parent
618a9983e3
commit
7dc7a0b904
@ -18,22 +18,6 @@ import { isArray } from "@/utils/validate";
|
|||||||
|
|
||||||
let loadingInstance;
|
let loadingInstance;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author chuzhixin 1204505056@qq.com (不想保留author可删除)
|
|
||||||
* @description 判断当前url是否需要加loading
|
|
||||||
* @param {*} config
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const needLoading = (config) => {
|
|
||||||
let status = false;
|
|
||||||
debounce.forEach((item) => {
|
|
||||||
if (Vue.prototype.$baseLodash.includes(config.url, item)) {
|
|
||||||
status = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return status;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author chuzhixin 1204505056@qq.com (不想保留author可删除)
|
* @author chuzhixin 1204505056@qq.com (不想保留author可删除)
|
||||||
* @description 处理code异常
|
* @description 处理code异常
|
||||||
@ -77,17 +61,14 @@ instance.interceptors.request.use(
|
|||||||
config.data,
|
config.data,
|
||||||
Vue.prototype.$baseLodash.identity
|
Vue.prototype.$baseLodash.identity
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
contentType === "application/x-www-form-urlencoded;charset=UTF-8" &&
|
config.data &&
|
||||||
config.data
|
config.headers["Content-Type"] ===
|
||||||
) {
|
"application/x-www-form-urlencoded;charset=UTF-8"
|
||||||
|
)
|
||||||
config.data = qs.stringify(config.data);
|
config.data = qs.stringify(config.data);
|
||||||
}
|
if (debounce.some((item) => config.url.includes(item)))
|
||||||
|
|
||||||
if (needLoading(config)) {
|
|
||||||
loadingInstance = Vue.prototype.$baseLoading();
|
loadingInstance = Vue.prototype.$baseLoading();
|
||||||
}
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
@ -99,7 +80,7 @@ instance.interceptors.response.use(
|
|||||||
(response) => {
|
(response) => {
|
||||||
if (loadingInstance) loadingInstance.close();
|
if (loadingInstance) loadingInstance.close();
|
||||||
|
|
||||||
const { status, data, config } = response;
|
const { data, config } = response;
|
||||||
const { code, msg } = data;
|
const { code, msg } = data;
|
||||||
// 操作正常Code数组
|
// 操作正常Code数组
|
||||||
const codeVerificationArray = isArray(successCode)
|
const codeVerificationArray = isArray(successCode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user