Browse Source

circle page

邹能昇 5 months ago
parent
commit
cdb17e3936

+ 24 - 2
nova-werun/components/circle-card/index.js

@@ -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);
         }
+
     }
 })

+ 2 - 0
nova-werun/components/circle-card/index.less

@@ -297,6 +297,7 @@
                 position: absolute;
                 top: -40rpx;
                 left: 50%;
+                z-index: 99;
             }
         }
     }
@@ -341,6 +342,7 @@
                 position: absolute;
                 bottom: -40rpx;
                 left: 50%;
+                z-index: 99;
             }
         }
     }

+ 3 - 3
nova-werun/components/circle-card/index.wxml

@@ -100,15 +100,15 @@
                 <span style="color: #072d79;">{{item.user.nickname}}</span>
                 :
                 <span>{{item.content}}</span>
-                <view wx:if="{{item.showdeletid}}" class="delete">删除</view>
+                <view wx:if="{{item.showdeletid}}" class="delete" bindtap="deletecomment" data-id="{{item.objectId}}">删除</view>
             </view>
-            <view class="{{item.showdeletid?'comment2':'comment'}}" wx:if="{{item.comment}}" bindtap="showpop" data-id="{{item.objectId}}">
+            <view class="{{item.showdeletid?'comment2':'comment'}}" wx:if="{{item.comment&&!item.comment.isDeleted}}" bindtap="showpop" data-id="{{item.objectId}}">
                 <span style="color: #072d79;">{{item.user.nickname}}</span>
                 回复
                 <span style="color: #072d79;">{{item.comment.user.nickname}}</span>
                 :
                 <span>{{item.content}}</span>
-                <view wx:if="{{item.showdeletid}}" class="delete">删除</view>
+                <view wx:if="{{item.showdeletid}}" class="delete" bindtap="deletecomment" data-id="{{item.objectId}}">删除</view>
             </view>
         </block>
 

File diff suppressed because it is too large
+ 0 - 0
nova-werun/components/circle-card/index.wxss


Some files were not shown because too many files changed in this diff