From e33672cf85da88d515d5fe6ccc0a139c3cfaa5db Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期四, 28 八月 2025 22:53:54 +0800
Subject: [PATCH] 8.28更新

---
 src/assets/methods/examination.js |  557 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 390 insertions(+), 167 deletions(-)

diff --git a/src/assets/methods/examination.js b/src/assets/methods/examination.js
index 39764b8..984b098 100644
--- a/src/assets/methods/examination.js
+++ b/src/assets/methods/examination.js
@@ -2,7 +2,16 @@
 import { tokenKey } from "@/assets/js/config";
 import getPublicImage from "@/assets/js/middleGround/tool";
 // 鑾峰彇棰樼洰鍒楄〃
-const getQuestionList = async (page, questionList, activeBook) => {
+const getQuestionList = async (
+  page,
+  questionList,
+  activeBook,
+  bookQuestionsList
+) => {
+  if (!bookQuestionsList || !Array.isArray(bookQuestionsList) || bookQuestionsList.length === 0) {
+    console.warn("getQuestionList: 浼犲叆鐨� bookQuestionsList 涓虹┖鎴栨棤鏁堬紝灏嗚繑鍥炵┖鍒楄〃銆�");
+    return [];
+  }
   const token = localStorage.getItem(tokenKey);
   let collectList = [];
   if (token) collectList = await getCollectList(activeBook);
@@ -36,187 +45,244 @@
       catalogName: "绠�绛旈",
       infoList: [],
     },
+    {
+      catalogName: "鏉愭枡棰�",
+      infoList: [],
+    },
   ];
   let singleChoiceArr = []; // 鍗曢��
   let judgeArr = []; // 鍒ゆ柇
   let shortArr = []; // 绠�绛�
   let multipleChoiceArr = []; // 澶氶��
   let completionArr = []; // 濉┖
+  let materialArr = []; // 鏉愭枡
   // 11
