From 2c1a13eae201887fdee0a7e0007b7dccdfb4e1db Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期二, 11 三月 2025 10:28:28 +0800
Subject: [PATCH] 云学习资源扫码判断购买

---
 packageBookService/pages/bookServices/detail/components/tree/index.js |   35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js
index ed16170..223f666 100644
--- a/packageBookService/pages/bookServices/detail/components/tree/index.js
+++ b/packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -176,7 +176,7 @@
       const parentName = parent ? parent.name : "鏁欏璧勬簮";
       // 璧勬簮璐拱椤甸潰(鍙睍绀烘湭璐拱璧勬簮) 鐐瑰嚮涓嶈烦杞�
       if (this.properties.isShowCheck) return false;
-      if (item.selectType == "webpage") {
+      if (item.selectType == "webpage" || item.learnSelectType == "webpage") {
         // 缃戦〉绫诲瀷璺宠浆鍒扮綉鍧�澶嶅埗椤碉紝鍥犱负url浼犲弬涓嶈兘浼� 甯﹀弬鏁扮殑缃戠粶鍦板潃锛屾墍浠ユ澶勮鎶婄綉缁滃湴鍧�閲岀殑浼犲弬鎽樺嚭鏉ワ紝鏀惧埌url閲�
         let urlData = ''
         const flags = item.jsek_link.indexOf("?")
@@ -194,7 +194,7 @@
           title: '鏆傛棤璧勬簮',
         })
       }
-      if (item.selectType == 'zip') {
+      if (item.selectType == 'zip' || item.learnSelectType == 'zip') {
         // if (this.properties.applyState == 'Normal') {
         return wx.showToast({
           icon: 'error',
@@ -211,12 +211,13 @@
         let file = item.fileMap[item.file] ? item.fileMap[item.file] : item.fileMap[item.freeFile]
         if (file && file.protectType !== "Public") {
           return wx.showToast({
-            icon: "error",
+            icon: "none",
             title: "璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳",
           });
         }
       }
       if (this.properties.tab == "jsek_cloudLearning") {
+
         // 1.鎵惧嚭鎵�鏈夌埗绾х洰褰曞拰鏈韩(鏈夐攢鍞柟寮�) 鍜� 浜戝涔犳湰韬�(鏈夐攢鍞柟寮�) 鏀惧埌涓�涓暟缁�  涓虹┖鍒欐殏鏈紑鏀鹃攢鍞�
         let learn = []
         if (this.properties.isCloundHaveSaleMethod) {
@@ -224,9 +225,9 @@
           learn.push(this.properties.learnMenu)
         } else {
           // 1.2 浜戝涔犳棤閿�鍞柟寮忥紝灏嗙埗绾х洰褰曞拰鏈韩鍔犲叆鏁扮粍
-          const learn = this.handleTreeData(this.properties.learnList).filter(
+          learn = this.handleTreeData(this.properties.learnList).filter(
             (citem) => citem.saleMethod &&
-            citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal') &&
+            citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal' && ditem.Price > 0) &&
             new Date(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').EndDate).getTime() >= new Date().getTime() &&
             new Date(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').BeginDate).getTime() <= new Date().getTime() &&
             item.productLinkPath.includes(citem.productLinkPath)
@@ -236,10 +237,20 @@
         let buyList = []
         if (learn.length) buyList = learn.filter((item) => this.properties.buyIds.includes(item.saleMethod.find((citem) => citem.SaleType == 'Normal').Id))
         // 鏈夌埗绾�(鍖呭惈閿�鍞柟寮�)锛屼笖鏈喘涔�
-        if (learn.length && !buyList.length) return wx.showToast({
-          icon: 'error',
-          title: '璇峰厛璐拱璇ヨ祫婧�',
-        })
+        // if (learn.length && !buyList.length) return wx.showToast({
+        //   icon: 'error',
+        //   title: '璇峰厛璐拱璇ヨ祫婧�',
+        // })
+        if (item.protectedFile || item.freeFile) {
+          let file = item.fileMap[item.protectedFile] ? item.fileMap[item.protectedFile] : item.fileMap[item.freeFile]
+          if (file && file.protectType !== "Public") {
+            return wx.showToast({
+              icon: 'none',
+              title: "璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳",
+            });
+          }
+        }
+
       }
       let url;
       if (item.selectType == "video" || item.learnSelectType == "video") {
@@ -251,11 +262,11 @@
       ) {
         url = "/packageDomain/pages/resourceDetails/myAudio/index";
       }
-      if (item.selectType == "picture" || item.selectType == 'document' || item.selectType == 'pdf') {
+      if (item.selectType == "picture" || item.selectType == 'document' || item.selectType == 'pdf' || item.learnSelectType == "picture" || item.learnSelectType == 'document' || item.learnSelectType == 'pdf') {
         url = "/packageDomain/pages/resourceDetails/document/index";
       }
       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}`,
+        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}&source=qrcode`,
       });
     },
 
@@ -498,7 +509,7 @@
       });
       if (shoppingCartGetId.includes(saleMethodId)) {
         wx.showToast({
-          icon: "error",
+          icon: "success",
           title: "宸叉坊鍔�",
         });
         this.setData({

--
Gitblit v1.9.1