请求500处理
This commit is contained in:
parent
a667473da1
commit
9ac12b7627
11
http/http.js
11
http/http.js
|
|
@ -73,6 +73,11 @@ function commonsProcess(showLoading, httpReqCallback,isreturm) {
|
|||
isShowErrorToast = true;
|
||||
return Promise.reject(bodyData); // 跳转到catch函数
|
||||
}
|
||||
if (bodyData.code == 500) {
|
||||
// 提示信息
|
||||
isShowErrorToast = true;
|
||||
return Promise.reject(bodyData); // 跳转到catch函数
|
||||
}
|
||||
if (bodyData.code != 0) {
|
||||
infoBox.showToast(data.message);
|
||||
return;
|
||||
|
|
@ -85,12 +90,12 @@ function commonsProcess(showLoading, httpReqCallback,isreturm) {
|
|||
code: bodyData.code,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 构造请求成功的响应数据
|
||||
return Promise.resolve(bodyData.data || bodyData.page|| bodyData);
|
||||
})
|
||||
.catch((res) => {
|
||||
|
||||
|
||||
if (res.status == 404) {
|
||||
infoBox.showErrorToast("接口404").then(() => {});
|
||||
reject();
|
||||
|
|
@ -110,7 +115,7 @@ function commonsProcess(showLoading, httpReqCallback,isreturm) {
|
|||
reject();
|
||||
}
|
||||
if (res.code == 500) {
|
||||
infoBox.showErrorToast(res.message || "服务器异常").then(() => {});
|
||||
infoBox.showErrorToast(res.msg || "服务器异常").then(() => {});
|
||||
reject();
|
||||
}
|
||||
reqFinishFunc(); // 请求完毕的动作
|
||||
|
|
|
|||
Loading…
Reference in New Issue