Просмотр исходного кода

feat(choiceQuestion): 支持渲染题目和选项中的LaTeX数学公式

1.  新增katexToText计算方法,实现LaTeX公式解析渲染
2.  为选择题组件的题干和选项添加v-html调用该方法
3.  新增公式检测逻辑,方便后续扩展相关功能
4.  修复部分代码格式和语法问题,优化可读性
SanHQin 1 день назад
Родитель
Сommit
6312e06cca

+ 47 - 3
src/components/pages/workPage/components/choiceQuestion.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="choiceQuestion">
     <div class="cq_title" v-if="work.testJson[showIndex]">
-      <span>{{ work.testJson[showIndex].teststitle }}</span>
+      <span v-html="katexToText(work.testJson[showIndex].teststitle)"></span>
 
       <!-- <div class="cq_changeBtnArea" v-if="work.testJson.length>1">
         <span :class="{cq_cba_disabled: showIndex == 0}" @click="changeQuestion('prev')">{{ lang.ssPrevQ }}</span>
@@ -36,7 +36,7 @@
             <span>{{ options[index] }}</span>
           </div>
           <img v-if="item.imgType && item.imgType == '1'" :src="item.src" @click="$hevueImgPreview(item.src)">
-          <span v-else>{{ item }}</span>
+          <span v-else v-html="katexToText(item)"></span>
         </div>
       </div>
 
@@ -54,7 +54,7 @@
             <span>{{ options[index] }}</span>
           </div>
           <img v-if="item.imgType && item.imgType == '1'" :src="item.src" @click="$hevueImgPreview(item.src)">
-          <span v-else>{{ item }}</span>
+          <span v-else v-html="katexToText(item)"></span>
         </div>
       </div>
     </div>
@@ -82,6 +82,7 @@
 </template>
 
 <script>
