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 | 162 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 144 insertions(+), 18 deletions(-) diff --git a/pages/bibliographyList/index.js b/pages/bibliographyList/index.js index cab19a3..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: '' }, /** @@ -26,16 +31,20 @@ this.vocationalGet() this.teacherGet() - - //鑾峰彇绯荤粺淇℃伅锛岀姸鎬佹爮楂樺害涓簊ysInfo['statusBarHeight']; - let sysInfo = wx.getSystemInfoSync(); - let menu = wx.getMenuButtonBoundingClientRect(); //鑳跺泭淇℃伅 - let navBarHeight = (menu.top - sysInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� + const systInfo = wx.getSystemInfoSync(); + const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 + const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� this.setData({ - BarHeight: sysInfo.statusBarHeight, navBarHeight: navBarHeight + navBarHeight: navBarHeight, + barHeight: systInfo.statusBarHeight, }) + let event = + { + detail: { value: "0" } + } + this.onTabsChange(event) @@ -92,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, @@ -112,7 +141,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -139,7 +168,7 @@ }) console.log(this.data.higherList, '5555'); }) - + wx.stopPullDownRefresh() }, @@ -156,7 +185,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -181,6 +210,7 @@ }) }) + wx.stopPullDownRefresh() }, // 鑱屼笟鏁欒偛 teacherGet(keyword) { @@ -195,7 +225,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -220,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 @@ -253,6 +286,13 @@ console.log('涓嬭浇鏂囦欢澶辫触', res); } }); + + setTimeout(() => { + this.setData({ + downloadLoadin: false + }); + }, 2000); + }, onSearchSubmit: function (e) { const keyword = e.detail.value; @@ -261,9 +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