litian
2024-04-02 6a734d758720185f538e672c879121adb6732274
pages/student/index.js
@@ -1,5 +1,7 @@
const app = getApp();
import { getPublicImage } from "../../assets/js/middleGround/tool.js";
import {
  getPublicImage
} from "../../assets/js/middleGround/tool.js";
Page({
  /**
@@ -23,13 +25,13 @@
    isBackTop: false,
    setScrollValue: 0,
    skeletonLoding: true,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    this.getStaticsSum();
    this.getDataList(false);
  },
@@ -49,11 +51,41 @@
        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) {
    let that = this;
    console.log(item)
    that.setData({
      active: item.detail.value,
    })
@@ -75,12 +107,10 @@
    } else if (this.data.active == '2') {
      keywords = "jsek_digitalTextbooks";
    }
    let searchData = [
      {
        keywords: keywords,
        field: "ProductType",
      },
    ];
    let searchData = [{
      keywords: keywords,
      field: "ProductType",
    }, ];
    let data = {
      Size: this.data.limit,
      Start: this.data.page * this.data.limit - this.data.limit,
@@ -116,12 +146,20 @@
            loading: false
          })
        }
        console.log(this.data.list)
      } catch (error) {
        console.log(error)
      }
    })
  },
  goBookDetails(e) {
    const {
      book
    } = e.currentTarget.dataset;
    wx.navigateTo({
      url: `/packageBookService/pages/bookServices/detail/index?id=${book.product.id}&name=${book.product.name}`,
    });
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */