Commit ef88b594 authored by 罗林杰's avatar 罗林杰

修改评论删除

parent fdbfa0b2
......@@ -17,10 +17,7 @@
<div class="c-left">
<image :src="info.avatarUrl"></image>
</div>
<div class="c-right"
@touchstart="()=>handleTouchStart(info)"
@touchend="()=>handleTouchEnd(info)"
>
<div class="c-right" @click="()=>reply(info)">
<div class="c-name">
{{ info.memNickName }}
</div>
......@@ -37,6 +34,9 @@
<image @click="()=>praise(info)" :src="info.isLike == '0'? baseUrl+'/article/105.png': baseUrl+'/article/105-no.png'"></image>
{{ info.likeCount }}
</div>
<view v-if="articleInfo.createBy == userId || info.userId == userId" class="action-item">
<image @click="()=>handleLongPress(info)" :src=" baseUrl+'/article/commentDelete.png'"></image>
</view>
</div>
<view>
<view
......@@ -48,10 +48,7 @@
<image :src="children.avatarUrl"></image>
</view>
<view class="c-right"
@touchstart.stop="()=>handleTouchStart(children)"
@touchend="()=>handleTouchEnd(children)"
>
<view class="c-right" @click.stop="()=>reply(children)">
<view class="c-name">
{{ children.memNickName }}
<view style="color: #333; margin-top: 10rpx">
......@@ -73,6 +70,9 @@
<image @click="()=>praise(children)" :src="children.isLike == '0' ? baseUrl+'/article/105.png': baseUrl+'/article/105-no.png'"></image>
{{ children.likeCount }}
</view>
<view v-if="articleInfo.createBy == userId || children.userId == userId" class="action-item">
<image @click="()=>handleLongPress(children)" :src=" baseUrl+'/article/commentDelete.png'"></image>
</view>
</view>
</view>
</view>
......@@ -148,6 +148,7 @@ export default{
commentedUserId:null,
//上级评论ID
parentId:null,
userId:uni.getStorageSync('userInfo').businessId,
tipMsg: '',
isConfirm: false,
isRejectConfirm: false,
......@@ -400,34 +401,13 @@ export default{
}
})
},
handleTouchStart(item) {
// 清除之前的定时器
if (this.longPressTimeout !== null) clearTimeout(this.longPressTimeout);
// 设置新的定时器
this.longPressTimeout = setTimeout(() => {
this.reply(item); // 处理点击事件逻辑
}, 100); // 设置长按时间为1秒
this.longPressTimeout = setTimeout(() => {
this.handleLongPress(item); // 处理长按逻辑
}, 1000); // 设置长按时间为1秒
},
handleTouchEnd() {
// 清除定时器,因为手指离开屏幕即取消长按
if (this.longPressTimeout !== null) {
clearTimeout(this.longPressTimeout);
this.longPressTimeout = null;
}
},
handleLongPress(item) {
if (this.articleInfo.createBy == uni.getStorageSync('userInfo').businessId || item.userId == uni.getStorageSync('userInfo').businessId) {
this.longPressedItem = item;
this.deleteId = item.businessId;
this.deleteParentId = item.parentId;
this.tipMsg = '是否删除当前评论';
this.isDeleteConfirm = true;
this.$refs.elmDelete.showDialog();
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment