|
@@ -588,26 +588,49 @@ export default {
|
|
|
getAnswerItemResultFun(item) {
|
|
|
let isSure = false;
|
|
|
let lastAnswer = [""];
|
|
|
- lastAnswer[0] = this.getUserAnswerSortFun(item);
|
|
|
- if (lastAnswer[0] === item.finalAnswer[0]) {
|
|
|
- isSure = true;
|
|
|
+ // lastAnswer[0] = this.getUserAnswerSortFun(item);
|
|
|
+ // if (lastAnswer[0] === item.finalAnswer[0]) {
|
|
|
+ // isSure = true;
|
|
|
+ // }
|
|
|
+ lastAnswer = this.getUserAnswerSortFun(item);
|
|
|
+ for (let i = 0; i < item.finalAnswer.length; i++) {
|
|
|
+ if (lastAnswer[i] && lastAnswer[i] === item.finalAnswer[i]) {
|
|
|
+ isSure = true;
|
|
|
+ } else {
|
|
|
+ isSure = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
return isSure;
|
|
|
},
|
|
|
// 获取用户所选选项的升序编号答案
|
|
|
getUserAnswerSortFun(item) {
|
|
|
let newUnserAnswer = [];
|
|
|
- item.answers.forEach((itemOne, indexOne) => {
|
|
|
- item.userAnswer.forEach(itemTwo => {
|
|
|
- if (itemOne === itemTwo) {
|
|
|
- newUnserAnswer.push(this.formatQuestionIndex(indexOne));
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- newUnserAnswer.sort();
|
|
|
- return newUnserAnswer.join("");
|
|
|
+ switch (item.type) {
|
|
|
+ case this.questionType.singleChoice:
|
|
|
+ case this.questionType.multipleChoice:
|
|
|
+ case this.questionType.TrueOrFalse:
|
|
|
+ let arr = [];
|
|
|
+ item.answers.forEach((itemOne, indexOne) => {
|
|
|
+ item.userAnswer.forEach(itemTwo => {
|
|
|
+ if (itemOne === itemTwo) {
|
|
|
+ arr.push(this.formatQuestionIndex(indexOne));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ arr = arr.sort();
|
|
|
+ newUnserAnswer = [arr.join("")];
|
|
|
+ break;
|
|
|
+ case this.questionType.gapFilling:
|
|
|
+ newUnserAnswer = item.answers;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // return newUnserAnswer.join("");
|
|
|
+ return newUnserAnswer;
|
|
|
},
|
|
|
- // 方法:获取题目的答案
|
|
|
+ // 方法:获取用户的作答
|
|
|
getUserExamAllAnswersFun() {
|
|
|
let answers = [];
|
|
|
this.examQuestionList.forEach((item, index) => {
|