From 9f1e740e07085a7fc74defe5d63bcc4818aab69e Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期四, 29 二月 2024 18:49:37 +0800 Subject: [PATCH] zhang --- pages/bibliographyList/index.js | 415 ++++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 254 insertions(+), 161 deletions(-) diff --git a/pages/bibliographyList/index.js b/pages/bibliographyList/index.js index 5edaf82..dfa20f5 100644 --- a/pages/bibliographyList/index.js +++ b/pages/bibliographyList/index.js @@ -1,174 +1,267 @@ // pages/bibliographyList/index.js const app = getApp() -Page({ +const config = + Page({ - /** - * 椤甸潰鐨勫垵濮嬫暟鎹� - */ - data: { - higherList: [], - vocationalList: [], - teacherList: [], - higherTotal: null, - vocationalTotal: null, - teacherTotal: null - }, + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + higherList: [], + vocationalList: [], + teacherList: [], + higherTotal: null, + vocationalTotal: null, + teacherTotal: null, + value: '', + BarHeight: '', + navBarHeight: '' + }, - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 - */ - onLoad(options) { - this.higherGet() - this.vocationalGet() - this.teacherGet() - }, + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + onLoad(options) { + this.higherGet() + this.vocationalGet() + this.teacherGet() - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 - */ - onReady() { - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず - */ - onShow() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 - */ - onHide() { - - }, - - /** - * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 - */ - onUnload() { - - }, - - /** - * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 - */ - onPullDownRefresh() { - - }, - - /** - * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� - */ - onReachBottom() { - - }, - - /** - * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� - */ - onShareAppMessage() { - - }, - onTabsChange(event) { - console.log(`Change tab, tab-panel value is ${event.detail.value}.`); - }, - - onTabsClick(event) { - console.log(`Click tab, tab-panel value is ${event.detail.value}.`); - }, - //楂樼瓑鏁欒偛 - higherGet() { - app.MG.resource.getItem({ - path: 'jsek_biblioClassification\\jsek_bCHigherEducation', - queryType: '*', - paging: { - start: '0', - size: '999' - }, - coverSize: { - width: 260 - }, - fields: { - jsek_link: [], - content: [], - subtitle: [], - fileType: [], - jsek_resource: [], - freeFile: [] - }, - SysType: 'CmsItem' - }).then(res => { - console.log(res.total); + //鑾峰彇绯荤粺淇℃伅锛岀姸鎬佹爮楂樺害涓簊ysInfo['statusBarHeight']; + let sysInfo = wx.getSystemInfoSync(); + let menu = wx.getMenuButtonBoundingClientRect(); //鑳跺泭淇℃伅 + let navBarHeight = (menu.top - sysInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� this.setData({ - higherList: res.datas, - higherTotal: res.total - }) - console.log(this.data.higherList, '5555'); - }) - - - }, - - //鏁欏笀鏁欒偛 - vocationalGet() { - app.MG.resource.getItem({ - path: 'jsek_biblioClassification\\jsek_bCVocationalEducation', - queryType: '*', - paging: { - start: '0', - size: '999' - }, - coverSize: { - width: 260 - }, - fields: { - jsek_link: [], - content: [], - subtitle: [], - fileType: [], - jsek_resource: [], - freeFile: [] - }, - SysType: 'CmsItem' - }).then(res => { - this.setData({ - vocationalList: res.datas, - vocationalTotal: res.total + BarHeight: sysInfo.statusBarHeight, navBarHeight: navBarHeight }) - }) - }, - // 鑱屼笟鏁欒偛 - teacherGet() { - app.MG.resource.getItem({ - path: 'jsek_biblioClassification\\jsek_bCTeacherEducation', - queryType: '*', - paging: { - start: '0', - size: '999' - }, - coverSize: { - width: 260 - }, - fields: { - jsek_link: [], - content: [], - subtitle: [], - fileType: [], - jsek_resource: [], - freeFile: [] - }, - SysType: 'CmsItem' - }).then(res => { - this.setData({ - teacherList: res.datas, - teacherTotal: res.total + + + + + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + console.log(this.data.value); + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() { + + }, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + + }, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + }, + onTabsChange(event) { + console.log(`Change tab, tab-panel value is ${event.detail.value}.`); + }, + + onTabsClick(event) { + console.log(`Click tab, tab-panel value is ${event.detail.value}.`); + }, + //楂樼瓑鏁欒偛 + higherGet(keyword) { + let searchObj = { + 'Name*': keyword, + '||author*': keyword, + '||isbn*': keyword + + } + + app.MG.resource.getItem({ + path: 'jsek_biblioClassification\\jsek_bCHigherEducation', + queryType: '*', + paging: { + start: '0', + size: '999' + }, + coverSize: { + width: 260 + }, + fields: { + jsek_link: [], + content: [], + subtitle: [], + fileType: [], + jsek_resource: [], + freeFile: [], + ...searchObj, + }, + SysType: 'CmsItem' + }).then(res => { + + 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'); }) - }) + + }, + + //鏁欏笀鏁欒偛 + vocationalGet(keyword) { + let searchObj = { + 'Name*': keyword, + '||author*': keyword, + '||isbn*': keyword + + } + app.MG.resource.getItem({ + path: 'jsek_biblioClassification\\jsek_bCVocationalEducation', + queryType: '*', + paging: { + start: '0', + size: '999' + }, + coverSize: { + width: 260 + }, + fields: { + jsek_link: [], + content: [], + subtitle: [], + fileType: [], + jsek_resource: [], + freeFile: [], + ...searchObj + }, + SysType: 'CmsItem' + }).then(res => { + res.datas.forEach(item => { + item.determine = true + }) + this.setData({ + vocationalList: res.datas, + vocationalTotal: res.total + }) + + }) + }, + // 鑱屼笟鏁欒偛 + teacherGet(keyword) { + let searchObj = { + 'Name*': keyword, + '||author*': keyword, + '||isbn*': keyword + + } + app.MG.resource.getItem({ + path: 'jsek_biblioClassification\\jsek_bCTeacherEducation', + queryType: '*', + paging: { + start: '0', + size: '999' + }, + coverSize: { + width: 260 + }, + fields: { + jsek_link: [], + content: [], + subtitle: [], + fileType: [], + jsek_resource: [], + freeFile: [], + ...searchObj + }, + SysType: 'CmsItem' + }).then(res => { + res.datas.forEach(item => { + item.determine = true + }) + this.setData({ + teacherList: res.datas, + teacherTotal: res.total + }) + + }) - } -}) \ No newline at end of file + }, + downloadData(event) { + 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); + } + }); + }, + onSearchSubmit: function (e) { + const keyword = e.detail.value; + // 澶勭悊鎼滅储閫昏緫锛屼緥濡傚彂閫佹悳绱㈣姹傜瓑 + console.log('鎼滅储鍏抽敭璇嶏細', keyword); + this.higherGet(keyword) + this.vocationalGet(keyword) + this.teacherGet(keyword) + }, + + + + + }) \ No newline at end of file -- Gitblit v1.9.1