From 4eaafc69d96ad39662e02314f0ea61b53c3b9659 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 16 十二月 2024 14:34:21 +0800
Subject: [PATCH] 教学互动答题完善

---
 packageBookService/pages/bookServices/examination/questionList/index.js               |    6 ++-
 packageBookService/pages/bookServices/examination/components/joinGroupDialog/index.js |    2 
 packageBookService/pages/bookServices/examination/examination.js                      |   59 ++++++++++++++++++++++++-----
 packageBookService/pages/bookServices/detail/components/testResource/testResource.js  |    2 
 packageBookService/pages/bookServices/examination/questionOptions/index.js            |    2 
 pages/scanResult/index.js                                                             |    3 -
 packageBookService/pages/bookServices/detail/index.js                                 |    4 +-
 7 files changed, 58 insertions(+), 20 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/components/testResource/testResource.js b/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
index 201a8dc..d04bac2 100644
--- a/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
+++ b/packageBookService/pages/bookServices/detail/components/testResource/testResource.js
@@ -138,7 +138,7 @@
             this.properties.bookInfo.rootCmsItemId
           }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${
             value.name
-          }&answerType=${"option"}&storeInfo=${this.properties.storeInfo}&jslx=${this.properties.jslx}`,
+          }&answerType=${value.refCode ?? "option"}&storeInfo=${this.properties.storeInfo}&jslx=${this.properties.jslx}`,
         });
       }
     },
diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 8c7fbf8..cbbe71c 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -1173,8 +1173,8 @@
                 jslx: false,
               });
             } else {
-              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' &&
-                item.refCode != 'jsek_interaction')
+              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder')
+              // && item.refCode != 'jsek_interaction'
               that.setData({
                 jslx: true,
               });
diff --git a/packageBookService/pages/bookServices/examination/components/joinGroupDialog/index.js b/packageBookService/pages/bookServices/examination/components/joinGroupDialog/index.js
index 5bd6cdc..e724c1b 100644
--- a/packageBookService/pages/bookServices/examination/components/joinGroupDialog/index.js
+++ b/packageBookService/pages/bookServices/examination/components/joinGroupDialog/index.js
@@ -86,7 +86,7 @@
       } else {
         wx.showToast({
           icon: 'error',
-          title: '璇烽�夋嫨鍔犲叆鐝骇',
+          title: '璇烽�夋嫨鍚庣‘璁�',
         })
       }
     },
diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js
index 4b751df..11a7fd1 100644
--- a/packageBookService/pages/bookServices/examination/examination.js
+++ b/packageBookService/pages/bookServices/examination/examination.js
@@ -2285,6 +2285,7 @@
       filterList: [],
     }
     app.MG.identity.joinedGroupByList(query).then((res) => {
+      console.log('鐝骇淇℃伅', res);
       res.datas.forEach(async item => {
         item.topicId = null
         const data = await this.getTopicInfo(item.id)
@@ -2292,18 +2293,41 @@
           item.topicId = data.id
         }
       })
+
       if (res.datas.length) {
         this.setData({
-          joinGroup: true,
-          classList: res.datas,
+          classList: res.datas
         })
+        // 鍒ゆ柇鐝骇 鏄惁鎵�灞炰簬璇ヤ功
+        const flag = res.datas.some(item => item.linkProductDto.product.id == this.data.bookId)
+        if (!flag) {
+          this.setData({
+            visible: true,
+          })
+        } else {
+          this.setData({
+            visible: false,
+            joinGroup: true
+          })
+        }
       } else {
-        // 鏈姞鍏ョ彮绾э紝鍞よ捣鍔犲叆鐝骇寮圭獥
         this.setData({
-          joinGroup: false,
-          visible: true
+          visible: true,
         })
       }
+
+      // if (res.datas.length) {
+      //   this.setData({
+      //     classList: res.datas,
+      //     visible: true
+      //   })
+      // } else {
+      //   // 鏈姞鍏ョ彮绾э紝鍞よ捣鍔犲叆鐝骇寮圭獥
+      //   this.setData({
+      //     joinGroup: false,
+      //     visible: true
+      //   })
+      // }
     })
   },
   // 鍔犲叆鐝骇
