瀏覽代碼

去除数学公式

11wqe1 1 月之前
父節點
當前提交
7fab5f193f

+ 2 - 45
src/components/components/askStatic2.vue

@@ -33,7 +33,7 @@
                   cursor: pointer;
                   cursor: pointer;
                 "
                 "
               >
               >
-                {{ index + 1 + "、"  }} <span ref="latexElement" v-html="renderedFormula(item.teststitle)"></span>
+                {{ index + 1 + "、"  }} <span ref="latexElement" v-html="item.teststitle"></span>
               </div>
               </div>
             </el-tooltip>
             </el-tooltip>
             <!-- </el-tooltip> -->
             <!-- </el-tooltip> -->
@@ -200,50 +200,7 @@ export default {
     };
     };
   },
   },
   computed: {
   computed: {
-    renderedFormula() {
-      return function(val){
-        try {
-           // 判断是否含有HTML标签,<tag ...>...</tag>
-            const hasTag = /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g.test(val);
-            if (!hasTag) {
-              val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-              // 纯文本,整体渲染
-              try {
-                return katex.renderToString(val.trim(), {
-                  throwOnError: false,
-                  strict: false,
-                  output: "htmlAndMathml"
-                });
-              } catch (e) {
-                return val; // 渲染失败原样输出
-              }
-            } else {
-              // 有标签,对每个标签内容渲染
-              return val.replace(
-                /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g,
-                (match, tag, attrs, inner) => {
-                  let html;
-                  val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-                  try {
-                    html = katex.renderToString(inner.trim(), {
-                      throwOnError: false,
-                      strict: false,
-                      output: "htmlAndMathml"
-                    });
-                  } catch (e) {
-                    html = inner;
-                  }
-                  return `<${tag}${attrs}>${html}</${tag}>`;
-                }
-              );
-            }
-        } catch (e) {
-          console.error('KaTeX渲染错误:', e);
-          return val;
-        }
-      }
-    }
+    
   },
   },
   methods: {
   methods: {
     handleClose(done) {
     handleClose(done) {

+ 4 - 47
src/components/components/choseWorksDetailDialog.vue

@@ -57,7 +57,7 @@
                     @click="upLoadApp">作业提交</el-button>
                     @click="upLoadApp">作业提交</el-button>
                   </div>
                   </div>
 
 
-                  <span v-if="testData.toolDetail"><span v-html="renderedFormula(testData.toolDetail)"></span></span>
+                  <span v-if="testData.toolDetail"><span v-html="testData.toolDetail"></span></span>
 									<span v-else>无</span>
 									<span v-else>无</span>
                 </div>
                 </div>
 
 
@@ -85,7 +85,7 @@
                         >
                         >
                           (多选题)
                           (多选题)
                         </div>
                         </div>
-                        <div style="display: flex;align-items: center;">题目:<span v-html="renderedFormula(item1.teststitle)"></span></div>
+                        <div style="display: flex;align-items: center;">题目:<span v-html="item1.teststitle"></span></div>
                       </div>
                       </div>
                       <img
                       <img
                         v-if="item1.img"
                         v-if="item1.img"
@@ -1045,7 +1045,7 @@
                         typeof item.answer === "number"
                         typeof item.answer === "number"
                           ? "单选题:"
                           ? "单选题:"
                           : "多选题:"
                           : "多选题:"
-                      }}<span v-html="renderedFormula(item.title)"></span></span
+                      }}<span v-html="item.title"></span></span
                     >
                     >
                   </div>
                   </div>
 
 
