From dc934dfd63fecff84d0bf996418e041b9bd4ea59 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期二, 30 四月 2024 18:16:13 +0800 Subject: [PATCH] bug修改 --- pages/bibliographyList/index.js | 242 ++++++++++++++++++++++------------------------- 1 files changed, 113 insertions(+), 129 deletions(-) diff --git a/pages/bibliographyList/index.js b/pages/bibliographyList/index.js index af7a83d..b2588bb 100644 --- a/pages/bibliographyList/index.js +++ b/pages/bibliographyList/index.js @@ -1,4 +1,5 @@ // pages/bibliographyList/index.js +import Toast from 'tdesign-miniprogram/toast/index'; const app = getApp() const config = Page({ @@ -7,6 +8,9 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + hiddenmodalput: false, + name: "", + phoneNum: '', input: '', dialogKey: '', showWithInput: false, @@ -38,7 +42,6 @@ this.higherGet() this.vocationalGet() this.teacherGet() - const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� @@ -46,19 +49,12 @@ navBarHeight: navBarHeight, barHeight: systInfo.statusBarHeight, }) - let event = { detail: { value: "0" } } - this.onTabsChange(event) - - - - - }, /** @@ -72,7 +68,8 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { - console.log(this.data.value); + // console.log(this.data.value); + }, /** @@ -110,9 +107,7 @@ }, onTabsChange(event) { - const value = event.detail.value - if (value === '0') { console.log(value); this.setData({ @@ -133,18 +128,14 @@ }) } }, - - //楂樼瓑鏁欒偛 higherGet(keyword) { - console.log(keyword, 'keyword'); + // console.log(keyword, 'keyword'); let searchObj = { 'Name*': keyword, '||author*': keyword, '||isbn*': keyword - } - app.MG.resource.getItem({ path: 'jsek_biblioClassification\\jsek_bCHigherEducation', queryType: '*', @@ -170,20 +161,16 @@ res.datas.forEach(item => { item.determine = true }) - console.log(res, 789111); this.setData({ higherList: res.datas, higherTotal: res.total }) - console.log(this.data.higherList, '5555'); this.setData({ loading: false, //寮�鍚鏋跺睆鍔犺浇 hidden: false, //鏄惁灞曠ず鍐呭 }) }) wx.stopPullDownRefresh() - - }, //鏁欏笀鏁欒偛 @@ -192,7 +179,6 @@ 'Name*': keyword, '||author*': keyword, '||isbn*': keyword - } app.MG.resource.getItem({ path: 'jsek_biblioClassification\\jsek_bCVocationalEducation', @@ -215,6 +201,7 @@ }, SysType: 'CmsItem' }).then(res => { + console.log(res); res.datas.forEach(item => { item.determine = true }) @@ -222,7 +209,6 @@ vocationalList: res.datas, vocationalTotal: res.total }) - }) wx.stopPullDownRefresh() }, @@ -232,7 +218,6 @@ 'Name*': keyword, '||author*': keyword, '||isbn*': keyword - } app.MG.resource.getItem({ path: 'jsek_biblioClassification\\jsek_bCTeacherEducation', @@ -251,6 +236,8 @@ fileType: [], jsek_resource: [], freeFile: [], + bookshelf_freeEpub: [], //epub璇曡鐧惧垎姣� + bookshelf_probationPage: [], //pdf璇曡椤垫暟 ...searchObj }, SysType: 'CmsItem' @@ -265,44 +252,71 @@ }) 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) { - 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 + const item = event.currentTarget.dataset.item + if (item.fileType == "pdf") { + 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=" + + item.id, }); - }, 2000); + } else { + Toast({ + context: this, + selector: '#t-toast', + message: '姝や功涓嶈兘鏌ョ湅', + theme: 'warning', + direction: 'column', + }); + } }, onSearchSubmit: function (e) { const keyword = e.detail.value; @@ -312,14 +326,11 @@ 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, @@ -335,11 +346,8 @@ isMore: false }) }, 100) - } - - } else if (this.data.tabValue == 1) { - + } else if (this.data.tabValue == 2) { if (this.data.teacherList.length < this.data.teacherTotal) { this.setData({ isMore: true, @@ -355,12 +363,11 @@ 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) { + } else if (this.data.tabValue == 1) { + console.log(this.data.vocationalList.length); + console.log(this.data.vocationalTotal); + if (this.data.vocationalList.length < this.data.vocationalTotal) { this.setData({ isMore: true, start: this.data.start + 1 @@ -375,13 +382,8 @@ isMore: false }) }, 100) - } - console.log(2); } - - - }, onPullDownRefresh() { @@ -397,49 +399,45 @@ 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] + }) + wx.showModal({ + title: '璇疯緭鍏ラ偖绠�', + content: '', + confirmColor: '#ff6c00', + cancelColor: '#949494', + placeholderText: '璇疯緭鍏ラ偖绠卞彿', + editable: true, + complete: (res) => { + if (res.cancel) { + console.log('鍙栨秷'); } - app.MG.file.sendFileWithEmail(query).then(res => { - console.log(res); - }) + if (res.confirm) { + this.setData({ + input: res.content + }) + this.confirmM() + } } + }) + }, + //鎻愪氦 + confirmM(e) { + const isEmailValid = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(this.data.input); + if (isEmailValid && this.data.input) { + let query = { + eMail: this.data.input, + md5s: [this.data.Md5] + } + app.MG.file.sendFileWithEmail(query).then(res => { + if (res) { + wx.showToast({ + icon: 'success', + title: '閭欢宸插彂閫�', + }) + } + }) } else { // 鏍¢獙涓嶉�氳繃锛岀粰鍑洪敊璇彁绀� wx.showToast({ @@ -447,19 +445,5 @@ icon: 'none', }); } - }, - // 寮圭獥鍙栨秷 - closeDialog() { - const { - dialogKey - } = this.data; - this.setData({ - [dialogKey]: false - }); - console.log(111); - }, - - - }) \ No newline at end of file -- Gitblit v1.9.1