litian
2024-04-02 6a734d758720185f538e672c879121adb6732274
pages/student/index.js
@@ -31,6 +31,7 @@
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    this.getStaticsSum();
    this.getDataList(false);
  },
@@ -50,6 +51,37 @@
        active: 2
      })
    }
  },
  getStaticsSum() {
    const data = {
      start: 0,
      size: 10,
      filterList: [{
        value: "LearningTime",
        field: "type",
      }],
    };
    app.MG.app.getStaticsSum(data).then((res) => {
      if (res) {
        let minutes = Number(res) / (1000 * 60)
        let hours = Number(res) / (1000 * 60 * 60)
        if (minutes > 0 && minutes < 60) {
          this.setData({
            learningDuration: Math.round(minutes) + "分钟"
          })
        } else if (minutes > 60) {
          this.setData({
            learningDuration: Math.round(hours) + "小时"
          })
        } else {
          this.setData({
            learningDuration: "0小时"
          })
        }
      }
    })
  },
  tabClick(item) {