From dc934dfd63fecff84d0bf996418e041b9bd4ea59 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期二, 30 四月 2024 18:16:13 +0800
Subject: [PATCH] bug修改

---
 packageDomain/pages/resourceDetails/document/index.js |   53 +++++++++--------------------------------------------
 1 files changed, 9 insertions(+), 44 deletions(-)

diff --git a/packageDomain/pages/resourceDetails/document/index.js b/packageDomain/pages/resourceDetails/document/index.js
index 2449ab4..2276497 100644
--- a/packageDomain/pages/resourceDetails/document/index.js
+++ b/packageDomain/pages/resourceDetails/document/index.js
@@ -38,23 +38,13 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   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,
@@ -94,12 +84,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 +97,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)
     }
@@ -184,11 +173,6 @@
     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 +180,6 @@
             selectType: item.selectType
           })
         }
-
-
       })
     })
   },
@@ -205,16 +187,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 +206,6 @@
     wx.showLoading({
       title: '姝e湪涓嬭浇...',
     });
-
     wx.downloadFile({
       url: downloadUrl,
       success(res) {
@@ -285,9 +263,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 +279,6 @@
         webpageSrc: item.jsek_link
       })
     }
-
     //鏂囨。绛�
     if (item.selectType == 'pdf' || item.selectType == 'document') {
       app.MG.file.getPdfInfo({
@@ -317,14 +292,8 @@
           }
         }
       })
-
-
-
-
     }
   },
-
-
 
   handleTap: function () {
     const naturalResources = this.data.naturalResources;
@@ -332,8 +301,6 @@
       // console.log(item);
     });
   },
-
-
 
   onClick() {
     this.setData({
@@ -349,7 +316,6 @@
     const {
       index
     } = e.detail;
-
     console.log('change', index);
   },
 
@@ -378,7 +344,6 @@
   preview(event) {
     console.log(event.currentTarget.dataset.src)
     let currentUrl = event.currentTarget.dataset.src
-
     wx.previewImage({
       current: currentUrl, // 褰撳墠鏄剧ず鍥剧墖鐨刪ttp閾炬帴
       // urls: this.data.showData // 闇�瑕侀瑙堢殑鍥剧墖http閾炬帴鍒楄〃

--
Gitblit v1.9.1