From 04c7b0163caeae4ab1c5da62e301fa993101cfad Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 31 三月 2025 10:40:45 +0800
Subject: [PATCH] bug修改

---
 packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js |   58 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js
index 185e615..5ce392d 100644
--- a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js
+++ b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js
@@ -1,4 +1,8 @@
 // pages/bookServices/detail/components/learnResource/learnResource.js
+import {
+  loginInfo
+} from "../../../../../../assets/js/login";
+const app = getApp()
 Component({
   /**
    * 缁勪欢鐨勫睘鎬у垪琛�
@@ -22,6 +26,13 @@
     isShowBuyCloundMenu: {
       type: Boolean,
       default: false
+    },
+    isShowBuyCloundBtn: {
+      type: Boolean,
+      default: true
+    },
+    learnTaskData: {
+      type: Object,
     },
   },
 
@@ -47,15 +58,23 @@
     },
     // 璺宠浆璧勬簮璐拱椤�
     goBuyResource() {
-      if (!this.properties.isGoBuyResource) {
-        return wx.showToast({
-          icon: 'error',
-          title: '鏆傛棤鍙喘涔拌祫婧�',
+      const gotoPageFun = () => {
+        if (!this.properties.isGoBuyResource) {
+          return wx.showToast({
+            icon: 'error',
+            title: '鏆傛棤鍙喘涔拌祫婧�',
+          })
+        }
+        wx.navigateTo({
+          url: `/packageBookService/pages/bookServices/detail/buyResource/index?productLinkPath=${this.properties.buyResourceData.productLinkPath}&refCode=${this.properties.buyResourceData.refCode}&bookId=${this.properties.bookId}`,
         })
       }
-      wx.navigateTo({
-        url: `/packageBookService/pages/bookServices/detail/buyResource/index?productLinkPath=${this.properties.buyResourceData.productLinkPath}&refCode=${this.properties.buyResourceData.refCode}&bookId=${this.properties.bookId}`,
-      })
+      const token = wx.getStorageSync(app.config.tokenKey);
+      if (token) {
+        gotoPageFun()
+      } else {
+        loginInfo(app, (data) => {})
+      }
     },
 
     changeReceive(type) {
@@ -69,9 +88,28 @@
       })
     },
     goLearnTask() {
-      wx.navigateTo({
-        url: `/packageBookService/pages/bookServices/detail/components/learnTask/index?bookId=${this.properties.bookId}`,
-      })
+      const gotoPageFun = () => {
+        wx.navigateTo({
+          url: `/packageBookService/pages/bookServices/detail/components/learnTask/index?bookId=${this.properties.bookId}&cmsPath=${this.properties.learnTaskData?.productLinkPath}`,
+        })
+      }
+      const token = wx.getStorageSync(app.config.tokenKey);
+      if (token) {
+        gotoPageFun()
+      } else {
+        loginInfo(app, (data) => {
+          if (data) gotoPageFun()
+        })
+      }
+
+    },
+    buyCloudLearnClass() {
+      var myEventDetail = {} // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟
+      var myEventOption = {
+        bubbles: true,
+        composed: true
+      } // 瑙﹀彂浜嬩欢鐨勯�夐」
+      this.triggerEvent('buyCloudLearnClass', myEventDetail, myEventOption)
     }
   }
 })
\ No newline at end of file

--
Gitblit v1.9.1