From c6abdfaf883e35e9c930dbdbe533d36e2966eb23 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期一, 08 七月 2024 12:00:37 +0800
Subject: [PATCH] 检索页修改

---
 packageBookService/pages/bookServices/detail/components/tree/index.js |  115 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 68 insertions(+), 47 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js
index f8e88e0..1c287fe 100644
--- a/packageBookService/pages/bookServices/detail/components/tree/index.js
+++ b/packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -139,11 +139,25 @@
       if (token) {
         const item = e.currentTarget.dataset.item;
         const parent = e.currentTarget.dataset.parent;
+        console.log('item', item);
         const parentProductLinkPath = parent ?
           parent.productLinkPath :
           wx.getStorageSync("teachResourcesPath");
         const parentName = parent ? parent.name : "鏁欏璧勬簮";
         let url;
+        if (item.selectType == 'zip') {
+          if (this.properties.applyState == 'Normal') {
+            return wx.showToast({
+              icon: 'error',
+              title: '璇峰墠寰�PC绔笅杞�',
+            })
+          } else {
+            return wx.showToast({
+              icon: 'error',
+              title: '璇峰厛鐢宠涓嬭浇',
+            })
+          }
+        }
         if (this.properties.isShowCheck && this.resourceIsBuy(item)) {
           return false;
         }
@@ -177,16 +191,15 @@
             title: "鏆傛湭寮�濮嬮攢鍞紝璇疯仈绯荤鐞嗗憳",
           });
         }
-        if (this.properties.tab == "jsek_teachingResources" && item.fileMap) {
+        if (this.properties.tab == "jsek_teachingResources" && (item.file || item.freeFile)) {
           let file = item.fileMap[item.file] ? item.fileMap[item.file] : item.fileMap[item.freeFile]
-          debugger
           if (file && file.protectType !== "Public") {
             return wx.showToast({
               icon: "error",
               title: "璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳",
             });
           }
-        } else {
+        } else if ((this.properties.tab == "jsek_teachingResources" || this.properties.tab == "jsek_cloudLearning") && (!item.file && !item.freeFile && !item.protectedFile)) {
           return wx.showToast({
             icon: 'error',
             title: '鏆傛棤璧勬簮',
@@ -195,7 +208,12 @@
         wx.navigateTo({
           url: `${url}?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parentProductLinkPath}&parentName=${parentName}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}&formPath=${this.properties.tab}&applyState=${this.properties.applyState}&deadline=${this.properties.deadline}`,
         });
-        if (item.selectType == "pdf") {
+<<<<<<< Updated upstream
+=======
+
+        // debugger
+>>>>>>> Stashed changes
+        if (item.selectType == "pdf" || item.selectType == "document") {
           const fileLink = item.file ? item.file : item.freeFile
           console.log(fileLink);
           wx.navigateTo({
@@ -203,51 +221,54 @@
               fileLink +
               "&fileName=" +
               item.name +
-              "&fileType=" +
-              item.selectType + "&bookBuy=true"
+<<<<<<< Updated upstream
+              "&fileType=pdf" +
+              "&bookBuy=true"
+=======
+              "&fileType=pdf" + "&bookBuy=true"
+>>>>>>> Stashed changes
           });
         }
-        if (item.selectType == "document") {
-          // freeFile
-          if (item.selectType == "document") {
-            item.selectType = "pptx";
-          }
-          const fileLink = item.file ?
-            app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file :
-            app.config.requestCtx +
-            "/file/api/ApiDownload?md5=" +
-            item.freeFile;
-          console.log(fileLink, "fileLink");
-          //鎻愮ず鍔犺浇涓�
-          util.showLoading();
-          // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB
-          wx.downloadFile({
-            url: fileLink,
-            // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`,
-            filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`,
-            success: function (res) {
-              console.log(res, "wx.downloadFile success res");
-              if (res.statusCode != 200) {
-                util.hideLoadingWithErrorTips();
-                return false;
-              }
-              var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢�
-              let data = res.filePath;
-              wx.openDocument({
-                filePath: data,
-                showMenu: true,
-                success: function (res) {
-                  console.log("鎵撳紑鎴愬姛");
-                  util.hideLoading();
-                },
-              });
-            },
-            fail: function (err) {
-              console.log(err, "wx.downloadFile fail err");
-              util.hideLoadingWithErrorTips();
-            },
-          });
-        }
+        // if (item.selectType == "document") {
+        //   // freeFile
+        //   // if (item.selectType == "document") {
+        //   //   item.selectType = "pptx";
+        //   // }
+        //   const fileLink = item.file ?
+        //     app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file :
+        //     app.config.requestCtx +
+        //     "/file/api/ApiDownload?md5=" +
+        //     item.freeFile;
+        //   console.log(fileLink, "fileLink");
+        //   //鎻愮ず鍔犺浇涓�
+        //   // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB
+        //   wx.downloadFile({
+        //     url: fileLink,
+        //     // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`,
+        //     filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`,
+        //     success: function (res) {
+        //       console.log(res, "wx.downloadFile success res");
+        //       if (res.statusCode != 200) {
+        //         util.hideLoadingWithErrorTips();
+        //         return false;
+        //       }
+        //       var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢�
+        //       let data = res.filePath;
+        //       wx.openDocument({
+        //         filePath: data,
+        //         showMenu: true,
+        //         success: function (res) {
+        //           console.log("鎵撳紑鎴愬姛");
+        //           util.hideLoading();
+        //         },
+        //       });
+        //     },
+        //     fail: function (err) {
+        //       console.log(err, "wx.downloadFile fail err");
+        //       util.hideLoadingWithErrorTips();
+        //     },
+        //   });
+        // }
         if (item.selectType == "webpage") {
           this.setData({
             webpageSrc: item.jsek_link,

--
Gitblit v1.9.1