|
@@ -6,17 +6,35 @@ style:
|
|
|
<script setup lang="ts">
|
|
|
import SectionHeading from '@/components/section-heading.vue'
|
|
|
import Tag from '@/components/tag.vue'
|
|
|
-import { getCircle, getMoment } from '../../../core/libs/requests'
|
|
|
+import {
|
|
|
+ createCircleReview,
|
|
|
+ getCircle,
|
|
|
+ getCircleReviews,
|
|
|
+ getMoment,
|
|
|
+} from '../../../core/libs/requests'
|
|
|
import { thumbsUp } from '../../../core/libs/svgs'
|
|
|
import dayjs from 'dayjs'
|
|
|
import CommentItem from '../components/comment-item.vue'
|
|
|
import AvatarGroupCasual from '@/components/avatar-group-casual/avatar-group-casual.vue'
|
|
|
+import { useUserStore } from '../../../store'
|
|
|
+import { storeToRefs } from 'pinia'
|
|
|
|
|
|
+const userStore = useUserStore()
|
|
|
+const { userInfo } = storeToRefs(userStore)
|
|
|
const id = ref()
|
|
|
const { data, run } = useRequest(() => getCircle(id.value), { initialData: {} })
|
|
|
+const { data: reviews, run: runGetReviews } = useRequest(
|
|
|
+ () => getCircleReviews({ circleId: id.value }),
|
|
|
+ {
|
|
|
+ initialData: {
|
|
|
+ list: [],
|
|
|
+ },
|
|
|
+ },
|
|
|
+)
|
|
|
const current = ref(0)
|
|
|
const swiperSizes = ref()
|
|
|
const swiperStyle = ref()
|
|
|
+const reviewContent = ref('')
|
|
|
const handleChange = ({ detail: { current } }) => {
|
|
|
swiperStyle.value = {
|
|
|
height: swiperSizes.value[current].height + 'px',
|
|
@@ -31,10 +49,25 @@ const setSwiperStyle = async () => {
|
|
|
height: swiperSizes.value[0].height + 'px',
|
|
|
}
|
|
|
}
|
|
|
+const handleSend = async () => {
|
|
|
+ const { code, msg } = await createCircleReview({
|
|
|
+ circleId: id.value,
|
|
|
+ userId: userInfo.value.userId,
|
|
|
+ userName: userInfo.value.nickname,
|
|
|
+ reviewContent: reviewContent.value,
|
|
|
+ })
|
|
|
+ if (code !== 0) {
|
|
|
+ uni.showToast({ title: msg, icon: 'none' })
|
|
|
+ } else {
|
|
|
+ reviewContent.value = ''
|
|
|
+ uni.showToast({ title: '评论成功', icon: 'none' })
|
|
|
+ }
|
|
|
+}
|
|
|
onMounted(async () => {})
|
|
|
onLoad(async (query: { id: string }) => {
|
|
|
id.value = query.id
|
|
|
await run()
|
|
|
+ await runGetReviews()
|
|
|
await setSwiperStyle()
|
|
|
})
|
|
|
</script>
|
|
@@ -102,7 +135,7 @@ onLoad(async (query: { id: string }) => {
|
|
|
<!-- <span v-if="data?.comments">{{ data?.comments }}</span> -->
|
|
|
</div>
|
|
|
<view class="flex-1"></view>
|
|
|
- <!-- <view v-if="data?.comments" class="flex">
|
|
|
+ <view v-if="reviews?.list" class="flex">
|
|
|
<div class="text-black/90 text-xs font-normal font-['PingFang SC'] leading-[10.18px]">
|
|
|
按热度
|
|
|
</div>
|
|
@@ -114,12 +147,12 @@ onLoad(async (query: { id: string }) => {
|
|
|
<div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-[10.18px]">
|
|
|
按时间
|
|
|
</div>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
- <!-- <view>
|
|
|
- <template v-if="data?.commentList.length">
|
|
|
- <template v-for="it of data?.commentList" :key="it.id">
|
|
|
+ <view>
|
|
|
+ <template v-if="reviews?.list.length">
|
|
|
+ <template v-for="it of reviews?.list" :key="it.id">
|
|
|
<CommentItem :options="it" :isChild="false"></CommentItem>
|
|
|
<template v-for="child of it.childrens" :key="child.id">
|
|
|
<CommentItem :options="child" :isChild="true"></CommentItem>
|
|
@@ -138,13 +171,19 @@ onLoad(async (query: { id: string }) => {
|
|
|
</div>
|
|
|
</view>
|
|
|
</template>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<div
|
|
|
class="fixed bottom-0 left-0 right-0 border-t border-t-solid border-[#ececec] h-[54px] bg-white flex items-center px-3.5"
|
|
|
>
|
|
|
<div class="w-[168px] bg-[#f6f6f6] rounded-[60px] px-3.5 py-2 flex items-center">
|
|
|
- <wd-input custom-class="bg-transparent!" no-border></wd-input>
|
|
|
+ <wd-input
|
|
|
+ custom-class="bg-transparent!"
|
|
|
+ no-border
|
|
|
+ confirm-type="send"
|
|
|
+ v-model="reviewContent"
|
|
|
+ @confirm="handleSend"
|
|
|
+ ></wd-input>
|
|
|
</div>
|
|
|
<view class="flex justify-around flex-1">
|
|
|
<view
|