邹能昇 1 semana atrás
pai
commit
14f8e4a07a

+ 22 - 0
nova-werun/pages/home/signin/index.js

@@ -25,6 +25,8 @@ Page({
             'https://pic.nximg.cn/file/20230420/12106414_122949747127_2.jpg'
         ],
         randomImage: '',
+        accumulateChink:0,
+        continuousChink:0
     },
 
     /**
@@ -51,6 +53,8 @@ Page({
         });
         this.showRandomImage()
         this.order()
+        this.accumulateChink()
+        this.continuousChink()
     },
 
     /**
@@ -166,6 +170,7 @@ Page({
             try {
                 let saveDate = await EventLog.save();
                 console.log(saveDate);
+                this.accumulateChink()
                 this.setData({
                     issigin: true
                 })
@@ -182,5 +187,22 @@ Page({
         this.setData({
             randomImage: this.data.images[randomIndex]
         });
+    },
+    //积累打卡
+    async accumulateChink(){
+        const currentUser = Parse.User.current();
+        let EventLogquery = new Parse.Query('EventLog');
+        EventLogquery.equalTo('user', currentUser.id);
+        EventLogquery.equalTo('company', company);
+        EventLogquery.notEqualTo('isDeleted', true)
+        let P = await EventLogquery.find();
+        let chickList = P.map(item => item.toJSON());
+        this.setData({
+            accumulateChink:chickList.length
+        })
+    },
+    //连续打卡
+    async continuousChink() {
+
     }
 })

+ 2 - 2
nova-werun/pages/home/signin/index.wxml

@@ -9,14 +9,14 @@
                 <view class="chick">
                     <view class="chick-text">连续打卡</view>
                     <view class="numberbox">
-                        <view class="number">77</view>
+                        <view class="number">{{continuousChink}}</view>
                         <view class="number-text">天</view>
                     </view>
                 </view>
                 <view class="chick">
                     <view class="chick-text">累计打卡</view>
                     <view class="numberbox">
-                        <view class="number">177</view>
+                        <view class="number">{{accumulateChink}}</view>
                         <view class="number-text">天</view>
                     </view>
                 </view>