|
@@ -18,7 +18,7 @@
|
|
|
|
|
|
<main class="main">
|
|
|
<StartQuestion
|
|
|
- v-if="curQuestionIndex === -1 && !(user_answer_record_info.is_exist_answer_record === 'true')"
|
|
|
+ v-if="curQuestionIndex === -1 && !(user_answer_record_info.is_exist_answer_record === 'true') && !isShow"
|
|
|
:question-length="questionList.length"
|
|
|
:answer-time-limit-minute="answer_time_limit_minute"
|
|
|
@startAnswer="startAnswer"
|
|
@@ -103,9 +103,9 @@
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
- <el-button round @click="fillQuestionAnswer('pre')">上一题</el-button>
|
|
|
+ <el-button v-if="curQuestionIndex > 0" round @click="fillQuestionAnswer('pre')">上一题</el-button>
|
|
|
<el-button
|
|
|
- v-if="curQuestionIndex === questionList.length - 1 && !isTeacherAnnotations"
|
|
|
+ v-if="curQuestionIndex === questionList.length - 1 && !isTeacherAnnotations && !isShow"
|
|
|
type="primary"
|
|
|
round
|
|
|
@click="confirmSubmitAnswer"
|
|
@@ -113,7 +113,7 @@
|
|
|
提交
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
- v-else-if="curQuestionIndex < questionList.length - 1 || !isTeacherAnnotations"
|
|
|
+ v-else-if="curQuestionIndex < questionList.length - 1"
|
|
|
type="primary"
|
|
|
round
|
|
|
@click="fillQuestionAnswer('next')"
|
|
@@ -136,6 +136,7 @@ import {
|
|
|
GetQuestionInfo_AnswerRecord,
|
|
|
FillQuestionAnswerRemark,
|
|
|
GetAnswerRecordReport,
|
|
|
+ GetQuestionInfo,
|
|
|
} from '@/api/exercise';
|
|
|
import { subjectiveQuestionList } from './answer';
|
|
|
import { fileUpload } from '@/api/app';
|
|
@@ -152,10 +153,19 @@ export default {
|
|
|
},
|
|
|
mixins: [PreviewQuestionTypeMixin],
|
|
|
data() {
|
|
|
- const { id, share_record_id, answer_record_id, exercise_id, question_index, back_url } = this.$route.query;
|
|
|
+ const {
|
|
|
+ id,
|
|
|
+ share_record_id,
|
|
|
+ answer_record_id,
|
|
|
+ exercise_id,
|
|
|
+ question_index,
|
|
|
+ back_url,
|
|
|
+ type = 'answer',
|
|
|
+ } = this.$route.query;
|
|
|
let questionIndex = Number(question_index);
|
|
|
|
|
|
return {
|
|
|
+ isShow: type === 'show', // 是否是展示模式
|
|
|
exercise_id: id || exercise_id, // 练习题id
|
|
|
share_record_id, // 分享记录id
|
|
|
answer_record_id: answer_record_id ?? '', // 答题记录id
|
|
@@ -225,6 +235,10 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
curQuestionIndex() {
|
|
|
+ if (this.isShow) {
|
|
|
+ this.getQuestionInfo();
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.getQuestionInfo_AnswerRecord();
|
|
|
},
|
|
|
isSubmit(val) {
|
|
@@ -257,7 +271,7 @@ export default {
|
|
|
this.time = answer_time_limit_minute * 60;
|
|
|
this.loading = false;
|
|
|
// 如果已经存在答题记录,则直接显示答题报告
|
|
|
- if (this.user_answer_record_info.is_exist_answer_record === 'true' && !this.isTeacher) {
|
|
|
+ if (this.user_answer_record_info.is_exist_answer_record === 'true') {
|
|
|
this.answer_record_id = this.user_answer_record_info.answer_record_id;
|
|
|
this.answer_mode = answer_mode;
|
|
|
this.isSubmit = true;
|
|
@@ -291,8 +305,13 @@ export default {
|
|
|
...item,
|
|
|
isFill: this.isTeacherAnnotations || this.user_answer_record_info.is_exist_answer_record === 'true',
|
|
|
}));
|
|
|
+ if (this.isShow) {
|
|
|
+ this.curQuestionIndex = 0;
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (this.question_index >= 0) {
|
|
|
this.curQuestionIndex = this.question_index;
|
|
|
+ return;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -349,11 +368,14 @@ export default {
|
|
|
if (type === 'pre' && this.curQuestionIndex <= 0) return;
|
|
|
if (type === 'next' && this.curQuestionIndex > this.questionList.length - 1) return;
|
|
|
if (!this.answer_record_id) {
|
|
|
- this.curQuestionIndex = type === 'pre' ? this.curQuestionIndex - 1 : this.curQuestionIndex + 1;
|
|
|
+ this.curQuestionIndex =
|
|
|
+ type === 'pre'
|
|
|
+ ? Math.max(0, this.curQuestionIndex - 1)
|
|
|
+ : Math.min(this.questionList.length - 1, this.curQuestionIndex + 1);
|
|
|
return;
|
|
|
}
|
|
|
// 如果已填写,直接跳转
|
|
|
- if (this.questionList[this.curQuestionIndex].isFill) {
|
|
|
+ if (this.questionList[this.curQuestionIndex].isFill || this.isShow) {
|
|
|
if (type === 'pre') return this.preQuestion();
|
|
|
if (type === 'next') return this.nextQuestion();
|
|
|
}
|
|
@@ -375,6 +397,19 @@ export default {
|
|
|
);
|
|
|
});
|
|
|
},
|
|
|
+ getQuestionInfo() {
|
|
|
+ if (this.questionList.length === 0) return;
|
|
|
+ GetQuestionInfo({ question_id: this.questionList[this.curQuestionIndex].id }).then(({ question, file_list }) => {
|
|
|
+ if (!question.content) return;
|
|
|
+ this.curQuestionPage =
|
|
|
+ this.curQuestionIndex < 0 ? '' : this.previewComponents[this.questionList[this.curQuestionIndex].type];
|
|
|
+ // 将题目文件id列表添加到题目内容中
|
|
|
+ let file_id_list = file_list.map(({ file_id }) => file_id);
|
|
|
+ let content = JSON.parse(question.content);
|
|
|
+ content.file_id_list = file_id_list;
|
|
|
+ this.currentQuestion = content;
|
|
|
+ });
|
|
|
+ },
|
|
|
// 得到答题记录题目信息
|
|
|
getQuestionInfo_AnswerRecord() {
|
|
|
if (this.questionList.length === 0) return;
|