From af2e38d1d72633d03afdb6e75f8d30b7ef0d0aee Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 29 七月 2024 15:24:30 +0800
Subject: [PATCH] 图书详情页添加对云学习目录整体购买的判断

---
 pages/index/resourceCover.js |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/pages/index/resourceCover.js b/pages/index/resourceCover.js
index 683ad99..de4f902 100644
--- a/pages/index/resourceCover.js
+++ b/pages/index/resourceCover.js
@@ -1,5 +1,8 @@
 // pages/index/resourceCover.js
 const app = getApp()
+import {
+  loginInfo
+} from '../../assets/js/login';
 Page({
 
   /**
@@ -20,9 +23,22 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad(options) {
-    if (options.scene) {
-      this.getBookInfo(options.scene)
+    const token = wx.getStorageSync(app.config.tokenKey)
+    if (!token) {
+      loginInfo(app, (data) => {
+        // 濡傛灉涓嶆槸绗竴娆$櫥褰曪紝浼氭墽琛屽洖璋�
+        if (data) {
+          if (options.scene) {
+            this.getBookInfo(options.scene)
+          }
+        }
+      })
+    } else {
+      if (options.scene) {
+        this.getBookInfo(options.scene)
+      }
     }
+
   },
 
   /**
@@ -41,8 +57,8 @@
 
   getBookInfo(refcode) {
     const obj = {
-      storeInfo: app.config.jslx,
-      path: app.config.jslx,
+      storeInfo: app.config.goodsStore,
+      path: app.config.goodsStore,
       queryType: 'ProductCmsItem',
       SysType: "CmsItem",
       RefCode: refcode,
@@ -92,7 +108,7 @@
         formPath: book.learnSelectType ? 'jsek_cloudLearning' : ''
       })
       wx.redirectTo({
-        url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&activeId=${book.id}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&storeInfo=${book.storeInfo}&formPath=${this.data.formPath}`,
+        url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&activeId=${book.id}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&formPath=${this.data.formPath}`,
       });
 
       if (book.selectType == "pdf" || book.selectType == 'document') {

--
Gitblit v1.9.1