From bbba5d26e9e26c910ed337dcb65f462752ee6dce Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期四, 12 九月 2024 09:11:47 +0800 Subject: [PATCH] fenxiang --- pages/retrievalPage/index.js | 201 ++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 154 insertions(+), 47 deletions(-) diff --git a/pages/retrievalPage/index.js b/pages/retrievalPage/index.js index 2ededee..2dd384d 100644 --- a/pages/retrievalPage/index.js +++ b/pages/retrievalPage/index.js @@ -19,7 +19,6 @@ showTextAndTitleWithInput: false, downloadLoadin: false, isMore: null, - tabPanelstyle: 'display:flex;justify-content:center;align-items:center;', navBarHeight: '', barHeight: '', searchVal: '', @@ -39,7 +38,41 @@ page: 1, total: 0, }, - tabValue: '0' + tabValue: '0', + tabPanelstyle: 'display:flex;justify-content:center;align-items:center;', + // tab閫夐」 + tabList: [{ + title: "鍥句功", + index: "0", + bookTotal: 0 + }, + { + title: "璇剧▼", + index: "1", + bookTotal: 0 + }, + { + title: "鏁板瓧鏁欐潗", + index: "2", + bookTotal: 0 + }, { + title: "涓撻", + index: "3", + bookTotal: 0 + }, + { + title: "涔︾洰", + index: "4", + bookTotal: 0 + }, + { + title: "涔﹀睍", + index: "5", + bookTotal: 0 + }, + ], + tabsId: 0, //榛樿閫夊瀷涓鸿澶� + }, /** @@ -57,14 +90,49 @@ }) this.retrievalPageGet() this.bibliographyGet() - let event = { + let e = { detail: { value: "0" } } - // this.onTabsChange(event) + this.onTabsChange(e) + // 妫�鏌ョ櫥褰曠姸鎬� + const token = wx.getStorageSync(app.config.tokenKey) + if (!token) { + loginInfo(app, (data) => { + if (data) { + this.getUserInfo() + } + }) + } else { + this.getUserInfo() + } }, - + // 鑾峰彇鐧诲綍鐢ㄦ埛韬唤 + getUserInfo() { + app.MG.identity.getCurrentAppUser().then(res => { + // 鐢ㄦ埛淇℃伅浼樺厛绾э細鏁欏笀璁よ瘉 > 寰俊 > 瀛︾敓锛堟敞鍐屾椂榛樿锛� + if (res) { + //鑾峰彇鐢ㄦ埛绫诲瀷 + let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher') + let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo') + let eMailData = res.secretList.find(i => i.type == 'EMail') + if (eMailData) { + this.setData({ + input: eMailData.credential + }) + } else if (teacherRole && teacherInfos) { + this.setData({ + input: JSON.parse(teacherInfos.data).email + }) + } else { + this.setData({ + input: '' + }) + } + } + }); + }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 */ @@ -110,9 +178,8 @@ /** * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� */ - onShareAppMessage() { - - }, + onShareAppMessage() {}, + onShareTimeline() {}, goBack() { wx.navigateBack(); }, @@ -129,37 +196,15 @@ onTabsChange(event) { const value = event.detail.value console.log(value); - if (value === '0') { - this.setData({ - tabValue: value, - isMore: false - }) - } else if (value === '1') { - console.log(value, 'tab'); - this.setData({ - tabValue: value, - isMore: false - }) - } else if (value === '2') { - this.setData({ - tabValue: value, - isMore: false - }) - } else if (value === '3') { - this.setData({ - tabValue: value, - isMore: false - }) - } else if (value === '4') { - this.setData({ - tabValue: value, - isMore: false - }) - } else if (value === '5') { - this.setData({ - tabValue: value, - isMore: false - }) + this.setData({ + tabValue: value, + isMore: false + }) + + if (value === '4') { + this.bibliographyGet() + } else { + this.retrievalPageGet() } }, @@ -182,7 +227,8 @@ 'Name*': this.data.searchVal.trim(), '||author*': this.data.searchVal.trim(), '||isbn*': this.data.searchVal.trim(), - '||seriesName*': this.data.searchVal.trim() + '||seriesName*': this.data.searchVal.trim(), + '||projectLeader*': this.data.searchVal.trim() } } @@ -224,7 +270,8 @@ 'Name*': this.data.searchVal.trim(), '||author*': this.data.searchVal.trim(), '||isbn*': this.data.searchVal.trim(), - '||seriesName*': this.data.searchVal.trim() + '||seriesName*': this.data.searchVal.trim(), + '||projectLeader*': this.data.searchVal.trim() } } //璇剧▼ @@ -417,7 +464,9 @@ this.setData({ bookData: datas1, bookTotal: data1.totalCount, + [`tabList[${0}].bookTotal`]: data1.totalCount }) + console.log(this.data.tabList, 7777) //鏁板瓧璇剧▼ 1 const data2 = resp[1] const datas2 = handleQueryResourceListData({ @@ -426,7 +475,8 @@ }) this.setData({ courseData: datas2, - courseTotal: data2.totalCount + courseTotal: data2.totalCount, + [`tabList[${1}].bookTotal`]: data2.totalCount }) // 鏁板瓧鏁欐潗 2 const data3 = resp[2] @@ -436,7 +486,8 @@ }) this.setData({ digitalTextbooksData: datas3, - digitalTextbooksTotal: data3.totalCount + digitalTextbooksTotal: data3.totalCount, + [`tabList[${2}].bookTotal`]: data3.totalCount }) // 涓撻鐮旇 3 const data4 = resp[3] @@ -446,7 +497,8 @@ }) this.setData({ seminarData: datas4, - seminarTotal: data4.totalCount + seminarTotal: data4.totalCount, + [`tabList[${3}].bookTotal`]: data4.totalCount }) // 涔﹀睍 4 const data5 = resp[4] @@ -460,7 +512,8 @@ // console.log(datas5, 'sadasd'); this.setData({ biblioClassificationData: datas5, - biblioClassificationTotal: data5.totalCount + biblioClassificationTotal: data5.totalCount, + [`tabList[${5}].bookTotal`]: data5.totalCount }) this.setData({ loading: false, @@ -504,7 +557,8 @@ this.setData({ bookFairData: res.datas, - bookFairTotal: res.total + bookFairTotal: res.total, + [`tabList[${4}].bookTotal`]: res.total }) }) @@ -539,6 +593,33 @@ } }); }, + openBookFair(event) { + 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, + }); + } else { + Toast({ + context: this, + selector: '#t-toast', + message: '姝や功涓嶈兘鏌ョ湅', + theme: 'warning', + direction: 'column', + }); + } + }, onSearchSubmit() { this.setData({ loading: true, @@ -572,6 +653,7 @@ * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ onReachBottom(e) { + console.log(this.data.tabValue); if (this.data.tabValue == 0) { console.log(0); if (this.data.bookData.length < this.data.bookTotal) { @@ -719,7 +801,6 @@ this.setData({ [key]: true, dialogKey: key, - input: '', Md5: item.datas.freeFile.FileList[0].Md5 }); }, @@ -885,4 +966,30 @@ } } }, + onTabsClick(event) { + console.log(` + Click tab, tab - panel value is $ { + event.detail.value + }. + `); + }, + tabClick() { + console.log(2323); + }, + // 婊戝姩鏃惰Е鍙戠殑浜嬩欢 + slideOn(e) { + // 鎷垮埌褰撳墠绱㈠紩骞跺姩鎬佹敼鍙� + this.setData({ + tabsId: e.detail.current + }) + }, + + //鐐瑰嚮tab鏃惰Е鍙� + tabsOn(e) { + this.setData({ + //鎷垮埌褰撳墠绱㈠紩骞跺姩鎬佹敼鍙� + tabsId: e.currentTarget.dataset.idx + }) + }, + }) \ No newline at end of file -- Gitblit v1.9.1