|
@@ -92,7 +92,7 @@ export default {
|
|
|
|
|
|
this.submitInterval = setInterval(
|
|
this.submitInterval = setInterval(
|
|
() => this.answerAllQuestions(),
|
|
() => this.answerAllQuestions(),
|
|
- 1 * 60 * 1000
|
|
|
|
|
|
+ 10 * 1000 // 10秒检查是否有更改需要提交答案
|
|
);
|
|
);
|
|
|
|
|
|
// this.$Modal.info({
|
|
// this.$Modal.info({
|
|
@@ -111,7 +111,12 @@ export default {
|
|
// this.updateQuestion(next);
|
|
// this.updateQuestion(next);
|
|
// },
|
|
// },
|
|
methods: {
|
|
methods: {
|
|
- ...mapMutations(["updateExamState", "toggleSnapNow", "updateExamResult"]),
|
|
|
|
|
|
+ ...mapMutations([
|
|
|
|
+ "updateExamState",
|
|
|
|
+ "toggleSnapNow",
|
|
|
|
+ "updateExamResult",
|
|
|
|
+ "resetExamQuestionDirty"
|
|
|
|
+ ]),
|
|
async initData() {
|
|
async initData() {
|
|
const exam = await this.$http.get(
|
|
const exam = await this.$http.get(
|
|
"/api/ecs_exam_work/exam/" + this.$route.params.examId
|
|
"/api/ecs_exam_work/exam/" + this.$route.params.examId
|
|
@@ -168,7 +173,6 @@ export default {
|
|
if (!this.exam) return;
|
|
if (!this.exam) return;
|
|
},
|
|
},
|
|
async answerAllQuestions() {
|
|
async answerAllQuestions() {
|
|
- // TODO: reset dirty
|
|
|
|
const answers = this.examQuestionList.filter(eq => eq.dirty).map(eq => {
|
|
const answers = this.examQuestionList.filter(eq => eq.dirty).map(eq => {
|
|
return {
|
|
return {
|
|
order: eq.order,
|
|
order: eq.order,
|
|
@@ -176,17 +180,15 @@ export default {
|
|
audioPlayTimes: eq.audioPlayTimes
|
|
audioPlayTimes: eq.audioPlayTimes
|
|
};
|
|
};
|
|
});
|
|
});
|
|
- await this.$http.post(
|
|
|
|
- "/api/ecs_oe_student/examQuestion/submitQuestionAnswer",
|
|
|
|
- answers
|
|
|
|
- );
|
|
|
|
- // this.updateExamQuestion({
|
|
|
|
- // order: this.$route.params.order,
|
|
|
|
- // studentAnswer
|
|
|
|
- // });
|
|
|
|
|
|
+ if (answers.length > 0) {
|
|
|
|
+ await this.$http.post(
|
|
|
|
+ "/api/ecs_oe_student/examQuestion/submitQuestionAnswer",
|
|
|
|
+ answers
|
|
|
|
+ );
|
|
|
|
+ this.resetExamQuestionDirty();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
async submitPaper() {
|
|
async submitPaper() {
|
|
- //FIXME: submit precondition
|
|
|
|
await this.answerAllQuestions();
|
|
await this.answerAllQuestions();
|
|
|
|
|
|
const answered = this.examQuestionList.filter(
|
|
const answered = this.examQuestionList.filter(
|