-  for (let qindex = 0; qindex < questionList.length; qindex++) {
-    const qitem = questionList[qindex];
-    let query = {
-      storeInfo: activeBook.storeRefcode,
-      path: "*",
-      cmsPath: activeBook.rootCmsItemId,
-      cmsType: "*",
-      productId: activeBook.bookId,
-      queryType: "*",
-      itemIds: qitem + "",
-      itemFields: {
-        Embedded_QuestionBank_Stem: [],
-        Embedded_QuestionBank_AnalysisCon: [],
-        Embedded_QuestionBank_Answer: [],
-        Embedded_QuestionBank_Option: [],
-        Embedded_QuestionBank_QuestionType: [],
-        Embedded_QuestionBank_StemStyle: [],
-        Embedded_QuestionBank_OptionStyle: [],
-        Embedded_QuestionBank_KnowledgePoint: [],
-        Embedded_QuestionBank_Difficulty: [],
-      },
-    };
-    const res = await MG.store.getProductDetail(query);
-    if (!res.datas) return false;
-    res.datas.cmsDatas[0].datas.forEach((item, index) => {
-      let oldObj = {};
-      if (oldList) {
-        oldObj = oldList.find((item) => item.id == qitem);
-      }
-      const questionObj = {
-        number: index + 1, // 棰樺彿
-        id: item.id,
-        stem:
-          item.Embedded_QuestionBank_QuestionType == "completion"
-            ? JSON.parse(item.Embedded_QuestionBank_Stem)
-                .stemTxt.replaceAll("<vacancy>", ",input,")
-                .split(",")
-            : JSON.parse(item.Embedded_QuestionBank_Stem), // 棰樺共
-        answer: item.Embedded_QuestionBank_Answer, // 绛旀
-        option: item.Embedded_QuestionBank_Option
-          ? JSON.parse(item.Embedded_QuestionBank_Option)
-          : "", // 閫夋嫨棰橀�夐」
-        analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 瑙f瀽
-        questionType: item.Embedded_QuestionBank_QuestionType, // 棰樺瀷
-        optionStyle: item.Embedded_QuestionBank_OptionStyle, // 閫夐」鏄剧ず绫诲瀷
-        stemStyle: item.Embedded_QuestionBank_StemStyle, // 棰樺共鏄剧ず绫诲瀷
-        difficulty: item.Embedded_QuestionBank_Difficulty
-          ? 4 - item.Embedded_QuestionBank_Difficulty
-          : 0, // 闅惧害绛夌骇
-        userAnswer: oldObj
-          ? oldObj.userAnswer
-          : item.Embedded_QuestionBank_QuestionType == "completion" ||
-            item.Embedded_QuestionBank_QuestionType == "multipleChoice"
-          ? []
-          : "",
-        isSubmit: false, // 鏌ョ湅瑙f瀽
-        isRight: null, // 鏄惁姝g‘
-        isComplete: false,
-        isCollect: collectList.indexOf(qitem) > -1 ? true : false,
-        isUnfold: "",
-      };
-      // 澶氶�夊拰濉┖绛旀鑲负鏁扮粍锛岃杞崲JSON鏍煎紡
-      if (
-        questionObj.questionType == "completion" ||
-        questionObj.questionType == "multipleChoice"
-      ) {
-        try {
-          questionObj.answer = JSON.parse(questionObj.answer);          
-        } catch (error) {
-          questionObj.answer = item.Embedded_QuestionBank_Answer;
+  for (let bindex = 0; bindex < questionList.length; bindex++) {
+    const qitem = questionList[bindex];
+    let foundItems = bookQuestionsList.find((citem) => citem.id == qitem);
+    if (
+      foundItems &&
+      foundItems.Embedded_QuestionBank_QuestionType == "material"
+    ) {
+      foundItems.childList = bookQuestionsList.filter(
+        (ditem) =>
+          ditem.productLinkInfo[0].LinkPath == foundItems.productLinkPath
+      );
+    }
+
+    let foundlist = [];
+    foundlist.push(foundItems);
+    if (foundlist.length > 0 && foundlist != undefined) {
+      foundlist.forEach((item, index) => {
+        const questionObj = handleQuestion(item, index + 1, oldList, collectList);
+        if (item.Embedded_QuestionBank_QuestionType == "judge") {
+          questionObj.type = "鍒ゆ柇棰�";
+          judgeArr.push(questionObj);
+        } else if (item.Embedded_QuestionBank_QuestionType == "singleChoice") {
+          questionObj.type = "鍗曢�夐";
+          singleChoiceArr.push(questionObj);
+        } else if (
+          item.Embedded_QuestionBank_QuestionType == "multipleChoice"
+        ) {
+          questionObj.type = "澶氶�夐";
+          multipleChoiceArr.push(questionObj);
+        } else if (item.Embedded_QuestionBank_QuestionType == "completion") {
+          questionObj.type = "濉┖棰�";
+          completionArr.push(questionObj);
+        } else if (item.Embedded_QuestionBank_QuestionType == "shortAnswer") {
+          questionObj.type = "绠�绛旈";
+          shortArr.push(questionObj);
+        } else if (item.Embedded_QuestionBank_QuestionType == "material") {
+          questionObj.type = "鏉愭枡棰�";
+          materialArr.push(questionObj);
         }
-      }
-      // 濉┖棰樻敼閫�
-      if (questionObj.questionType == "completion") {
-        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",
-            };
-            questionObj.userAnswer[index] = "";
-            index++;
-          }
-        }
-      }
-      // 鑾峰彇鍥剧墖
-      if (
-        questionObj.stemStyle == "Image" ||
-        questionObj.stemStyle == "TxtAndImage"
-      ) {
-        questionObj.stem.stemImage = getPublicImage(
-          questionObj.stem.stemImage,
-          150
-        );
-      }
-      if (
-        questionObj.optionStyle == "Image" ||
-        questionObj.optionStyle == "TxtAndImage"
-      ) {
-        questionObj.option.forEach((optionItem) => {
-          if (optionItem.img)
-            optionItem.img = getPublicImage(optionItem.img, 150);
-        });
-      }
-      // 棰樺共瀵屾枃鏈鐞�
-      if (questionObj.stemStyle == "RichText") {
-        // questionObj.option.txt = ''
-        questionObj.stem.stemTxt = questionObj.stem.stemTxt
-          .replace(
-            /\<img/gi,
-            '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
-          )
-          .replace(/\<p/gi, '<p class="stem-rich-p"')
-          .replace("../file", process.env.VUE_APP_API_URL + "/file");
-      }
-      // 閫夐」瀵屾枃鏈鐞�
-      if (
-        questionObj.optionStyle == "RichText" &&
-        (questionObj.questionType == "singleChoice" ||
-          questionObj.questionType == "judge" ||
-          questionObj.questionType == "multipleChoice")
-      ) {
-        questionObj.option.forEach((item) => {
-          if (item.txt)
-            item.txt = item.txt
-              .replace(/\<img/gi, '<img class="option-rich-img"')
-              .replace(/\<p/gi, '<p class="stem-rich-p"')
-              .replace("../file", process.env.VUE_APP_API_URL + "/file");
-        });
-      }
-      // 瑙f瀽瀵屾枃鏈鐞�
-      if (
-        questionObj.analysisCon &&
-        typeof questionObj.analysisCon == "string"
-      ) {
-        questionObj.analysisCon = questionObj.analysisCon.replace(
-          /\<img/gi,
-          '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
-        );
-      }
-      // 鍚姏棰樹慨鏀�
-      // if (questionObj.questionType == 'singleChoice') {
-      //   const src = this.extractSourceSrc(questionObj.stem.stemTxt)
-      //   if (src) {
-      //     questionObj.src = src
-      //     questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
-      //   }
-      // }
-      if (item.Embedded_QuestionBank_QuestionType == "judge") {
-        questionObj.type = "鍒ゆ柇棰�";
-        judgeArr.push(questionObj);
-      } else if (item.Embedded_QuestionBank_QuestionType == "singleChoice") {
-        questionObj.type = "鍗曢�夐";
-        singleChoiceArr.push(questionObj);
-      } else if (item.Embedded_QuestionBank_QuestionType == "multipleChoice") {
-        questionObj.type = "澶氶�夐";
-        multipleChoiceArr.push(questionObj);
-      } else if (item.Embedded_QuestionBank_QuestionType == "completion") {
-        questionObj.type = "濉┖棰�";
-        completionArr.push(questionObj);
-      } else if (item.Embedded_QuestionBank_QuestionType == "shortAnswer") {
-        questionObj.type = "绠�绛旈";
-        shortArr.push(questionObj);
-      }
-    });
+      });
+    }
   }
