From f4e7324c27b7c6ecb824029e22a13541c5033ade Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期一, 22 七月 2024 16:07:56 +0800
Subject: [PATCH] ceshi

---
 packageBookService/pages/bookServices/detail/index.js |   59 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index d0fa544..94b0dc2 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -35,6 +35,7 @@
     teach: [],
     learn: [],
     test: [],
+    jslx: true,
     openTeachids: [],
     openLearnids: [],
     openTestids: [],
@@ -154,7 +155,8 @@
     ],
     showIndex: '',
     successOrderNumber: '',
-    applicationState: '' // 鐢靛瓙鏍蜂功鐢宠鐘舵��
+    applicationState: '', // 鐢靛瓙鏍蜂功鐢宠鐘舵��
+
   },
 
   resetTree: function (e) {
@@ -385,7 +387,6 @@
       },
     };
     app.MG.store.getProductDetail(query).then(async (res) => {
-      console.log(res.datas, 'res.datas');
       this.setData({
         bookDetail: res.datas,
         buyIdList: res.datas.purchasedSaleMethodIdList,
@@ -457,7 +458,6 @@
         ),
 
       });
-      console.log("鍥句功淇℃伅", this.data.bookClass);
     });
   },
   //璇锋眰瀛愬晢鍝佺殑鏂囦欢
@@ -658,8 +658,6 @@
       this.setData({
         showIndex: '1'
       })
-    console.log(this.data.bookDetail.icon, '0111111');
-    console.log(this.data.bookDetail.name, '45688');
   },
   // 璺宠浆缃戝簵
   goShop(e) {
@@ -977,15 +975,16 @@
   },
   //  鑾峰彇 浜戞祴璇�
   getResourceData(type) {
-    this.setData({
+    var that = this
+    that.setData({
       loading: true,
       noResources: false,
     });
     let query = {
       path: "*",
       queryType: "*",
-      storeInfo: this.data.options.storeInfo,
-      productId: this.data.bookDetail.id,
+      storeInfo: that.data.options.storeInfo,
+      productId: that.data.bookDetail.id,
       cmsPath: type.productLinkPath,
       cmsType: '*',
       itemFields: {
@@ -1012,38 +1011,57 @@
         if (type.refCode == "questionBank") {
           let data = []
           let result = [];
-          if (this.data.options.storeInfo == 'jsek_jslx') {
+          const isTSFW = res.datas.cmsDatas[0].datas.filter(
+            (item) =>
+            item.type == 'questionBankFolder' &&
+            (item.name == '濉┖棰�' ||
+              item.name == '鍒ゆ柇棰�' ||
+              item.name == '鍗曢�夐' ||
+              item.name == '澶氶�夐' ||
+              item.name == '绠�绛旈')
+          )
+          if (that.data.options.storeInfo == 'jsek_jslx') {
             data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder');
             if (data.length > 0) {
-              this.setData({
+              that.setData({
                 test: data,
                 loading: false,
                 openTeachids: result,
               });
             } else {
-              this.setData({
+              that.setData({
                 noResources: true,
                 loading: false,
               });
             }
           } else {
-            data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0);
+            if (isTSFW.length > 0) {
+              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0)
+              that.setData({
+                jslx: false,
+              });
+            } else {
+              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder')
+              that.setData({
+                jslx: true,
+              });
+            }
             if (data.length > 0) {
               let list = []
               // 娴嬭瘯 6浣�// 姝e紡 5浣�//  娴嬭瘯璋冪敤浼�20锛屽唴閮�7  姝e紡璋冪敤浼�17 鍐呴儴浼�6
 
               const addNum = query.cmsPath.length > 10 ? 7 : query.cmsPath.length > 14 ? 8 : 6
               const num = query.cmsPath.length + addNum
-              this.getTreeList(data, num, list, '\\', addNum)
-              list = this.ensureTreeConsistency(list)
-              this.findChildIds(list[0].children, result);
-              this.setData({
-                test: list[0].children,
+              that.getTreeList(data, num, list, '\\', addNum)
+              list = that.ensureTreeConsistency(list)
+              that.findChildIds(list[0].children, result);
+              that.setData({
+                test: list.length == 1 && list[0].name == '棰樺簱' ? list[0].children : list,
                 loading: false,
                 openTeachids: result,
               });
             } else {
-              this.setData({
+              that.setData({
                 noResources: true,
                 loading: false,
               });
@@ -1265,9 +1283,7 @@
             url,
           });
         }
-      } else {
-        console.log(222);
-      }
+      } else {}
     } else {
       wx.showToast({
         title: "鍟嗗搧涓嶅湪鏈夋晥鏈�",
@@ -2228,7 +2244,6 @@
             });
             return false;
           } else if (isApply.state == 'Normal') {
-            console.log(isApply.state, "isApply.state")
             const flag = new Date(isApply.feedBack.endDate + ' 23:59:59').getTime() > new Date().getTime()
             if (flag) {
               wx.showToast({

--
Gitblit v1.9.1