From 338ad19ee45b5380a0d8433cbbce2a727a576dfa Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期五, 19 四月 2024 17:34:36 +0800
Subject: [PATCH] bug2

---
 packageBookService/pages/bookServices/detail/index.js |   92 ++++++++++++++++++++++++++-------------------
 1 files changed, 53 insertions(+), 39 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 58289fc..ff204b8 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -148,7 +148,9 @@
       }, {
         width: '100%'
       },
-    ]
+    ],
+    showIndex: '',
+    successOrderNumber: ''
   },
 
   resetTree: function (e) {
@@ -176,6 +178,9 @@
         name: options.name,
       },
     });
+    wx.setNavigationBarTitle({
+      title: options.name,
+    })
     this.getBookInfo(options.id);
     this.getResourceClass(); // 鑾峰彇璧勬簮鎵�灞炲垎绫�
     const token = wx.getStorageSync(app.config.tokenKey);
@@ -374,10 +379,10 @@
       },
     };
     app.MG.store.getProductDetail(query).then(async (res) => {
+      console.log(res.datas, 'res.datas');
       this.setData({
         bookDetail: res.datas,
         buyIdList: res.datas.purchasedSaleMethodIdList,
-
       });
       if (res.datas.cmsDatas && res.datas.cmsDatas.length) {
         this.setData({
@@ -517,6 +522,7 @@
           this.setData({
             noFile: true,
           });
+          // debugger
           if (this.data.bookDetail.pdf) {
             this.setData({
               "fileInfo.bookName": this.data.bookDetail.name,
@@ -525,6 +531,7 @@
               "fileInfo.freePage": this.data.bookDetail.probationPage,
             });
           } else if (this.data.bookDetail.protectedEpub) {
+
             this.setData({
               "fileInfo.bookName": this.data.bookDetail.name,
               "fileInfo.fileType": "epub",
@@ -626,24 +633,11 @@
     // 妫�鏌ョ櫥褰曠姸鎬�
     const token = wx.getStorageSync(app.config.tokenKey);
     const child = this.selectComponent("#suggest-component");
-    if (!token) {
-      wx.showLoading({
-        title: "鍔犺浇涓�",
-      });
-      loginInfo(app, (data) => {
-        // 濡傛灉涓嶆槸绗竴娆$櫥褰曪紝浼氭墽琛屽洖璋�
-        if (data) {
-          // 鐧诲綍鎴愬姛锛岃嚜鍔ㄨ褰晅oken鍜岀敤鎴蜂俊鎭紝骞惰繑鍥瀟rue
-          child.showDialog();
-          wx.hideLoading();
-        } else {
-          // 鍑虹幇閿欒锛岃繑鍥瀎alse
-        }
-      });
-    } else {
-      // 濡傛灉鏄涓�娆$櫥褰曪紝浼氳烦杞嚦缁戝畾鐢ㄦ埛淇℃伅椤甸潰锛屽~鍐欏畬鐢ㄦ埛淇℃伅鍚庤繘琛岀櫥褰曞苟鍌ㄥ瓨token鍜岀敤鎴蜂俊鎭紝缁撴潫鍚庤烦杞洖褰撳墠椤甸潰锛堟惡甯﹂〉闈㈠弬鏁帮級
-      child.showDialog();
-    }
+    if (token)
+      // child.showDialog();
+      this.setData({
+        showIndex: '1'
+      })
   },
   // 璺宠浆缃戝簵
   goShop(e) {
@@ -683,6 +677,9 @@
           (e.detail.value == "jsek_cloudLearning" && !this.data.learn.length) ||
           (e.detail.value == "questionBank" && !this.data.test.length)
         ) {
+          if (e.detail.value == "jsek_teachingResources") {
+            wx.setStorageSync('teachResourcesPath', checkData.productLinkPath)
+          }
           this.getResourceData(checkData);
         }
         if (e.detail.value == "questionBank" && token) this.getMockData();
@@ -801,6 +798,7 @@
                 openLearnids: result,
               });
             }
+            console.log(list, '浜戝缈�789');
           } else {
             // 鏃犳暟鎹�
           }
@@ -904,29 +902,29 @@
   },
   // 鑾峰彇灞曞紑椤�
   findChildIds(data, result) {
-    let index = 0;
+    let index = 0
     for (let i = 0; i < data.length; i++) {
       if (index < 3) {
-        const item = data[i];
-        if (item.children && item.children.length > 0) {
-          result.push(item.id);
+        const item = data[i]
+        if (item.childrenFolderCount > 0) {
+          result.push(item.id)
           for (let j = 0; j < item.children.length; j++) {
             if (index < 3) {
-              const childrenItme = item.children[j];
-              if (item.children && item.children.length > 0) {
-                result.push(childrenItme.id);
-                index += 1;
+              const childrenItme = item.children[j]
+              if (item.childrenCount > 0) {
+                result.push(childrenItme.id)
+                index += 1
               }
             } else {
-              break;
+              break
             }
           }
-        } else if (item.children && item.children.length > 0) {
-          result.push(item.id);
-          index += 1;
+        } else if (item.childrenCount > 0) {
+          result.push(item.id)
+          index += 1
         }
       } else {
-        break;
+        break
       }
     }
   },
@@ -1113,12 +1111,13 @@
   },
   // 鐢宠鏁欏璧勬簮
   applyResource() {
-    if (this.data.applyResourceState) {
-      return wx.showToast({
-        icon: "error",
-        title: "璇峰嬁閲嶅鐐瑰嚮",
-      });
-    }
+
+    // if (this.data.applyResourceState) {
+    //   return wx.showToast({
+    //     icon: "error",
+    //     title: "璇峰嬁閲嶅鐐瑰嚮",
+    //   });
+    // }
     this.setData({
       applyResourceState: true,
     });
@@ -1476,12 +1475,21 @@
         };
         // 纭璁㈠崟
         const confirmOrderRes = await app.MG.store.confirmOrder(parameter);
+        console.log(confirmOrderRes.orderNumber, 'confirmOrderRes.orderNumber');
+
+
+
         if (confirmOrderRes.orderNumber) {
           child.changeReceive(false);
           wx.showToast({
             title: "棰嗗彇鎴愬姛",
           });
           this.getBookInfo(this.data.bookId);
+          this.setData({
+            successOrderNumber: confirmOrderRes.orderNumber
+          })
+
+
         }
       } catch (error) {
         console.log(error);
@@ -1764,6 +1772,10 @@
     }
 
     wx.setStorageSync("bookPathList", JSON.stringify(bookPathList));
+    this.setData({
+      learn: [],
+      teach: []
+    })
     this.onLoad({
       id: e.detail.id,
       name: e.detail.name,
@@ -1790,6 +1802,8 @@
       });
       return false;
     }
+
+    // debugger
     wx.navigateTo({
       url: "/packageBookService/pages/components/webView/index?md5=" +
         this.data.fileInfo.md5 +

--
Gitblit v1.9.1