From 4bc1c36faeec2f90e5acfa836732e49fe0b245e9 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期五, 12 四月 2024 20:47:03 +0800
Subject: [PATCH] 云学习11

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

diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js
index 21592ed..00e10a7 100644
--- a/packageBookService/pages/bookServices/detail/components/tree/index.js
+++ b/packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -58,6 +58,7 @@
     selectAll: [],
     shoppingCart: true,
     stop: false,
+    cart: true
   },
   ready() {},
 
@@ -131,16 +132,7 @@
     goPlayer(e) {
       // 妫�鏌ョ櫥褰曠姸鎬�
       const token = wx.getStorageSync(app.config.tokenKey);
-      if (!token) {
-        loginInfo(app, (data) => {
-          // 濡傛灉涓嶆槸绗竴娆$櫥褰曪紝浼氭墽琛屽洖璋�
-          if (data) {
-            // 鐧诲綍鎴愬姛锛岃嚜鍔ㄨ褰晅oken鍜岀敤鎴蜂俊鎭紝骞惰繑鍥瀟rue
-          } else {
-            // 鍑虹幇閿欒锛岃繑鍥瀎alse
-          }
-        });
-      } else {
+      if (token) {
         const item = e.currentTarget.dataset.item;
         const parent = e.currentTarget.dataset.parent;
         let url;
@@ -168,7 +160,7 @@
           });
         }
         wx.navigateTo({
-          url: `${url}?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parent.productLinkPath}&parentName=${parent.name}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}`,
+          url: `${url}?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parent.productLinkPath}&parentName=${parent.name}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}&formPath=${this.properties.tab}`,
         });
         if (item.selectType == "document" || item.selectType == "pdf") {
           const fileLink =
@@ -478,6 +470,9 @@
     // 鍔犲叆璐墿杞�
     async onCloudShoppingCart(e) {
       let shoppingCartGetId = [];
+
+      const item = e.currentTarget.dataset.item
+      console.log(item.isShopCar);
       const saleMethodId = e.currentTarget.dataset.item.saleMethod[0].Id;
       console.log(saleMethodId);
       let query = {
@@ -513,10 +508,15 @@
         };
         const addRes = await app.MG.store.addShoppingCart(query);
         console.log(addRes, "addRes");
-        wx.showToast({
-          icon: "success",
-          title: "娣诲姞鎴愬姛",
-        });
+        if (addRes) {
+          wx.showToast({
+            icon: "success",
+            title: "娣诲姞鎴愬姛",
+          });
+          item.isShopCar = false
+          this.triggerEvent("updateCloudLearning")
+        }
+
       }
     },
     sadd() {

--
Gitblit v1.9.1