Quellcode durchsuchen

update exam module

reghao vor 1 Jahr
Ursprung
Commit
0f68f60d4c
2 geänderte Dateien mit 33 neuen und 10 gelöschten Zeilen
  1. 13 1
      src/views/exam/ExamCard.vue
  2. 20 9
      src/views/exam/ExamResult.vue

+ 13 - 1
src/views/exam/ExamCard.vue

@@ -35,7 +35,7 @@
                 <br>
                 <br>
                 <i class="num">{{ curIndex + 1 }}</i>
-                <span>{{ questionList[curIndex].questionContent }}:</span>
+                <span v-html="questionList[curIndex].questionContent" />
               </div>
               <!--题目中的配图-->
               <img
@@ -446,6 +446,16 @@ export default {
     }
   },
   methods: {
+    renderByMathjax() {
+      // tinymce 的 mathjax 插件生成的 latex 格式公式放在 className 为 math-tex 的 span 标签内
+      const className = 'math-tex'
+      this.$nextTick(function() {
+        if (this.MathJax.isMathjaxConfig) {
+          this.MathJax.initMathjaxConfig()
+        }
+        this.MathJax.MathQueue1(className)
+      })
+    },
     // 查询当前考试的信息
     getExamInfo() {
       const paperId = this.$route.params.paperId
@@ -484,6 +494,8 @@ export default {
           this.questionList = this.questionList.sort(function(a, b) {
             return a.questionType - b.questionType
           })
+
+          this.renderByMathjax()
         }
       })
       this.loading.close()

+ 20 - 9
src/views/exam/ExamResult.vue

@@ -23,6 +23,9 @@
         <div v-for="(item,index) in questionInfo" :key="index" style="margin-top: 15px">
           <div>
             <i class="num">{{ index + 1 }}</i>
+            <span style="color: red;font-style: italic;font-weight: 400;">&nbsp;{{
+              item.score
+            }}分</span>
             <span v-if="item.questionType === 1">【单选题】</span>
             <span v-else-if="item.questionType === 2">【多选题】</span>
             <span v-else-if="item.questionType === 3">【不定项选择题】</span>
@@ -31,10 +34,7 @@
             <span v-else-if="item.questionType === 6">【问答题】</span>
             <span v-else-if="item.questionType === 7">【理解题】</span>
             <span v-else>【综合题】</span>
-            <span>{{ item.questionContent }}:</span>
-            <span style="color: red;font-style: italic;font-weight: 400;">&nbsp;{{
-              item.score
-            }}分</span>
+            <span v-html="item.questionContent" />
           </div>
           <!--题目中的配图-->
           <img
@@ -54,9 +54,9 @@
             <div class="el-radio-group">
               <label
                 v-for="(i2,index2) in item.answer"
-                :class="String(index2) === userAnswer[index] && i2.isTrue === 'true' ?
+                :class="String(index2) === userAnswer[index] && i2.correct ?
                   'activeAndTrue' : String(index2) === userAnswer[index] ? 'active' :
-                    i2.isTrue === 'true' ? 'true' : ''"
+                    i2.correct ? 'true' : ''"
               >
                 <span>{{ optionName[index2] + '、' + i2.answer }}</span>
                 <img
@@ -81,9 +81,9 @@
             <div class="el-radio-group">
               <label
                 v-for="(i2,index2) in item.answer"
-                :class="(userAnswer[index]+'').indexOf(index2+'') !== -1 && i2.isTrue === 'true'
+                :class="(userAnswer[index]+'').indexOf(index2+'') !== -1 && i2.correct
                   ? 'activeAndTrue' : (userAnswer[index]+'').indexOf(index2+'') !== -1 ? 'active' :
-                    i2.isTrue === 'true' ? 'true' : ''"
+                    i2.correct ? 'true' : ''"
               >
                 <span>{{ optionName[index] + '、' + i2.answer }}</span>
                 <img
@@ -160,6 +160,16 @@ export default {
     })
   },
   methods: {
+    renderByMathjax() {
+      // tinymce 的 mathjax 插件生成的 latex 格式公式放在 className 为 math-tex 的 span 标签内
+      const className = 'math-tex'
+      this.$nextTick(function() {
+        if (this.MathJax.isMathjaxConfig) {
+          this.MathJax.initMathjaxConfig()
+        }
+        this.MathJax.MathQueue1(className)
+      })
+    },
     // 查询用户当时考试的信息
     async getExamRecord() {
       const examId = this.$route.params.examId
@@ -172,6 +182,7 @@ export default {
           this.getPaperQuestions(paperId)
           // 数据加载完毕
           this.loading.close()
+          this.renderByMathjax()
         }
       })
     },
@@ -283,7 +294,7 @@ export default {
 
 /*选中的答案*/
 .active {
-  border: 1px solid #1f90ff !important;
+  border: 1px solid #ff1f39 !important;
   opacity: .5;
 }