From 04acf6421dded7b6f6eef9d2cf41d0b4a0e8dd0d Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期日, 28 四月 2024 09:23:10 +0800 Subject: [PATCH] 设置表单的bug --- pages/bibliographyList/index.js | 261 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 221 insertions(+), 40 deletions(-) diff --git a/pages/bibliographyList/index.js b/pages/bibliographyList/index.js index 53945fb..ee3e3b0 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,14 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + hiddenmodalput: false, + name: "", + phoneNum: '', + input: '', + dialogKey: '', + showWithInput: false, + showTextAndTitleWithInput: false, + downloadLoadin: false, isMore: null, higherList: [], vocationalList: [], @@ -18,13 +27,22 @@ BarHeight: '', navBarHeight: '', start: 1, - tabValue: '' + tabValue: '', + keyword: '', + Md5: '', + emailError: false, + loading: true, //寮�鍚鏋跺睆鍔犺浇 + hidden: true, //鏄惁灞曠ず鍐呭 }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { + + + + this.higherGet() this.vocationalGet() this.teacherGet() @@ -37,9 +55,10 @@ barHeight: systInfo.statusBarHeight, }) - let event = - { - detail: { value: "0" } + let event = { + detail: { + value: "0" + } } this.onTabsChange(event) @@ -126,6 +145,7 @@ //楂樼瓑鏁欒偛 higherGet(keyword) { + console.log(keyword, 'keyword'); let searchObj = { 'Name*': keyword, '||author*': keyword, @@ -164,8 +184,13 @@ higherTotal: res.total }) console.log(this.data.higherList, '5555'); + this.setData({ + loading: false, //寮�鍚鏋跺睆鍔犺浇 + hidden: false, //鏄惁灞曠ず鍐呭 + }) }) wx.stopPullDownRefresh() + }, @@ -234,6 +259,8 @@ fileType: [], jsek_resource: [], freeFile: [], + bookshelf_freeEpub: [], //epub璇曡鐧惧垎姣� + bookshelf_probationPage: [], //pdf璇曡椤垫暟 ...searchObj }, SysType: 'CmsItem' @@ -245,41 +272,80 @@ 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 = 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); - } - }); + + const item = event.currentTarget.dataset.item + console.log(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=" + + // this.data.bookDetail.id, + }); + } else { + Toast({ + context: this, + selector: '#t-toast', + message: '姝や功涓嶈兘鏌ョ湅', + theme: 'warning', + direction: 'column', + }); + console.log(456); + } + + + }, onSearchSubmit: function (e) { const keyword = e.detail.value; @@ -360,16 +426,131 @@ }, + 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({ - start: 1 - }) - this.vocationalGet() - this.higherGet() - this.teacherGet() + // [key]: true, + // dialogKey: key, + hiddenmodalput: true, + 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); + }, + //鍙栨秷寮规 + cancelM: function (e) { + this.setData({ + hiddenmodalput: false, + }) + }, + //鎻愪氦 + confirmM: function (e) { + console.log("濮撳悕锛�" + this.data.name + " 鐢佃瘽锛�" + this.data.phoneNum); + if (!this.data.emailError && this.data.name) { + + + + + if (this.data.name) { + let query = { + eMail: this.data.name, + md5s: [this.data.Md5] + } + app.MG.file.sendFileWithEmail(query).then(res => { + console.log(res); + this.setData({ + hiddenmodalput: false, + }) + }) + } + } else { + // 鏍¢獙涓嶉�氳繃锛岀粰鍑洪敊璇彁绀� + wx.showToast({ + title: '閭鏍煎紡涓嶆纭�', + icon: 'none', + }); + } + + }, + + iName: function (e) { + this.setData({ + name: e.detail.value + }) + // console.log(this.data.name); + }, + iPhoneNum: function (e) { + this.setData({ + phoneNum: e.detail.value + }) + }, + + }) \ No newline at end of file -- Gitblit v1.9.1