| | |
| | | <!-- 子评论区域 --> |
| | | <view class="sub-comment"> |
| | | <comment-sub-item |
| | | avatar="https://img.yzcdn.cn/vant/cat.jpeg" |
| | | nickname="图墙精选" |
| | | :isAuthor="true" |
| | | content="如果路线里全是常规景区,没一个特殊的点位..." |
| | | :images="urls2" |
| | | date="2天前" |
| | | v-for="(item, index) in child" |
| | | :avatar="item.picture" |
| | | :nickname="item.commentUserName" |
| | | :isAuthor="item.createBy === filmInfo.createBy" |
| | | :content="item.content" |
| | | :images="getImageList(item)" |
| | | :date="item.createTime" |
| | | address="湖北" |
| | | :likes="30" |
| | | :likes="item.likeCount" |
| | | @reply="emitReply" |
| | | :filmInfo="filmInfo" |
| | | /> |
| | | </view> |
| | | </view> |
| | |
| | | |
| | | <script setup lang="ts"> |
| | | import { ref, onMounted } from 'vue' |
| | | import { CommentDTO } from '@/types/index' |
| | | interface Props { |
| | | avatar: string |
| | | nickname: string |
| | |
| | | date: string |
| | | address: string |
| | | likes: number |
| | | child: CommentDTO[] |
| | | filmInfo: CommentDTO |
| | | } |
| | | |
| | | const props = defineProps<Props>() |
| | |
| | | (e: 'reply'): void |
| | | }>() |
| | | |
| | | const urls2 = ref<string[]>([ |
| | | 'https://img.yzcdn.cn/vant/cat.jpeg', |
| | | 'https://img.yzcdn.cn/vant/cat.jpeg', |
| | | 'https://img.yzcdn.cn/vant/cat.jpeg', |
| | | 'https://img.yzcdn.cn/vant/cat.jpeg', |
| | | 'https://img.yzcdn.cn/vant/cat.jpeg' |
| | | ]) |
| | | |
| | | const getImageList = (item: any): string[] => { |
| | | if (!item || !item.filmPictures || typeof item.filmPictures !== 'string') { |
| | | return []; |
| | | } |
| | | |
| | | try { |
| | | const pictures = JSON.parse(item.filmPictures); |
| | | return Array.isArray(pictures) ? pictures.map((p: any) => p.url) : []; |
| | | } catch (e) { |
| | | console.error('filmPictures JSON parse error:', e, item.filmPictures); |
| | | return []; |
| | | } |
| | | }; |
| | | |
| | | |
| | | const onReply = () => { |
| | | emit('reply') |
| | |
| | | align-items: flex-start; |
| | | |
| | | .comment-opeartor-heart-number { |
| | | width: 100%; |
| | | text-align: center; |
| | | font-size: 20rpx; |
| | | } |
| | |
| | | } |
| | | } |
| | | </style> |
| | | |