|  | @@ -18,9 +18,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <main class="main">
 | 
	
		
			
				|  |  |        <StartQuestion
 | 
	
		
			
				|  |  | -        v-if="
 | 
	
		
			
				|  |  | -          curQuestionIndex === -1 && !(user_answer_record_info.is_exist_answer_record === 'true' && answer_mode === 2)
 | 
	
		
			
				|  |  | -        "
 | 
	
		
			
				|  |  | +        v-if="curQuestionIndex === -1 && !(user_answer_record_info.is_exist_answer_record === 'true')"
 | 
	
		
			
				|  |  |          :question-length="questionList.length"
 | 
	
		
			
				|  |  |          :answer-time-limit-minute="answer_time_limit_minute"
 | 
	
		
			
				|  |  |          @startAnswer="startAnswer"
 | 
	
	
		
			
				|  | @@ -96,11 +94,7 @@
 | 
	
		
			
				|  |  |        </el-popover>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        <div>
 | 
	
		
			
				|  |  | -        <template
 | 
	
		
			
				|  |  | -          v-if="
 | 
	
		
			
				|  |  | -            curQuestionIndex === -1 && !(user_answer_record_info.is_exist_answer_record === 'true' && answer_mode === 2)
 | 
	
		
			
				|  |  | -          "
 | 
	
		
			
				|  |  | -        >
 | 
	
		
			
				|  |  | +        <template v-if="curQuestionIndex === -1 && !(user_answer_record_info.is_exist_answer_record === 'true')">
 | 
	
		
			
				|  |  |            <el-button type="primary" round @click="startAnswer">开始答题</el-button>
 | 
	
		
			
				|  |  |          </template>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -114,7 +108,7 @@
 | 
	
		
			
				|  |  |              v-if="curQuestionIndex === questionList.length - 1 && !isTeacherAnnotations"
 | 
	
		
			
				|  |  |              type="primary"
 | 
	
		
			
				|  |  |              round
 | 
	
		
			
				|  |  | -            @click="submitAnswer"
 | 
	
		
			
				|  |  | +            @click="confirmSubmitAnswer"
 | 
	
		
			
				|  |  |            >
 | 
	
		
			
				|  |  |              提交
 | 
	
		
			
				|  |  |            </el-button>
 | 
	
	
		
			
				|  | @@ -158,13 +152,17 @@ export default {
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    mixins: [PreviewQuestionTypeMixin],
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  | -    const { id, share_record_id, answer_record_id, exercise_id, question_index } = this.$route.query;
 | 
	
		
			
				|  |  | +    const { id, share_record_id, answer_record_id, exercise_id, question_index, back_url } = this.$route.query;
 | 
	
		
			
				|  |  |      let questionIndex = Number(question_index);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  |        exercise_id: id || exercise_id, // 练习题id
 | 
	
		
			
				|  |  |        share_record_id, // 分享记录id
 | 
	
		
			
				|  |  |        answer_record_id: answer_record_id ?? '', // 答题记录id
 | 
	
		
			
				|  |  | +      back_url:
 | 
	
		
			
				|  |  | +        back_url?.length > 0
 | 
	
		
			
				|  |  | +          ? decodeURIComponent(back_url)
 | 
	
		
			
				|  |  | +          : `${window.location.origin}/GCLS-Learn/#/main?tab=ExerciseList`, // 返回链接
 | 
	
		
			
				|  |  |        secondFormatConversion,
 | 
	
		
			
				|  |  |        isTeacher: this.$store.getters.isTeacher, // 是否是教师
 | 
	
		
			
				|  |  |        user_answer_record_info: {
 | 
	
	
		
			
				|  | @@ -214,7 +212,11 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 是否显示批注
 | 
	
		
			
				|  |  |      isAnnotations() {
 | 
	
		
			
				|  |  | -      return this.remark.is_remarked === 'true' || this.isTeacherAnnotations;
 | 
	
		
			
				|  |  | +      return (
 | 
	
		
			
				|  |  | +        (this.remark.is_remarked === 'true' || this.isTeacherAnnotations) &&
 | 
	
		
			
				|  |  | +        this.curQuestionIndex >= 0 &&
 | 
	
		
			
				|  |  | +        !this.isSubmit
 | 
	
		
			
				|  |  | +      );
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 是否考试模式
 | 
	
		
			
				|  |  |      isExamMode() {
 | 
	
	
		
			
				|  | @@ -254,12 +256,11 @@ export default {
 | 
	
		
			
				|  |  |              this.answer_time_limit_minute = answer_time_limit_minute;
 | 
	
		
			
				|  |  |              this.time = answer_time_limit_minute * 60;
 | 
	
		
			
				|  |  |              this.loading = false;
 | 
	
		
			
				|  |  | -            // 如果是考试模式,且已经存在答题记录,则直接显示答题报告
 | 
	
		
			
				|  |  | +            // 如果已经存在答题记录,则直接显示答题报告
 | 
	
		
			
				|  |  |              if (this.user_answer_record_info.is_exist_answer_record === 'true' && !this.isTeacher) {
 | 
	
		
			
				|  |  |                this.answer_record_id = this.user_answer_record_info.answer_record_id;
 | 
	
		
			
				|  |  |                this.answer_mode = answer_mode;
 | 
	
		
			
				|  |  | -              // 如果是考试模式,且已经存在答题记录,则直接显示答题报告
 | 
	
		
			
				|  |  | -              if (this.isExamMode) this.isSubmit = true;
 | 
	
		
			
				|  |  | +              this.isSubmit = true;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              if (!this.isTeacher) {
 | 
	
		
			
				|  |  |                this.getAnswerRecordReport();
 | 
	
	
		
			
				|  | @@ -288,7 +289,7 @@ export default {
 | 
	
		
			
				|  |  |        GetExerciseQuestionIndexList({ exercise_id: this.exercise_id }).then(({ index_list }) => {
 | 
	
		
			
				|  |  |          this.questionList = index_list.map((item) => ({
 | 
	
		
			
				|  |  |            ...item,
 | 
	
		
			
				|  |  | -          isFill: this.isTeacherAnnotations,
 | 
	
		
			
				|  |  | +          isFill: this.isTeacherAnnotations || this.user_answer_record_info.is_exist_answer_record === 'true',
 | 
	
		
			
				|  |  |          }));
 | 
	
		
			
				|  |  |          if (this.question_index >= 0) {
 | 
	
		
			
				|  |  |            this.curQuestionIndex = this.question_index;
 | 
	
	
		
			
				|  | @@ -301,7 +302,7 @@ export default {
 | 
	
		
			
				|  |  |          this.isView = false;
 | 
	
		
			
				|  |  |          return;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      this.$router.push('/personal_question');
 | 
	
		
			
				|  |  | +      window.location.href = this.back_url;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 倒计时
 | 
	
		
			
				|  |  |      countDown() {
 | 
	
	
		
			
				|  | @@ -309,6 +310,7 @@ export default {
 | 
	
		
			
				|  |  |          this.time -= 1;
 | 
	
		
			
				|  |  |          if (this.time === 0) {
 | 
	
		
			
				|  |  |            clearInterval(this.countDownTimer);
 | 
	
		
			
				|  |  | +          this.handleSubmitAnswer();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        }, 1000);
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -319,6 +321,10 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        StartAnswer({ exercise_id: this.exercise_id, share_record_id: this.share_record_id }).then(
 | 
	
		
			
				|  |  |          ({ answer_mode, answer_record_id }) => {
 | 
	
		
			
				|  |  | +          this.questionList = this.questionList.map((item) => ({
 | 
	
		
			
				|  |  | +            ...item,
 | 
	
		
			
				|  |  | +            isFill: false,
 | 
	
		
			
				|  |  | +          }));
 | 
	
		
			
				|  |  |            this.answer_record_id = answer_record_id;
 | 
	
		
			
				|  |  |            this.countDown();
 | 
	
		
			
				|  |  |            this.answer_mode = answer_mode;
 | 
	
	
		
			
				|  | @@ -371,6 +377,7 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 得到答题记录题目信息
 | 
	
		
			
				|  |  |      getQuestionInfo_AnswerRecord() {
 | 
	
		
			
				|  |  | +      if (this.questionList.length === 0) return;
 | 
	
		
			
				|  |  |        GetQuestionInfo_AnswerRecord({
 | 
	
		
			
				|  |  |          answer_record_id: this.answer_record_id,
 | 
	
		
			
				|  |  |          question_id: this.questionList[this.curQuestionIndex].id,
 | 
	
	
		
			
				|  | @@ -400,7 +407,7 @@ export default {
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 提交答题
 | 
	
		
			
				|  |  | -    submitAnswer() {
 | 
	
		
			
				|  |  | +    confirmSubmitAnswer() {
 | 
	
		
			
				|  |  |        if (!this.answer_record_id) return;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        this.$confirm('是否确认提交答题?', '提示', {
 | 
	
	
		
			
				|  | @@ -409,27 +416,31 @@ export default {
 | 
	
		
			
				|  |  |          type: 'warning',
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |          .then(() => {
 | 
	
		
			
				|  |  | -          clearInterval(this.countDownTimer);
 | 
	
		
			
				|  |  | -          // 如果已经填写过答案,直接提交
 | 
	
		
			
				|  |  | -          if (this.questionList[this.curQuestionIndex].isFill) {
 | 
	
		
			
				|  |  | -            SubmitAnswer({ answer_record_id: this.answer_record_id })
 | 
	
		
			
				|  |  | -              .then(() => {
 | 
	
		
			
				|  |  | -                this.isSubmit = true;
 | 
	
		
			
				|  |  | -              })
 | 
	
		
			
				|  |  | -              .catch(() => {});
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | +          this.handleSubmitAnswer();
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        .catch(() => {});
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -          this.fillQuestionAnswer('next').then(() => {
 | 
	
		
			
				|  |  | -            SubmitAnswer({ answer_record_id: this.answer_record_id })
 | 
	
		
			
				|  |  | -              .then(() => {
 | 
	
		
			
				|  |  | -                this.isSubmit = true;
 | 
	
		
			
				|  |  | -              })
 | 
	
		
			
				|  |  | -              .catch(() => {});
 | 
	
		
			
				|  |  | -          });
 | 
	
		
			
				|  |  | +    handleSubmitAnswer() {
 | 
	
		
			
				|  |  | +      clearInterval(this.countDownTimer);
 | 
	
		
			
				|  |  | +      // 如果已经填写过答案,直接提交
 | 
	
		
			
				|  |  | +      if (this.questionList[this.curQuestionIndex].isFill) {
 | 
	
		
			
				|  |  | +        this.submitAnswer();
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      this.fillQuestionAnswer('next').then(() => {
 | 
	
		
			
				|  |  | +        this.submitAnswer();
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    submitAnswer() {
 | 
	
		
			
				|  |  | +      SubmitAnswer({ answer_record_id: this.answer_record_id })
 | 
	
		
			
				|  |  | +        .then(() => {
 | 
	
		
			
				|  |  | +          this.isSubmit = true;
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |          .catch(() => {});
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      selectQuestion(i) {
 | 
	
		
			
				|  |  |        this.isSubmit = false;
 | 
	
		
			
				|  |  |        this.isView = true;
 |