|
@@ -318,6 +318,7 @@ Component({
|
|
|
Momentquery.equalTo('moment', this.data.objectId);
|
|
|
Momentquery.notEqualTo('isDeleted', true);
|
|
|
Momentquery.include('user');
|
|
|
+ Momentquery.include('comment');
|
|
|
Momentquery.include('comment.user');
|
|
|
|
|
|
// 按照创建时间升序排列(从旧到新)
|
|
@@ -330,9 +331,10 @@ Component({
|
|
|
comment.showdeletid = false;
|
|
|
return comment;
|
|
|
});
|
|
|
- console.log('评论', commentList);
|
|
|
+ const filteredCommentList = commentList.filter(item =>!item.comment || (item.comment&&!item.comment.isDeleted));
|
|
|
+ console.log('评论', filteredCommentList);
|
|
|
this.setData({
|
|
|
- commentList
|
|
|
+ commentList:filteredCommentList
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -459,6 +461,26 @@ Component({
|
|
|
this.setData({
|
|
|
bottomNavHeight,
|
|
|
});
|
|
|
+ },
|
|
|
+ //删除评论
|
|
|
+ async deletecomment(e){
|
|
|
+ const objectId = e.currentTarget.dataset.id
|
|
|
+ let Momentquery = new Parse.Query('AIMomentComment');
|
|
|
+ Momentquery.equalTo('company', company);
|
|
|
+ Momentquery.equalTo('objectId', objectId);
|
|
|
+ Momentquery.notEqualTo('isDeleted', true);
|
|
|
+ let d = await Momentquery.first();
|
|
|
+ d.set('isDeleted',true)
|
|
|
+ try {
|
|
|
+ let saveDate2 = await d .save();
|
|
|
+ console.log(saveDate2);
|
|
|
+ console.log("删除成功");
|
|
|
+ this.getComment()
|
|
|
+ } catch (error) {
|
|
|
+ console.error("保存数据时出现错误:", error);
|
|
|
+ }
|
|
|
+ console.log(objectId);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
})
|