Forráskód Böngészése

监听数据返回

natasha 1 éve
szülő
commit
23a76578a2
1 módosított fájl, 22 hozzáadás és 3 törlés
  1. 22 3
      src/views/courseWare.vue

+ 22 - 3
src/views/courseWare.vue

@@ -45,7 +45,13 @@
             @handleBookUserAnswer="handleBookUserAnswer"
           />
         </template>
-        <template v-if="category == 'NPC'">
+        <template
+          v-if="
+            category == 'NPC' &&
+            ((bookAnswerContent && TaskModel === 'ANSWER') ||
+              TaskModel !== 'ANSWER')
+          "
+        >
           <Booknpc
             v-if="chapterId && context"
             ref="previewBook"
@@ -166,6 +172,16 @@ export default {
       duration: 0,
     };
   },
+  watch: {
+    bookAnswerContent: {
+      handler(newVal, oldVal) {
+        if (newVal) {
+          this.loading = false;
+        }
+      },
+      deep: true,
+    },
+  },
   created() {
     const _this = this;
     if (_this.$route.query.AccessToken) {
@@ -253,7 +269,9 @@ export default {
           const _this = this;
           _this.context = null;
         }
-        this.loading = false;
+        if (_this.$route.query.ViewMode !== "Result") {
+          this.loading = false;
+        }
       });
     },
     // 跳转编辑页面
@@ -334,7 +352,6 @@ export default {
       };
       getContens(MethodName, datas, AccessToken, AppID)
         .then((res) => {
-          this.loading = false;
           if (res.status === 1) {
             let exam_answer = res.exam_answer
               ? JSON.parse(res.exam_answer)
@@ -344,6 +361,8 @@ export default {
             this.duration = exam_answer.duration;
             this.rightNumber = exam_answer.count_right;
             this.errorNumber = exam_answer.count_error;
+          } else {
+            this.loading = false;
           }
         })
         .catch(() => {