diff --git a/components/CommentSection/CommentSection.vue b/components/CommentSection/CommentSection.vue index 1da0843..7cf8222 100644 --- a/components/CommentSection/CommentSection.vue +++ b/components/CommentSection/CommentSection.vue @@ -446,11 +446,18 @@ const submitMainComment = async () => { try { sending.value = true; - await props.publishHandler({ + const res = await props.publishHandler({ content, mode: "comment", replyTarget: null, }); + if(res?.success === false) { + uni.showToast({ + title: res?.message || '发布失败', + icon: 'none' + }); + return; + } if (props.showSuccessToast) { uni.showToast({ title: props.mainSuccessText, icon: "none" }); } @@ -493,11 +500,18 @@ const submitReplyComment = async () => { try { sendingReply.value = true; - await props.publishHandler({ + const res = await props.publishHandler({ content, mode: "reply", replyTarget: replyTarget.value, }); + if(res?.success === false) { + uni.showToast({ + title: res?.message || '回复失败', + icon: 'none' + }); + return; + } if (props.showSuccessToast) { uni.showToast({ title: props.replySuccessText, icon: "none" }); } diff --git a/pages/rating/detail.vue b/pages/rating/detail.vue index 2a67be4..41a05b3 100644 --- a/pages/rating/detail.vue +++ b/pages/rating/detail.vue @@ -371,13 +371,19 @@ const handleSendComment = async (payload) => { try { isSendingComment.value = true; uni.showLoading({ title: '发送中...' }); - await publishTopicComment({ + const res = await publishTopicComment({ content: payload.content, mode: 'comment', replyTarget: null }); uni.hideLoading(); - + if(res?.success === false) { + uni.showToast({ + title: res?.message || '发送失败', + icon: 'none' + }); + return; + } handleCommentPublished({ mode: 'comment', content: payload.content,