From 8dc4e50769a7ebc5f0a3d766f61aa08b8f23b772 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期五, 06 九月 2024 11:23:21 +0800 Subject: [PATCH] login --- packageDomain/pages/resourceDetails/document/index.js | 125 +++++++++++++++++++++++++---------------- 1 files changed, 77 insertions(+), 48 deletions(-) diff --git a/packageDomain/pages/resourceDetails/document/index.js b/packageDomain/pages/resourceDetails/document/index.js index 2449ab4..4808f57 100644 --- a/packageDomain/pages/resourceDetails/document/index.js +++ b/packageDomain/pages/resourceDetails/document/index.js @@ -16,6 +16,7 @@ navBarHeight: '', barHeight: '', activeId: '', + storeInfo: '', bookId: '', bookName: '', cmsId: '', @@ -33,34 +34,29 @@ pauseTime: 0, //鏆傚仠鏃堕棿 applyState: '', deadline: '', + lzoomFlag: false, //瀹氫箟 缂╂斁浜嬩欢 鑺傛祦闃�,闃叉涓�娆$缉鏀捐Е鍙戜袱娆$缉鏀句簨浠� + distance: 0, //璁板綍鎵嬫寚绉诲姩璺濈 + scale: 1, //瀹氫箟鍒濆鍖栫殑椤甸潰缂╂斁澶у皬 + newScale: 1, //璁板綍鏂扮殑椤甸潰缂╂斁澶у皬 }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - wx.setNavigationBarTitle({ title: '璧勬簮璇︽儏' }); - - - - - - - - console.log(options); const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� - this.setData({ navBarHeight: navBarHeight, barHeight: systInfo.statusBarHeight, activeId: options.activeId, bookId: options.bookId, bookName: options.bookName, + storeInfo: options.storeInfo, cmsId: options.cmsId, parentName: options.parentName, parentProductLinkPath: options.parentProductLinkPath, @@ -68,6 +64,12 @@ applyState: options.applyState, deadline: options.deadline }) + const token = wx.getStorageSync(app.config.tokenKey) + if (!token) { + loginInfo(app, (data) => { + if (data) {} else {} + }) + } this.resourceDetailsData() }, @@ -94,12 +96,11 @@ this.setData({ pauseTime: Date.now() }) - if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { + if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) { let duration = this.data.pauseTime - this.data.startTime this.count(duration) } }, - /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 @@ -108,7 +109,7 @@ this.setData({ pauseTime: Date.now() }) - if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { + if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) { let duration = this.data.pauseTime - this.data.startTime this.count(duration) } @@ -181,14 +182,12 @@ size: 999 } } + if (this.data.storeInfo) { + query.storeInfo = this.data.storeInfo + } app.MG.store.getProductDetail(query).then((res) => { console.log(res); res.datas.cmsDatas[0].datas.forEach((item) => { - - - - - //鍒氬垰杩涙潵鐨勬椂鍊� if (this.data.productLinkPath == item.productLinkPath) { this.handleTeachData(item) this.setData({ @@ -196,8 +195,6 @@ selectType: item.selectType }) } - - }) }) }, @@ -205,16 +202,13 @@ onDownloadButton() { const item = this.data.zipData; if (this.data.applyState !== 'Normal') { - return wx.showToast({ - icon: 'none', - title: '璇峰厛鐢宠涓嬭浇', - }) - } else { - const flag = new Date(this.data.deadline) > new Date() - if (!flag) return wx.showToast({ - icon: 'none', - title: '璇峰厛鐢宠涓嬭浇', - }) + if (!this.data.deadline == '姘镐箙') { + const flag = new Date(this.data.deadline) > new Date() + return wx.showToast({ + icon: 'none', + title: '璇峰厛鐢宠涓嬭浇', + }) + } } if (!item || !item.file) { wx.showToast({ @@ -227,7 +221,6 @@ wx.showLoading({ title: '姝e湪涓嬭浇...', }); - wx.downloadFile({ url: downloadUrl, success(res) { @@ -285,9 +278,7 @@ console.log(item, 'item11111'); if (item.selectType == 'picture') { this.setData({ - showData: item.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.freeFile, - }) console.log(this.data.showData, 'showData'); } @@ -303,7 +294,6 @@ webpageSrc: item.jsek_link }) } - //鏂囨。绛� if (item.selectType == 'pdf' || item.selectType == 'document') { app.MG.file.getPdfInfo({ @@ -317,14 +307,8 @@ } } }) - - - - } }, - - handleTap: function () { const naturalResources = this.data.naturalResources; @@ -332,8 +316,6 @@ // console.log(item); }); }, - - onClick() { this.setData({ @@ -349,7 +331,6 @@ const { index } = e.detail; - console.log('change', index); }, @@ -376,13 +357,61 @@ }, //棰勮鍥剧墖锛屾斁澶ч瑙� preview(event) { - console.log(event.currentTarget.dataset.src) - let currentUrl = event.currentTarget.dataset.src - + let urls = [event.currentTarget.dataset.src] wx.previewImage({ - current: currentUrl, // 褰撳墠鏄剧ず鍥剧墖鐨刪ttp閾炬帴 - // urls: this.data.showData // 闇�瑕侀瑙堢殑鍥剧墖http閾炬帴鍒楄〃 + urls: urls // 闇�瑕侀瑙堢殑鍥剧墖http閾炬帴鍒楄〃 }) }, + // myTouchStart(e) { + // //---------------------璁板綍缂╂斁浜嬩欢淇℃伅--------------------- + // // 褰撲袱鏍规墜鎸囨斁涓婂幓鐨勬椂鍊欙紝灏嗚窛绂�(distance)鍒濆鍖栥�� + // let xMove = e.touches[1].clientX - e.touches[0].clientX; + // let yMove = e.touches[1].clientY - e.touches[0].clientY; + // //璁$畻寮�濮嬭Е鍙戜袱涓墜鎸囧潗鏍囩殑璺濈 + // const distance = Math.sqrt(xMove * xMove + yMove * yMove); + // this.setData({ + // distance: distance + // }) + // //---------------------璁板綍缂╂斁浜嬩欢淇℃伅end--------------------- + // }, + // myTouchMove(e) { + // // ----------------鐩戝惉鎵嬪娍缂╁皬鏀惧ぇ浜嬩欢---------------- + // // 鍗曟墜鎸囩缉鏀句笉鍋氫换浣曟搷浣� + // if (e.touches.length != 1) { + // //鍙屾墜鎸囪繍鍔� x绉诲姩鍚庣殑鍧愭爣鍜寉绉诲姩鍚庣殑鍧愭爣 + // let xMove = e.touches[1].clientX - e.touches[0].clientX; + // let yMove = e.touches[1].clientY - e.touches[0].clientY; + // //鍙屾墜鎸囪繍鍔ㄦ柊鐨� ditance + // let newDistance = Math.sqrt(xMove * xMove + yMove * yMove); + // //璁$畻绉诲姩鐨勮繃绋嬩腑瀹為檯绉诲姩浜嗗灏戠殑璺濈 + // let distanceDiff = newDistance - this.data.distance; + // // newScale = scale + 0.005 * distanceDiff + // console.log('绉诲姩璺濈', distanceDiff); + // this.setData({ + // newScale: this.data.newScale + 0.005 * distanceDiff + // }) + // // 鎵撳紑缂╂斁鐩戝惉 + // // zoomFlag = true + // this.setData({ + // lzoomFlag: true + // }) + // return + // } + // // ----------------鐩戝惉鎵嬪娍缂╁皬鏀惧ぇ浜嬩欢end---------------- + // }, + // myTouchEnd() { + // if (this.data.lzoomFlag) { + // if (this.data.newScale > 1.3) { + // console.log("鏀惧ぇ浜�", this.data.newScale); + // } else if (this.data.newScale < 0.7, this.data.newScale) { + // console.log("缂╁皬浜�"); + // } + // // 鍏抽棴缂╂斁鐩戝惉 + // // zoomFlag = false + // this.setData({ + // lzoomFlag: false + // }) + // } + // }, }) \ No newline at end of file -- Gitblit v1.9.1