From c192e381734b9caf173c90bb9141dff0326785ee Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期四, 17 七月 2025 14:20:11 +0800
Subject: [PATCH] 京师智教小程序的专题活动模块      不做点击进入页面提示复制链接       点击时直接提示“请移步PC端查看”

---
 packageBookService/pages/psychologyAnswer/psychologyAnswer.js |   85 ++++++++++++++++++++++++++----------------
 1 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/packageBookService/pages/psychologyAnswer/psychologyAnswer.js b/packageBookService/pages/psychologyAnswer/psychologyAnswer.js
index 8911ba3..77d6c63 100644
--- a/packageBookService/pages/psychologyAnswer/psychologyAnswer.js
+++ b/packageBookService/pages/psychologyAnswer/psychologyAnswer.js
@@ -56,46 +56,65 @@
         }
       }
       const indexof = listIndex
-      const questionId = questionList[indexof].id;
+      const idPath = questionList[indexof].idPath;
       const bookId = questionList[indexof].bookId;
       const bookName = "澶у鐢熷績鐞嗗仴搴凤紙绗�3鐗堬級锛堣瀺濯掍綋鐗堬級"
       const formPath = "questionBank"
+      // 杩涜澶勭悊
       const query = {
-        "cmsItemId": Number(questionId)
+        path: "*",
+        queryType: "*",
+        productId: bookId,
+        cmsPath: "161796",
+        cmsType: "*"
       };
-      app.MG.file.checkCmsItem(query)
-        .then((res) => {
-          const isBuys = res;
-          this.setData({
-            isBuy: isBuys
-          });
-          if (!isBuys) {
-            wx.showModal({
-              icon: 'error',
-              title: '娓╅Θ鎻愮ず',
-              content: '璇疯喘涔伴搴擄紝鍗冲皢杩斿洖璐拱椤�',
-              confirmText: '纭畾',
-              showCancel: false, // 鍏抽棴鍙栨秷鎸夐挳
-              success: function (res) {
-                if (res.confirm) {
-                  wx.navigateTo({
-                    url: '/packageBookService/pages/bookServices/detail/index?id=' + bookId + '&name=' + bookName + '&tabValue=' + formPath,
-                  })
-                }
-              }
-            });
-            return; // 鐩存帴杩斿洖锛岄伩鍏嶆墽琛屽悗缁唬鐮�
+      app.MG.store.getProductDetail(query).then(async (res) => {
+        const linkPathList = res.datas.cmsDatas[0].datas
+        const isBuyList = res.datas.purchasedSaleMethodIdList
+        let isBuy = false
+        const idParhList = idPath.split("/").reverse()
+        for (let index = 0; index < idParhList.length; index++) {
+          const item = idParhList[index];
+          const thisItem = linkPathList.find(citem => item == citem.id);
+          if (thisItem.saleMethod.length > 0) {
+            if (isBuyList.includes(thisItem.saleMethod[0].Id) || thisItem.saleMethod[0].Price == 0) {
+              isBuy = true
+              break
+            } else {
+              isBuy = false
+              break
+            }
           }
-          // 鍏朵粬閫昏緫
-          this.initialize()
-        })
-        .catch((err) => {
-          console.error('妫�鏌ラ搴撳け璐�:', err);
-          wx.showToast({
-            icon: 'error',
-            title: '鍔犺浇澶辫触锛岃閲嶈瘯'
-          });
+        }
+        this.setData({
+          isBuy: isBuy
         });
+        if (!isBuy) {
+          wx.showModal({
+            icon: 'error',
+            title: '娓╅Θ鎻愮ず',
+            content: '璇疯喘涔伴搴擄紝鍗冲皢杩斿洖璐拱椤�',
+            confirmText: '纭畾',
+            showCancel: false, // 鍏抽棴鍙栨秷鎸夐挳
+            success: function (res) {
+              if (res.confirm) {
+                wx.navigateTo({
+                  url: '/packageBookService/pages/bookServices/detail/index?id=' + bookId + '&name=' + bookName + '&tabValue=' + formPath,
+                })
+              }
+            }
+          });
+          return; // 鐩存帴杩斿洖锛岄伩鍏嶆墽琛屽悗缁唬鐮�
+        }
+        // 鍏朵粬閫昏緫
+        this.initialize()
+      }).catch((err) => {
+        console.error('妫�鏌ラ搴撳け璐�:', err);
+        wx.showToast({
+          icon: 'error',
+          title: '鍔犺浇澶辫触锛岃閲嶈瘯'
+        });
+      });
     }
   },
 

--
Gitblit v1.9.1