邹能昇 4 meses atrás
pai
commit
615ea17b46

+ 37 - 13
nova-werun/components/circle-card/index.js

@@ -8,7 +8,7 @@ Component({
     properties: {
         objectId: '',
         type: '',
-        permission:''
+        permission: ''
     },
 
     /**
@@ -209,13 +209,13 @@ Component({
             AIMomentCommentquery2.equalTo('user', currentUser.id);
             let moment2 = await AIMomentCommentquery2.find()
             let AIMoment1List2 = moment2.map(item => item.toJSON());
-            if(AIMoment1List2.length!=0){
+            if (AIMoment1List2.length != 0) {
                 this.setData({
-                    isclick:AIMoment1List2[0].isDeleted
+                    isclick: AIMoment1List2[0].isDeleted
                 })
-            }else{
+            } else {
                 this.setData({
-                    isclick:true
+                    isclick: true
                 })
             }
             console.log('isclick', AIMoment1List2);
@@ -338,10 +338,10 @@ Component({
                 comment.showdeletid = false;
                 return comment;
             });
-            const filteredCommentList = commentList.filter(item =>!item.comment || (item.comment&&!item.comment.isDeleted));
+            const filteredCommentList = commentList.filter(item => !item.comment || (item.comment && !item.comment.isDeleted));
             console.log('评论', filteredCommentList);
             this.setData({
-                commentList:filteredCommentList
+                commentList: filteredCommentList
             });
         },
 
@@ -380,10 +380,10 @@ Component({
                             ...comment,
                             showdeletid: true // 更新当前评论项
                         };
-                        
+
                     }
                     return comment; // 保持其他评论项不变
-                   
+
                 });
                 this.setData({
                     commentList: updatedCommentList // 更新 commentList 的状态
@@ -470,16 +470,16 @@ Component({
             });
         },
         //删除评论
-      async  deletecomment(e){
+        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)
+            d.set('isDeleted', true)
             try {
-                let saveDate2 = await d .save();
+                let saveDate2 = await d.save();
                 console.log(saveDate2);
                 console.log("删除成功");
                 this.getComment()
@@ -487,7 +487,31 @@ Component({
                 console.error("保存数据时出现错误:", error);
             }
             console.log(objectId);
-        }
+        },
+        //删除动态
+        async deletecircle() {
+            let Profilequery = new Parse.Query('AIMoment');
+            Profilequery.equalTo('company', company);
+            Profilequery.equalTo('isVisible', true);
+            Profilequery.notEqualTo('isDeleted', true)
+            Profilequery.equalTo('objectId', this.data.objectId);
+
+            let P = await Profilequery.first();
+
+            P.set('isDeleted', true)
+            try {
+                let saveDate2 = await P.save();
+                console.log(saveDate2);
+                this.setData({
+                    objectId: ''
+                })
+                console.log("删除数据成功");
+            } catch (error) {
+                console.error("保存数据时出现错误:", error);
+            }
+
+
+        },
 
     }
 })

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

@@ -1,5 +1,5 @@
 <!--nova-werun/components/circle-card/index.wxml-->
-<view class="trends-one" bindtouchstart="onTouchStart">
+<view class="trends-one" bindtouchstart="onTouchStart" wx:if="{{objectId}}">
     <!-- 详细-->
     <view wx:if="{{type=='detail'}}" class="namebax">
         <image src="{{cicleList[0].profile.user.avatar}}"></image>
@@ -52,7 +52,7 @@
     <view class="timebox">
         <view class="time-box">
             <view class="time">{{time}}</view>
-            <van-icon wx:if="{{ permission=='delete'}}" name="delete-o" size='20' />
+            <van-icon wx:if="{{ permission=='delete'}}"  color='#1a1abd' bind:click='deletecircle' name="delete-o" size='20' />
         </view>
         <!-- 点赞评论 -->
         <view class="functionbox" wx:if="{{isgood}}">

+ 28 - 27
nova-werun/pages/my-circle/index.js

@@ -30,7 +30,7 @@ Page({
         const custom = wx.getMenuButtonBoundingClientRect();
         const customHeight = custom.height + 10 + 2 || 0;
         const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-        const contentHeight = (screenHeight - 50 - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
+        const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
         this.setData({
             statusBarHeight,
             screenHeight,
@@ -90,30 +90,31 @@ Page({
     onShareAppMessage: function () {
 
     },
-            //查全部朋友圈
-            async getcircle() {
-                const currentUser = Parse.User.current();
-                let Profilequery2 = new Parse.Query('Profile');
-                Profilequery2.equalTo('company', company);
-                Profilequery2.equalTo('user', currentUser.id);
-                Profilequery2.equalTo('isCheck', true);
-                Profilequery2.notEqualTo('isDeleted', true)
-                let P2 = await Profilequery2.find();
-                let profile1List2 = P2.map(item => item.toJSON());
-
-                let Profilequery = new Parse.Query('AIMoment');
-                Profilequery.equalTo('company', company);
-                Profilequery.equalTo('isVisible', true);
-                Profilequery.notEqualTo('isDeleted', true)
-                Profilequery.equalTo('profile', profile1List2[0].objectId);
-
-                let P = await Profilequery.find();
-                let profile1List = P.map(item => item.toJSON());
-                profile1List.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
-                console.log(profile1List);
-                this.setData({
-                    cardList: profile1List
-                })
-                console.log(this.data.cardList);
-            },
+    //查全部朋友圈
+    async getcircle() {
+        const currentUser = Parse.User.current();
+        let Profilequery2 = new Parse.Query('Profile');
+        Profilequery2.equalTo('company', company);
+        Profilequery2.equalTo('user', currentUser.id);
+        Profilequery2.equalTo('isCheck', true);
+        Profilequery2.notEqualTo('isDeleted', true)
+        let P2 = await Profilequery2.find();
+        let profile1List2 = P2.map(item => item.toJSON());
+
+        let Profilequery = new Parse.Query('AIMoment');
+        Profilequery.equalTo('company', company);
+        Profilequery.equalTo('isVisible', true);
+        Profilequery.notEqualTo('isDeleted', true)
+        Profilequery.equalTo('profile', profile1List2[0].objectId);
+
+        let P = await Profilequery.find();
+        let profile1List = P.map(item => item.toJSON());
+        profile1List.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
+        console.log(profile1List);
+        this.setData({
+            cardList: profile1List
+        })
+        console.log(this.data.cardList);
+    },
+
 })

+ 1 - 1
nova-werun/pages/my-circle/index.wxml

@@ -3,7 +3,7 @@
 <view class="all" style="height: {{contentHeight}}rpx;">
     <view class="trends" style="height: {{contentHeight}}rpx;">
         <block wx:for="{{cardList}}" wx:key="{{item.objectId}}">
-            <circle-card bindonChange="onChange" objectId='{{item.objectId}}' type='surface' permission='delete'></circle-card>
+            <circle-card  objectId='{{item.objectId}}' type='surface' permission='delete'></circle-card>
         </block>
     </view>
 </view>