|
@@ -1,6 +1,11 @@
|
|
|
<template>
|
|
|
<div class="page-through-question-box">
|
|
|
- <van-nav-bar v-if="env!=='pro'" title="闯关答题" left-arrow @click-left="handleBackFun" />
|
|
|
+ <van-nav-bar
|
|
|
+ v-if="env !== 'pro'"
|
|
|
+ title="闯关答题"
|
|
|
+ left-arrow
|
|
|
+ @click-left="handleBackFun"
|
|
|
+ />
|
|
|
<!-- 题目卡片 -->
|
|
|
<div v-if="answerThroughNumber" class="through-question-div">
|
|
|
<div class="through-question-card">
|
|
@@ -30,7 +35,7 @@
|
|
|
<div class="through-question-describe">
|
|
|
{{
|
|
|
examQuestionList[answerIndex].questionContent ||
|
|
|
- examQuestionList[answerIndex].content
|
|
|
+ examQuestionList[answerIndex].content
|
|
|
}}
|
|
|
</div>
|
|
|
<!-- 答题列表 -->
|
|
@@ -38,9 +43,8 @@
|
|
|
<div
|
|
|
v-if="
|
|
|
examQuestionList[answerIndex].type === questionType.TrueOrFalse ||
|
|
|
- examQuestionList[answerIndex].type ===
|
|
|
- questionType.singleChoice ||
|
|
|
- examQuestionList[answerIndex].type === questionType.multipleChoice
|
|
|
+ examQuestionList[answerIndex].type === questionType.singleChoice ||
|
|
|
+ examQuestionList[answerIndex].type === questionType.multipleChoice
|
|
|
"
|
|
|
class="through-question-options"
|
|
|
>
|
|
@@ -49,11 +53,10 @@
|
|
|
:key="index"
|
|
|
:class="{
|
|
|
'through-question-options-item': true,
|
|
|
- 'through-question-options-item-checked': answerValue.includes(
|
|
|
- item
|
|
|
- ),
|
|
|
+ 'through-question-options-item-checked':
|
|
|
+ answerValue.includes(item),
|
|
|
'through-question-options-false':
|
|
|
- answerValue.includes(item) && answerStatus === 2
|
|
|
+ answerValue.includes(item) && answerStatus === 2,
|
|
|
}"
|
|
|
@click="handleExamQuestionOptionsItemFun(item)"
|
|
|
>
|
|
@@ -79,8 +82,7 @@
|
|
|
/>
|
|
|
</div>
|
|
|
<div v-else class="through-question-button-box">
|
|
|
- <div class="through-question-single-button-box">
|
|
|
- </div>
|
|
|
+ <div class="through-question-single-button-box"></div>
|
|
|
<div class="through-question-single-button-box">
|
|
|
<van-button
|
|
|
v-show="answerStatus === 0"
|
|
@@ -410,24 +412,43 @@ export default {
|
|
|
// return isSure;
|
|
|
let isSure = false;
|
|
|
let lastAnswer = [""];
|
|
|
- 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;
|
|
|
},
|
|
|
// 操作:下一题
|
|
|
handleNextFun() {
|
|
@@ -506,6 +527,7 @@ export default {
|
|
|
return result;
|
|
|
},
|
|
|
// 方法:获取题目的答案
|
|
|
+
|
|
|
getUserExamAllAnswersFun() {
|
|
|
let answers = [];
|
|
|
this.examQuestionList.forEach((item, index) => {
|