+
+  // for (let qindex = 0; qindex < questionList.length; qindex++) {
+  //   const qitem = questionList[qindex];
+  //   let query = {
+  //     storeInfo: activeBook.storeRefcode,
+  //     path: "*",
+  //     cmsPath: activeBook.rootCmsItemId,
+  //     cmsType: "*",
+  //     productId: activeBook.bookId,
+  //     queryType: "*",
+  //     itemIds: qitem + "",
+  //     itemFields: {
+  //       Embedded_QuestionBank_Stem: [],
+  //       Embedded_QuestionBank_AnalysisCon: [],
+  //       Embedded_QuestionBank_Answer: [],
+  //       Embedded_QuestionBank_Option: [],
+  //       Embedded_QuestionBank_QuestionType: [],
+  //       Embedded_QuestionBank_StemStyle: [],
+  //       Embedded_QuestionBank_OptionStyle: [],
+  //       Embedded_QuestionBank_KnowledgePoint: [],
+  //       Embedded_QuestionBank_Difficulty: [],
+  //     },
+  //   };
+  //   const res = await MG.store.getProductDetail(query);
+  //   console.log(res.datas.cmsDatas[0].datas, "鏉愭枡棰�");
+  //   if (!res.datas) return false;
+  //   res.datas.cmsDatas[0].datas.forEach((item, index) => {
+  //     let oldObj = {};
+  //     if (oldList) {
+  //       oldObj = oldList.find((item) => item.id == qitem);
+  //     }
+  //     const questionObj = {
+  //       number: index + 1, // 棰樺彿
+  //       id: item.id,
+  //       stem:
+  //         item.Embedded_QuestionBank_QuestionType == "completion"
+  //           ? JSON.parse(item.Embedded_QuestionBank_Stem)
+  //               .stemTxt.replaceAll("<vacancy>", ",input,")
+  //               .split(",")
+  //           : JSON.parse(item.Embedded_QuestionBank_Stem), // 棰樺共
+  //       answer: item.Embedded_QuestionBank_Answer, // 绛旀
+  //       option: item.Embedded_QuestionBank_Option
+  //         ? JSON.parse(item.Embedded_QuestionBank_Option)
+  //         : "", // 閫夋嫨棰橀�夐」
+  //       analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 瑙f瀽
+  //       questionType: item.Embedded_QuestionBank_QuestionType, // 棰樺瀷
+  //       optionStyle: item.Embedded_QuestionBank_OptionStyle, // 閫夐」鏄剧ず绫诲瀷
+  //       stemStyle: item.Embedded_QuestionBank_StemStyle, // 棰樺共鏄剧ず绫诲瀷
+  //       difficulty: item.Embedded_QuestionBank_Difficulty
+  //         ? 4 - item.Embedded_QuestionBank_Difficulty
+  //         : 0, // 闅惧害绛夌骇
+  //       userAnswer: oldObj
+  //         ? oldObj.userAnswer
+  //         : item.Embedded_QuestionBank_QuestionType == "completion" ||
+  //           item.Embedded_QuestionBank_QuestionType == "multipleChoice"
+  //         ? []
+  //         : "",
+  //       isSubmit: false, // 鏌ョ湅瑙f瀽
+  //       isRight: null, // 鏄惁姝g‘
+  //       isComplete: false,
+  //       isCollect: collectList.indexOf(qitem) > -1 ? true : false,
+  //       isUnfold: "",
+  //     };
+
+  //     console.log(item, "鏉愭枡棰�");
+
+  //     // 澶氶�夊拰濉┖绛旀鑲负鏁扮粍锛岃杞崲JSON鏍煎紡
+  //     if (
+  //       questionObj.questionType == "completion" ||
+  //       questionObj.questionType == "multipleChoice"
+  //     ) {
+  //       try {
+  //         questionObj.answer = JSON.parse(questionObj.answer);
+  //       } catch (error) {
+  //         questionObj.answer = item.Embedded_QuestionBank_Answer;
+  //       }
+  //     }
+  //     // 濉┖棰樻敼閫�
+  //     if (questionObj.questionType == "completion") {
+  //       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",
+  //           };
+  //           questionObj.userAnswer[index] = "";
+  //           index++;
+  //         }
+  //       }
+  //     }
+  //     // 鑾峰彇鍥剧墖
+  //     if (
+  //       questionObj.stemStyle == "Image" ||
+  //       questionObj.stemStyle == "TxtAndImage"
+  //     ) {
+  //       questionObj.stem.stemImage = getPublicImage(
+  //         questionObj.stem.stemImage,
+  //         150
+  //       );
+  //     }
+  //     if (
+  //       questionObj.optionStyle == "Image" ||
+  //       questionObj.optionStyle == "TxtAndImage"
+  //     ) {
+  //       questionObj.option.forEach((optionItem) => {
+  //         if (optionItem.img)
+  //           optionItem.img = getPublicImage(optionItem.img, 150);
+  //       });
+  //     }
+  //     // 棰樺共瀵屾枃鏈鐞�
+  //     if (questionObj.stemStyle == "RichText") {
+  //       // questionObj.option.txt = ''
+  //       questionObj.stem.stemTxt = questionObj.stem.stemTxt
+  //         .replace(
+  //           /\<img/gi,
+  //           '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
+  //         )
+  //         .replace(/\<p/gi, '<p class="stem-rich-p"')
+  //         .replace("../file", process.env.VUE_APP_API_URL + "/file");
+  //     }
+  //     // 閫夐」瀵屾枃鏈鐞�
+  //     if (
+  //       questionObj.optionStyle == "RichText" &&
+  //       (questionObj.questionType == "singleChoice" ||
+  //         questionObj.questionType == "judge" ||
+  //         questionObj.questionType == "multipleChoice")
+  //     ) {
+  //       questionObj.option.forEach((item) => {
+  //         if (item.txt)
+  //           item.txt = item.txt
+  //             .replace(/\<img/gi, '<img class="option-rich-img"')
+  //             .replace(/\<p/gi, '<p class="stem-rich-p"')
+  //             .replace("../file", process.env.VUE_APP_API_URL + "/file");
+  //       });
+  //     }
+  //     // 瑙f瀽瀵屾枃鏈鐞�
+  //     if (
+  //       questionObj.analysisCon &&
+  //       typeof questionObj.analysisCon == "string"
+  //     ) {
+  //       questionObj.analysisCon = questionObj.analysisCon.replace(
+  //         /\<img/gi,
+  //         '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
+  //       );
+  //     }
+  //     // 鍚姏棰樹慨鏀�
+  //     // if (questionObj.questionType == 'singleChoice') {
+  //     //   const src = this.extractSourceSrc(questionObj.stem.stemTxt)
+  //     //   if (src) {
+  //     //     questionObj.src = src
+  //     //     questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
+  //     //   }
+  //     // }
+
+  //     if (item.Embedded_QuestionBank_QuestionType == "judge") {
+  //       questionObj.type = "鍒ゆ柇棰�";
+  //       judgeArr.push(questionObj);
+  //     } else if (item.Embedded_QuestionBank_QuestionType == "singleChoice") {
+  //       questionObj.type = "鍗曢�夐";
+  //       singleChoiceArr.push(questionObj);
+  //     } else if (item.Embedded_QuestionBank_QuestionType == "multipleChoice") {
+  //       questionObj.type = "澶氶�夐";
+  //       multipleChoiceArr.push(questionObj);
+  //     } else if (item.Embedded_QuestionBank_QuestionType == "completion") {
+  //       questionObj.type = "濉┖棰�";
+  //       completionArr.push(questionObj);
+  //     } else if (item.Embedded_QuestionBank_QuestionType == "shortAnswer") {
+  //       questionObj.type = "绠�绛旈";
+  //       shortArr.push(questionObj);
+  //     } else if (item.Embedded_QuestionBank_QuestionType == "material") {
+  //       questionObj.type = "鏉愭枡棰�";
+  //       materialArr.push(questionObj);
+  //     }
+  //   });
+  // }
   // 22
   cardList[0].infoList = singleChoiceArr;
   cardList[1].infoList = judgeArr;
   cardList[2].infoList = multipleChoiceArr;
   cardList[3].infoList = completionArr;
   cardList[4].infoList = shortArr;
