Skip to content

Commit af665f6

Browse files
committed
修正:试题练习中公式无法解析的问题
1 parent e38c196 commit af665f6

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

Sourcecode/Song.WebSite/Templates/Mobi/Default/Question/Components/SetupMenu.js

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Vue.component('setupmenu', {
7979
init = isNaN(init) ? 0 : init;
8080
let val = num == null ? init : (num == 0 ? num : init + num);
8181
if (val < min || val > max) return;
82+
//设置父级应用中的字体大小
8283
this.$parent.fontsize = val;
8384
$api.storage(this.fontsizekey, val);
8485
},

Sourcecode/Song.WebSite/Templates/Mobi/Default/Question/Styles/Exercise.css

-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,3 @@ html, body, #vapp {
2222
/*IE10*/
2323
user-select: none;
2424
}
25-
26-
27-
28-

Sourcecode/Song.WebSite/Utilities/Components/Question/exercise.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ Vue.component('question', {
5353
//是否存在知识点
5454
existknl: t => !$api.isnull(t.knowledge),
5555
},
56+
updated: function () {
57+
//this.$mathjax();
58+
},
5659
mounted: function () { },
5760
methods: {
5861
//始始化的方法
@@ -66,17 +69,19 @@ Vue.component('question', {
6669
th.ques = req.data.result;
6770
th.getKnowledge(th.ques);
6871
th.ques = th.parseAnswer(th.ques);
69-
72+
console.error(th.ques)
7073
th.$nextTick(function () {
7174
var dom = $dom("dd[qid='" + th.ques.Qus_ID + "']");
75+
let title = dom.find('card-title');
7276
//清理空元素
7377
window.ques.clearempty(dom.find('card-title'));
7478
window.ques.clearempty(dom.find('.ans_area'));
7579
//公式渲染
7680
th.$mathjax([dom[0]]);
7781
window.setTimeout(function () {
7882
th.setfontsize(th.fontsize);
79-
}, 20);
83+
th.$mathjax([dom[0]]);
84+
}, 200);
8085

8186
});
8287
} else {
@@ -95,6 +100,10 @@ Vue.component('question', {
95100
var size = 16, min_size = 12, max_size = 30;
96101
ergodic($dom("dl.quesArea dd[qid='" + this.qid + "']"), num);
97102
function ergodic(dom, num) {
103+
//如果是公式,则不处理
104+
let domname = dom[0].tagName.toLowerCase();
105+
if (domname.toLowerCase() == 'mjx-container') return;
106+
//
98107
var fontsize = parseInt(dom.css("font-size"));
99108
fontsize = isNaN(fontsize) ? size : fontsize;
100109
if (num < 0 && fontsize + num > min_size) fontsize += num;
@@ -299,16 +308,16 @@ Vue.component('question', {
299308
let answer = ques.Qus_Items[i].answer; //答题信息
300309
ansstr.push(answer);
301310
let items = ques.Qus_Items[i].Ans_Context.split(","); //正确答案
302-
if(!items.includes(answer)){
311+
if (!items.includes(answer)) {
303312
correct = false;
304313
break;
305314
}
306315
}
307316
ques.Qus_Answer = ansstr.join(',');
308317
this.state['ans'] = ansstr.join(',');
309-
this.state['correct'] = ansstr.length > 0 ? (correct ? "succ" : "error") : "null";
318+
this.state['correct'] = ansstr.length > 0 ? (correct ? "succ" : "error") : "null";
310319
if (correct) this.$parent.swipe({ 'direction': 2 });
311-
return correct;
320+
return correct;
312321
}
313322
},
314323
template: `<dd :qid="qid" :current="current" :render="init">

0 commit comments

Comments
 (0)