| | |
| | | </view> |
| | | <view class="xian"></view> |
| | | <view class="pl"> |
| | | <view class="pl-title">评论 {{info.commentCount || 0}}</view> |
| | | <view class="pl-title">评论 {{total}}</view> |
| | | <view class="pl-wu" v-if="commentList.length === 0"> |
| | | <image src="/static/images/default_nocomment@2x.png" mode="widthFix"></image> |
| | | </view> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="pl-more" v-if="item.childern.length > 0" @click.stop="more(item)">展开{{item.replyCount - 1}}条回复</view> |
| | | <view class="pl-more" v-if="item.childern.length < item.replyCount" @click.stop="more(index)">展开{{item.replyCount - item.childern.length}}条回复</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | info: null, |
| | | content: '', |
| | | commentList: [], |
| | | total: 0, |
| | | page: 1, |
| | | next: true, |
| | | value: '', |
| | |
| | | this.show1 = false |
| | | }, |
| | | // 展开评论 |
| | | more(item) { |
| | | more(index) { |
| | | this.$u.api.findActivityReplyCommentDTOPage({ |
| | | capacity: 10, |
| | | page: 1, |
| | | page: this.commentList[index].page, |
| | | model: { |
| | | type: 1, |
| | | commentId: item.id |
| | | commentId: this.commentList[index].id |
| | | } |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | console.log(res) |
| | | this.commentList[index].page++ |
| | | this.commentList[index].childern = this.uniqueById([ |
| | | ...this.commentList[index].childern, |
| | | ...res.data.records |
| | | ]) |
| | | } |
| | | }) |
| | | }, |
| | | // 数组去重 |
| | | uniqueById(arr) { |
| | | const map = new Map(); |
| | | return arr.filter(item => { |
| | | if (!map.has(item.id)) { |
| | | map.set(item.id, true); |
| | | return true; |
| | | } |
| | | return false; |
| | | }); |
| | | }, |
| | | // 评论 |
| | | sendComment() { |
| | |
| | | } |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.total = res.data.total |
| | | res.data.records.forEach(item => { |
| | | item.createDate = dateConversion(item.createDate) |
| | | item.page = 1 |
| | | item.childern = [] |
| | | if (item.activityReplyCommentDTO) { |
| | | item.activityReplyCommentDTO.createDate = dateConversion(item.activityReplyCommentDTO.createDate) |