From f6088ce5e3086edc3bd669265f07c7624475d0f7 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期五, 01 八月 2025 14:35:32 +0800
Subject: [PATCH] 优化提示语,填空题渲染,不再加入班级

---
 packageBookService/pages/bookServices/examination/examination.js |   71 +++++++++++++++++++++++++----------
 1 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js
index 2bee062..740c2c2 100644
--- a/packageBookService/pages/bookServices/examination/examination.js
+++ b/packageBookService/pages/bookServices/examination/examination.js
@@ -649,7 +649,7 @@
     const saleData = res.datas.saleMethod.find(item => item.Name.includes('棰樺簱'))
     if (saleData && !res.datas.purchasedSaleMethodIdList.includes(saleData.Id)) return wx.showModal({
       title: '鎻愮ず',
-      content: '璇峰厛璐拱棰樺簱鍐嶇瓟棰�',
+      content: '璇峰厛婵�娲绘垨璐拱棰樺簱鍐嶇瓟棰�',
       confirmColor: "#ff6c00",
       cancelColor: "#949494",
       editable: false, //鏄惁鏄剧ず杈撳叆妗�
@@ -951,14 +951,15 @@
           let oldObj = "";
           if (oldList)
             oldObj = oldList.find((oldItem) => oldItem.id == item.id);
+          // console.log(item.Embedded_QuestionBank_Stem, 111)
           let questionObj = {
             // num: index, // 棰樺彿
             id: item.id,
             type: pathitem.name,
-            stem: item.Embedded_QuestionBank_QuestionType == "completion" ?
+            stem: item.Embedded_QuestionBank_Stem ? item.Embedded_QuestionBank_QuestionType == "completion" ?
               JSON.parse(item.Embedded_QuestionBank_Stem)
               .stemTxt.replaceAll("<vacancy>", ",input,")
-              .split(",") : JSON.parse(item.Embedded_QuestionBank_Stem), // 棰樺共
+              .split(",") : JSON.parse(item.Embedded_QuestionBank_Stem) : '-', // 棰樺共
             answer: item.Embedded_QuestionBank_Answer, // 绛旀
             option: item.Embedded_QuestionBank_Option ?
               JSON.parse(item.Embedded_QuestionBank_Option) : "", // 閫夋嫨棰橀�夐」
@@ -991,18 +992,37 @@
           }
           // 濉┖棰樻敼閫�
           if (questionObj.questionType == "completion") {
+            let c = [];
             let index = 0;
             for (let i = 0; i < questionObj.stem.length; i++) {
               const item = questionObj.stem[i];
-              if (item == "input") {
-                questionObj.stem[i] = {
-                  num: index,
-                  data: "input",
-                };
+              if (item != 'input') {
+                item.split("").map(citem => {
+                  const obj = {
+                    type: 'txt',
+                    text: citem
+                  }
+                  c.push(obj)
+                })
+              } else {
+                const obj = {
+                  type: "input",
+                  num: index
+                }
                 if (!oldObj) questionObj.userAnswer[index] = "";
                 index++;
+                c.push(obj)
               }
+              // if (item == "input") {
+              //   questionObj.stem[i] = {
+              //     num: index,
+              //     data: "input",
+              //   };
+              //   if (!oldObj) questionObj.userAnswer[index] = "";
+              //   index++;
+              // }
             }
+            questionObj.customArr = c;
           }
           // 棰樺共瀵屾枃鏈鐞�
           if (questionObj.stemStyle == "RichText") {
@@ -1487,7 +1507,7 @@
             questionObj.questionType == "completion" ||
             questionObj.questionType == "multipleChoice"
           ) {
-            console.log(questionObj.answer, "111")
+            // console.log(questionObj.answer, "111")
             try {
               questionObj.answer = JSON.parse(questionObj.answer).toString();
             } catch (error) {
@@ -1820,7 +1840,7 @@
           if (src) {
             questionObj.src = src
             questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
-            console.log('棰樺共', questionObj.stem.stemTxt);
+            // console.log('棰樺共', questionObj.stem.stemTxt);
           }
         }
         if (item.Embedded_QuestionBank_QuestionType == "judge") {
@@ -1867,7 +1887,7 @@
         cardList: cardList,
         loading: false,
       });
-      console.log(this.data.questionDataList, "questionDataList");
+      // console.log(this.data.questionDataList, "questionDataList");
     });
   },
   // 鑾峰彇缁勫嵎缁撴灉
@@ -2219,7 +2239,7 @@
               JSON.parse(res[0].value).time : 1000,
             "mockData.answer": JSON.parse(res[0].value).answerData,
           });
-          console.log(JSON.parse(res[0].value));
+          // console.log(JSON.parse(res[0].value));
           data = JSON.parse(res[0].value).answerData;
         }
       });
@@ -2274,7 +2294,7 @@
         this.setData({
           saveTime: 20,
         });
-        console.log("妯¤�冪瓟棰樻暟鎹凡璁板綍");
+        // console.log("妯¤�冪瓟棰樻暟鎹凡璁板綍");
       });
   },
 
@@ -2329,7 +2349,7 @@
           item.topicId = data.id
         }
       })
-      console.log('鐝骇', res)
+      let isJoinClass = wx.getStorageSync('joinClass')
       if (res.datas.length) {
         this.setData({
           classList: res.datas
@@ -2362,20 +2382,28 @@
             })
           } else {
             // 鎷掔粷
+            if (!isJoinClass) {
+
+              this.setData({
+                visible: true
+              })
+            }
+
+          }
+        } else {
+          // 鏈姞鍏ョ彮绾�
+          if (!isJoinClass) {
             this.setData({
               visible: true
             })
           }
-        } else {
-          // 鏈姞鍏ョ彮绾�
+        }
+      } else {
+        if (!isJoinClass) {
           this.setData({
             visible: true
           })
         }
-      } else {
-        this.setData({
-          visible: true,
-        })
       }
 
     })
@@ -2494,8 +2522,9 @@
       // 鍋氬畬浜嗕笖鍔犲叆浜嗙彮绾э紝鎻愪氦鍒癿essage
       if (this.data.classList.length && this.data.joinGroup) {
         this.data.classList.forEach(item => {
-          if (item.linkProductDto.product.id == this.data.bookId && item.topicId)
+          if (item.linkProductDto.product.id == this.data.bookId && item.topicId) {
             this.newTopicMessage(item.topicId)
+          }
         })
         this.setinteractionInfo()
       } else {

--
Gitblit v1.9.1