From e2bf73079051769b7b7cdc9627fc32ce64226144 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期二, 08 七月 2025 15:21:36 +0800
Subject: [PATCH] 量表修改

---
 packageBookService/pages/psychologyAnswer/psychologyAnswer.js                        |   75 +++++++++++++++++++++++++++++--------
 packageBookService/pages/bookServices/detail/components/testResource/testResource.js |   11 +++--
 assets/js/middleGround/api/file.js                                                   |    8 ++++
 packageDomain/pages/resourceDetails/myVideo/index.js                                 |   18 ++++++---
 packageBookService/pages/bookServices/detail/index.js                                |    2 
 project.config.json                                                                  |    2 
 packageBookService/pages/bookServices/detail/components/testTree/index.js            |    1 
 7 files changed, 88 insertions(+), 29 deletions(-)

diff --git a/assets/js/middleGround/api/file.js b/assets/js/middleGround/api/file.js
index 4339689..1dc4075 100644
--- a/assets/js/middleGround/api/file.js
+++ b/assets/js/middleGround/api/file.js
@@ -92,6 +92,14 @@
       method: 'post',
       data
     })
+  },
+  // 妫�鏌msItem 鏉冮檺
+  checkCmsItem(data) {
+    return request({
+      url: '/file/api/ApiCheckCmsItemAccessRights',
+      method: 'post',
+      data
+    })
   }
 }
 
diff --git a/packageBookService/pages/bookServices/detail/components/testResource/testResource.js b/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
index b23e79d..97ead59 100644
--- a/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
+++ b/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
@@ -82,10 +82,10 @@
           },
         });
       }
-      if (!this.data.isBuyBank) return wx.showToast({
-        icon: 'error',
-        title: '璇峰厛璐拱棰樺簱',
-      })
+      // if (!this.data.isBuyBank) return wx.showToast({
+      //   icon: 'error',
+      //   title: '璇峰厛璐拱棰樺簱',
+      // })
       wx.showLoading({
         title: "鍔犺浇涓�",
       });
@@ -130,10 +130,11 @@
       wx.hideLoading();
       if (value.refCode == "psychology") {
         const listName = value.name
+        const listId = value.id
         wx.navigateTo({
           url: `/packageBookService/pages/psychologyAnswer/psychologyAnswer?listName=${
             listName
-        }`
+        }&listId=${listId}`
         })
       } else {
         wx.navigateTo({
diff --git a/packageBookService/pages/bookServices/detail/components/testTree/index.js b/packageBookService/pages/bookServices/detail/components/testTree/index.js
index 2f55bc2..a78bb5c 100644
--- a/packageBookService/pages/bookServices/detail/components/testTree/index.js
+++ b/packageBookService/pages/bookServices/detail/components/testTree/index.js
@@ -33,6 +33,7 @@
         openIds: e.detail.value,
       });
     },
+
     goTest(e) {
       const value = e.currentTarget.dataset;
       var myEventDetail = {
diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index f25d147..2d67d09 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -1230,7 +1230,7 @@
               });
             }
             if (data.length > 0) {
-              console.log('data', data);
+              console.log('data01', data);
               let list = []
               that.getTreeList(data, list, query.cmsPath)
               list = that.ensureTreeConsistency(list)
diff --git a/packageBookService/pages/psychologyAnswer/psychologyAnswer.js b/packageBookService/pages/psychologyAnswer/psychologyAnswer.js
index 02f47f5..f7322cf 100644
--- a/packageBookService/pages/psychologyAnswer/psychologyAnswer.js
+++ b/packageBookService/pages/psychologyAnswer/psychologyAnswer.js
@@ -9,6 +9,7 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    isBuy: false, // 鏄惁闇�瑕佽喘涔�
     questuionName: "", //璇曞嵎鍚嶇О
     dataList: "",
     barHeight: "",
@@ -37,28 +38,70 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad(options) {
-    const questuionName = options.listName
-    this.setData({
-      questuionName: questuionName
-    })
-    const systInfo = wx.getSystemInfoSync();
-    const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
-    const navBarHeight =
-      (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
-    const token = wx.getStorageSync(app.config.tokenKey)
-    if (!token) {
-      loginInfo(app, (data) => {
-        if (data) {
-          this.init();
+    // 鍦ㄦ杩涜鏄惁璐拱鐨勬煡璇�
+    const questionId = options.listId;
+    const query = {
+      "cmsItemId": Number(questionId)
+    };
+
+    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.switchTab({
+                  url: '/pages/home/home', // 鏇挎崲涓轰綘鐨勯椤佃矾寰�
+                });
+              }
+            }
+          });
+          return; // 鐩存帴杩斿洖锛岄伩鍏嶆墽琛屽悗缁唬鐮�
+        }
+
+        // 鍏朵粬閫昏緫
+        const questuionName = options.listName;
+        this.setData({
+          questionName: questuionName
+        });
+
+        const systInfo = wx.getSystemInfoSync();
+        const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
+        const navBarHeight =
+          (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
+
+        const token = wx.getStorageSync(app.config.tokenKey);
+        if (!token) {
+          loginInfo(app, (data) => {
+            if (data) {
+              this.init();
+            } else {
+              this.init();
+            }
+          });
         } else {
           this.init();
         }
       })
-    } else {
-      this.init()
-    }
+      .catch((err) => {
+        console.error('妫�鏌ラ搴撳け璐�:', err);
+        wx.showToast({
+          icon: 'error',
+          title: '鍔犺浇澶辫触锛岃閲嶈瘯'
+        });
+      });
   },
 
+
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
    */
diff --git a/packageDomain/pages/resourceDetails/myVideo/index.js b/packageDomain/pages/resourceDetails/myVideo/index.js
index 4b9da84..54aadc5 100644
--- a/packageDomain/pages/resourceDetails/myVideo/index.js
+++ b/packageDomain/pages/resourceDetails/myVideo/index.js
@@ -458,12 +458,18 @@
           }
         });
       } else {
-        wx.showToast({
-          icon: 'none',
-          title: '璇峰厛杩斿洖璧勬簮鎵�鍦ㄥ浘涔﹁鎯呰喘涔拌棰戣祫婧�',
-        })
-        wx.navigateTo({
-          url: `/packageBookService/pages/bookServices/detail/index?id=${this.data.bookDetail.id}&name=${this.data.bookDetail.name}&tabValue=${this.data.formPath}`,
+        wx.showModal({
+          title: '娓╅Θ鎻愮ず',
+          content: '璇峰厛杩斿洖璧勬簮鎵�鍦ㄥ浘涔﹁鎯呰喘涔拌棰戣祫婧�',
+          confirmText: '纭畾',
+          showCancel: false, // 鍏抽棴鍙栨秷鎸夐挳
+          success: function (res) {
+            if (res.confirm) {
+              wx.navigateTo({
+                url: `/packageBookService/pages/bookServices/detail/index?id=${this.data.bookDetail.id}&name=${this.data.bookDetail.name}&tabValue=${this.data.formPath}`,
+              });
+            }
+          }
         });
       }
       this.setData({
diff --git a/project.config.json b/project.config.json
index 81cebec..eded02d 100644
--- a/project.config.json
+++ b/project.config.json
@@ -136,6 +136,6 @@
     "include": []
   },
   "appid": "wx7f362fe7cb6e0d1f",
-  "libVersion": "3.6.3",
+  "libVersion": "3.8.10",
   "projectname": "jsek-applet"
 }
\ No newline at end of file

--
Gitblit v1.9.1