From 47d56a8b0f22fb15a46b69dfd46fac23560ad2cd Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 12 五月 2026 09:07:49 +0800
Subject: [PATCH] 改bug
---
mini-program/pages/article-details/article-details.vue | 58 +++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 47 insertions(+), 11 deletions(-)
diff --git a/mini-program/pages/article-details/article-details.vue b/mini-program/pages/article-details/article-details.vue
index b0ec822..7d94abf 100644
--- a/mini-program/pages/article-details/article-details.vue
+++ b/mini-program/pages/article-details/article-details.vue
@@ -11,11 +11,11 @@
<view class="pl-wu" v-if="commentList.length === 0">
<image src="/static/images/default_nocomment@2x.png" mode="widthFix"></image>
</view>
- <view class="pl-item" v-for="(item, index) in commentList" :key="item.id" v-else>
+ <view class="pl-item" v-for="(item, index) in commentList" :key="item.id" v-else @longpress="openDele(item, index)">
<view class="pl-item-tx">
- <image :src="item.memberImgUrl" mode="widthFix"></image>
+ <image :src="item.memberImgUrl || '/static/icon/default.png'" mode="widthFix"></image>
</view>
- <view class="pl-item-info" @click.stop="openTwo(item.id, item)">
+ <view class="pl-item-info" @click.stop="openTwo(item.id, item, item.nikeName)">
<view class="pl-item-info-name">{{item.nikeName}}</view>
<view class="pl-item-info-content" v-if="item.content">
{{item.content}}
@@ -41,9 +41,9 @@
</view>
</view>
</view>
- <view class="pl-item" style="border: none;" v-for="(child, a) in item.childern" :key="child.id" >
+ <view class="pl-item" style="border: none;" v-for="(child, a) in item.childern" :key="child.id" @click.stop="openTwo(item.id, child, child.nikeName)" @longpress.stop="openDele(child, index, a)">
<view class="pl-item-tx">
- <image :src="child.memberImgUrl" mode="widthFix"></image>
+ <image :src="child.memberImgUrl || '/static/icon/default.png'" mode="widthFix"></image>
</view>
<view class="pl-item-info">
<view class="pl-item-info-name">{{child.nikeName}}</view>
@@ -61,7 +61,7 @@
<view class="pl-item-info-data">
<view class="pl-item-info-data-time">{{child.createDate}}</view>
<view class="pl-item-info-data-list">
- <view class="pl-item-info-data-list-item" @click.stop="openTwo(item.id, child)">
+ <view class="pl-item-info-data-list-item">
<image src="/static/icon/ic_reply2@2x.png" mode="widthFix"></image>
</view>
<view class="pl-item-info-data-list-item" @click.stop="dianzanpl(child)">
@@ -96,10 +96,10 @@
<view style="width: 100%; height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 鍒犻櫎璇勮 -->
- <u-popup :show="show" round="5" mode="bottom">
+ <u-popup :show="show" round="5" mode="bottom" @close="show = false">
<view class="dele">
<view class="dele-title">鍒犻櫎鎴戠殑璇勮</view>
- <view class="dele-item" style="color: #E4001D;">鍒犻櫎</view>
+ <view class="dele-item" style="color: #E4001D;" @click="deleOne">鍒犻櫎</view>
<view class="dele-item" @click="show = false">鍙栨秷</view>
</view>
</u-popup>
@@ -107,7 +107,7 @@
<u-popup :show="show1" round="5" mode="bottom" @close="closePush">
<view class="pus">
<view class="pus-content">
- <textarea placeholder="璇寸偣浠�涔堝惂锝�" v-model="value"></textarea>
+ <textarea :placeholder="nikeName ? `鍥炲${nikeName}鐨勮瘎璁篳 : '璇寸偣浠�涔堝惂锝�'" v-model="value"></textarea>
<view class="pus-content-list" v-if="multifileList.length > 0">
<view class="pus-content-list-item" v-for="(item, index) in multifileList" :key="index">
<view class="shanchu" @click.stop="deleImg(index)">
@@ -151,10 +151,14 @@
page: 1,
next: true,
value: '',
+ nikeName: '',
multifileList: [],
commentId: null,
- item: null
+ pl: null,
+ item: null,
+ one: null,
+ two: null
}
},
onLoad(option) {
@@ -170,6 +174,35 @@
}
},
methods: {
+ openDele(item, one, two) {
+ this.one = one
+ this.two = two
+ this.pl = item
+
+ if ((item.memberId === this.userInfo.id) && item.isdeleted !== 1) {
+ this.show = true
+ }
+ },
+ deleOne() {
+ this.$u.api.deleteComment(this.pl.id)
+ .then(res => {
+ if (res.code === 200) {
+ this.pl.content = '璇ヨ瘎璁哄凡琚師浣滆�呭垹闄�'
+ this.pl.isdeleted = 1
+ // if (this.one && !this.two) {
+ // this.commentList[this.one].content = '璇ヨ瘎璁哄凡琚師浣滆�呭垹闄�'
+ // this.commentList[this.one].isdeleted = 1
+ // } else if (this.one && this.two) {
+ // this.commentList[this.one].childern[this.two].content = '璇ヨ瘎璁哄凡琚師浣滆�呭垹闄�'
+ // this.commentList[this.one].childern[this.two].isdeleted = 1
+ // }
+ // this.one = null
+ // this.two = null
+ this.pl = null
+ this.show = false
+ }
+ })
+ },
// 鐐硅禐
dianzanpl(item) {
if (!this.userInfo) {
@@ -199,13 +232,14 @@
}
},
// 浜岀骇璇勮
- openTwo(commentId, item) {
+ openTwo(commentId, item, nikeName) {
if (!this.userInfo) {
this.$refs.login.open()
return;
}
this.item = item
this.commentId = commentId
+ this.nikeName = nikeName
this.show1 = true
},
// 鍒犻櫎鍥剧墖
@@ -258,6 +292,7 @@
closePush() {
this.item = null
this.commentId = null
+ this.nikeName = ''
this.value = ''
this.multifileList = []
this.show1 = false
@@ -666,6 +701,7 @@
height: 132rpx;
border-radius: 16rpx;
overflow: hidden;
+ margin-bottom: 15rpx;
image {
width: 100%;
}
--
Gitblit v1.9.3