From 6577a7ad7f2044bcfe75601e0360e9172a7d2380 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期六, 28 二月 2026 15:07:23 +0800
Subject: [PATCH] 提交
---
mini-program/pages/article-details/article-details.vue | 64 +++++++++++++++++++++++++++++---
1 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/mini-program/pages/article-details/article-details.vue b/mini-program/pages/article-details/article-details.vue
index b87b75a..f7eb10f 100644
--- a/mini-program/pages/article-details/article-details.vue
+++ b/mini-program/pages/article-details/article-details.vue
@@ -7,7 +7,7 @@
</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>
@@ -21,7 +21,7 @@
{{item.content}}
</view>
<view class="pl-item-info-list" v-if="item.multifileList && item.multifileList.length > 0">
- <view class="pl-item-info-list-image" v-for="(child, i) in item.multifileList" :key="i" @click="yulan(child.fileFullUrl, item.multifileList)">
+ <view class="pl-item-info-list-image" v-for="(child, i) in item.multifileList" :key="i" @click.stop="yulan(child.fileFullUrl, item.multifileList)">
<image :src="child.fileFullUrl" mode="widthFix"></image>
</view>
<view style="width: 132rpx; height: 0;"></view>
@@ -50,7 +50,7 @@
{{child.content}}
</view>
<view class="pl-item-info-list" v-if="child.multifileList && child.multifileList.length > 0">
- <view class="pl-item-info-list-image" v-for="(child1, i) in child.multifileList" :key="i">
+ <view class="pl-item-info-list-image" v-for="(child1, i) in child.multifileList" :key="i" @click.stop="yulan(child1.fileFullUrl, child.multifileList)">
<image :src="child1.fileFullUrl" mode="widthFix"></image>
</view>
<view style="width: 132rpx; height: 0;"></view>
@@ -71,7 +71,7 @@
</view>
</view>
</view>
- <view class="pl-more" v-if="item.childern.length > 0">灞曞紑2鏉″洖澶�</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>
@@ -124,13 +124,16 @@
</view>
</view>
</u-popup>
+ <Login ref="login" />
</view>
</template>
<script>
import { mapState } from 'vuex'
import { dateConversion } from '@/utils/utils.js'
+ import Login from '@/components/login/login.vue'
export default {
+ components: { Login },
computed: {
...mapState(['userInfo', 'token'])
},
@@ -142,6 +145,7 @@
info: null,
content: '',
commentList: [],
+ total: 0,
page: 1,
next: true,
value: '',
@@ -166,6 +170,10 @@
methods: {
// 鐐硅禐
dianzanpl(item) {
+ if (!this.userInfo) {
+ this.$refs.login.open()
+ return;
+ }
if (!item.zanStatus || item.zanStatus == 0) {
this.$u.api.zanCreate({
objId: item.id,
@@ -248,8 +256,42 @@
this.multifileList = []
this.show1 = false
},
+ // 灞曞紑璇勮
+ more(index) {
+ this.$u.api.findActivityReplyCommentDTOPage({
+ capacity: 10,
+ page: this.commentList[index].page,
+ model: {
+ type: 1,
+ commentId: this.commentList[index].id
+ }
+ }).then(res => {
+ if (res.code === 200) {
+ 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() {
+ if (!this.userInfo) {
+ this.$refs.login.open()
+ return;
+ }
if (!this.value && this.multifileList.length === 0) return uni.showToast({
title: '璇勮鍐呭涓嶈兘涓虹┖',
icon: 'none'
@@ -258,7 +300,7 @@
activityId: this.info.id,
content: this.value,
multifileList: this.multifileList,
- commentId: this.commentId,
+ // commentId: this.commentId,
replyId: this.item ? this.item.id : null
}).then(res => {
if (res.code === 200) {
@@ -268,7 +310,7 @@
if (this.commentId) {
this.commentList.forEach(item => {
if (item.id === this.commentId) {
- item.commentList.childern.unshift(res.data)
+ item.childern.unshift(res.data)
}
})
} else {
@@ -294,8 +336,10 @@
}
}).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)
@@ -311,6 +355,10 @@
})
},
shoucang(type) {
+ if (!this.userInfo) {
+ this.$refs.login.open()
+ return;
+ }
if (type === 1) {
this.$u.api.cancelbatch({
ids: this.info.id,
@@ -332,6 +380,10 @@
}
},
dianzan(type) {
+ if (!this.userInfo) {
+ this.$refs.login.open()
+ return;
+ }
if (type === 1) {
this.$u.api.zanCancel({
objId: this.info.id,
--
Gitblit v1.9.3