From a263e8a7e05c4ae576962eabe0d1033e112f80f6 Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Thu, 25 Jun 2026 00:03:30 +0800 Subject: [PATCH] feat: feishu alert --- src/api/rating/pk.js | 15 ++ src/api/rating/topicOperate.js | 21 ++- .../components/RecordCommentEdit.vue | 38 ++++- .../components/RecordCommentReplyList.vue | 160 ++++++++++++++++++ src/views/rating/topicCommentRecord/index.vue | 21 ++- 5 files changed, 245 insertions(+), 10 deletions(-) create mode 100644 src/views/rating/topicCommentRecord/components/RecordCommentReplyList.vue diff --git a/src/api/rating/pk.js b/src/api/rating/pk.js index 7ebd506..390784e 100644 --- a/src/api/rating/pk.js +++ b/src/api/rating/pk.js @@ -97,3 +97,18 @@ export function toggleEnable(data) { data, }) } + +/** + * 修改评论状态 + * @param {*} { id, enable: boolean } + * @param { enable: boolean } data 是否启用 + * @param { id: string } data 评论id + * @returns + */ +export function commentStatus(data) { + return request({ + url: 'management/api/rating/pk/comment/toggle', + method: 'post', + data, + }) +} diff --git a/src/api/rating/topicOperate.js b/src/api/rating/topicOperate.js index 2025815..56ec108 100644 --- a/src/api/rating/topicOperate.js +++ b/src/api/rating/topicOperate.js @@ -29,7 +29,7 @@ export function scoreRecordList(data) { /** * 评论记录 - * @param {*} { pageNo, pageSize, userId?, topicId?, itemId?, trueUser? } + * @param {*} { pageNo, pageSize, userId?, topicId?, itemId?, trueUser?, rootCommentId? } * @returns */ export function userCommentList(data) { @@ -42,7 +42,9 @@ export function userCommentList(data) { /** * 评论 - * @param {*} { topicId, itemId, comment, userId } + * @param {*} { topicId, itemId, comment, userId,parentCommentId, replyToCommentId, } + * @param { parentCommentId: string } data 评论回复必传 + * @param { replyToCommentId: string } data 回复必传 * @returns */ export function comment(data) { @@ -53,6 +55,21 @@ export function comment(data) { }) } +/** + * 修改评论状态 + * @param {*} { id, enable: boolean } + * @param { enable: boolean } data 是否启用 + * @param { id: string } data 评论id + * @returns + */ +export function commentStatus(data) { + return request({ + url: 'management/api/rating/topicItemOperate/comment/toggle', + method: 'post', + data, + }) +} + /** * 评论点赞 * @param {*} { commentId, userId } diff --git a/src/views/rating/topicCommentRecord/components/RecordCommentEdit.vue b/src/views/rating/topicCommentRecord/components/RecordCommentEdit.vue index 4a5f4ec..ed4f157 100644 --- a/src/views/rating/topicCommentRecord/components/RecordCommentEdit.vue +++ b/src/views/rating/topicCommentRecord/components/RecordCommentEdit.vue @@ -18,7 +18,7 @@ - + - + - + @@ -96,11 +96,15 @@ title: '立即评论', dialogFormVisible: false, saving: false, + isReply: false, + contentPlaceholder: '请输入您的评论文字', form: { userId: '', topicId: '', itemId: '', content: '', + parentCommentId: '', + replyToCommentId: '', }, rules: { userId: [{ required: true, trigger: 'change', message: '请选择用户' }], @@ -130,11 +134,31 @@ }, methods: { getThumbUrl, - showEdit() { - this.title = '立即评论' + showEdit(row = null, parentCommentId = null) { this.dialogFormVisible = true this.form = this.$options.data().form + if (row) { + this.isReply = true + this.title = '回复评论' + this.contentPlaceholder = `回复 @${row.user ? row.user.nickname : '未知用户'}:` + + this.form.parentCommentId = parentCommentId || row.id + this.form.replyToCommentId = row.id + + if (row.rating) { + this.form.topicId = row.rating.topicId || row.rating.topic?.id || row.topicId + this.form.itemId = row.rating.itemId || row.rating.item?.id || row.itemId + } else { + this.form.topicId = row.topicId + this.form.itemId = row.itemId + } + } else { + this.isReply = false + this.title = '立即评论' + this.contentPlaceholder = '请输入您的评论文字' + } + // 重置列表数据 this.userList = [] this.userQuery.pageNo = 1 @@ -151,7 +175,9 @@ // 初始化加载第一页数据 this.fetchUserList() - this.fetchTopicList() + if (!this.isReply) { + this.fetchTopicList() + } }, close() { this.$refs['form'].resetFields() diff --git a/src/views/rating/topicCommentRecord/components/RecordCommentReplyList.vue b/src/views/rating/topicCommentRecord/components/RecordCommentReplyList.vue new file mode 100644 index 0000000..61a00d3 --- /dev/null +++ b/src/views/rating/topicCommentRecord/components/RecordCommentReplyList.vue @@ -0,0 +1,160 @@ + + + + + diff --git a/src/views/rating/topicCommentRecord/index.vue b/src/views/rating/topicCommentRecord/index.vue index c6b2d11..7288a40 100644 --- a/src/views/rating/topicCommentRecord/index.vue +++ b/src/views/rating/topicCommentRecord/index.vue @@ -83,9 +83,11 @@ - + @@ -153,6 +155,7 @@ + @@ -166,10 +169,11 @@ import UserInfo from '@/components/UserInfo' import RecordCommentEdit from './components/RecordCommentEdit' import RecordCommentLikeEdit from './components/RecordCommentLikeEdit' + import RecordCommentReplyList from './components/RecordCommentReplyList' export default { name: 'RatingTopicCommentIndex', - components: { RecordCommentEdit, RecordCommentLikeEdit, UserInfo }, + components: { RecordCommentEdit, RecordCommentLikeEdit, RecordCommentReplyList, UserInfo }, directives: { loadmore: { bind(el, binding) { @@ -333,9 +337,22 @@ handleLike(row) { this.$refs['likeEdit'].showEdit(row) }, + handleReply(row) { + this.$refs['commentEdit'].showEdit(row) + }, + handleViewReplies(row) { + this.$refs['replyList'].show(row) + }, handleCommentNow() { this.$refs['commentEdit'].showEdit() }, + // 子组件触发的方法 + handleReplyFromList(row, parentCommentId) { + this.$refs['commentEdit'].showEdit(row, parentCommentId) + }, + handleLikeFromList(row) { + this.$refs['likeEdit'].showEdit(row) + }, handleSizeChange(val) { this.queryForm.pageSize = val this.fetchData()