diff --git a/api/topicItem.js b/api/topicItem.js index 6455182..617f6f6 100644 --- a/api/topicItem.js +++ b/api/topicItem.js @@ -18,6 +18,16 @@ export const topicItemComment = async (data) => { }); }; +// 评论点赞 +// data = { commentId: 'xxx' } +export const topicItemCommentLike = async (data) => { + return request({ + url: "/api/rating/topic/comment/item/like", + method: "POST", + data, + }); +}; + // 获取评论列表 export const topicItemCommentList = async (topicId, itemId, page = 1) => { return request({ diff --git a/components/CommentItem/CommentItem.vue b/components/CommentItem/CommentItem.vue index 6221b53..510afb5 100644 --- a/components/CommentItem/CommentItem.vue +++ b/components/CommentItem/CommentItem.vue @@ -26,6 +26,7 @@ diff --git a/pages/rating/detail.vue b/pages/rating/detail.vue index 158b726..dd4b20d 100644 --- a/pages/rating/detail.vue +++ b/pages/rating/detail.vue @@ -220,6 +220,7 @@ const getCommentsData = async () => { time: formatDate(item.createdAt) || '刚刚', // 如果后端返回了时间字段可以替换 content: item.content, likes: item.likeCount || 0, + isLiked: item.isLiked || false, badge: '', // 预留徽章字段 badgeIcon: '', userAction: item.userAction || "" // 夯/顶级/人上人/NPC/拉