From 103db27cd0ca6b3305e95170dc297380f97fcc70 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期四, 25 四月 2024 17:05:47 +0800 Subject: [PATCH] bug3 --- pages/bookExhibitionDetails/index.js | 75 ++++++++++++++++++++++++++++++++----- 1 files changed, 65 insertions(+), 10 deletions(-) diff --git a/pages/bookExhibitionDetails/index.js b/pages/bookExhibitionDetails/index.js index bb04659..8a752fa 100644 --- a/pages/bookExhibitionDetails/index.js +++ b/pages/bookExhibitionDetails/index.js @@ -6,6 +6,9 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + start: 1, + loading: true, + hidden: true, bookName: '', bookBeginDate: '', bookCreator: '', @@ -14,13 +17,18 @@ bookExhibitionList: [], navBarHeight: '', barHeight: '', - bookName: '' + subtitleName: '', + totalSize: '', + passId: '', + isMore: null, }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { + + const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� @@ -32,13 +40,19 @@ this.setData({ - bookName: options.bookName + bookName: options.bookName, + subtitleName: options.subtitleName, + passId: options.id }) const passId = options.id this.bookExhibitionGet(passId) - this.getBookExhibitionDetails(passId) + this.getBookExhibitionDetails() + + wx.setNavigationBarTitle({ + title: this.data.subtitleName + }); }, /** @@ -91,6 +105,10 @@ }, bookExhibitionGet(passId) { + this.setData({ + loading: true, + hidden: true, + }) wx.showLoading({ title: '鍔犺浇涓�...', }) @@ -117,15 +135,24 @@ bookImage: res.datas.icon }); wx.hideLoading() + this.setData({ + loading: false, + hidden: false, + }) }) }, //涔﹀睍璇︽儏鎺ュ彛 - getBookExhibitionDetails(passId) { + getBookExhibitionDetails() { + app.MG.store.getProductList({ path: '*', storeInfo: 'jsek_bookFair', - mainProductId: passId, + mainProductId: this.data.passId, queryType: 'Related', // 鏌ヨ绫诲瀷锛� Related锛氭煡璇㈠叧鑱斿晢鍝侊紱SubProduct: 鏌ヨ瀛愬晢鍝侊紱 + paging: { + start: 0, + size: this.data.start * 6 + }, fields: { author: [], publicationDate: [], @@ -136,20 +163,48 @@ }).then(res => { this.setData({ - bookExhibitionList: res.datas + bookExhibitionList: res.datas, + totalSize: res.total }) - console.log(this.data.bookExhibitionList, 88888); + + this.setData({ + loading: false, + hidden: false, + }) }) }, onBookDetails(event) { const item = event.currentTarget.dataset.item; console.log(item, 'item'); - // wx.navigateTo({ - // url: '/pages/bookExhibitionDetails/index?id?name=' + item.id + item.name // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡id鍙傛暟 - // }); + wx.navigateTo({ + url: '/packageBookService/pages/bookServices/detail/index?id=' + item.id + '&name=' + item.name + }); }, goBack() { wx.navigateBack(); }, + // 瑙﹀簳鍑芥暟 + onReachBottom() { + console.log(this.data.bookExhibitionList.length); + console.log(this.data.totalSize); + if (this.data.bookExhibitionList.length < this.data.totalSize) { + console.log(11111); + this.setData({ + isMore: true, + start: this.data.start + 1 + }) + this.getBookExhibitionDetails() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + console.log('300'); + }, 300) + } + }, }) \ No newline at end of file -- Gitblit v1.9.1