浏览代码

首页统计

lrf402788946 4 年之前
父节点
当前提交
a755d58fcc
共有 2 个文件被更改,包括 26 次插入5 次删除
  1. 22 1
      pages/home/home.js
  2. 4 4
      pages/home/home.wxml

+ 22 - 1
pages/home/home.js

@@ -6,7 +6,11 @@ Page({
   data: {
     // 个人信息
     videoUrl: 'https://vd3.bdstatic.com/mda-kar9n2ip1u508ewq/hd/mda-kar9n2ip1u508ewq.mp4?pd=20',
-    userInfo: {}
+    userInfo: {},
+    yesterday: 0,
+    week: 0,
+    month: 0,
+    group: 0,
   },
   //事件处理函数
   // 统计信息
@@ -112,5 +116,22 @@ Page({
         })
       }
     })
+    this.indexCount();
   },
+
+  /**
+   * 首页查询4块统计
+   * @property mobile 当前用户手机号,查询条件
+   */
+  indexCount() {
+    wx.request({
+      url: `${app.globalData.publicUrl}/api/htyd/count/index?mobile=${app.globalData.userInfo.mobile}`,
+      method: 'get',
+      success: res => {
+        const { data } = res.data
+        console.log(data);
+        this.setData({ ...data })
+      }
+    })
+  }
 })

+ 4 - 4
pages/home/home.wxml

@@ -38,28 +38,28 @@
           <text>昨日新增</text>
           <image src="/pages/images/zr.png"></image>
         </view>
-        <view class="numTwo">0</view>
+        <view class="numTwo">{{yesterday}}</view>
       </view>
       <view class="num" bindtap="achieveBtn" id="week">
         <view class="numOne">
           <text>本周新增</text>
           <image src="/pages/images/zhou.png"></image>
         </view>
-        <view class="numTwo">0</view>
+        <view class="numTwo">{{week}}</view>
       </view>
       <view class="num" bindtap="achieveBtn" id="month">
         <view class="numOne">
           <text>当月新增</text>
           <image src="/pages/images/yue.png"></image>
         </view>
-        <view class="numTwo">0</view>
+        <view class="numTwo">{{month}}</view>
       </view>
       <view class="num" bindtap="achieveBtn" id="group">
         <view class="numOne">
           <text>团队统计</text>
           <image src="/pages/images/team.png"></image>
         </view>
-        <view class="numTwo">0</view>
+        <view class="numTwo">{{group}}</view>
       </view>
     </van-col>
     <van-col span="24" class="four">