소스 검색

任务描述工具描述添加katex

11wqe1 1 개월 전
부모
커밋
a4d4d5e8bc

+ 2 - 2
src/components/components/choseWorksDetailDialog.vue

@@ -57,7 +57,7 @@
                     @click="upLoadApp">作业提交</el-button>
                   </div>
 
-                  <span v-if="testData.toolDetail">{{ testData.toolDetail }}</span>
+                  <span v-if="testData.toolDetail"><span v-html="renderedFormula(testData.toolDetail)"></span></span>
 									<span v-else>无</span>
                 </div>
 
@@ -1044,7 +1044,7 @@
                         typeof item.answer === "number"
                           ? "单选题:"
                           : "多选题:"
-                      }}{{ item.title }}</span
+                      }}<span v-html="renderedFormula(item.title)"></span></span
                     >
                   </div>
 

+ 16 - 3
src/components/components/studentWorkPreviewDialog.vue

@@ -38,7 +38,7 @@
 
                   <span
                     >{{ item.type == 1 ? "单选题:" : "多选题:"
-                    }}{{ item.teststitle }}</span
+                    }}<span v-html="renderedFormula(item.teststitle)"></span> </span
                   >
                 </div>
                 <div
@@ -312,7 +312,8 @@
 
 <script>
 import MarkdownIt from "markdown-it";
