fix: pk comment
This commit is contained in:
@@ -5,6 +5,13 @@
|
||||
<view class="c-header">
|
||||
<view class="c-user-info">
|
||||
<text class="c-name">{{ localComment.name }}</text>
|
||||
<view
|
||||
v-if="localComment.choiceLabel"
|
||||
class="choice-tag"
|
||||
:class="localComment.choiceTone ? `choice-tag--${localComment.choiceTone}` : ''"
|
||||
>
|
||||
<text class="choice-tag-text">{{ localComment.choiceLabel }}</text>
|
||||
</view>
|
||||
<ActionBadge v-if="localComment.userAction" :action="localComment.userAction" />
|
||||
<view class="c-badge" v-if="localComment.badge">
|
||||
<text class="b-icon">{{ localComment.badgeIcon }}</text>
|
||||
@@ -89,6 +96,14 @@ const props = defineProps({
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({})
|
||||
},
|
||||
likeHandler: {
|
||||
type: Function,
|
||||
default: null
|
||||
},
|
||||
pageName: {
|
||||
type: String,
|
||||
default: 'rating_detail'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -115,6 +130,8 @@ const buildCommentState = (comment = {}) => ({
|
||||
...comment,
|
||||
likes: Number(comment.likes || 0),
|
||||
isLiked: !!comment.isLiked,
|
||||
choiceLabel: comment.choiceLabel || '',
|
||||
choiceTone: comment.choiceTone || '',
|
||||
replyCount: Number(comment.replyCount || 0),
|
||||
repliesLoading: !!comment.repliesLoading,
|
||||
repliesLoaded: !!comment.repliesLoaded,
|
||||
@@ -200,7 +217,8 @@ const handleLike = async (target = null) => {
|
||||
});
|
||||
|
||||
try {
|
||||
await topicItemCommentLike({ commentId: currentTarget.id });
|
||||
const likeRequest = props.likeHandler || topicItemCommentLike;
|
||||
await likeRequest({ commentId: currentTarget.id });
|
||||
uni.$trackRecord({
|
||||
eventName: 'like_comment',
|
||||
eventType: 'like',
|
||||
@@ -209,7 +227,7 @@ const handleLike = async (target = null) => {
|
||||
customParams: {
|
||||
comment: currentTarget.content,
|
||||
isReply: currentTarget.id !== localComment.value.id,
|
||||
page: 'rating_detail'
|
||||
page: props.pageName
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -303,6 +321,34 @@ const handleLike = async (target = null) => {
|
||||
.b-icon { font-size: 20rpx; margin-right: 6rpx; }
|
||||
.b-text { font-size: 20rpx; color: #666; font-weight: bold; }
|
||||
|
||||
.choice-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 42rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(79, 70, 229, 0.08);
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.choice-tag--left {
|
||||
background: rgba(92, 67, 245, 0.1);
|
||||
}
|
||||
|
||||
.choice-tag--right {
|
||||
background: rgba(255, 141, 95, 0.12);
|
||||
}
|
||||
|
||||
.choice-tag-text {
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
color: #4f46e5;
|
||||
}
|
||||
|
||||
.choice-tag--right .choice-tag-text {
|
||||
color: #ff7a45;
|
||||
}
|
||||
|
||||
.c-like {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user