riku
2022-10-28 b45a01a8bee4a9bff5f9c248ead301b8675d1099
pages/home/home.js
@@ -55,6 +55,13 @@
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //判断用户是否为首次登录,决定是否强制修改默认密码
    if (app.globalData.userInfo.remark == null || app.globalData.userInfo.remark == '') {
      wx.navigateTo({
        url: '/pages/m_user/p_changepw/p_changepw',
      })
    }
    wx.getStorage({
      key: 'accessToken',
      success: (result) => {
@@ -205,18 +212,28 @@
    let monthInfo = {
      totalMust: 0,
      finishedMust: 0,
      totalSelf: 0,
      finishedSelf: 0
    }
    subtypes.forEach(s => {
      //月度统计
      if (s.needUpdate) {
        monthInfo.totalMust++
        //统计自巡查类型的台账,类别为-1(暂定)
        if (s.ledgerTypeId == -1) {
          monthInfo.totalSelf++
        }
        if (s.upLoad) {
          monthInfo.finishedMust++
          if (s.ledgerTypeId == -1) {
            monthInfo.finishedSelf++
          }
        }
      }
    });
    monthInfo.percent = Math.round(monthInfo.finishedMust / monthInfo.totalMust * 100)
    monthInfo.percent = monthInfo.totalMust == 0 ? 0 : Math.round(monthInfo.finishedMust / monthInfo.totalMust * 100)
    monthInfo.percent2 = monthInfo.totalSelf == 0 ? 0 : Math.round(monthInfo.finishedSelf / monthInfo.totalSelf * 100)
    this.setData({monthInfo})
  },
@@ -285,6 +302,13 @@
      wx.navigateTo({
        url: url
      })
    } else {
      wx.showToast({
        title: '功能敬请期待',
        duration: 1000,
        icon: 'none',
        mask: true,
      })
    }
  }
})