diff --git a/src/api/comment.js b/src/api/comment.js
index 97a300d81..568c30176 100644
--- a/src/api/comment.js
+++ b/src/api/comment.js
@@ -33,6 +33,14 @@ commentApi.delete = commentId => {
})
}
+commentApi.create = comment => {
+ return service({
+ url: baseUrl,
+ data: comment,
+ method: 'post'
+ })
+}
+
commentApi.commentStatus = {
PUBLISHED: {
color: 'green',
diff --git a/src/components/Tools/UserMenu.vue b/src/components/Tools/UserMenu.vue
index 0fb351d19..48271e6fc 100644
--- a/src/components/Tools/UserMenu.vue
+++ b/src/components/Tools/UserMenu.vue
@@ -36,7 +36,7 @@
-
+
通过
-
- 通过该评论
- 回复并通过
+
+
+ 通过
+
+
+ 通过并回复
+
回复
+
+
+
+
+ 回复
+
+
+
+
+
+
+
+
@@ -206,6 +240,7 @@ export default {
data() {
return {
columns,
+ replyCommentVisible: false,
pagination: {
current: 1,
pageSize: 10,
@@ -221,6 +256,8 @@ export default {
selectedRowKeys: [],
selectedRows: [],
comments: [],
+ selectComment: {},
+ replyComment: {},
commentsLoading: false,
commentStatus: commentApi.commentStatus
}
@@ -267,6 +304,25 @@ export default {
this.loadComments()
})
},
+ handleReplyAndPassClick(comment) {
+ this.handleReplyClick(comment)
+ this.handleEditStatusClick(comment.id, 'PUBLISHED')
+ },
+ handleReplyClick(comment) {
+ this.selectComment = comment
+ this.replyCommentVisible = true
+ this.replyComment.parentId = comment.id
+ this.replyComment.postId = comment.post.id
+ },
+ handleCreateClick() {
+ commentApi.create(this.replyComment).then(response => {
+ this.$message.success('回复成功!')
+ this.replyComment = {}
+ this.selectComment = {}
+ this.replyCommentVisible = false
+ this.loadComments()
+ })
+ },
handlePaginationChange(page, pageSize) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
this.pagination.current = page
@@ -277,6 +333,11 @@ export default {
this.queryParam.keyword = null
this.queryParam.status = null
this.loadComments()
+ },
+ onReplyClose() {
+ this.replyComment = {}
+ this.selectComment = {}
+ this.replyCommentVisible = false
}
}
}