From 232e4dcf0fc80bdcfff1bdf45431e67c25831fb6 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期五, 28 六月 2024 13:03:24 +0800
Subject: [PATCH] erweima

---
 pages/index/resourceCover.js                                                         |   14 ++-----
 packageBookService/pages/bookServices/detail/components/testResource/testResource.js |   65 +++++++++++++++++++-------------
 packageBookService/pages/bookServices/detail/index.wxml                              |    2 
 3 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/components/testResource/testResource.js b/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
index 3bcfb6a..09b18ad 100644
--- a/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
+++ b/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
@@ -25,6 +25,10 @@
       type: Object,
       value: {},
     },
+    storeInfo: {
+      type: String,
+      value: "",
+    },
   },
 
   /**
@@ -53,7 +57,7 @@
       })
     },
     async goTest(e) {
-      console.log(e, 666)
+      console.log(e.detail.value.item, 666)
       const value = e.detail.value.item;
       const token = wx.getStorageSync("jsek-token");
       if (!token) {
@@ -69,32 +73,41 @@
       });
       // 鑾峰彇绔犺妭涓嬫槸鍚︽湁棰樼洰
       let idPathList = [];
-      let query = {
-        path: "*",
-        queryType: "*",
-        productId: this.properties.bookInfo.id,
-        cmsPath: value.productLinkPath,
-        pading: {
-          start: 0,
-          size: 999,
-        },
-      };
-      if (value.childrenFolderCount == 0) {
-        wx.hideLoading();
-        return wx.showToast({
-          icon: "error",
-          title: "鏆傛棤鏁版嵁",
-        });
+      if (this.properties.storeInfo) {
+        idPathList.push({
+          id: this.properties.bookInfo.id,
+          name: this.properties.bookInfo.name,
+          productLinkPath: value.productLinkPath,
+          type: value.type,
+        })
       } else {
-        const res = await app.MG.store.getProductDetail(query);
-        res.datas.cmsDatas[0].datas.forEach((item) => {
-          idPathList.push({
-            id: item.id,
-            name: item.name,
-            productLinkPath: item.productLinkPath,
-            type: item.type,
+        let query = {
+          path: "*",
+          queryType: "*",
+          productId: this.properties.bookInfo.id,
+          cmsPath: value.productLinkPath,
+          pading: {
+            start: 0,
+            size: 999,
+          },
+        };
+        if (value.childrenFolderCount == 0) {
+          wx.hideLoading();
+          return wx.showToast({
+            icon: "error",
+            title: "鏆傛棤鏁版嵁",
           });
-        });
+        } else {
+          const res = await app.MG.store.getProductDetail(query);
+          res.datas.cmsDatas[0].datas.forEach((item) => {
+            idPathList.push({
+              id: item.id,
+              name: item.name,
+              productLinkPath: item.productLinkPath,
+              type: item.type,
+            });
+          });
+        }
       }
       wx.hideLoading();
       wx.navigateTo({
@@ -104,7 +117,7 @@
           this.properties.bookInfo.rootCmsItemId
         }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${
           value.name
-        }&answerType=${"option"}`,
+        }&answerType=${"option"}&storeInfo=${this.properties.storeInfo}`,
       });
     },
     goMycollect(e) {
diff --git a/packageBookService/pages/bookServices/detail/index.wxml b/packageBookService/pages/bookServices/detail/index.wxml
index e4f2ca0..1337015 100644
--- a/packageBookService/pages/bookServices/detail/index.wxml
+++ b/packageBookService/pages/bookServices/detail/index.wxml
@@ -154,7 +154,7 @@
           </t-tab-panel>
           <t-tab-panel label="浜戞祴璇�" icon="{{tabValue == 'questionBank' ? testResourceClickIocn : testResourceIocn}}" value="questionBank" style="{{tabPanelstyle}}">
             <view wx:if="{{!loading}}">
-              <test-resource id="test-resource" list="{{test}}" bookInfo="{{bookDetail}}" openIds="{{openLearnids}}" mockData="{{mockData}}" tab="{{tabValue}}" bind:buyMock="buyMock"></test-resource>
+              <test-resource id="test-resource" list="{{test}}" bookInfo="{{bookDetail}}" openIds="{{openLearnids}}" mockData="{{mockData}}" tab="{{tabValue}}" storeInfo="{{options.storeInfo}}" bind:buyMock="buyMock"></test-resource>
             </view>
           </t-tab-panel>
           <t-tab-panel label="浜戠瑪璁�" icon="{{tabValue == 'jsek_note' ? noteClickIcon: noteIcon}}" value="jsek_note" style="{{tabPanelstyle}}">
diff --git a/pages/index/resourceCover.js b/pages/index/resourceCover.js
index 22d3fb3..715c6bd 100644
--- a/pages/index/resourceCover.js
+++ b/pages/index/resourceCover.js
@@ -112,18 +112,12 @@
           "/file/api/ApiDownload?md5=" +
           book.freeFile;
         console.log(fileLink, "fileLink");
+        // wx.redirectTo({
+        //   url: "/packageBookService/pages/bookServices/webView/index?url=" + fileLink
+        // });
         //鎻愮ず鍔犺浇涓�
         // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB
-        wx.downloadFile({
-          url: fileLink,
-          filePath: wx.env.USER_DATA_PATH + `/${book.name}.${book.selectType}`,
-          success: function (res) {
-            console.log(res, "wx.downloadFile success res");
-            if (res.statusCode != 200) {
-              return false;
-            }
-          }
-        });
+
       }
     })
   },

--
Gitblit v1.9.1