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 | 56 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 46 insertions(+), 10 deletions(-) diff --git a/pages/bookExhibitionDetails/index.js b/pages/bookExhibitionDetails/index.js index 43c1898..8a752fa 100644 --- a/pages/bookExhibitionDetails/index.js +++ b/pages/bookExhibitionDetails/index.js @@ -6,6 +6,7 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + start: 1, loading: true, hidden: true, bookName: '', @@ -17,12 +18,17 @@ navBarHeight: '', barHeight: '', subtitleName: '', + totalSize: '', + passId: '', + isMore: null, }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { + + const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� @@ -35,13 +41,18 @@ this.setData({ bookName: options.bookName, - subtitleName: options.subtitleName + subtitleName: options.subtitleName, + passId: options.id }) const passId = options.id this.bookExhibitionGet(passId) - this.getBookExhibitionDetails(passId) + this.getBookExhibitionDetails() + + wx.setNavigationBarTitle({ + title: this.data.subtitleName + }); }, /** @@ -131,16 +142,17 @@ }) }, //涔﹀睍璇︽儏鎺ュ彛 - getBookExhibitionDetails(passId) { - this.setData({ - loading: true, - hidden: true, - }) + 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: [], @@ -151,9 +163,10 @@ }).then(res => { this.setData({ - bookExhibitionList: res.datas + bookExhibitionList: res.datas, + totalSize: res.total }) - console.log(this.data.bookExhibitionList, 'bookExhibitionList'); + this.setData({ loading: false, hidden: false, @@ -170,5 +183,28 @@ 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