From 6a734d758720185f538e672c879121adb6732274 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 02 四月 2024 09:20:45 +0800 Subject: [PATCH] 代码合并,问题修改,学习 --- pages/student/index.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 8 deletions(-) diff --git a/pages/student/index.js b/pages/student/index.js index f3cc83e..a94d555 100644 --- a/pages/student/index.js +++ b/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,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) { @@ -74,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, @@ -120,6 +151,15 @@ } }) }, + + goBookDetails(e) { + const { + book + } = e.currentTarget.dataset; + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/detail/index?id=${book.product.id}&name=${book.product.name}`, + }); + }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ -- Gitblit v1.9.1