dusenyao hace 1 año
padre
commit
d7b2188d12

+ 5 - 3
src/views/exercise_questions/answer/index.vue

@@ -166,6 +166,7 @@ export default {
     let questionIndex = Number(question_index);
 
     return {
+      type, // 类型:answer【答题】show【展示】
       isShow: type === 'show', // 是否是展示模式
       exercise_id: id || exercise_id, // 练习题id
       share_record_id, // 分享记录id
@@ -218,7 +219,7 @@ export default {
   computed: {
     // 是否教师批改
     isTeacherAnnotations() {
-      return this.question_index >= 0 && this.isTeacher;
+      return this.question_index >= 0 && this.isTeacher && this.type !== 'show';
     },
     // 是否显示批注
     isAnnotations() {
@@ -310,7 +311,7 @@ export default {
           isFill: this.isTeacherAnnotations || this.user_answer_record_info.is_exist_answer_record === 'true',
         }));
         if (this.isShow) {
-          this.curQuestionIndex = 0;
+          this.curQuestionIndex = this.question_index || 0;
           return;
         }
         if (this.question_index >= 0) {
@@ -325,6 +326,7 @@ export default {
         this.isView = false;
         return;
       }
+      if (this.back_url === 'not-return') return;
       window.location.href = this.back_url;
     },
     // 倒计时
@@ -385,7 +387,7 @@ export default {
             : Math.min(this.questionList.length - 1, this.curQuestionIndex + 1);
         return;
       }
-      // 如果已填写,直接跳转
+      // 如果已填写或展示预览模式,直接跳转
       if (this.questionList[this.curQuestionIndex].isFill || this.isShow) {
         if (type === 'pre') return this.preQuestion();
         if (type === 'next') return this.nextQuestion();

+ 12 - 10
src/views/exercise_questions/create/index.vue

@@ -264,16 +264,18 @@ export default {
     },
     // 完整预览
     fullPreview() {
-      // TODO 待完善
-      // window.open(
-      //   this.$router.resolve({
-      //     path: '/answer',
-      //     query: {
-      //       id: this.exercise_id,
-      //     },
-      //   }).href,
-      //   '_blank',
-      // );
+      window.open(
+        this.$router.resolve({
+          path: '/answer',
+          query: {
+            id: this.exercise_id,
+            type: 'show',
+            question_index: this.curIndex,
+            back_url: 'not-return',
+          },
+        }).href,
+        '_blank',
+      );
     },
     // 预览
     setPreview() {