diff --git a/open-isle-cli/src/components/CommentEditor.vue b/open-isle-cli/src/components/CommentEditor.vue index c0a9cb669..f47d3b67a 100644 --- a/open-isle-cli/src/components/CommentEditor.vue +++ b/open-isle-cli/src/components/CommentEditor.vue @@ -2,13 +2,24 @@
-
发布评论
+
+ + +
@@ -89,6 +110,14 @@ export default { font-size: 14px; cursor: pointer; } +.comment-submit.disabled { + background-color: var(--primary-color-disabled); + opacity: 0.5; + cursor: not-allowed; +} +.comment-submit.disabled:hover { + background-color: var(--primary-color-disabled); +} .comment-submit:hover { background-color: var(--primary-color-hover); } diff --git a/open-isle-cli/src/components/CommentItem.vue b/open-isle-cli/src/components/CommentItem.vue index 248b1dfd5..95642b9a9 100644 --- a/open-isle-cli/src/components/CommentItem.vue +++ b/open-isle-cli/src/components/CommentItem.vue @@ -40,7 +40,7 @@ - +
{{ comment.reply.length }}条回复
@@ -77,6 +77,7 @@ const CommentItem = { setup(props) { const showReplies = ref(false) const showEditor = ref(false) + const isWaitingForReply = ref(false) const toggleReplies = () => { showReplies.value = !showReplies.value } @@ -85,9 +86,11 @@ const CommentItem = { } const submitReply = async (text) => { if (!text.trim()) return + isWaitingForReply.value = true const token = getToken() if (!token) { toast.error('请先登录') + isWaitingForReply.value = false return } try { @@ -120,13 +123,15 @@ const CommentItem = { } } catch (e) { toast.error('回复失败') + } finally { + isWaitingForReply.value = false } } const copyCommentLink = () => { const link = `${location.origin}${location.pathname}#comment-${props.comment.id}` navigator.clipboard.writeText(link) } - return { showReplies, toggleReplies, showEditor, toggleEditor, submitReply, copyCommentLink, renderMarkdown } + return { showReplies, toggleReplies, showEditor, toggleEditor, submitReply, copyCommentLink, renderMarkdown, isWaitingForReply } } } CommentItem.components = { CommentItem, CommentEditor } diff --git a/open-isle-cli/src/views/PostPageView.vue b/open-isle-cli/src/views/PostPageView.vue index f3188a79a..f4a502cf5 100644 --- a/open-isle-cli/src/views/PostPageView.vue +++ b/open-isle-cli/src/views/PostPageView.vue @@ -65,7 +65,7 @@ - +
@@ -112,6 +112,7 @@ export default { const tags = ref([]) const comments = ref([]) const isWaitingFetchingPost = ref(false); + const isWaitingPostingComment = ref(false); const postTime = ref('') const postItems = ref([]) const mainContainer = ref(null) @@ -169,9 +170,11 @@ export default { const postComment = async (text) => { if (!text.trim()) return + isWaitingPostingComment.value = true const token = getToken() if (!token) { toast.error('请先登录') + isWaitingPostingComment.value = false return } try { @@ -188,6 +191,8 @@ export default { } } catch (e) { toast.error('评论失败') + } finally { + isWaitingPostingComment.value = false } } @@ -227,7 +232,8 @@ export default { onScroll: updateCurrentIndex, copyPostLink, renderMarkdown, - isWaitingFetchingPost + isWaitingFetchingPost, + isWaitingPostingComment } } }