From ecbc81c918a288dc752b1634b3f545f795d992aa Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 20 三月 2024 16:15:41 +0800 Subject: [PATCH] 图书分类,图书列表样式修改,答题器优化 --- pages/bookServices/assort/index.js | 103 +++++++++++++++++++++++++++++++++++---------------- 1 files changed, 70 insertions(+), 33 deletions(-) diff --git a/pages/bookServices/assort/index.js b/pages/bookServices/assort/index.js index 024fe3d..e8f86b1 100644 --- a/pages/bookServices/assort/index.js +++ b/pages/bookServices/assort/index.js @@ -1,18 +1,25 @@ // pages/bookServices/assort/index.js +import { getPublicImage } from '../../../assets/js/middleGround/tool' const app = getApp(); Page({ /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + placeholderstyle: 'font-size:28rpx', assortList: [], assortCheck: { name: '', code: '', }, startList: [], - startCheck: '', + + startCheck: { + id: '', + code: '' + }, bookList: [], + loading: false, listLoding: false, }, @@ -20,49 +27,50 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - // this.getAssortList() - console.log(options); + this.getAssortList(); }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 */ - onReady() {}, + onReady() { }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { - this.getAssortList(); }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 */ - onHide() {}, + onHide() { }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ - onUnload() {}, + onUnload() { }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ - onPullDownRefresh() {}, + onPullDownRefresh() { }, /** * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ - onReachBottom() {}, + onReachBottom() { }, /** * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� */ - onShareAppMessage() {}, + onShareAppMessage() { }, // 鑾峰彇渚ц竟鏍忓垪琛� getAssortList() { + this.setData({ + loading: true + }) const query = { path: '*', filterList: [ @@ -82,6 +90,7 @@ const list = res.datas.filter((item) => item.refCode != 'jsek_homepageBookService'); this.setData({ assortList: list, + loading: false }); this.setData({ assortCheck: { @@ -93,14 +102,14 @@ }); }, // 渚ц竟鏍忓垏鎹� - changeAssort(data) { + changeAssort(e) { this.setData({ assortCheck: { - name: data.detail.label, - code: data.detail.value, + name: e.detail.label, + code: e.detail.value, }, }); - this.getStairList(data.detail.value); + this.getStairList(e.detail.value); }, // 鑾峰彇涓�绾у垎绫� getStairList(path) { @@ -109,7 +118,12 @@ }); const query = { path, - filterList: [], + filterList: [ + { + value: 'Normal', + field: 'state' + } + ], queryType: '\\', searchList: [], size: '30', @@ -118,22 +132,20 @@ sort: { type: 'Asc', field: 'LinkOrder' }, }; app.MG.store.getStoreChannelList(query).then(async (res) => { - // 涓�绾у垎绫婚�変腑 - this.setData({ - startCheck: res.datas[0].refCode, - }); // 鑾峰彇浜岀骇鍒嗙被 for (let index = 0; index < res.datas.length; index++) { const item = res.datas[index]; + item.icon ? item.icon = getPublicImage(item.icon, 58, 72) : item.icon = item.icon item.children = await this.getSecondList(item); } + console.log(res.datas); // 涓�绾у垎绫昏祴鍊� this.setData({ startList: res.datas, + listLoding: false, + 'startCheck.id': res.datas[0].id, + 'startCheck..code': '' }); - }); - this.setData({ - listLoding: false, }); }, @@ -143,7 +155,12 @@ let datas; const query = { path, - filterList: [], + filterList: [ + { + value: 'Normal', + field: 'state' + } + ], queryType: '\\', searchList: [], size: '30', @@ -152,27 +169,47 @@ sort: { type: 'Asc', field: 'LinkOrder' }, }; await app.MG.store.getStoreChannelList(query).then((res) => { + for (let index = 0; index < res.datas.length; index++) { + const element = res.datas[index]; + if (element.icon) + element.icon = getPublicImage(element.icon, 58, 72) + + } datas = res.datas; }); return datas; }, - tabClick(tabData) { - const data = tabData.currentTarget.dataset.tabdata; + tabClick(e) { + const data = e.currentTarget.dataset.tabdata; this.setData({ - startCheck: data.refCode, + 'startCheck.id': data.id, + 'startCheck.code': data.refCode, }); + console.log(data); }, // 璺宠浆鍒楄〃椤� - goPageList(item) { - const secondCode = `${item.currentTarget.dataset.staircode.pathLinks[0].linkPath}\\${item.currentTarget.dataset.staircode.id}`; - wx.navigateTo({ - url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck}&secondCode=${secondCode}`, - }); + goPageList(e) { + const tab = e.currentTarget.dataset.tabdata + const stair = e.currentTarget.dataset.stair + this.setData({ + 'startCheck.id': tab.id, + 'startCheck.code': tab.refCode + }) + if (stair) { + const secondCode = `${stair.pathLinks[0].linkPath}\\${stair.id}`; + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck.code}&secondCode=${secondCode}`, + }); + } else { + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}`, + }); + } + }, navToSearchPage(e) { - console.log(e.detail.value); wx.navigateTo({ - url: `/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck}&searchValue=${e.detail.value}`, + url: `/packageBookService/pages/bookServices/list/index?assorName=${this.data.assortCheck.name}&assortCode=${this.data.assortCheck.code}&stairCode=${this.data.startCheck.code}&searchValue=${e.detail.value}`, }); }, }); -- Gitblit v1.9.1