From b6923adb7b6a5fcbe4a2eaa06e1ebe0e044ba0e2 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期四, 28 三月 2024 14:22:42 +0800 Subject: [PATCH] 代码合并 --- pages/bibliographyList/index.js | 149 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 137 insertions(+), 12 deletions(-) diff --git a/pages/bibliographyList/index.js b/pages/bibliographyList/index.js index d3fee23..c02f54b 100644 --- a/pages/bibliographyList/index.js +++ b/pages/bibliographyList/index.js @@ -7,6 +7,8 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + downloadLoadin: false, + isMore: null, higherList: [], vocationalList: [], teacherList: [], @@ -15,7 +17,10 @@ teacherTotal: 0, value: '', BarHeight: '', - navBarHeight: '' + navBarHeight: '', + start: 1, + tabValue: '', + keyword: '' }, /** @@ -34,7 +39,12 @@ barHeight: systInfo.statusBarHeight, }) + let event = + { + detail: { value: "0" } + } + this.onTabsChange(event) @@ -91,14 +101,34 @@ }, onTabsChange(event) { - console.log(`Change tab, tab-panel value is ${event.detail.value}.`); + + const value = event.detail.value + + if (value === '0') { + console.log(value); + this.setData({ + tabValue: value, + isMore: false + }) + } else if (value === '1') { + console.log(value); + this.setData({ + tabValue: value, + isMore: false + }) + } else if (value === '2') { + console.log(value); + this.setData({ + tabValue: value, + isMore: false + }) + } }, - onTabsClick(event) { - console.log(`Click tab, tab-panel value is ${event.detail.value}.`); - }, + //楂樼瓑鏁欒偛 higherGet(keyword) { + console.log(keyword, 'keyword'); let searchObj = { 'Name*': keyword, '||author*': keyword, @@ -111,7 +141,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -138,7 +168,7 @@ }) console.log(this.data.higherList, '5555'); }) - + wx.stopPullDownRefresh() }, @@ -155,7 +185,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -180,6 +210,7 @@ }) }) + wx.stopPullDownRefresh() }, // 鑱屼笟鏁欒偛 teacherGet(keyword) { @@ -194,7 +225,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -219,16 +250,19 @@ }) }) - + wx.stopPullDownRefresh() }, downloadData(event) { + this.setData({ + downloadLoadin: true + }) console.log(111); const item = event.currentTarget.dataset.item; // console.log(item.datas.freeFile.Value); - const URL = 'http://182.92.203.7:3001/file/api/ApiDownload?md5=' + item.datas.freeFile.Value + const URL = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.datas.freeFile.Value item.determine = false - + console.log(URL, 'URL'); setTimeout(() => { if (URL) { item.determine = true @@ -252,6 +286,13 @@ console.log('涓嬭浇鏂囦欢澶辫触', res); } }); + + setTimeout(() => { + this.setData({ + downloadLoadin: false + }); + }, 2000); + }, onSearchSubmit: function (e) { const keyword = e.detail.value; @@ -260,11 +301,95 @@ this.higherGet(keyword) this.vocationalGet(keyword) this.teacherGet(keyword) + }, goBack() { wx.navigateBack(); }, + onReachBottom(e) { + if (this.data.tabValue == 0) { + console.log(0); + if (this.data.higherList.length < this.data.higherTotal) { + this.setData({ + isMore: true, + start: this.data.start + 1 + }) + this.higherGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + + } + + } else if (this.data.tabValue == 1) { + + if (this.data.teacherList.length < this.data.teacherTotal) { + this.setData({ + isMore: true, + start: this.data.start + 1 + }) + this.teacherGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + + } + console.log(2); + } else if (this.data.tabValue == 2) { + + if (this.data.vocationalList.length < this.data.vocationalTotal && this.data.vocationalList.length > 9) { + this.setData({ + isMore: true, + start: this.data.start + 1 + }) + this.vocationalGet() + } else { + this.setData({ + isMore: true, + }) + setTimeout(() => { + this.setData({ + isMore: false + }) + }, 100) + + } + console.log(2); + } + + + + }, + + onPullDownRefresh() { + + + let keyword = this.data.value + + this.setData({ + start: 1, + + }) + + this.higherGet(keyword) + this.vocationalGet(keyword) + this.teacherGet(keyword) + + + }, }) \ No newline at end of file -- Gitblit v1.9.1