|
@@ -148,6 +148,7 @@ const useSubjectCheck = (nextSubject: () => Promise<void>, _type?: ExerciseType.
|
|
|
* 选择答案后进行校验
|
|
|
*/
|
|
|
const userAnswerChange = (currentSubject: any) => {
|
|
|
+ console.log(currentSubject, 'currentSubject')
|
|
|
try {
|
|
|
if (!currentSubject.userAnswer) return;
|
|
|
|
|
@@ -163,7 +164,18 @@ const useSubjectCheck = (nextSubject: () => Promise<void>, _type?: ExerciseType.
|
|
|
}
|
|
|
return { opt: val, status };
|
|
|
});
|
|
|
- if (JSON.stringify(currentSubject.answer) == JSON.stringify(currentSubject.userAnswer)) {
|
|
|
+
|
|
|
+ if (currentSubject.questionType == 2 && currentSubject.answer === currentSubject.userAnswer) {
|
|
|
+ console.log("答案正确");
|
|
|
+ currentSubject.isTrue = true;
|
|
|
+ trueNum.value++;
|
|
|
+ if (isJumpNext.value) {
|
|
|
+ nextTick(() => {
|
|
|
+ nextSubject();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (currentSubject.questionType == 3 && currentSubject.answer.split("-").sort().toString() === currentSubject.userAnswer.sort().toString()) {
|
|
|
console.log("答案正确");
|
|
|
currentSubject.isTrue = true;
|
|
|
trueNum.value++;
|
|
@@ -172,22 +184,24 @@ const useSubjectCheck = (nextSubject: () => Promise<void>, _type?: ExerciseType.
|
|
|
nextSubject();
|
|
|
});
|
|
|
}
|
|
|
- } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
falseNum.value++;
|
|
|
if (_type == "wrong") {
|
|
|
- let wrongSet :[any] = JSON.parse(window.localStorage.getItem(vehicle + subject) || "[]") || []
|
|
|
+ let wrongSet: [any] = JSON.parse(window.localStorage.getItem(vehicle + subject) || "[]") || []
|
|
|
currentSubject.userAnswer = ""
|
|
|
wrongSet.push(currentSubject)
|
|
|
- window.localStorage.setItem(vehicle+subject,JSON.stringify(wrongSet)||"[]")
|
|
|
+ window.localStorage.setItem(vehicle + subject, JSON.stringify(wrongSet) || "[]")
|
|
|
currentSubject.isTrue = null;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
currentSubject.isTrue = false;
|
|
|
-
|
|
|
+
|
|
|
//错误题目的合集
|
|
|
console.log("答案错误");
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.log(error);
|