+  cardList[5].infoList = materialArr;
   for (let index = 0; index < cardList.length; index++) {
     const item = cardList[index];
     for (let cindex = 0; cindex < item.infoList.length; cindex++) {
@@ -226,6 +292,163 @@
   }
   return cardList.filter((item) => item.infoList.length > 0);
 };
+
+// 澶勭悊棰樼洰閫昏緫
+const handleQuestion = (item, index, oldList, collectList) => {
+  // 娉ㄦ剰锛氳繖閲岀殑 qitem 搴旇鏄� item.id锛屾垜鍋囪浣犲師鏉ョ殑浠g爜閲� qitem 灏辨槸褰撳墠 item 鐨� id
+  const qitem = item.id;
+  let oldObj = {};
+  if (oldList) {
+    oldObj = oldList.find((oldItem) => oldItem.id == qitem);
+  }
+  // 1. 鏋勫缓 questionObj 鐨勫熀纭�缁撴瀯
+  const questionObj = {
+    number: index + 1, // 棰樺彿
+    id: item.id,
+    stem:
+      item.Embedded_QuestionBank_QuestionType == "completion"
+        ? JSON.parse(item.Embedded_QuestionBank_Stem)
+          .stemTxt.replaceAll("<vacancy>", ",input,")
+          .split(",")
+        : JSON.parse(item.Embedded_QuestionBank_Stem), // 棰樺共
+    answer: item.Embedded_QuestionBank_Answer, // 绛旀
+    option: item.Embedded_QuestionBank_Option
+      ? JSON.parse(item.Embedded_QuestionBank_Option)
+      : "", // 閫夋嫨棰橀�夐」
+    analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 瑙f瀽
+    questionType: item.Embedded_QuestionBank_QuestionType, // 棰樺瀷
+    optionStyle: item.Embedded_QuestionBank_OptionStyle, // 閫夐」鏄剧ず绫诲瀷
+    stemStyle: item.Embedded_QuestionBank_StemStyle, // 棰樺共鏄剧ず绫诲瀷
+    difficulty: item.Embedded_QuestionBank_Difficulty
+      ? 4 - item.Embedded_QuestionBank_Difficulty
+      : 0, // 闅惧害绛夌骇
+    userAnswer: oldObj
+      ? oldObj.userAnswer
+      : item.Embedded_QuestionBank_QuestionType == "completion" ||
+        item.Embedded_QuestionBank_QuestionType == "multipleChoice"
+        ? []
+        : "",
+    isSubmit: false, // 鏌ョ湅瑙f瀽
+    isRight: null, // 鏄惁姝g‘
+    isComplete: false,
+    isCollect: collectList.indexOf(qitem) > -1 ? true : false,
+    isUnfold: "",
+  };
+
+
+
+  // 2. 澶勭悊澶氶�夊拰濉┖棰樼殑绛旀锛圝SON鏍煎紡杞崲锛�
+  if (
+    questionObj.questionType == "completion" ||
+    questionObj.questionType == "multipleChoice"
+  ) {
+    try {
+      questionObj.answer = JSON.parse(questionObj.answer);
+    } catch (error) {
+      console.error("瑙f瀽绛旀澶辫触:", error, item);
+      questionObj.answer = item.Embedded_QuestionBank_Answer; // 瑙f瀽澶辫触鍒欎繚鐣欏師鏍�
+    }
+  }
+
+  // 3. 濉┖棰樻敼閫�
+  if (questionObj.questionType == "completion") {
+    let inputIndex = 0; // 浣跨敤鏇村叿鎻忚堪鎬х殑鍙橀噺鍚�
+    for (let i = 0; i < questionObj.stem.length; i++) {
+      const stemPart = questionObj.stem[i]; // 浣跨敤鏇村叿鎻忚堪鎬х殑鍙橀噺鍚�
+      if (stemPart == "input") {
+        questionObj.stem[i] = {
+          num: inputIndex,
+          data: "input",
+        };
+        // 纭繚 userAnswer 鏄暟缁勪笖闀垮害瓒冲
+        if (!Array.isArray(questionObj.userAnswer)) {
+          questionObj.userAnswer = [];
+        }
+        questionObj.userAnswer[inputIndex] = "";
+        inputIndex++;
+      }
+    }
+  }
+
+  // 4. 鏉愭枡棰樺鐞� (鏍稿績閫掑綊鐐�)
+  if (questionObj.questionType == "material" && Array.isArray(item.childList)) {
+
+    // 閬嶅巻瀛愰鐩垪琛紝骞跺姣忎竴涓瓙椤归�掑綊璋冪敤 processQuestionItem
+    questionObj.childList = item.childList.map((childItem, childIndex) => {
+      // 瀛愰鐩�氬父涓嶉渶瑕� oldList 鍜� collectList锛屼絾涓轰簡閫昏緫缁熶竴锛屽彲浠ヤ紶鍏�
+      // 濡傛灉瀛愰鐩篃闇�瑕佺嫭绔嬬殑浣滅瓟鐘舵�佸拰鏀惰棌鐘舵�侊紝鍒欓渶瑕佽皟鏁� oldList 鍜� collectList 鐨勭粨鏋�
+      // 杩欓噷鍋囪瀹冧滑涓嶉渶瑕侊紝鎴栬�呯敱鐖剁骇鏉愭枡棰樼粺涓�绠$悊
+      return handleQuestion(childItem, childIndex + 1, null, []);
+    });
+  }
+
+  // 5. 鑾峰彇鍥剧墖
+  if (
+    questionObj.stemStyle == "Image" ||
+    questionObj.stemStyle == "TxtAndImage"
+  ) {
+    // 纭繚 stem 鏄竴涓璞′笖鏈� stemImage 灞炴��
+    if (questionObj.stem && typeof questionObj.stem === 'object' && questionObj.stem.stemImage) {
+      questionObj.stem.stemImage = getPublicImage(
+        questionObj.stem.stemImage,
+        150
+      );
+    }
+  }
+  if (
+    questionObj.optionStyle == "Image" ||
+    questionObj.optionStyle == "TxtAndImage"
+  ) {
+    questionObj.option.forEach((optionItem) => {
+      if (optionItem.img)
+        optionItem.img = getPublicImage(optionItem.img, 150);
+    });
+  }
+
+  // 6. 棰樺共瀵屾枃鏈鐞�
+  if (questionObj.stemStyle == "RichText") {
+    // 纭繚 stem 鏄竴涓璞′笖鏈� stemTxt 灞炴��
+    if (questionObj.stem && typeof questionObj.stem === 'object' && questionObj.stem.stemTxt) {
+      questionObj.stem.stemTxt = questionObj.stem.stemTxt
+        .replace(
+          /\<img/gi,
+          '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
+        )
+        .replace(/\<p/gi, '<p class="stem-rich-p"')
+        .replace("../file", process.env.VUE_APP_API_URL + "/file");
+    }
+  }
+
+  // 7. 閫夐」瀵屾枃鏈鐞�
+  if (
+    questionObj.optionStyle == "RichText" &&
+    (questionObj.questionType == "singleChoice" ||
+      questionObj.questionType == "judge" ||
+      questionObj.questionType == "multipleChoice")
+  ) {
+    questionObj.option.forEach((optItem) => { // 浣跨敤鏇村叿鎻忚堪鎬х殑鍙橀噺鍚�
+      if (optItem.txt)
+        optItem.txt = optItem.txt
+          .replace(/\<img/gi, '<img class="option-rich-img"')
+          .replace(/\<p/gi, '<p class="stem-rich-p"')
+          .replace("../file", process.env.VUE_APP_API_URL + "/file");
+    });
+  }
+
+  // 8. 瑙f瀽瀵屾枃鏈鐞�
+  if (
+    questionObj.analysisCon &&
+    typeof questionObj.analysisCon == "string"
+  ) {
+    questionObj.analysisCon = questionObj.analysisCon.replace(
+      /\<img/gi,
+      '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
+    );
+  }
+
+  return questionObj;
+};
+
 // 鑾峰彇鏀惰棌鍒楄〃
 const getCollectList = async (activeBook) => {
   const allCollect = [

--
Gitblit v1.9.1