+import katex from 'katex';
 export default {
   props: {
     workData: {
@@ -128,6 +129,49 @@ export default {
       ]
     };
   },
+
+  computed: {
+    katexToText() {
+      return (str) => {
+        if (!str) return '';
+        const escapeHtml = (text) => {
+          return text
+            .replace(/&/g, '&amp;')
+            .replace(/</g, '&lt;')
+            .replace(/>/g, '&gt;');
+        };
+        try {
+          let result = '';
+          let lastIndex = 0;
+          // 匹配 $$...$$(块级公式)或 $...$(行内公式)
+          const regex = /\$\$([\s\S]+?)\$\$|\$([^$]+?)\$/g;
+          let match;
+          while ((match = regex.exec(str)) !== null) {
+            // 转义并拼接公式前的纯文本
+            result += escapeHtml(str.substring(lastIndex, match.index));
+            if (match[1] !== undefined) {
+              // 块级公式
+              result += katex.renderToString(match[1], {
+                throwOnError: false,
+                displayMode: true
+              });
+            } else {
+              // 行内公式
+              result += katex.renderToString(match[2], {
+                throwOnError: false
+              });
+            }
+            lastIndex = regex.lastIndex;
+          }
+          // 拼接剩余纯文本
+          result += escapeHtml(str.substring(lastIndex));
+          return result || escapeHtml(str);
+        } catch (e) {
+          return str;
+        }
+      };
+    }
+  },
   watch: {
     work: {
       handler(newValue) {

+ 55 - 23
src/components/pages/workPage/components/setChoiceQuestion.vue

@@ -2,7 +2,9 @@
   <div class="setChoiceQuestion">
     <div class="testItem" v-for="(item, index) in jsonData.testJson" :key="item.id">
       <div class="ti_header">
-        <span>{{ lang.ssTopic }}{{ index + 1 }} <span v-if="item.answer.length==0 || item.checkList.some(opt=>!opt)">{{lang.ssNoSettingAnswer}}</span></span>
+        <span>{{ lang.ssTopic }}{{ index + 1 }} <span
+            v-if="item.answer.length == 0 || item.checkList.some(opt => !opt)">{{ lang.ssNoSettingAnswer
+            }}</span></span>
         <div class="ti_h_edit">
           <span @click="copyTest(item.id)">
             <!-- <svg viewBox="0 0 1024 1024" version="1.1" p-id="4608" width="200" height="200">
@@ -10,11 +12,15 @@
                 d="M731.68184 676.057473 731.68184 183.323259c0-30.233582-24.512277-54.745858-54.747905-54.745858L184.216093 128.577401c-30.233582 0-54.746882 24.512277-54.746882 54.745858l0 492.734214c0 30.207999 24.5133 54.746882 54.746882 54.746882l492.717841 0C707.16854 730.804355 731.68184 706.265472 731.68184 676.057473zM622.1891 676.057473 238.962975 676.057473c-30.233582 0-54.746882-24.538883-54.746882-54.745858L184.216093 238.07014c0-30.233582 24.5133-54.746882 54.746882-54.746882l383.226125 0c30.233582 0 54.744835 24.512277 54.744835 54.746882l0 383.242498C676.933935 651.51859 652.421658 676.057473 622.1891 676.057473zM841.17458 292.817022l-54.745858 0 0 54.746882c30.232558 0 54.745858 24.5133 54.745858 54.759161l0 383.228171c0 30.206976-24.5133 54.745858-54.745858 54.745858L403.201573 840.297095c-30.233582 0-54.746882-24.538883-54.746882-54.745858l-54.746882 0 0 54.745858c0 30.207999 24.5133 54.747905 54.746882 54.747905l492.719888 0c30.234605 0 54.747905-24.539906 54.747905-54.747905L895.922485 347.563904C895.922485 317.329299 871.408161 292.817022 841.17458 292.817022z"
                 p-id="4609"></path>
             </svg> -->
-            <svg fill="#000" viewBox="0 0 1024 1024" width="200" height="200"><path d="M753.312 698.848 753.312 383.6736c0-62.048-50.3104-112.3264-112.288-112.3264L395.3024 271.3472 324.288 271.3472l-53.7344 0-29.536 0c-62.048 0-112.288 50.272-112.288 112.3264l0 400.0512c0 61.9776 50.24 112.2752 112.288 112.2752l400.0128 0c62.048 0 112.288-50.2976 112.288-112.2752l0-31.0656 0.8768 0 0-54.0352C753.888 698.624 753.6768 698.7776 753.312 698.848zM660.6016 681.728l0 42.5984c0 0.864-0.2368 1.792-0.2368 2.6688-1.4272 42.3552-36.064 76.3008-78.7328 76.3008L300.3392 803.296c-43.5968 0-78.9056-35.3664-78.9056-78.9696L221.4336 442.9888c0-42.2336 33.2608-76.4928 75.0144-78.5984 1.2928-0.064 2.5984-0.3712 3.8912-0.3712l41.4272 0L581.632 364.0192c43.6608 0 78.9696 35.4048 78.9696 78.9696L660.6016 681.728zM895.1232 555.5008 895.1232 240.3264c0-62.048-50.3104-112.3264-112.288-112.3264L537.1136 128 466.0992 128l-53.7344 0-29.536 0c-62.048 0-112.288 50.272-112.288 112.3264l0 4.4736 115.0784 0c13.4912-13.8112 32.0256-22.72 52.6464-23.7568 1.2864-0.064 2.592-0.3712 3.8848-0.3712l41.4272 0 239.8656 0c43.6608 0 78.9696 35.4048 78.9696 78.9696l0 238.7328 0 42.5984c0 0.864-0.2368 1.792-0.2368 2.6688-0.8768 25.9136-14.208 48.6336-34.176 62.4l0 106.6048 14.8352 0c62.048 0 112.288-50.2976 112.288-112.2752l0-31.0656L896 609.3056l0-54.0352C895.6992 555.2768 895.488 555.424 895.1232 555.5008z"></path></svg>
+            <svg fill="#000" viewBox="0 0 1024 1024" width="200" height="200">
+              <path
+                d="M753.312 698.848 753.312 383.6736c0-62.048-50.3104-112.3264-112.288-112.3264L395.3024 271.3472 324.288 271.3472l-53.7344 0-29.536 0c-62.048 0-112.288 50.272-112.288 112.3264l0 400.0512c0 61.9776 50.24 112.2752 112.288 112.2752l400.0128 0c62.048 0 112.288-50.2976 112.288-112.2752l0-31.0656 0.8768 0 0-54.0352C753.888 698.624 753.6768 698.7776 753.312 698.848zM660.6016 681.728l0 42.5984c0 0.864-0.2368 1.792-0.2368 2.6688-1.4272 42.3552-36.064 76.3008-78.7328 76.3008L300.3392 803.296c-43.5968 0-78.9056-35.3664-78.9056-78.9696L221.4336 442.9888c0-42.2336 33.2608-76.4928 75.0144-78.5984 1.2928-0.064 2.5984-0.3712 3.8912-0.3712l41.4272 0L581.632 364.0192c43.6608 0 78.9696 35.4048 78.9696 78.9696L660.6016 681.728zM895.1232 555.5008 895.1232 240.3264c0-62.048-50.3104-112.3264-112.288-112.3264L537.1136 128 466.0992 128l-53.7344 0-29.536 0c-62.048 0-112.288 50.272-112.288 112.3264l0 4.4736 115.0784 0c13.4912-13.8112 32.0256-22.72 52.6464-23.7568 1.2864-0.064 2.592-0.3712 3.8848-0.3712l41.4272 0 239.8656 0c43.6608 0 78.9696 35.4048 78.9696 78.9696l0 238.7328 0 42.5984c0 0.864-0.2368 1.792-0.2368 2.6688-0.8768 25.9136-14.208 48.6336-34.176 62.4l0 106.6048 14.8352 0c62.048 0 112.288-50.2976 112.288-112.2752l0-31.0656L896 609.3056l0-54.0352C895.6992 555.2768 895.488 555.424 895.1232 555.5008z">
+              </path>
+            </svg>
           </span>
 
           <!-- 上 -->
-          <span :class="{'disabled': index === 0}" @click="changeIndex(item, index, 'up')">
+          <span :class="{ 'disabled': index === 0 }" @click="changeIndex(item, index, 'up')">
             <svg viewBox="0 0 1024 1024" width="200" height="200" fill="#6B7280">
               <path
                 d="M959.804421 511.603981l-84.009346 84.023672L576.143391 293.406446l0 665.582911L448.20351 958.989357 448.20351 293.406446 147.619594 595.628676l-84.024695-84.023672L512.213359 63.546292 959.804421 511.603981z">
@@ -22,7 +28,8 @@
             </svg>
           </span>
           <!-- 下 -->
-          <span :class="{'disabled': index === jsonData.testJson.length - 1}" @click="changeIndex(item, index, 'down')">
+          <span :class="{ 'disabled': index === jsonData.testJson.length - 1 }"
+            @click="changeIndex(item, index, 'down')">
             <svg style="transform: rotate(180deg);" viewBox="0 0 1024 1024" width="200" height="200" fill="#6B7280">
               <path
                 d="M959.804421 511.603981l-84.009346 84.023672L576.143391 293.406446l0 665.582911L448.20351 958.989357 448.20351 293.406446 147.619594 595.628676l-84.024695-84.023672L512.213359 63.546292 959.804421 511.603981z">
@@ -37,7 +44,11 @@
                 d="M902.4 282.1H117.7c-13.4 0-23.5-10.1-23.5-23.5v-3.4c0-13.4 10.1-23.5 23.5-23.5h788.1c13.4 0 23.5 10.1 23.5 23.5v3.4c0 13.4-10.1 23.5-26.9 23.5zM634.1 151.3H386c-13.4 0-26.8-10.1-23.5-23.5v-6.7c0-13.4 10.1-23.5 23.5-23.5h248.2c13.4 0 23.5 10.1 23.5 23.5v3.4c3.3 13.3-10.1 26.8-23.6 26.8z m228.1 238.1c0-13.4-10.1-26.8-26.8-26.8-16.8 0-26.8 10.1-26.8 26.8L775 798.5v13.4c0 23.5-10.1 43.6-30.2 53.7-13.4 6.7-30.2 10.1-50.3 10.1H332.3c-33.5 3.4-60.4 0-70.4-33.5-3.4-6.7-6.7-16.8-6.7-26.8l-10.1-104-36.9-322c0-13.4-10.1-23.5-23.5-23.5s-26.8 10.1-26.8 23.5l47 462.8c0 40.2 40.2 73.8 80.5 73.8h459.5c40.2 0 80.5-33.5 80.5-73.8l36.8-462.8c0 3.3 0 0 0 0z m0 0"
                 p-id="12416"></path>
             </svg> -->
-            <svg fill="#000" style="width: 1.2rem;height: 1.2rem;"  viewBox="0 0 1024 1024"  width="200" height="200"><path d="M921.6 371.2v537.6c0 56.32-43.52 102.4-99.84 102.4H202.24c-53.76 0-99.84-46.08-99.84-102.4v-537.6c0-28.16 23.04-51.2 51.2-51.2s51.2 23.04 51.2 51.2l-2.56 486.4c0 28.16 23.04 51.2 48.64 51.2h522.24c28.16 0 46.08-23.04 46.08-51.2v-486.4c0-28.16 23.04-51.2 51.2-51.2s51.2 23.04 51.2 51.2z m51.2-204.8H51.2c-28.16 0-51.2 23.04-51.2 51.2s23.04 51.2 51.2 51.2h921.6c28.16 0 51.2-23.04 51.2-51.2s-23.04-51.2-51.2-51.2z m-665.6-51.2h409.6c28.16 0 51.2-23.04 51.2-51.2s-23.04-51.2-51.2-51.2H307.2c-28.16 0-51.2 23.04-51.2 51.2s23.04 51.2 51.2 51.2z m128 640v-384c0-28.16-23.04-51.2-51.2-51.2s-51.2 23.04-51.2 51.2v384c0 28.16 23.04 51.2 51.2 51.2s51.2-23.04 51.2-51.2z m256 0v-384c0-28.16-23.04-51.2-51.2-51.2s-51.2 23.04-51.2 51.2v384c0 28.16 23.04 51.2 51.2 51.2s51.2-23.04 51.2-51.2z" fill="#000"></path></svg>
+            <svg fill="#000" style="width: 1.2rem;height: 1.2rem;" viewBox="0 0 1024 1024" width="200" height="200">
+              <path
+                d="M921.6 371.2v537.6c0 56.32-43.52 102.4-99.84 102.4H202.24c-53.76 0-99.84-46.08-99.84-102.4v-537.6c0-28.16 23.04-51.2 51.2-51.2s51.2 23.04 51.2 51.2l-2.56 486.4c0 28.16 23.04 51.2 48.64 51.2h522.24c28.16 0 46.08-23.04 46.08-51.2v-486.4c0-28.16 23.04-51.2 51.2-51.2s51.2 23.04 51.2 51.2z m51.2-204.8H51.2c-28.16 0-51.2 23.04-51.2 51.2s23.04 51.2 51.2 51.2h921.6c28.16 0 51.2-23.04 51.2-51.2s-23.04-51.2-51.2-51.2z m-665.6-51.2h409.6c28.16 0 51.2-23.04 51.2-51.2s-23.04-51.2-51.2-51.2H307.2c-28.16 0-51.2 23.04-51.2 51.2s23.04 51.2 51.2 51.2z m128 640v-384c0-28.16-23.04-51.2-51.2-51.2s-51.2 23.04-51.2 51.2v384c0 28.16 23.04 51.2 51.2 51.2s51.2-23.04 51.2-51.2z m256 0v-384c0-28.16-23.04-51.2-51.2-51.2s-51.2 23.04-51.2 51.2v384c0 28.16 23.04 51.2 51.2 51.2s51.2-23.04 51.2-51.2z"
+                fill="#000"></path>
+            </svg>
             <!-- <svg fill="#000" style="width: 1.2rem;height: 1.2rem;"  viewBox="0 0 1024 1024" width="200" height="200"><path d="M835.226046 328.70941a44.817364 44.817364 0 0 0-45.10981 44.524918v513.681565a48.107383 48.107383 0 0 1-48.546052 47.814937H282.356704a48.107383 48.107383 0 0 1-48.546051-47.814937V373.234328c0-24.565472-20.178781-44.524918-45.109811-44.524918s-45.182922 19.959446-45.182921 44.524918v513.681565c0 75.377981 62.144795 136.645438 138.69256 136.645438h459.140369c76.547765 0 138.69256-61.267457 138.69256-136.645438V373.234328a44.598029 44.598029 0 0 0-44.817364-44.524918z m-165.597601 447.881194v-403.57561a44.817364 44.817364 0 0 0-45.182922-44.451807 44.744252 44.744252 0 0 0-44.963587 44.451807v403.57561c0 24.565472 20.251892 44.451806 45.182922 44.451806a44.598029 44.598029 0 0 0 44.963587-44.451806z m-225.183493 0v-403.57561a44.817364 44.817364 0 0 0-45.10981-44.451807 44.817364 44.817364 0 0 0-45.182922 44.451807v403.57561c0 24.565472 20.251892 44.451806 45.182922 44.451806 24.857918 0 45.10981-19.886334 45.10981-44.451806z m534.152792-592.13023h-148.635728v-51.178066C829.962016 59.732115 769.352563 0 694.705698 0H329.001856C254.428102 0 193.818649 59.732115 193.818649 133.282308v51.178066H45.10981c-24.93103 0-45.10981 19.959446-45.10981 44.524918s20.178781 44.451806 45.10981 44.451806h933.341711c24.93103 0 45.10981-19.886334 45.10981-44.451806s-20.032557-44.524918-44.963587-44.524918z m-238.709125 0H284.111381v-51.178066c0-24.565472 20.178781-44.451806 45.10981-44.451807h365.484507c24.93103 0 45.182922 19.886334 45.182921 44.451807v51.178066z"></path></svg> -->
             <!-- <svg fill="#000" viewBox="0 0 1024 1024" width="200" height="200"><path d="M380 455a8 8 0 0 1 8-8h64a8 8 0 0 1 8 8v240a8 8 0 0 1-8 8h-64a8 8 0 0 1-8-8V455zM644 455a8 8 0 0 0-8-8h-64a8 8 0 0 0-8 8v240a8 8 0 0 0 8 8h64a8 8 0 0 0 8-8V455z" fill="#323338" p-id="12402"></path><path d="M321 212V96c0-17.673 14.327-32 32-32h320c17.673 0 32 14.327 32 32v116h183a8 8 0 0 1 8 8v64a8 8 0 0 1-8 8h-55v635c0 17.673-14.327 32-32 32H225c-17.673 0-32-14.327-32-32V292h-58a8 8 0 0 1-8-8v-64a8 8 0 0 1 8-8h186z m80-68v68h224v-68H401zM273 292v587h480V292H273z" ></path></svg> -->
           </span>
@@ -45,7 +56,9 @@
       </div>
 
       <div class="ti_title">
-        <el-input class="ti_t_input" type="textarea" v-model="item.teststitle" :rows="3" :autosize="{ minRows: 3, maxRows: 6 }" resize="none" :placeholder="lang.ssEnterTextTitle" @input="setTestTitle(item.id)"></el-input>
+        <el-input class="ti_t_input" type="textarea" v-model="item.teststitle" :rows="3"
+          :autosize="{ minRows: 3, maxRows: 6 }" resize="none" :placeholder="lang.ssEnterTextTitle"
+          @input="setTestTitle(item.id)"></el-input>
         <div class="uploadImage" @click="uploadImage(item.id)">
           <svg viewBox="0 0 1024 1024" version="1.1" p-id="15953" width="200" height="200">
             <path
@@ -70,12 +83,9 @@
 
       <!-- 选择题 -->
       <div class="checkList">
-        <div class="checkItem" v-for="(check, checkIndex) in item.checkList" :key="checkIndex"
-            draggable="true"
-            @dragstart="dragStart($event, item, checkIndex)"
-            @dragover.prevent="dragOver($event, item, checkIndex)"
-            @drop="drop($event, item, checkIndex)"
-            @dragend="dragEnd">
+        <div class="checkItem" v-for="(check, checkIndex) in item.checkList" :key="checkIndex" draggable="true"
+          @dragstart="dragStart($event, item, checkIndex)" @dragover.prevent="dragOver($event, item, checkIndex)"
+          @drop="drop($event, item, checkIndex)" @dragend="dragEnd">
           <div class="drag" draggable="true" @dragstart="dragStart($event, item, checkIndex)">
             <svg viewBox="0 0 1024 1024" width="200" height="200">
               <path
@@ -122,6 +132,8 @@
             </div>
           </div>
         </div>
+        <!-- 是否是数学公式 -->
+        <div class="isKate" v-show="false">{{ isKatexTest(item) ? '是数学公式' : '不是数学公式' }}</div>
         <div class="addCheck" @click="addCheck(item.id)">
           <svg viewBox="0 0 1024 1024" version="1.1" p-id="2732" width="200" height="200">
             <path
@@ -136,7 +148,8 @@
       <div class="explanation">
         <div class="e_header">
           <span>{{ lang.ssExplanationTip }}</span>
-          <div @click="generateExplanation(item, index)" :disabled="chatLoading[index]" v-loading="messagesloading[index]">
+          <div @click="generateExplanation(item, index)" :disabled="chatLoading[index]"
+            v-loading="messagesloading[index]">
             <svg t="1774233113566" viewBox="0 0 1027 1024" width="200" height="200">
               <path
                 d="M511.979521 544.586217a54.525819 54.525819 0 0 1-23.359066-5.247791L31.038758 321.427143a54.397824 54.397824 0 0 1 0-98.236071L488.620455 5.279789c14.719411-7.039718 31.99872-7.039718 46.718131 0l457.581697 217.911283a54.397824 54.397824 0 0 1 0 98.236071l-457.581697 217.911283A54.525819 54.525819 0 0 1 511.979521 544.586217zM180.984761 272.341106L511.979521 429.966801l331.058757-157.625695L511.979521 114.587417 180.984761 272.341106z m354.417823 746.402144l457.517699-217.911283a54.397824 54.397824 0 1 0-46.718131-98.236071L511.979521 909.371625l-434.158634-206.775729a54.397824 54.397824 0 0 0-46.718131 98.300068l457.581697 217.847286a54.525819 54.525819 0 0 0 46.718131 0z m0-239.73441l457.517699-217.847286a54.397824 54.397824 0 1 0-46.718131-98.300068L511.979521 669.573217l-434.158634-206.711731a54.397824 54.397824 0 0 0-46.718131 98.300068l457.581697 217.847286a54.525819 54.525819 0 0 0 46.718131 0z"
@@ -146,7 +159,8 @@
           </div>
         </div>
         <el-input type="textarea" rows="3" style="font-size: 1.2rem;" resize="none" v-model="item.explanation"
-          :placeholder="lang.ssEnterExplanation" v-loading="messagesloading[index]" :disabled="chatLoading[index]" @input="setTestJson()"></el-input>
+          :placeholder="lang.ssEnterExplanation" v-loading="messagesloading[index]" :disabled="chatLoading[index]"
+          @input="setTestJson()"></el-input>
       </div>
     </div>
 
@@ -182,13 +196,31 @@ export default {
     return {
       jsonData: {},
       dragItem: null,
-      delJson:null,
+      delJson: null,
       streamController: [],
       chatLoading: [],
       messagesloading: [],
       userid: this.$route.query.userid,
     }
   },
+
+  computed: {
+    isKatexTest() {
+      // 判断是否包含数学公式(支持 $...$、$$...$$、\(...\)、\[...\] 等 LaTeX 格式)
+      return (test)=>{
+        const mathPattern = /\$\$[\s\S]+?\$\$|\$[\s\S]+?\$|\\\([\s\S]+?\\\)|\\\[[\s\S]+?\\\]/;
+        // 判断标题是否包含数学公式
+        if (mathPattern.test(test.teststitle)) {
+          return true;
+        }
+        // 判断选项是否包含数学公式
+        if (test.checkList && test.checkList.some(option => mathPattern.test(option))) {
+          return true;
+        }
+        return false;
+      }
+    }
+  },
   watch: {
     workData: {
       handler(newVal, oldVal) {
@@ -196,12 +228,12 @@ export default {
           if (JSON.stringify(newVal.json) != JSON.stringify(this.jsonData)) {
             let editJson = JSON.parse(JSON.stringify(newVal.json))
             editJson.testJson.forEach(item => {
-              if(typeof item.answer == 'string' || typeof item.answer == 'number'){
+              if (typeof item.answer == 'string' || typeof item.answer == 'number') {
                 item.answer = [item.answer];
               }
             })
             this.jsonData = editJson;
-            if(this.jsonData.testJson.length == 0){
+            if (this.jsonData.testJson.length == 0) {
               this.addTest();
             }
           }
@@ -266,7 +298,7 @@ export default {
       let test = this.jsonData.testJson[index];
       if (!checkIndex) {
         checkIndex = test.checkList.length;
-      }else{
+      } else {
         checkIndex = checkIndex + 1;
       }
       test.checkList.splice(checkIndex, 0, '');
@@ -346,7 +378,7 @@ export default {
         e.preventDefault();
         return;
       }
-      console.log('e',e)
+      console.log('e', e)
       this.dragItem = { item, checkIndex };
       const checkItem = e.target.closest('.checkItem');
       if (checkItem) checkItem.classList.add('dragging');
@@ -446,7 +478,7 @@ export default {
       }
       let zimu = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
       let prompt = `- 题干:${item.teststitle}
-      - 选项:  
+      - 选项:
         ${item.checkList.map((check, index) => `${zimu[index]}. ${check}`).join('\n')}
       - 正确答案(若已知):${item.answer.length > 0 ? item.answer.map(index => zimu[index]).join('、') : '未知'}`
       this.chatLoading[index] = true
@@ -462,7 +494,7 @@ export default {
           this.messagesloading[index] = false
           this.chatLoading[index] = false
           this.$forceUpdate()
-        }else if (event.type === 'error') {
+        } else if (event.type === 'error') {
           this.chatLoading[index] = false
           this.messagesloading[index] = false
           this.$message.error(event.data)
@@ -486,7 +518,7 @@ export default {
     }
   },
   mounted() {
-    window.addEventListener('keydown', (e)=>{
+    window.addEventListener('keydown', (e) => {
       if (e.ctrlKey && e.key === 'z') {
         this.undoDelete();
       }
@@ -687,7 +719,7 @@ export default {
   transition: .2s;
 }
 
-.checkItem:hover > .drag {
+.checkItem:hover>.drag {
   opacity: 1;
 }