|
@@ -118,8 +118,8 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
userInfo: {
|
|
userInfo: {
|
|
- id: 0,
|
|
|
|
- username: "string",
|
|
|
|
|
|
+ id: "testuser-ztdxxDGdNj",
|
|
|
|
+ username: "testuser-ztdxxDGdNj",
|
|
firstName: "string",
|
|
firstName: "string",
|
|
lastName: "string",
|
|
lastName: "string",
|
|
email: "string",
|
|
email: "string",
|
|
@@ -378,6 +378,18 @@ export default {
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ this.handleNextFun(); // 方法:下一题
|
|
|
|
+ },
|
|
|
|
+ // 方法:下一题
|
|
|
|
+ handleNextFun() {
|
|
|
|
+ let nextIndex = this.answerIndex + 1;
|
|
|
|
+ if (nextIndex >= this.examQuestionList.length) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.handleExamQuestionItemFun(
|
|
|
|
+ this.examQuestionList[nextIndex],
|
|
|
|
+ nextIndex
|
|
|
|
+ );
|
|
},
|
|
},
|
|
// 操作:确定
|
|
// 操作:确定
|
|
handleSureFun() {
|
|
handleSureFun() {
|
|
@@ -395,9 +407,8 @@ export default {
|
|
message: "确认交卷?"
|
|
message: "确认交卷?"
|
|
})
|
|
})
|
|
.then(() => {
|
|
.then(() => {
|
|
- // TODO...
|
|
|
|
- this.answerTime.endTime = new Date();
|
|
|
|
clearInterval(this.interval); // 销毁前清空计时器
|
|
clearInterval(this.interval); // 销毁前清空计时器
|
|
|
|
+ this.answerTime.endTime = new Date();
|
|
this.examsEndFun(isAuto);
|
|
this.examsEndFun(isAuto);
|
|
})
|
|
})
|
|
.catch(() => {});
|
|
.catch(() => {});
|
|
@@ -410,6 +421,7 @@ export default {
|
|
}
|
|
}
|
|
this.$store.commit("toggleLoading", true);
|
|
this.$store.commit("toggleLoading", true);
|
|
let grades = this.getUserExamAllPointsFun(); // 方法:计算成绩
|
|
let grades = this.getUserExamAllPointsFun(); // 方法:计算成绩
|
|
|
|
+ let answers = this.getUserExamAllAnswersFun(); // 方法:获取题目的答案
|
|
let params = {
|
|
let params = {
|
|
user: this.userInfo,
|
|
user: this.userInfo,
|
|
exam: {
|
|
exam: {
|
|
@@ -423,7 +435,8 @@ export default {
|
|
},
|
|
},
|
|
points: grades, // 成绩:分数
|
|
points: grades, // 成绩:分数
|
|
startTime: this.answerTime.startTime,
|
|
startTime: this.answerTime.startTime,
|
|
- endTime: this.answerTime.endTime
|
|
|
|
|
|
+ endTime: this.answerTime.endTime,
|
|
|
|
+ userAnswers: answers
|
|
};
|
|
};
|
|
this.$_http
|
|
this.$_http
|
|
.post(
|
|
.post(
|
|
@@ -433,7 +446,6 @@ export default {
|
|
params
|
|
params
|
|
)
|
|
)
|
|
.then(res => {
|
|
.then(res => {
|
|
- console.log("结束考试了", res);
|
|
|
|
this.$store.commit("toggleLoading", false);
|
|
this.$store.commit("toggleLoading", false);
|
|
this.$router.replace({
|
|
this.$router.replace({
|
|
name: "ExamResult",
|
|
name: "ExamResult",
|
|
@@ -461,6 +473,14 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
return grades;
|
|
return grades;
|
|
|
|
+ },
|
|
|
|
+ // 方法:获取题目的答案
|
|
|
|
+ getUserExamAllAnswersFun() {
|
|
|
|
+ let answers = [];
|
|
|
|
+ this.examQuestionList.forEach((item, index) => {
|
|
|
|
+ answers[index] = item.userAnswer.join(",");
|
|
|
|
+ });
|
|
|
|
+ return answers;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|