@@ -2358,9 +2382,11 @@
       .then((res) => {
         if (res.length) {
           let value = JSON.parse(res[0].value);
+          const scoreData = value.dataList.find(item => item.name == "瀹㈣棰樺緱鍒�" && item.path == this.data.productLinkPath)
           this.setData({
             submitStatus: value.submitStatus,
             currentIndex: value.currentIndex,
+            subjectiveNum: scoreData ? scoreData.score : 0
           });
           // 鎼哄甫绛旈璁板綍 鑾峰彇棰樼洰
           this.getQuestionList(value.dataList);
@@ -2385,6 +2411,11 @@
         }))
       })
     })
+    list.push({
+      name: "瀹㈣棰樺緱鍒�",
+      score: this.data.subjectiveNum,
+      path: this.data.productLinkPath,
+    })
     console.log('鎻愪氦鏁版嵁', list);
     app.MG.identity
       .setUserKey({
@@ -2402,20 +2433,28 @@
   },
   // 澶勭悊鏁欏浜掑姩绛旈 
   handleClassQuestion() {
-    debugger
+    console.log(1, this.data.questionDataList);
     const flag = this.data.questionDataList.some(item => !item.userAnswer)
     if (flag) {
       // 娌″仛瀹岋紝淇濆瓨鍗冲彲
       const isAnswer = this.data.questionDataList.some(item => item.userAnswer)
       if (isAnswer) this.setinteractionInfo(false)
     } else {
-      // 鍋氬畬浜嗭紝鎻愪氦鍒癿essage
-      this.setinteractionInfo(true)
-      if (this.data.classList.length) {
+      // 鍋氬畬浜嗕笖鍔犲叆浜嗙彮绾э紝鎻愪氦鍒癿essage
+      if (this.data.classList.length && this.data.joinGroup) {
         this.data.classList.forEach(item => {
-          this.newTopicMessage(item.topicId)
+          if (item.linkProductDto.product.id == this.data.bookId)
+            this.newTopicMessage(item.topicId)
         })
+        this.setinteractionInfo(true)
+      } else {
+        // 鍋氬畬浜嗭紝娌″姞鍏ョ彮绾�
+        this.setData({
+          isShowDialog: true
+        })
+        this.setinteractionInfo(false)
       }
+
     }
     this.setData({
       submitStatus: true
diff --git a/packageBookService/pages/bookServices/examination/questionList/index.js b/packageBookService/pages/bookServices/examination/questionList/index.js
index 17e96ec..1669dde 100644
--- a/packageBookService/pages/bookServices/examination/questionList/index.js
+++ b/packageBookService/pages/bookServices/examination/questionList/index.js
@@ -37,8 +37,10 @@
   observers: {},
   detached() {
     if (innerAudioContext) {
-      innerAudioContext.stop();
-      innerAudioContext.destroy();
+      try {
+        innerAudioContext.stop();
+        innerAudioContext.destroy();
+      } catch (error) {}
     }
 
   },
diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.js b/packageBookService/pages/bookServices/examination/questionOptions/index.js
index 47cb7cf..f4c88f8 100644
--- a/packageBookService/pages/bookServices/examination/questionOptions/index.js
+++ b/packageBookService/pages/bookServices/examination/questionOptions/index.js
@@ -75,7 +75,7 @@
   },
   observers: {
     countdownTime: function (newValue, oldValue) {
-      if (this.properties.answerType == "option") {
+      if (this.properties.answerType == "option" || this.properties.answerType == 'interaction') {
         this.setData({
           useTime: this.formatTime(
             2 * 60 * 60 * 1000 - this.properties.countdownTime
diff --git a/pages/scanResult/index.js b/pages/scanResult/index.js
index e9acf13..d9f65b5 100644
--- a/pages/scanResult/index.js
+++ b/pages/scanResult/index.js
@@ -33,14 +33,12 @@
         // this.getRules();
         this.getProductByCode();
       } else {
-        debugger
         this.setData({
           isOther: true
         })
       }
     } catch (error) {
       console.log(error);
-      debugger
       this.setData({
         isOther: true
       })
@@ -165,7 +163,6 @@
             const list = JSON.parse(res.config);
             console.log('code', res, list);
             if (this.data.result) {
-
               const type = res.saleMethodList[0].type
               this.setData({
                 goodsData: res,

--
Gitblit v1.9.1