From bfdd1a936731cf9b5f0d2c78d363cbb0ec93d941 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 04 九月 2024 09:43:52 +0800 Subject: [PATCH] 树结构排序优化 --- pages/study/index.js | 88 ++++++++++++++++++++++++++++++++++++-------- 1 files changed, 72 insertions(+), 16 deletions(-) diff --git a/pages/study/index.js b/pages/study/index.js index cb9b87e..3346031 100644 --- a/pages/study/index.js +++ b/pages/study/index.js @@ -36,22 +36,7 @@ */ onLoad() { // 妫�鏌ョ櫥褰曠姸鎬� - const token = wx.getStorageSync(app.config.tokenKey) - if (!token) { - loginInfo(app, (data) => { - if (data) { - this.getUserInfo() - this.getStaticsSum(); - this.getDataList(false); - } - }) - } else { - this.getUserInfo() - this.getStaticsSum(); - this.getDataList(false); - - } }, @@ -70,6 +55,22 @@ this.getTabBar().setData({ active: 2 }) + } + const token = wx.getStorageSync(app.config.tokenKey) + if (!token) { + loginInfo(app, (data) => { + if (data) { + this.getUserInfo() + this.getStaticsSum(); + this.getDataList(false); + this.getListCount() + } + }) + } else { + this.getUserInfo() + this.getStaticsSum(); + this.getDataList(false); + this.getListCount() } }, @@ -112,6 +113,61 @@ } }) }, + getListCount() { + let that = this; + let data = { + Size: 9999, + Start: 0, + sort: { + type: "Desc", + field: "CreateDate", + }, + searchList: [{ + keywords: 'jsek_mediaBook', + field: "ProductType", + }], + } + app.MG.store.getPurchasedProductList(data).then((res) => { + that.setData({ + titleBook: "鍥句功锛�" + res.totalSize + "鏈級", + }) + }) + let data1 = { + Size: 9999, + Start: 0, + sort: { + type: "Desc", + field: "CreateDate", + }, + searchList: [{ + keywords: 'jsek_digitalCourses', + field: "ProductType", + }], + } + app.MG.store.getPurchasedProductList(data1).then((res) => { + that.setData({ + titleCourse: "璇剧▼锛�" + res.totalSize + "闂級", + }) + }) + let data2 = { + Size: 9999, + Start: 0, + sort: { + type: "Desc", + field: "CreateDate", + }, + searchList: [{ + keywords: 'jsek_digitalTextbooks', + field: "ProductType", + }], + } + app.MG.store.getPurchasedProductList(data2).then((res) => { + that.setData({ + titleTextBook: "鏁板瓧鏁欐潗锛�" + res.totalSize + "鏈級", + }) + }) + }, + tabClick(item) { let that = this; @@ -163,7 +219,6 @@ this.setData({ list: dataList, pageTotalCount: res.totalSize, - titleBook: "鍥句功锛�" + res.totalSize + "鏈級", bottomLoading: false, isMoreData: dataList.length > 0 ? false : true, skeletonLoding: false, @@ -171,6 +226,7 @@ }) } else { this.setData({ + list: [], skeletonLoding: false, loading: false }) -- Gitblit v1.9.1