@@ -1521,50 +1521,7 @@ export default {
   },
   },
 
 
   computed: {
   computed: {
-    renderedFormula() {
-      return function(val){
-        try {
-           // 判断是否含有HTML标签,<tag ...>...</tag>
-            const hasTag = /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g.test(val);
-            if (!hasTag) {
-              val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-              // 纯文本,整体渲染
-              try {
-                return katex.renderToString(val.trim(), {
-                  throwOnError: false,
-                  strict: false,
-                  output: "htmlAndMathml"
-                });
-              } catch (e) {
-                return val; // 渲染失败原样输出
-              }
-            } else {
-              // 有标签,对每个标签内容渲染
-              return val.replace(
-                /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g,
-                (match, tag, attrs, inner) => {
-                  let html;
-                  val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-                  try {
-                    html = katex.renderToString(inner.trim(), {
-                      throwOnError: false,
-                      strict: false,
-                      output: "htmlAndMathml"
-                    });
-                  } catch (e) {
-                    html = inner;
-                  }
-                  return `<${tag}${attrs}>${html}</${tag}>`;
-                }
-              );
-            }
-        } catch (e) {
-          console.error('KaTeX渲染错误:', e);
-          return val;
-        }
-      }
-    },
+
     tableData() {
     tableData() {
       let _result = [];
       let _result = [];
       if (this.show && this.toolIndex !== null && [45].includes(this.toolType)) {
       if (this.show && this.toolIndex !== null && [45].includes(this.toolType)) {

+ 2 - 45
src/components/components/studentWorkPreviewDialog.vue

@@ -39,7 +39,7 @@
                   <span
                   <span
                     style="display: flex;align-items: center;"
                     style="display: flex;align-items: center;"
                     >{{ item.type == 1 ? "单选题:" : "多选题:"
                     >{{ item.type == 1 ? "单选题:" : "多选题:"
-                    }}<span v-html="renderedFormula(item.teststitle)"></span> </span
+                    }}<span v-html="item.teststitle"></span> </span
                   >
                   >
                 </div>
                 </div>
                 <div
                 <div
@@ -400,50 +400,7 @@ export default {
     }
     }
   },
   },
   computed: {
   computed: {
-    renderedFormula() {
-      return function(val){
-       try {
-           // 判断是否含有HTML标签,<tag ...>...</tag>
-            const hasTag = /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g.test(val);
-            if (!hasTag) {
-              val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-              // 纯文本,整体渲染
-              try {
-                return katex.renderToString(val.trim(), {
-                  throwOnError: false,
-                  strict: false,
-                  output: "htmlAndMathml"
-                });
-              } catch (e) {
-                return val; // 渲染失败原样输出
-              }
-            } else {
-              // 有标签,对每个标签内容渲染
-              return val.replace(
-                /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g,
-                (match, tag, attrs, inner) => {
-                  let html;
-                  val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-                  try {
-                    html = katex.renderToString(inner.trim(), {
-                      throwOnError: false,
-                      strict: false,
-                      output: "htmlAndMathml"
-                    });
-                  } catch (e) {
-                    html = inner;
-                  }
-                  return `<${tag}${attrs}>${html}</${tag}>`;
-                }
-              );
-            }
-        } catch (e) {
-          console.error('KaTeX渲染错误:', e);
-          return val;
-        }
-      }
-    },
+
     MarkdownT() {
     MarkdownT() {
       return function (c) {
       return function (c) {
         let md = new MarkdownIt();
         let md = new MarkdownIt();

+ 6 - 50
src/components/easy2/studyStudent.vue

@@ -522,9 +522,9 @@
                   v-html="
                   v-html="
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                       .taskDetail
                       .taskDetail
-                      ? renderedFormula(chapInfoList[courseType].chapterInfo[0].taskJson[
+                      ? chapInfoList[courseType].chapterInfo[0].taskJson[
                           taskCount
                           taskCount
-                        ].taskDetail)
+                        ].taskDetail
                       : '暂无描述'
                       : '暂无描述'
                   "
                   "
                 ></div>
                 ></div>
@@ -1577,7 +1577,7 @@
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                       <div
                       <div
                         style="height:100%;"
                         style="height:100%;"
-                        v-html="renderedFormula(tool.toolDetail)"
+                        v-html="tool.toolDetail"
                         v-if="toolDetailIndex != toolIndex"
                         v-if="toolDetailIndex != toolIndex"
                       ></div>
                       ></div>
                       <div v-else @click.stop="" style="height:100%;">
                       <div v-else @click.stop="" style="height:100%;">
@@ -6206,7 +6206,7 @@
                               cursor: pointer;
                               cursor: pointer;
                             "
                             "
                           >
                           >
-                            {{ index + 1 + "、"  }} <span v-html="renderedFormula(item.teststitle)"></span>
+                            {{ index + 1 + "、"  }} <span v-html="item.teststitle"></span>
                           </div>
                           </div>
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
@@ -13035,7 +13035,7 @@
                 >
                 >
                   (多选题)
                   (多选题)
                 </div>
                 </div>
-                <div>题目:<span v-html="renderedFormula(testJson.testJson[index1].teststitle)"></span></div>
+                <div>题目:<span v-html="testJson.testJson[index1].teststitle"></span></div>
               </div>
               </div>
               <img
               <img
                 v-if="testJson.testJson[index1].img"
                 v-if="testJson.testJson[index1].img"
@@ -26197,51 +26197,7 @@ export default {
     this.updateSplitScreenData(1);
     this.updateSplitScreenData(1);
   },
   },
   computed: {
   computed: {
-    renderedFormula() {
-      return function(val){
-        try {
-           // 判断是否含有HTML标签,<tag ...>...</tag>
-            const hasTag = /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g.test(val);
-            if (!hasTag) {
-              // 纯文本,整体渲染
-              val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-              try {
-                return katex.renderToString(val.trim(), {
-                  throwOnError: false,
-                  strict: false,
-                  output: "htmlAndMathml"
-                });
-              } catch (e) {
-                return val; // 渲染失败原样输出
-              }
-            } else {
-              // 有标签,对每个标签内容渲染
-              return val.replace(
-                /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g,
-                (match, tag, attrs, inner) => {
-                  let html;
-                   val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-                  try {
-                    html = katex.renderToString(inner.trim(), {
-                      throwOnError: false,
-                      strict: false,
-                      output: "htmlAndMathml"
-                    });
-                  } catch (e) {
-                    html = inner;
-                  }
-                  return `<${tag}${attrs}>${html}</${tag}>`;
-                }
-              );
-            }
-        } catch (e) {
-          console.error('KaTeX渲染错误:', e);
-          return val;
-        }
-      }
-    },
+
     isAndroid() {
     isAndroid() {
       return /Android/i.test(navigator.userAgent);
       return /Android/i.test(navigator.userAgent);
     },
     },

+ 5 - 50
src/components/easy3/studyStudent.vue

@@ -537,9 +537,9 @@
                   v-html="
                   v-html="
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                       .taskDetail
                       .taskDetail
-                      ? renderedFormula(chapInfoList[courseType].chapterInfo[0].taskJson[
+                      ? chapInfoList[courseType].chapterInfo[0].taskJson[
                           taskCount
                           taskCount
-                        ].taskDetail)
+                        ].taskDetail
                       : '暂无描述'
                       : '暂无描述'
                   "
                   "
                 ></div>
                 ></div>
@@ -1551,7 +1551,7 @@
                       <!-- <div class="toolTitle">工具描述</div> -->
                       <!-- <div class="toolTitle">工具描述</div> -->
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" 点击开启修改-->
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" 点击开启修改-->
                       <div style="height:100%;"
                       <div style="height:100%;"
-                        v-html="renderedFormula(tool.toolDetail)"
+                        v-html="tool.toolDetail"
                         v-if="toolDetailIndex != toolIndex"
                         v-if="toolDetailIndex != toolIndex"
                       ></div>
                       ></div>
                       <div v-else @click.stop="" style="height:100%;">
                       <div v-else @click.stop="" style="height:100%;">
@@ -4465,7 +4465,7 @@
                               cursor: pointer;
                               cursor: pointer;
                             "
                             "
                           >
                           >
-                            {{ index + 1 + "、"  }} <span v-html="renderedFormula(item.teststitle)"></span>
+                            {{ index + 1 + "、"  }} <span v-html="item.teststitle"></span>
                           </div>
                           </div>
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
@@ -9667,7 +9667,7 @@
                 >
                 >
                   (多选题)
                   (多选题)
                 </div>
                 </div>
-                <div>题目:<span v-html="renderedFormula(testJson.testJson[index1].teststitle)"></span></div>
+                <div>题目:<span v-html="testJson.testJson[index1].teststitle"></span></div>
               </div>
               </div>
               <img
               <img
                 v-if="testJson.testJson[index1].img"
                 v-if="testJson.testJson[index1].img"
@@ -21554,51 +21554,6 @@ export default {
 		this.updateSplitScreenData(1);
 		this.updateSplitScreenData(1);
   },
   },
   computed: {
   computed: {
-    renderedFormula() {
-      return function(val){
-        try {
-           // 判断是否含有HTML标签,<tag ...>...</tag>
-            const hasTag = /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g.test(val);
-            if (!hasTag) {
-              val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-              // 纯文本,整体渲染
-              try {
-                return katex.renderToString(val.trim(), {
-                  throwOnError: false,
-                  strict: false,
-                  output: "htmlAndMathml"
-                });
-              } catch (e) {
-                return val; // 渲染失败原样输出
-              }
-            } else {
-
-              // 有标签,对每个标签内容渲染
-              return val.replace(
-                /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g,
-                (match, tag, attrs, inner) => {
-                  let html;
-                  val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-                  try {
-                    html = katex.renderToString(inner.trim(), {
-                      throwOnError: false,
-                      strict: false,
-                      output: "htmlAndMathml"
-                    });
-                  } catch (e) {
-                    html = inner;
-                  }
-                  return `<${tag}${attrs}>${html}</${tag}>`;
-                }
-              );
-            }
-        } catch (e) {
-          console.error('KaTeX渲染错误:', e);
-          return val;
-        }
-      }
-    },
     isAndroid() {
     isAndroid() {
       return /Android/i.test(navigator.userAgent);
       return /Android/i.test(navigator.userAgent);
     },
     },

+ 5 - 49
src/components/studyStudent.vue

@@ -500,9 +500,9 @@
                   v-html="
                   v-html="
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                       .taskDetail
                       .taskDetail
-                      ? renderedFormula(chapInfoList[courseType].chapterInfo[0].taskJson[
+                      ? chapInfoList[courseType].chapterInfo[0].taskJson[
                           taskCount
                           taskCount
-                        ].taskDetail)
+                        ].taskDetail
                       : '暂无描述'
                       : '暂无描述'
                   "
                   "
                 ></div>
                 ></div>
@@ -1511,7 +1511,7 @@
                       <!-- <div class="toolTitle">工具描述</div> -->
                       <!-- <div class="toolTitle">工具描述</div> -->
                         <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                         <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                       <div style="height:100%;"
                       <div style="height:100%;"
-                        v-html="renderedFormula(tool.toolDetail)"
+                        v-html="tool.toolDetail"
                         v-if="toolDetailIndex != toolIndex"
                         v-if="toolDetailIndex != toolIndex"
                       ></div>
                       ></div>
                       <div v-else @click.stop="" style="height:100%;">
                       <div v-else @click.stop="" style="height:100%;">
@@ -4425,7 +4425,7 @@
                               cursor: pointer;
                               cursor: pointer;
                             "
                             "
                           >
                           >
-                            {{ index + 1 + "、"  }} <span v-html="renderedFormula(item.teststitle)"></span>
+                            {{ index + 1 + "、"  }} <span v-html="item.teststitle"></span>
                           </div>
                           </div>
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
@@ -9603,7 +9603,7 @@
                 >
                 >
                   (多选题)
                   (多选题)
                 </div>
                 </div>
-                <div>题目:<span v-html="renderedFormula(testJson.testJson[index1].teststitle)"></span></div>
+                <div>题目:<span v-html="testJson.testJson[index1].teststitle"></span></div>
               </div>
               </div>
               <img
               <img
                 v-if="testJson.testJson[index1].img"
                 v-if="testJson.testJson[index1].img"
@@ -21506,50 +21506,6 @@ export default {
 		this.updateSplitScreenData(1);
 		this.updateSplitScreenData(1);
   },
   },
   computed: {
   computed: {
-    renderedFormula() {
-      return function(val){
-        try {
-           // 判断是否含有HTML标签,<tag ...>...</tag>
-            const hasTag = /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g.test(val);
-            if (!hasTag) {
-              val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-              // 纯文本,整体渲染
-              try {
-                return katex.renderToString(val.trim(), {
-                  throwOnError: false,
-                  strict: false,
-                  output: "htmlAndMathml"
-                });
-              } catch (e) {
-                return val; // 渲染失败原样输出
-              }
-            } else {
-              // 有标签,对每个标签内容渲染
-              return val.replace(
-                /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g,
-                (match, tag, attrs, inner) => {
-                  let html;
-                  val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-                  try {
-                    html = katex.renderToString(inner.trim(), {
-                      throwOnError: false,
-                      strict: false,
-                      output: "htmlAndMathml"
-                    });
-                  } catch (e) {
-                    html = inner;
-                  }
-                  return `<${tag}${attrs}>${html}</${tag}>`;
-                }
-              );
-            }
-        } catch (e) {
-          console.error('KaTeX渲染错误:', e);
-          return val;
-        }
-      }
-    },
     isAndroid() {
     isAndroid() {
       return /Android/i.test(navigator.userAgent);
       return /Android/i.test(navigator.userAgent);
     },
     },

+ 5 - 50
src/components/studySutdentClass/studyStudent.vue

@@ -537,9 +537,9 @@
                   v-html="
                   v-html="
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                     chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                       .taskDetail
                       .taskDetail
-                      ? renderedFormula(chapInfoList[courseType].chapterInfo[0].taskJson[
+                      ? chapInfoList[courseType].chapterInfo[0].taskJson[
                           taskCount
                           taskCount
-                        ].taskDetail)
+                        ].taskDetail
                       : '暂无描述'
                       : '暂无描述'
                   "
                   "
                 ></div>
                 ></div>
@@ -1573,7 +1573,7 @@
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                       <!-- @click.stop="updateToolDetail(toolIndex, 2)" -->
                       <div
                       <div
                         style="height:100%;"
                         style="height:100%;"
-                        v-html="renderedFormula(tool.toolDetail)"
+                        v-html="tool.toolDetail"
                         v-if="toolDetailIndex != toolIndex"
                         v-if="toolDetailIndex != toolIndex"
                       ></div>
                       ></div>
                       <div v-else @click.stop="" style="height:100%;">
                       <div v-else @click.stop="" style="height:100%;">
@@ -6202,7 +6202,7 @@
                               cursor: pointer;
                               cursor: pointer;
                             "
                             "
                           >
                           >
-                            {{ index + 1 + "、"  }} <span v-html="renderedFormula(item.teststitle)"></span>
+                            {{ index + 1 + "、"  }} <span v-html="item.teststitle"></span>
                           </div>
                           </div>
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
@@ -12848,7 +12848,7 @@
                 >
                 >
                   (多选题)
                   (多选题)
                 </div>
                 </div>
-                <div>题目:<span v-html="renderedFormula(testJson.testJson[index1].teststitle)"></span></div>
+                <div>题目:<span v-html="testJson.testJson[index1].teststitle"></span></div>
               </div>
               </div>
               <img
               <img
                 v-if="testJson.testJson[index1].img"
                 v-if="testJson.testJson[index1].img"
@@ -25593,51 +25593,6 @@ export default {
 		this.updateSplitScreenData(1);
 		this.updateSplitScreenData(1);
   },
   },
   computed: {
   computed: {
-    renderedFormula() {
-      return function(val){
-        try {
-           // 判断是否含有HTML标签,<tag ...>...</tag>
-            const hasTag = /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g.test(val);
-            if (!hasTag) {
-              // 纯文本,整体渲染
-              val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-              try {
-                return katex.renderToString(val.trim(), {
-                  throwOnError: false,
-                  strict: false,
-                  output: "htmlAndMathml"
-                });
-              } catch (e) {
-                return val; // 渲染失败原样输出
-              }
-            } else {
-              // 有标签,对每个标签内容渲染
-              return val.replace(
-                /<([a-zA-Z][\w\-]*)([^>]*)>([\s\S]*?)<\/\1>/g,
-                (match, tag, attrs, inner) => {
-                  let html;
-                  val = val.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
-
-                  try {
-                    html = katex.renderToString(inner.trim(), {
-                      throwOnError: false,
-                      strict: false,
-                      output: "htmlAndMathml"
-                    });
-                  } catch (e) {
-                    html = inner;
-                  }
-                  return `<${tag}${attrs}>${html}</${tag}>`;
-                }
-              );
-            }
-        } catch (e) {
-          console.error('KaTeX渲染错误:', e);
-          return val;
-        }
-      }
-    },
     isAndroid() {
     isAndroid() {
       return /Android/i.test(navigator.userAgent);
       return /Android/i.test(navigator.userAgent);
     },
     },