From 3baf9a943cdf11d4cdfb52b3756458529d0dcf2a Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 21 三月 2024 14:35:01 +0800
Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master

---
 packageBookService/pages/bookServices/detail/index.js |   51 ++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 6c00c0f..7addb7f 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -52,7 +52,8 @@
       mockList: [] // 鐢ㄦ埛缁勫嵎鎻愪氦淇℃伅
     },
     flag: true,
-    applyResourceLoading: false
+    applyResourceLoading: false,
+    noResources: false
   },
 
 
@@ -344,7 +345,8 @@
   },
   onTabsChange(e) {
     this.setData({
-      tabValue: e.detail.value
+      tabValue: e.detail.value,
+      noResources: false
     })
     if (e.detail.label == '鏁欏璧勬簮' || e.detail.label == '浜戝涔�' || e.detail.label == '浜戞祴璇�') {
       const checkData = this.data.cmsDatas.find(item => item.refCode == e.detail.value)
@@ -354,7 +356,10 @@
           || (e.detail.value == 'questionBank' && !this.data.test.length)) {
           this.getResourceData(checkData)
         }
-
+      } else {
+        this.setData({
+          noResources: true
+        })
       }
     } else if (e.detail.label == '浜戠瑪璁�') {
       const token = wx.getStorageSync('jsek-token')
@@ -381,7 +386,8 @@
   //  鑾峰彇鏁欏璧勬簮  浜戝涔�  浜戞祴璇�
   getResourceData(type) {
     this.setData({
-      loading: true
+      loading: true,
+      noResources: false
     })
     let query = {
       path: '*',
@@ -408,6 +414,12 @@
     app.MG.store
       .getProductDetail(query)
       .then(async (res) => {
+        if (!res.datas.cmsDatas[0].datas.length) {
+          return this.setData({
+            noResources: true,
+            loading: false
+          })
+        }
         // 浜戞祴璇曪紝閫掑綊璇锋眰閲屽眰鏁版嵁
         if (type.refCode == 'questionBank') {
           const data = res.datas.cmsDatas[0].datas.filter(
@@ -427,14 +439,12 @@
                 teach: list,
                 loading: false
               })
-              console.log('鏁欏璧勬簮', this.data.teach);
               this.findChildIds(this.data.teach, this.data.openTeachids = [])
             } else if (type.refCode == 'jsek_cloudLearning') {
-              // res.datas.cmsDatas[0].datas.forEach(item => {
-              //   item.checked = false
-              // })
-              // const list = await this.getAllResource(res.datas.cmsDatas[0].datas)
-              console.log(list, 'currentlist');
+              res.datas.cmsDatas[0].datas.forEach(item => {
+                item.checked = false
+              })
+              const list = await this.getAllResource(res.datas.cmsDatas[0].datas)
               this.setData({
                 learn: list,
                 loading: false
@@ -557,6 +567,17 @@
 
   // 鍥句功娣诲姞璐墿杞�
   async addBookShopcCar() {
+
+    const token = wx.getStorageSync('jsek-token')
+    if (!token) {
+      return wx.getUserProfile({
+        desc: '鐢ㄦ埛鐧诲綍',
+        success: (res) => {
+          console.log(res);
+        }
+      })
+    }
+
     const shoppingCartGetId = []
 
     let query = {
@@ -1155,7 +1176,6 @@
         })
         res = await app.MG.store.initOrder(query)
       }
-
       if (res.orderNumber && this.data.mockData.price) {
         wx.navigateTo({
           url: `/pages/cart/paymentPage/index?orderNumber=${res.orderNumber}`,
@@ -1206,11 +1226,16 @@
       this.buyBook()
     }
     else if (this.data.tabValue == 'jsek_cloudLearning') {
-      console.log('浜戝涔�');
+      const tree = this.selectComponent('#tree')
+
+      tree.onCloudShoppingCart()
+
+
     } else if (this.data.tabValue == 'questionBank') {
       this.buyMock()
     } else {
       console.log(this.data.tabValue);
     }
-  }
+  },
+
 })

--
Gitblit v1.9.1