Commit a11bd2b1 by heshihao

feat: 屏蔽接口警告

parent 06037f3d
......@@ -17,8 +17,6 @@ let baseURL2 = "https://zysf-store.oss-cn-beijing.aliyuncs.com";
let baseURL3 = url;
let baseURL4 = "http://39.100.39.50:8006";
export const baseURL5 = "https://touzi.cjwltzj.taiyuan.gov.cn/prod-api";
// 2.请求拦截器
service.interceptors.request.use(
(config) => {
......@@ -35,9 +33,9 @@ service.interceptors.request.use(
case "api4":
config.url = baseURL4 + config.url;
break;
case "api5":
config.url = baseURL5 + config.url;
break;
// case "api5":
// config.url = baseURL5 + config.url;
// break;
default:
config.url = baseURL + config.url;
}
......@@ -53,13 +51,13 @@ service.interceptors.request.use(
// config.params = { 'token': token } //如果要求携带在参数中
config.headers.token = token; //如果要求携带在请求头中
}
if (config.url == `${baseURL5}/common/upload`) {
config.headers = {
token: localStorage.getItem("token"),
"Content-Type": "multipart/form-data",
};
return config;
}
// if (config.url == `${baseURL5}/common/upload`) {
// config.headers = {
// token: localStorage.getItem("token"),
// "Content-Type": "multipart/form-data",
// };
// return config;
// }
return config;
},
(error) => {
......@@ -147,9 +145,13 @@ service.interceptors.response.use(
} else {
error.message = "连接服务器失败";
// 超时处理
/**
* 暂时屏蔽报错
*/
if (JSON.stringify(error).includes("timeout")) {
error.message = "服务器响应超时,请刷新当前页";
// Message.error('服务器响应超时,请刷新当前页')
return Promise.resolve(error.response);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment