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
+1 -11
View File
@@ -225,14 +225,9 @@ export default {
page: 1, page: 1,
limit: 99999 limit: 99999
} }
uni.showLoading({
mask: true
})
getCommentList(params).then((res) => { getCommentList(params).then((res) => {
comment.children = res.data.records comment.children = res.data.records
comment.hasMoreChildren = false comment.hasMoreChildren = false
}).finally(() => {
uni.hideLoading()
}) })
}, },
commentInputChange(e) { commentInputChange(e) {
@@ -319,8 +314,6 @@ export default {
this.reply = '' this.reply = ''
this.currentComment = {} this.currentComment = {}
this.item.replyCount === null ? this.item.replyCount = 1 : this.item.replyCount++ this.item.replyCount === null ? this.item.replyCount = 1 : this.item.replyCount++
}).finally(() => {
uni.hideLoading()
}) })
}, },
init() { init() {
@@ -341,8 +334,6 @@ export default {
} }
getCommentList(params).then((res) => { getCommentList(params).then((res) => {
this.comments = res.data.records this.comments = res.data.records
}).finally(() => {
uni.hideLoading()
}) })
}, },
likeInfo() { likeInfo() {
@@ -350,9 +341,8 @@ export default {
mask: true mask: true
}) })
getHotelNewsZan(this.id).then((res) => { getHotelNewsZan(this.id).then((res) => {
getHotelNewsDetail(this.id).then(({ data }) => (this.item = data))
}).finally(() => {
uni.hideLoading() uni.hideLoading()
getHotelNewsDetail(this.id).then(({ data }) => (this.item = data))
}) })
} }
} }
+1 -2
View File
@@ -252,9 +252,8 @@ export default {
parentReplyId: this.currentComment.parentReplyId parentReplyId: this.currentComment.parentReplyId
} }
replyMessage(params).then(res => { replyMessage(params).then(res => {
this.fetchList()
}).finally(() => {
uni.hideLoading() uni.hideLoading()
this.fetchList()
}) })
}, },
/** /**
+8 -3
View File
@@ -35,6 +35,7 @@ http.interceptors.response.use(
}, },
(error) => { (error) => {
console.log(error) console.log(error)
uni.hideLoading()
if (error.toString() == "Error: Network Error") { if (error.toString() == "Error: Network Error") {
console.log("————————"); console.log("————————");
console.log("发送请求失败", error); console.log("发送请求失败", error);
@@ -96,6 +97,12 @@ function baseRequest(options) {
} }
} }
if (res.statusCode !== 200) { if (res.statusCode !== 200) {
uni.hideLoading()
uni.showToast({
title: resData.msg,
icon: 'none',
duration: 3000
})
return Promise.reject({msg: "请求失败", res, resData}) return Promise.reject({msg: "请求失败", res, resData})
} }
if (resData.status === 401) { if (resData.status === 401) {
@@ -131,9 +138,7 @@ function baseRequest(options) {
uni.showToast({ uni.showToast({
title: resData.msg, title: resData.msg,
icon: 'none', icon: 'none',
duration: 3000, duration: 3000
success() {
}
}) })
} }
return Promise.reject({msg: resData.msg, res, data}) return Promise.reject({msg: resData.msg, res, data})