From 56b70cdad0a96691eaf37e04a79ef5e92b892480 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期五, 19 四月 2024 11:14:40 +0800 Subject: [PATCH] bug1 --- pages/bibliographyList/index.js | 294 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 256 insertions(+), 38 deletions(-) diff --git a/pages/bibliographyList/index.js b/pages/bibliographyList/index.js index d3fee23..7529409 100644 --- a/pages/bibliographyList/index.js +++ b/pages/bibliographyList/index.js @@ -7,6 +7,12 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + input: '', + dialogKey: '', + showWithInput: false, + showTextAndTitleWithInput: false, + downloadLoadin: false, + isMore: null, higherList: [], vocationalList: [], teacherList: [], @@ -15,7 +21,14 @@ teacherTotal: 0, value: '', BarHeight: '', - navBarHeight: '' + navBarHeight: '', + start: 1, + tabValue: '', + keyword: '', + Md5: '', + emailError: false, + loading: true, //寮�鍚鏋跺睆鍔犺浇 + hidden: true, //鏄惁灞曠ず鍐呭 }, /** @@ -34,7 +47,13 @@ barHeight: systInfo.statusBarHeight, }) + let event = { + detail: { + value: "0" + } + } + this.onTabsChange(event) @@ -91,14 +110,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 +150,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -137,7 +176,12 @@ higherTotal: res.total }) console.log(this.data.higherList, '5555'); + this.setData({ + loading: false, //寮�鍚鏋跺睆鍔犺浇 + hidden: false, //鏄惁灞曠ず鍐呭 + }) }) + wx.stopPullDownRefresh() }, @@ -155,7 +199,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -180,6 +224,7 @@ }) }) + wx.stopPullDownRefresh() }, // 鑱屼笟鏁欒偛 teacherGet(keyword) { @@ -194,7 +239,7 @@ queryType: '*', paging: { start: '0', - size: '999' + size: this.data.start * 9 }, coverSize: { width: 260 @@ -206,6 +251,8 @@ fileType: [], jsek_resource: [], freeFile: [], + bookshelf_freeEpub: [], //epub璇曡鐧惧垎姣� + bookshelf_probationPage: [], //pdf璇曡椤垫暟 ...searchObj }, SysType: 'CmsItem' @@ -217,41 +264,68 @@ teacherList: res.datas, teacherTotal: res.total }) - }) - - + 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 = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.datas.freeFile.Value + // item.determine = false + // console.log(URL, 'URL'); + // setTimeout(() => { + // if (URL) { + // item.determine = true + // } + // }, 600) + // wx.downloadFile({ + // url: URL, + // success: function (res) { + // const filePath = res.tempFilePath; + // wx.openDocument({ + // filePath: filePath, + // success: function (res) { + // console.log('鎵撳紑鏂囨。鎴愬姛'); + // }, + // fail: function (res) { + // console.log('鎵撳紑鏂囨。澶辫触', res); + // } + // }); + // }, + // fail: function (res) { + // console.log('涓嬭浇鏂囦欢澶辫触', res); + // } + // }); + // setTimeout(() => { + // this.setData({ + // downloadLoadin: false + // }); + // }, 2000); + // }, downloadData(event) { - 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 - item.determine = false - setTimeout(() => { - if (URL) { - item.determine = true - } - }, 600) - wx.downloadFile({ - url: URL, - success: function (res) { - const filePath = res.tempFilePath; - wx.openDocument({ - filePath: filePath, - success: function (res) { - console.log('鎵撳紑鏂囨。鎴愬姛'); - }, - fail: function (res) { - console.log('鎵撳紑鏂囨。澶辫触', res); - } - }); - }, - fail: function (res) { - console.log('涓嬭浇鏂囦欢澶辫触', res); - } + const item = event.currentTarget.dataset.item + console.log(item); + wx.navigateTo({ + url: "/packageBookService/pages/components/webView/index?md5=" + + item.freeFile + + "&fileName=" + + item.name + + "&fileType=" + + item.fileType + "&bookBuy=true" + // "&freePage=" + + // this.data.fileInfo.freePage + + + // + + // "&bookId=" + + // this.data.bookDetail.id, }); + + }, onSearchSubmit: function (e) { const keyword = e.detail.value; @@ -266,5 +340,149 @@ 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) + }, + // 閭鐐瑰嚮 + mailbox(e) { + const key = e.currentTarget.dataset.key; + const item = e.currentTarget.dataset.item; + + + + this.setData({ + [key]: true, + dialogKey: key, + input: '', + Md5: item.datas.freeFile.FileList[0].Md5 + }); + + + + }, + + onEmailInput(e) { + const isEmailValid = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(e.detail.value); + this.setData({ + emailError: !isEmailValid, + "input": e.detail.value, + }); + }, + //寮圭獥纭 + onConfirm() { + if (!this.data.emailError && this.data.input) { + const { + dialogKey + } = this.data; + this.setData({ + [dialogKey]: false + }); + + + console.log(this.data.input); + console.log(this.data.Md5); + if (this.data.input) { + let query = { + eMail: this.data.input, + md5s: [this.data.Md5] + } + app.MG.file.sendFileWithEmail(query).then(res => { + console.log(res); + }) + } + } else { + // 鏍¢獙涓嶉�氳繃锛岀粰鍑洪敊璇彁绀� + wx.showToast({ + title: '閭鏍煎紡涓嶆纭�', + icon: 'none', + }); + } + + }, + // 寮圭獥鍙栨秷 + closeDialog() { + const { + dialogKey + } = this.data; + this.setData({ + [dialogKey]: false + }); + console.log(111); + }, + + }) \ No newline at end of file -- Gitblit v1.9.1