-
+import katex from 'katex'
+import 'katex/dist/katex.min.css'
 export default {
   components: {},
   data() {
@@ -404,6 +405,16 @@ export default {
     }
   },
   computed: {
+    renderedFormula() {
+      return function(val){
+        try {
+          return katex.renderToString(val,{ throwOnError: false });
+        } catch (e) {
+          console.error('KaTeX渲染错误:', e);
+          return val;
+        }
+      }
+    },
     MarkdownT() {
       return function (c) {
         let md = new MarkdownIt();
@@ -468,7 +479,9 @@ export default {
   width: 100vw;
   overflow: auto;
 }
-
+.studentWorkPreviewDialog >>> .katex{
+  font-size: 20px;
+}
 .s_body {
   width: 100%;
   height: 100%;

+ 7 - 4
src/components/easy2/studyStudent.vue

@@ -522,9 +522,9 @@
                   v-html="
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                       .taskDetail
-                      ? chapInfoList[courseType].chapterInfo[0].taskJson[
+                      ? renderedFormula(chapInfoList[courseType].chapterInfo[0].taskJson[
                           taskCount
-                        ].taskDetail
+                        ].taskDetail)
                       : '暂无描述'
                   "
                 ></div>
@@ -1577,7 +1577,7 @@
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                       <div
                         style="height:100%;"
-                        v-html="contentConvent(tool.toolDetail)"
+                        v-html="renderedFormula(tool.toolDetail)"
                         v-if="toolDetailIndex != toolIndex"
                       ></div>
                       <div v-else @click.stop="" style="height:100%;">
@@ -13031,7 +13031,7 @@
                 >
                   (多选题)
                 </div>
-                <div>题目:{{ testJson.testJson[index1].teststitle }}</div>
+                <div>题目:<span v-html="renderedFormula(testJson.testJson[index1].teststitle)"></span></div>
               </div>
               <img
                 v-if="testJson.testJson[index1].img"
@@ -30842,4 +30842,7 @@ div::-webkit-scrollbar {
   overflow: hidden;
   text-overflow: ellipsis;
 }
+.pb_content >>> .katex {
+  font-size: 16px;
+}
 </style>

+ 8 - 6
src/components/easy3/studyStudent.vue

@@ -537,9 +537,9 @@
                   v-html="
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                       .taskDetail
-                      ? chapInfoList[courseType].chapterInfo[0].taskJson[
+                      ? renderedFormula(chapInfoList[courseType].chapterInfo[0].taskJson[
                           taskCount
-                        ].taskDetail
+                        ].taskDetail)
                       : '暂无描述'
                   "
                 ></div>
@@ -1551,7 +1551,7 @@
                       <!-- <div class="toolTitle">工具描述</div> -->
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" 点击开启修改-->
                       <div style="height:100%;"
-                        v-html="contentConvent(tool.toolDetail)"
+                        v-html="renderedFormula(tool.toolDetail)"
                         v-if="toolDetailIndex != toolIndex"
                       ></div>
                       <div v-else @click.stop="" style="height:100%;">
@@ -9663,7 +9663,7 @@
                 >
                   (多选题)
                 </div>
-                <div>题目:{{ testJson.testJson[index1].teststitle }}</div>
+                <div>题目:<span v-html="renderedFormula(testJson.testJson[index1].teststitle)"></span></div>
               </div>
               <img
                 v-if="testJson.testJson[index1].img"
@@ -21561,7 +21561,7 @@ export default {
           ? c
               .replaceAll(/\r\n/g, "<br/>")
               .replaceAll(/\n/g, "<br/>")
-              .replaceAll(/\s/g, " &nbsp")
+              .replaceAll(/\s/g, "&nbsp")
           : "";
       };
     },
@@ -22010,7 +22010,9 @@ export default {
   overflow:hidden;
   box-sizing:border-box;
 }
-
+.pb_content >>> .katex {
+  font-size: 16px;
+}
 .file {
   display: flex;
   flex-direction: column;

+ 7 - 4
src/components/studyStudent.vue

@@ -500,9 +500,9 @@
                   v-html="
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                       .taskDetail
-                      ? chapInfoList[courseType].chapterInfo[0].taskJson[
+                      ? renderedFormula(chapInfoList[courseType].chapterInfo[0].taskJson[
                           taskCount
-                        ].taskDetail
+                        ].taskDetail)
                       : '暂无描述'
                   "
                 ></div>
@@ -1511,7 +1511,7 @@
                       <!-- <div class="toolTitle">工具描述</div> -->
                         <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                       <div style="height:100%;"
-                        v-html="contentConvent(tool.toolDetail)"
+                        v-html="renderedFormula(tool.toolDetail)"
                         v-if="toolDetailIndex != toolIndex"
                       ></div>
                       <div v-else @click.stop="" style="height:100%;">
@@ -9599,7 +9599,7 @@
                 >
                   (多选题)
                 </div>
-                <div>题目:{{ testJson.testJson[index1].teststitle }}</div>
+                <div>题目:<span v-html="renderedFormula(testJson.testJson[index1].teststitle)"></span></div>
               </div>
               <img
                 v-if="testJson.testJson[index1].img"
@@ -26145,4 +26145,7 @@ div::-webkit-scrollbar {
   overflow: hidden;
   text-overflow: ellipsis;
 }
+.pb_content >>> .katex {
+  font-size: 16px;
+}
 </style>

+ 7 - 4
src/components/studySutdentClass/studyStudent.vue

@@ -537,9 +537,9 @@
                   v-html="
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                       .taskDetail
-                      ? chapInfoList[courseType].chapterInfo[0].taskJson[
+                      ? renderedFormula(chapInfoList[courseType].chapterInfo[0].taskJson[
                           taskCount
-                        ].taskDetail
+                        ].taskDetail)
                       : '暂无描述'
                   "
                 ></div>
@@ -1573,7 +1573,7 @@
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                       <div
                         style="height:100%;"
-                        v-html="contentConvent(tool.toolDetail)"
+                        v-html="renderedFormula(tool.toolDetail)"
                         v-if="toolDetailIndex != toolIndex"
                       ></div>
                       <div v-else @click.stop="" style="height:100%;">
@@ -12844,7 +12844,7 @@
                 >
                   (多选题)
                 </div>
-                <div>题目:{{ testJson.testJson[index1].teststitle }}</div>
+                <div>题目:<span v-html="renderedFormula(testJson.testJson[index1].teststitle)"></span></div>
               </div>
               <img
                 v-if="testJson.testJson[index1].img"
@@ -30199,4 +30199,7 @@ div::-webkit-scrollbar {
 
   text-overflow: ellipsis;
 }
+.pb_content >>> .katex {
+  font-size: 16px;
+}
 </style>