Fix(评论):[#4018]错误提示未显示

This commit is contained in:
lifizer
2025-07-17 17:18:41 +08:00
parent 443b929d84
commit a98d504ee9
3 changed files with 23 additions and 29 deletions
+21 -16
View File
@@ -35,6 +35,7 @@ http.interceptors.response.use(
},
(error) => {
console.log(error)
uni.hideLoading()
if (error.toString() == "Error: Network Error") {
console.log("————————");
console.log("发送请求失败", error);
@@ -96,7 +97,13 @@ function baseRequest(options) {
}
}
if (res.statusCode !== 200) {
return Promise.reject({msg: "请求失败", res, resData})
uni.hideLoading()
uni.showToast({
title: resData.msg,
icon: 'none',
duration: 3000
})
return Promise.reject({msg: "请求失败", res, resData})
}
if (resData.status === 401) {
const whiteApiList = [
@@ -120,23 +127,21 @@ function baseRequest(options) {
return Promise.reject({msg: '未登录', res, resData, toLogin: true})
}
}
if ([ 403].indexOf(resData.status) !== -1) {
handleLoginFailure();
return Promise.reject({msg: res.data.msg, res, resData, toLogin: true})
if ([403].indexOf(resData.status) !== -1) {
handleLoginFailure();
return Promise.reject({msg: res.data.msg, res, resData, toLogin: true})
} else if (resData.status === 200) {
return Promise.resolve(resData, res)
return Promise.resolve(resData, res)
} else {
// 埋点数据推送、获取店铺分享图片
if (url.indexOf('api/systemStats/push') < 0 && url.indexOf('api/hotelMain/shareImage') < 0) {
uni.showToast({
title: resData.msg,
icon: 'none',
duration: 3000,
success() {
}
})
}
return Promise.reject({msg: resData.msg, res, data})
// 埋点数据推送、获取店铺分享图片
if (url.indexOf('api/systemStats/push') < 0 && url.indexOf('api/hotelMain/shareImage') < 0) {
uni.showToast({
title: resData.msg,
icon: 'none',
duration: 3000
})
}
return Promise.reject({msg: resData.msg, res, data})
}
})
}