diff --git a/pagesInn/inn/innInfoDetail.vue b/pagesInn/inn/innInfoDetail.vue index 8685ca6..53dba69 100644 --- a/pagesInn/inn/innInfoDetail.vue +++ b/pagesInn/inn/innInfoDetail.vue @@ -225,14 +225,9 @@ export default { page: 1, limit: 99999 } - uni.showLoading({ - mask: true - }) getCommentList(params).then((res) => { comment.children = res.data.records comment.hasMoreChildren = false - }).finally(() => { - uni.hideLoading() }) }, commentInputChange(e) { @@ -319,8 +314,6 @@ export default { this.reply = '' this.currentComment = {} this.item.replyCount === null ? this.item.replyCount = 1 : this.item.replyCount++ - }).finally(() => { - uni.hideLoading() }) }, init() { @@ -341,8 +334,6 @@ export default { } getCommentList(params).then((res) => { this.comments = res.data.records - }).finally(() => { - uni.hideLoading() }) }, likeInfo() { @@ -350,9 +341,8 @@ export default { mask: true }) getHotelNewsZan(this.id).then((res) => { - getHotelNewsDetail(this.id).then(({ data }) => (this.item = data)) - }).finally(() => { uni.hideLoading() + getHotelNewsDetail(this.id).then(({ data }) => (this.item = data)) }) } } diff --git a/pkg_common/views/message.vue b/pkg_common/views/message.vue index 0e0c921..d4f2e1f 100644 --- a/pkg_common/views/message.vue +++ b/pkg_common/views/message.vue @@ -252,9 +252,8 @@ export default { parentReplyId: this.currentComment.parentReplyId } replyMessage(params).then(res => { - this.fetchList() - }).finally(() => { uni.hideLoading() + this.fetchList() }) }, /** diff --git a/utils/request.js b/utils/request.js index a06b77b..b0a9c8c 100644 --- a/utils/request.js +++ b/utils/request.js @@ -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}) } }) }