问题修复
This commit is contained in:
@@ -92,7 +92,6 @@ function commonsProcess(showLoading, httpReqCallback) {
|
||||
|
||||
return Promise.reject(bodyData); // 跳转到catch函数
|
||||
}
|
||||
|
||||
// http响应码不正确
|
||||
if (statusCode != 200 && statusCode != 204 && statusCode != 201) {
|
||||
isShowErrorToast = true;
|
||||
@@ -101,19 +100,25 @@ function commonsProcess(showLoading, httpReqCallback) {
|
||||
infoBox.showToast(data.message || "服务器异常");
|
||||
return Promise.reject(bodyData); // 跳转到catch函数
|
||||
}
|
||||
|
||||
// 构造请求成功的响应数据
|
||||
if (bodyData.code == 501) {
|
||||
return Promise.reject(bodyData); // 跳转到catch函数
|
||||
}
|
||||
if(data.code!==200){
|
||||
return Promise.reject(bodyData); // 跳转到catch函数
|
||||
}
|
||||
if (data.code == 200 && data.data === null) {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
return Promise.resolve(bodyData.data);
|
||||
})
|
||||
.catch((res) => {
|
||||
console.log('res', res);
|
||||
if (res.code == 401 || res.code == 501) {
|
||||
storageManage.token(null, true);
|
||||
infoBox.showErrorToast(res.message || "请登录").then(() => {
|
||||
infoBox.showErrorToast(res.message || res.msg || "请登录").then(() => {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/index",
|
||||
});
|
||||
@@ -122,16 +127,12 @@ function commonsProcess(showLoading, httpReqCallback) {
|
||||
}
|
||||
|
||||
if (res.status == 500) {
|
||||
infoBox.showErrorToast(res.message || "服务器异常").then(() => {});
|
||||
infoBox.showErrorToast(res.message ||res.msg || "服务器异常").then(() => {});
|
||||
}
|
||||
infoBox.showErrorToast(res.message||res.msg || "服务器异常").then(() => {});
|
||||
|
||||
reqFinishFunc(); // 请求完毕的动作
|
||||
|
||||
// 如果没有提示错误, 那么此处提示 异常。
|
||||
if (!isShowErrorToast) {
|
||||
infoBox.showErrorToast(`请求网络异常`);
|
||||
}
|
||||
|
||||
return Promise.reject(res);
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user