提交 4f1c6c02 编写于 作者: C CodFrm

修复考试题目无法搜索的bug

上级 fc54cdf2
......@@ -84,7 +84,7 @@ module.exports = {
switch (topic.type) {
case 1:
case 2: {
let options = $(topic.options).find('input');
let options = $(topic.options).find('li input');
let noticText = this.fillSelect(options, correct);
common.signleLine(noticText, 'answer' + topic.index, undefined, topic.options);
break;
......@@ -143,12 +143,20 @@ module.exports = {
fillSelect: function (options, correct) {
let noticText = '';
$(options).removeAttr('checked');
let optionContent = $('.Cy_ulTop.w-top li div');
if (optionContent.length <= 0) {
optionContent = $(options).parents('li').find('a');
}
for (let i = 0; i < correct.length; i++) {
let index = (correct[i].option.charCodeAt() | 32) - 97;
$(options[index]).click();
noticText += correct[i].option + ':' + correct[i].content + '<br/>';
for (let n = 0; n < options.length; n++) {
let option = common.removeHTML($(optionContent[n]).html());
if (option == correct[i].option) {
$(options[n]).click();
noticText += correct[i].option + ':' + correct[i].content + '<br/>';
}
}
}
return noticText;
return noticText || '没有符合的答案';
},
fillJudge: function (options, correct) {
$(options).removeAttr('checked');
......
......@@ -94,11 +94,11 @@ export function removeHTML(html) {
* @param {*} topic
*/
function dealSymbol(topic) {
topic = topic.replace('', ',');
topic = topic.replace('', '(');
topic = topic.replace('', ')');
topic = topic.replace('', '?');
topic = topic.replace('', ':');
topic = topic.replace(/,/g, ',');
topic = topic.replace(/(/g, '(');
topic = topic.replace(/)/g, ')');
topic = topic.replace(/?/g, '?');
topic = topic.replace(/:/g, ':');
topic = topic.replace(/[“”]/g, '"');
return topic;
}
......@@ -363,7 +363,7 @@ export function requestAnswer(topic, platform, page, answer, compile, error, cou
time = time || 2000;
let post = '';
for (let i = (page * count), n = 0; i < topic.length && n < count; i++ , n++) {
post += 'topic[' + n + ']=' + topic[i].topic + '&type[' + n + ']=' + topic[i].type + '&';
post += 'topic[' + n + ']=' + '我们现在看不到《红楼梦》哪个章节?()' + '&type[' + n + ']=' + topic[i].type + '&';
}
if (post == '') {
compile && compile();
......@@ -433,8 +433,7 @@ export function fillAnswer(topic, answer, fill, findOption) {
export function fillSelect(options, correct, isTrue) {
let noticText = '';
for (let i = 0; i < correct.length; i++) {
isTrue(options, correct[i], 2);
noticText += correct[i].option + ':' + correct[i].content + '<br/>';
noticText += isTrue(options, correct[i], 2) + ':' + correct[i].content + '<br/>';
}
return noticText;
}
......
......@@ -54,7 +54,7 @@ module.exports = {
let tmpContent = common.removeHTML($(options[i]).html());
if (tmpContent == correct.content) {
$(options[i]).parent().find('input').click();
return true;
return $(options[i]).text();
}
}
}
......@@ -94,7 +94,7 @@ module.exports = {
common.oaForEach(correct, function (item2) {
if (common.numToZh(index + 1) == item2.option) {
$(item).val(item2.content);
retNotic += '' + item2.option + '空:' + item2.content+'<br/>';
retNotic += '' + item2.option + '空:' + item2.content + '<br/>';
}
});
});
......@@ -105,7 +105,7 @@ module.exports = {
if (text == '') {
return common.signleLine('没有合适的答案', 'answer' + index, undefined, topic.options);;
}
common.signleLine(text, 'answer' + index, undefined, topic.options[topic.options.length-1]);
common.signleLine(text, 'answer' + index, undefined, topic.options[topic.options.length - 1]);
},
() => { $(self.btn).text('搜索完成'); },
() => { $(self.btn).text('网络错误'); },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册