From 47462dc6c323cc4ac7b32b93051947d351799c1f Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期四, 21 三月 2024 18:53:20 +0800 Subject: [PATCH] 检索页修改 --- pages/retrievalPage/index.js | 201 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 185 insertions(+), 16 deletions(-) diff --git a/pages/retrievalPage/index.js b/pages/retrievalPage/index.js index 77f1025..9039b9a 100644 --- a/pages/retrievalPage/index.js +++ b/pages/retrievalPage/index.js @@ -9,6 +9,7 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + isMore: null, tabPanelstyle: 'display:flex;justify-content:center;align-items:center;', navBarHeight: '', barHeight: '', @@ -24,7 +25,12 @@ biblioClassificationData: [],//涔﹀睍 biblioClassificationTotal: 0, bookFairData: [],//涔︾洰 - bookFairTotal: 0 + bookFairTotal: 0, + pageCount: { + page: 1, + total: 0, + }, + tabValue: '' }, /** @@ -44,6 +50,13 @@ this.retrievalPageGet() this.bibliographyGet() + let event = { + detail: { + + value: "0" + } + } + this.onTabsChange(event) }, /** @@ -105,13 +118,47 @@ this.retrievalPageGet() this.bibliographyGet() }, + + + //鏍囩鐨勫垏鎹� onTabsChange(event) { - console.log(`Change tab, tab-panel searchVal is ${event.detail.searchVal}.`); + const value = event.detail.value + if (value === '0') { + this.setData({ + tabValue: value, + isMore: false + }) + } else if (value === '1') { + console.log(value, 'tab'); + this.setData({ + tabValue: value, + isMore: false + }) + } else if (value === '2') { + this.setData({ + tabValue: value, + isMore: false + }) + } else if (value === '3') { + this.setData({ + tabValue: value, + isMore: false + }) + } else if (value === '4') { + this.setData({ + tabValue: value, + isMore: false + }) + } else if (value === '5') { + this.setData({ + tabValue: value, + isMore: false + }) + } + }, - onTabsClick(event) { - console.log(`Click tab, tab-panel searchVal is ${event.detail.searchVal}.`); - }, + retrievalPageGet() { @@ -149,7 +196,7 @@ }, PageQuery: { Start: 0, - Size: 999 + Size: this.data.pageCount.page * 9, }, SortQuery: [ { @@ -194,7 +241,7 @@ }, PageQuery: { Start: 0, - Size: 999 + Size: this.data.pageCount.page * 4 }, SortQuery: [ { @@ -238,7 +285,7 @@ }, PageQuery: { Start: 0, - Size: 999 + Size: this.data.pageCount.page * 9, }, SortQuery: [ { @@ -283,7 +330,7 @@ }, PageQuery: { Start: 0, - Size: 999 + Size: this.data.pageCount.page * 6, }, SortQuery: [ { @@ -327,7 +374,7 @@ PageQuery: { Start: 0, - Size: 999 + Size: this.data.pageCount.page * 10 }, SortQuery: [ { @@ -382,7 +429,8 @@ }) this.setData({ bookData: datas1, - bookTotal: data1.totalCount + bookTotal: data1.totalCount, + }) @@ -434,7 +482,7 @@ datas5.forEach((items) => { items.subtitleName = items.subtitle + items.name }) - console.log(datas5, 'sadasd'); + // console.log(datas5, 'sadasd'); this.setData({ biblioClassificationData: datas5, biblioClassificationTotal: data5.totalCount @@ -462,7 +510,7 @@ queryType: '*', paging: { start: 0, - size: 999 + size: this.data.pageCount.page * 9, }, coverSize: { width: 260 @@ -478,7 +526,7 @@ }, SysType: "CmsItem" }).then(res => { - // console.log(res); + this.setData({ bookFairData: res.datas, bookFairTotal: res.total @@ -527,8 +575,6 @@ const item = e.currentTarget.dataset.item wx.navigateTo({ url: '/packageBookService/pages/bookServices/detail/index?id=' + item.id + '&name=' + item.name - - }) }, onBookExhibitionDetails(e) { @@ -547,6 +593,129 @@ onPullDownRefresh() { console.log("涓嬫媺鍒锋柊..."); }, + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom(e) { + if (this.data.tabValue == 0) { + console.log(0); + if (this.data.bookData.length < this.data.bookTotal) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1 + }) + this.retrievalPageGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + + } + + } else if (this.data.tabValue == 1) { + + if (this.data.courseData.length < this.data.courseTotal) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1 + }) + this.retrievalPageGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + + } + console.log(2); + } else if (this.data.tabValue == 2) { + + if (this.data.digitalTextbooksData.length < this.data.digitalTextbooksTotal && this.data.digitalTextbooksData.length > 9) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1 + }) + this.retrievalPageGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + + } + console.log(2); + } else if (this.data.tabValue == 3) { + if (this.data.seminarData.length < this.data.seminarTotal) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1 + }) + this.retrievalPageGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + } + console.log(3); + } else if (this.data.tabValue == 4) { + if (this.data.bookFairData.length < this.data.bookFairTotal) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1 + }) + this.bibliographyGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + } + console.log(4); + } else if (this.data.tabValue == 5) { + if (this.data.biblioClassificationData.length < this.data.biblioClassificationTotal) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1 + }) + this.retrievalPageGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + + } + } + + + + }, }) \ No newline at end of file -- Gitblit v1.9.1