|
@@ -1,9 +1,12 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
|
+import { useUserStore } from '../../../store'
|
|
|
|
+import { createCircleReviewUpvote } from '../../../core/libs/requests'
|
|
import { thumbsUp } from '../../../core/libs/svgs'
|
|
import { thumbsUp } from '../../../core/libs/svgs'
|
|
import { Comment } from '../../../core/models/moment'
|
|
import { Comment } from '../../../core/models/moment'
|
|
import { dayjs } from 'wot-design-uni'
|
|
import { dayjs } from 'wot-design-uni'
|
|
|
|
+import { storeToRefs } from 'pinia'
|
|
|
|
|
|
-defineProps({
|
|
|
|
|
|
+const props = defineProps({
|
|
options: {
|
|
options: {
|
|
type: Object as PropType<Comment>,
|
|
type: Object as PropType<Comment>,
|
|
default: () => ({}),
|
|
default: () => ({}),
|
|
@@ -13,6 +16,19 @@ defineProps({
|
|
default: false,
|
|
default: false,
|
|
},
|
|
},
|
|
})
|
|
})
|
|
|
|
+const emits = defineEmits<{ upvote: [] }>()
|
|
|
|
+const userStore = useUserStore()
|
|
|
|
+const { userInfo } = storeToRefs(userStore)
|
|
|
|
+const handleUpvote = async () => {
|
|
|
|
+ const { code, msg } = await createCircleReviewUpvote({
|
|
|
|
+ circleId: props.options.circleId,
|
|
|
|
+ userId: userInfo.value.userId,
|
|
|
|
+ userName: userInfo.value.nickname,
|
|
|
|
+ reviewId: props.options.id,
|
|
|
|
+ })
|
|
|
|
+ code === 0 && uni.showToast({ title: '点赞成功', icon: 'none' })
|
|
|
|
+ emits('upvote')
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
<template>
|
|
<template>
|
|
<view class="grid grid-cols-[28px_1fr_28px] gap-2.5" :class="isChild ? 'ml-9' : ''">
|
|
<view class="grid grid-cols-[28px_1fr_28px] gap-2.5" :class="isChild ? 'ml-9' : ''">
|
|
@@ -38,7 +54,7 @@ defineProps({
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view class="col-start-3 row-start-1 flex flex-col items-center">
|
|
|
|
|
|
+ <view class="col-start-3 row-start-1 flex flex-col items-center" @click="handleUpvote">
|
|
<div class="w-[18px] h-[18px] relative">
|
|
<div class="w-[18px] h-[18px] relative">
|
|
<wd-img :src="thumbsUp" width="18" height="18"></wd-img>
|
|
<wd-img :src="thumbsUp" width="18" height="18"></wd-img>
|
|
</div>
|
|
</div>
|