Explorar el Código

BookEep 问题修复

dsy hace 5 días
padre
commit
6c1510a570

+ 45 - 46
src/components/course/CompletionView.vue

@@ -74,13 +74,13 @@
     </template>
     <template v-if="category == 'EEP'">
       <BookEep
-        v-if="content.content && curCoursewareId"
+        v-if="context"
         :id="curCoursewareId"
-        :content="content.content"
-        :content-group-row-list="content.content_group_row_list"
-        :component-list="content.component_list"
-        :book-background="content.background"
-      ></BookEep>
+        :content="context.content"
+        :content-group-row-list="context.content_group_row_list"
+        :component-list="context.component_list"
+        :book-background="context.background"
+      />
     </template>
 
     <div slot="footer"></div>
@@ -140,50 +140,49 @@ export default {
         return;
       }
       this.getTaskMaterialStudentExamAnswer().then(() => {
-        GetCoursewareContent_View({ id: this.curCoursewareId }).then(
-          ({ content, category, book_theme_color, book_font_size }) => {
-            if (!content) {
-              this.context = null;
-              return;
-            }
-            this.category = category;
-            if (category === 'OC' || category.length === 0 || category === 'AILP') {
-              return this.$message.warning('该课件类型已被废弃');
-            }
-            if (category === 'NPC') {
-              this.themeColor = book_theme_color;
-              this.dialogWidth = '900px';
-              this.context = JSON.parse(content);
-              return;
-            }
-            if (category === 'NNPE') {
-              this.dialogWidth = '900px';
-              this.themeColor = book_theme_color;
-              this.context = JSON.parse(content);
-              return;
-            }
+        GetCoursewareContent_View({ id: this.curCoursewareId }).then((res) => {
+          const { content, category, book_theme_color, book_font_size } = res;
+          if (!content) {
+            this.context = null;
+            return;
+          }
+          this.category = category;
+          if (category === 'OC' || category.length === 0 || category === 'AILP') {
+            return this.$message.warning('该课件类型已被废弃');
+          }
+          if (category === 'NPC') {
+            this.themeColor = book_theme_color;
+            this.dialogWidth = '900px';
+            this.context = JSON.parse(content);
+            return;
+          }
+          if (category === 'NNPE') {
+            this.dialogWidth = '900px';
+            this.themeColor = book_theme_color;
+            this.context = JSON.parse(content);
+            return;
+          }
 
-            if (category === 'RLC') {
-              this.dialogWidth = '900px';
-              this.themeColor = book_theme_color;
-              this.bookFontSize = book_font_size;
-              this.context = JSON.parse(content);
-              return;
-            }
+          if (category === 'RLC') {
+            this.dialogWidth = '900px';
+            this.themeColor = book_theme_color;
+            this.bookFontSize = book_font_size;
+            this.context = JSON.parse(content);
+            return;
+          }
 
-            if (category === 'NEW') {
-              this.dialogWidth = '1190px';
-              this.context = JSON.parse(content);
-              return;
-            }
+          if (category === 'NEW') {
+            this.dialogWidth = '1190px';
+            this.context = JSON.parse(content);
+            return;
+          }
 
-            if (category === 'EEP') {
-              this.dialogWidth = '1250px';
-              this.content = JSON.parse(content);
-              return;
-            }
+          if (category === 'EEP') {
+            this.dialogWidth = '1250px';
+            this.context = res;
+            return;
           }
-        );
+        });
       });
     }
   },

+ 48 - 49
src/components/course/FinishCourseware.vue

@@ -69,13 +69,13 @@
     </template>
     <template v-if="category == 'EEP'">
       <BookEep
-        v-if="content.content && coursewareId"
+        v-if="context"
         :id="coursewareId"
-        :content="content.content"
-        :content-group-row-list="content.content_group_row_list"
-        :component-list="content.component_list"
-        :book-background="content.background"
-      ></BookEep>
+        :content="context.content"
+        :content-group-row-list="context.content_group_row_list"
+        :component-list="context.component_list"
+        :book-background="context.background"
+      />
     </template>
 
     <div v-if="category !== 'NPC' && category !== 'NNPE' && category !== 'RLC' && category !== 'NEW'" slot="footer">
@@ -127,53 +127,52 @@ export default {
         return;
       }
 
-      GetCoursewareContent_View({ id: this.coursewareId }).then(
-        ({ content, category, book_theme_color, book_font_size }) => {
-          if (!content) {
-            this.context = null;
-            return;
-          }
-          this.category = category;
-          if (category === 'OC' || category.length === 0 || category === 'AILP') {
-            return this.$message.warning('该课件类型已被废弃');
-          }
-          if (category === 'NPC') {
-            this.themeColor = book_theme_color;
-            this.dialogWidth = '900px';
-            this.context = JSON.parse(content);
-            this.$nextTick(() => {
-              this.$refs.booknpc.handleAnswerTimeStart();
-            });
-            return;
-          }
-          if (category === 'NNPE') {
-            this.dialogWidth = '900px';
-            this.themeColor = book_theme_color;
-            this.context = JSON.parse(content);
-            return;
-          }
+      GetCoursewareContent_View({ id: this.coursewareId }).then((res) => {
+        const { content, category, book_theme_color, book_font_size } = res;
+        if (!content) {
+          this.context = null;
+          return;
+        }
+        this.category = category;
+        if (category === 'OC' || category.length === 0 || category === 'AILP') {
+          return this.$message.warning('该课件类型已被废弃');
+        }
+        if (category === 'NPC') {
+          this.themeColor = book_theme_color;
+          this.dialogWidth = '900px';
+          this.context = JSON.parse(content);
+          this.$nextTick(() => {
+            this.$refs.booknpc.handleAnswerTimeStart();
+          });
+          return;
+        }
+        if (category === 'NNPE') {
+          this.dialogWidth = '900px';
+          this.themeColor = book_theme_color;
+          this.context = JSON.parse(content);
+          return;
+        }
 
-          if (category === 'RLC') {
-            this.dialogWidth = '900px';
-            this.themeColor = book_theme_color;
-            this.bookFontSize = book_font_size;
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'RLC') {
+          this.dialogWidth = '900px';
+          this.themeColor = book_theme_color;
+          this.bookFontSize = book_font_size;
+          this.context = JSON.parse(content);
+          return;
+        }
 
-          if (category === 'NEW') {
-            this.dialogWidth = '1190px';
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'NEW') {
+          this.dialogWidth = '1190px';
+          this.context = JSON.parse(content);
+          return;
+        }
 
-          if (category === 'EEP') {
-            this.dialogWidth = '1250px';
-            this.content = JSON.parse(content);
-            return;
-          }
+        if (category === 'EEP') {
+          this.dialogWidth = '1250px';
+          this.context = res;
+          return;
         }
-      );
+      });
     }
   },
   methods: {

+ 35 - 36
src/components/course/courseware.js

@@ -19,44 +19,43 @@ export function useShowCourseware(courseId, groupId = '[]', previewType = 'previ
   let exam_answer = ref('');
 
   function getCoursewareContent_View() {
-    GetCoursewareContent_View({ id: unref(courseId) }).then(
-      ({ content, category: ca, book_theme_color, book_font_size }) => {
-        if (!content) {
-          context.value = null;
-          return;
-        }
-        category.value = ca;
-        if (category.value === categoryList[0] || category.value.length === 0 || category.value === categoryList[1]) {
-          return Message.warning('该课件类型已被废弃');
-        }
-        if (category.value === categoryList[2]) {
-          themeColor.value = book_theme_color;
-          context.value = JSON.parse(content);
-          return;
-        }
-        if (category.value === categoryList[3]) {
-          themeColor.value = book_theme_color;
-          bookFontSize.value = book_font_size;
-          context.value = JSON.parse(content);
-          return;
-        }
+    GetCoursewareContent_View({ id: unref(courseId) }).then((res) => {
+      const { content, category: ca, book_theme_color, book_font_size } = res;
+      if (!content) {
+        context.value = null;
+        return;
+      }
+      category.value = ca;
+      if (category.value === categoryList[0] || category.value.length === 0 || category.value === categoryList[1]) {
+        return Message.warning('该课件类型已被废弃');
+      }
+      if (category.value === categoryList[2]) {
+        themeColor.value = book_theme_color;
+        context.value = JSON.parse(content);
+        return;
+      }
+      if (category.value === categoryList[3]) {
+        themeColor.value = book_theme_color;
+        bookFontSize.value = book_font_size;
+        context.value = JSON.parse(content);
+        return;
+      }
 
-        if (category.value === categoryList[4]) {
-          themeColor.value = book_theme_color;
-          bookFontSize.value = book_font_size;
-          context.value = JSON.parse(content);
-          return;
-        }
-        if (category.value === categoryList[5]) {
-          context.value = JSON.parse(content);
-          return;
-        }
-        if (category.value === categoryList[6]) {
-          context.value = JSON.parse(content);
-          return;
-        }
+      if (category.value === categoryList[4]) {
+        themeColor.value = book_theme_color;
+        bookFontSize.value = book_font_size;
+        context.value = JSON.parse(content);
+        return;
+      }
+      if (category.value === categoryList[5]) {
+        context.value = JSON.parse(content);
+        return;
+      }
+      if (category.value === categoryList[6]) {
+        context.value = res;
+        return;
       }
-    );
+    });
   }
   getCoursewareContent_View();
 

+ 9 - 8
src/components/live/CurMaterial.vue

@@ -100,13 +100,13 @@
 
       <template v-if="category == 'EEP'">
         <BookEep
-          v-if="content.content && material_id"
+          v-if="context"
           :id="material_id"
-          :content="content.content"
-          :content-group-row-list="content.content_group_row_list"
-          :component-list="content.component_list"
-          :book-background="content.background"
-        ></BookEep>
+          :content="context.content"
+          :content-group-row-list="context.content_group_row_list"
+          :component-list="context.component_list"
+          :book-background="context.background"
+        />
       </template>
     </template>
 
@@ -292,7 +292,8 @@ export default {
 
     getCoursewareContent_View() {
       GetCoursewareContent_View({ id: this.material_id })
-        .then(({ content, category, book_theme_color, book_font_size }) => {
+        .then((res) => {
+          const { content, category, book_theme_color, book_font_size } = res;
           if (!content) {
             this.context = null;
             return;
@@ -328,7 +329,7 @@ export default {
           }
 
           if (category === 'EEP') {
-            this.content = JSON.parse(content);
+            this.context = res;
             return;
           }
         })

+ 46 - 46
src/components/preview/PreviewCourse.vue

@@ -49,13 +49,13 @@
       </template>
       <template v-if="category == 'EEP'">
         <BookEep
-          v-if="content.content && fileId"
+          v-if="context"
           :id="fileId"
-          :content="content.content"
-          :content-group-row-list="content.content_group_row_list"
-          :component-list="content.component_list"
-          :book-background="content.background"
-        ></BookEep>
+          :content="context.content"
+          :content-group-row-list="context.content_group_row_list"
+          :component-list="context.component_list"
+          :book-background="context.background"
+        />
       </template>
     </template>
 
@@ -143,47 +143,47 @@ let context = ref(null);
 let themeColor = ref('');
 let bookFontSize = ref('');
 function getCoursewareContent_View() {
-  GetCoursewareContent_View({ id: props.fileId }).then(
-    ({ content, category: cate, book_theme_color, book_font_size }) => {
-      if (!content) {
-        context.value = null;
-        return;
-      }
-      category.value = cate;
-      if (category.value === 'OC' || category.value.length === 0 || category.value === 'AILP') {
-        return Message.warning('该课件类型已被废弃');
-      }
-
-      if (category.value === 'NPC') {
-        themeColor.value = book_theme_color;
-        context.value = JSON.parse(content);
-        return;
-      }
-
-      if (category.value === 'NNPE') {
-        themeColor.value = book_theme_color;
-        context.value = JSON.parse(content);
-        return;
-      }
-
-      if (category.value === 'RLC') {
-        themeColor.value = book_theme_color;
-        bookFontSize.value = book_font_size;
-        context.value = JSON.parse(content);
-        return;
-      }
-
-      if (category.value === 'NEW') {
-        context.value = JSON.parse(content);
-        return;
-      }
-
-      if (category.value === 'EEP') {
-        context.value = JSON.parse(content);
-        return;
-      }
+  GetCoursewareContent_View({ id: props.fileId }).then((res) => {
+    const { content, category: cate, book_theme_color, book_font_size } = res;
+
+    if (!content) {
+      context.value = null;
+      return;
+    }
+    category.value = cate;
+    if (category.value === 'OC' || category.value.length === 0 || category.value === 'AILP') {
+      return Message.warning('该课件类型已被废弃');
+    }
+
+    if (category.value === 'NPC') {
+      themeColor.value = book_theme_color;
+      context.value = JSON.parse(content);
+      return;
+    }
+
+    if (category.value === 'NNPE') {
+      themeColor.value = book_theme_color;
+      context.value = JSON.parse(content);
+      return;
+    }
+
+    if (category.value === 'RLC') {
+      themeColor.value = book_theme_color;
+      bookFontSize.value = book_font_size;
+      context.value = JSON.parse(content);
+      return;
+    }
+
+    if (category.value === 'NEW') {
+      context.value = JSON.parse(content);
+      return;
+    }
+
+    if (category.value === 'EEP') {
+      context.value = res;
+      return;
     }
-  );
+  });
 }
 
 let fileUrl = ref('');

+ 6 - 6
src/components/select/SelectCourse.vue

@@ -70,13 +70,13 @@
         </template>
         <template v-if="category == 'EEP'">
           <BookEep
-            v-if="content.content && courseID"
+            v-if="context"
             :id="courseID"
-            :content="content.content"
-            :content-group-row-list="content.content_group_row_list"
-            :component-list="content.component_list"
-            :book-background="content.background"
-          ></BookEep>
+            :content="context.content"
+            :content-group-row-list="context.content_group_row_list"
+            :component-list="context.component_list"
+            :book-background="context.background"
+          />
         </template>
       </div>
     </div>

+ 44 - 45
src/views/live/teacher/CompleteList.vue

@@ -109,13 +109,13 @@
         </template>
         <template v-if="category == 'EEP'">
           <BookEep
-            v-if="content.content && material_id"
+            v-if="context"
             :id="material_id"
-            :content="content.content"
-            :content-group-row-list="content.content_group_row_list"
-            :component-list="content.component_list"
-            :book-background="content.background"
-          ></BookEep>
+            :content="context.content"
+            :content-group-row-list="context.content_group_row_list"
+            :component-list="context.component_list"
+            :book-background="context.background"
+          />
         </template>
       </template>
       <template v-else>
@@ -279,49 +279,48 @@ export default {
     },
 
     getCoursewareContent_View() {
-      GetCoursewareContent_View({ id: this.material_id }).then(
-        ({ content, category, book_theme_color, book_font_size }) => {
-          if (!content) {
-            this.context = null;
-            return;
-          }
-          this.category = category;
+      GetCoursewareContent_View({ id: this.material_id }).then((res) => {
+        const { content, category, book_theme_color, book_font_size } = res;
+        if (!content) {
+          this.context = null;
+          return;
+        }
+        this.category = category;
 
-          if (category === 'OC' || category.length === 0 || category === 'AILP') {
-            return this.$message.warning('该课件类型已被废弃');
-          }
-          if (category === 'NPC') {
-            this.themeColor = book_theme_color;
-            this.dialogWidth = '920';
-            this.context = JSON.parse(content);
-            return;
-          }
-          if (category === 'NNPE') {
-            this.dialogWidth = '920';
-            this.themeColor = book_theme_color;
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'OC' || category.length === 0 || category === 'AILP') {
+          return this.$message.warning('该课件类型已被废弃');
+        }
+        if (category === 'NPC') {
+          this.themeColor = book_theme_color;
+          this.dialogWidth = '920';
+          this.context = JSON.parse(content);
+          return;
+        }
+        if (category === 'NNPE') {
+          this.dialogWidth = '920';
+          this.themeColor = book_theme_color;
+          this.context = JSON.parse(content);
+          return;
+        }
 
-          if (category === 'RLC') {
-            this.dialogWidth = '920';
-            this.themeColor = book_theme_color;
-            this.bookFontSize = book_font_size;
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'RLC') {
+          this.dialogWidth = '920';
+          this.themeColor = book_theme_color;
+          this.bookFontSize = book_font_size;
+          this.context = JSON.parse(content);
+          return;
+        }
 
-          if (category === 'NEW') {
-            this.context = JSON.parse(content);
-            return;
-          }
-          if (category === 'EEP') {
-            this.dialogWidth = '1250';
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'NEW') {
+          this.context = JSON.parse(content);
+          return;
         }
-      );
+        if (category === 'EEP') {
+          this.dialogWidth = '1250';
+          this.context = res;
+          return;
+        }
+      });
     },
 
     getFileStoreInfo() {

+ 44 - 45
src/views/new_live/teacher/components/CompleteList.vue

@@ -109,13 +109,13 @@
         </template>
         <template v-if="category == 'EEP'">
           <BookEep
-            v-if="content.content && material_id"
+            v-if="context"
             :id="material_id"
-            :content="content.content"
-            :content-group-row-list="content.content_group_row_list"
-            :component-list="content.component_list"
-            :book-background="content.background"
-          ></BookEep>
+            :content="context.content"
+            :content-group-row-list="context.content_group_row_list"
+            :component-list="context.component_list"
+            :book-background="context.background"
+          />
         </template>
       </template>
       <template v-else>
@@ -279,50 +279,49 @@ export default {
     },
 
     getCoursewareContent_View() {
-      GetCoursewareContent_View({ id: this.material_id }).then(
-        ({ content, category, book_theme_color, book_font_size }) => {
-          if (!content) {
-            this.context = null;
-            return;
-          }
-          this.category = category;
+      GetCoursewareContent_View({ id: this.material_id }).then((res) => {
+        const { content, category, book_theme_color, book_font_size } = res;
+        if (!content) {
+          this.context = null;
+          return;
+        }
+        this.category = category;
 
-          if (category === 'OC' || category.length === 0 || category === 'AILP') {
-            return this.$message.warning('该课件类型已被废弃');
-          }
-          if (category === 'NPC') {
-            this.themeColor = book_theme_color;
-            this.dialogWidth = '920';
-            this.context = JSON.parse(content);
-            return;
-          }
-          if (category === 'NNPE') {
-            this.dialogWidth = '920';
-            this.themeColor = book_theme_color;
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'OC' || category.length === 0 || category === 'AILP') {
+          return this.$message.warning('该课件类型已被废弃');
+        }
+        if (category === 'NPC') {
+          this.themeColor = book_theme_color;
+          this.dialogWidth = '920';
+          this.context = JSON.parse(content);
+          return;
+        }
+        if (category === 'NNPE') {
+          this.dialogWidth = '920';
+          this.themeColor = book_theme_color;
+          this.context = JSON.parse(content);
+          return;
+        }
 
-          if (category === 'RLC') {
-            this.dialogWidth = '920';
-            this.themeColor = book_theme_color;
-            this.bookFontSize = book_font_size;
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'RLC') {
+          this.dialogWidth = '920';
+          this.themeColor = book_theme_color;
+          this.bookFontSize = book_font_size;
+          this.context = JSON.parse(content);
+          return;
+        }
 
-          if (category === 'NEW') {
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'NEW') {
+          this.context = JSON.parse(content);
+          return;
+        }
 
-          if (category === 'EEP') {
-            this.dialogWidth = '1250';
-            this.context = JSON.parse(content);
-            return;
-          }
+        if (category === 'EEP') {
+          this.dialogWidth = '1250';
+          this.context = res;
+          return;
         }
-      );
+      });
     },
 
     getFileStoreInfo() {

+ 6 - 6
src/views/new_task_view/components/common/CoursewareView.vue

@@ -65,13 +65,13 @@
     </template>
     <template v-if="category == 'EEP'">
       <BookEep
-        v-if="content.content && coursewareData.courseware_id"
+        v-if="context"
         :id="coursewareData.courseware_id"
-        :content="content.content"
-        :content-group-row-list="content.content_group_row_list"
-        :component-list="content.component_list"
-        :book-background="content.background"
-      ></BookEep>
+        :content="context.content"
+        :content-group-row-list="context.content_group_row_list"
+        :component-list="context.component_list"
+        :book-background="context.background"
+      />
     </template>
   </div>
 </template>

+ 40 - 41
src/views/task_details/ShowCourseware.vue

@@ -57,13 +57,13 @@
       </template>
       <template v-if="category == 'EEP'">
         <BookEep
-          v-if="content.content && coursewareId"
+          v-if="context"
           :id="coursewareId"
-          :content="content.content"
-          :content-group-row-list="content.content_group_row_list"
-          :component-list="content.component_list"
-          :book-background="content.background"
-        ></BookEep>
+          :content="context.content"
+          :content-group-row-list="context.content_group_row_list"
+          :component-list="context.component_list"
+          :book-background="context.background"
+        />
       </template>
     </div>
   </div>
@@ -88,45 +88,44 @@ export default {
     };
   },
   created() {
-    GetCoursewareContent_View({ id: this.coursewareId }).then(
-      ({ content, category, book_theme_color, book_font_size }) => {
-        if (!content) {
-          this.context = null;
-          return;
-        }
-        this.category = category;
-        if (category === 'OC' || category.length === 0 || category === 'AILP') {
-          return this.$message.warning('该课件类型已被废弃');
-        }
-        if (category === 'NPC') {
-          this.context = JSON.parse(content);
-          this.themeColor = book_theme_color;
-          return;
-        }
-        if (category === 'NNPE') {
-          this.themeColor = book_theme_color;
-          this.context = JSON.parse(content);
-          return;
-        }
+    GetCoursewareContent_View({ id: this.coursewareId }).then((res) => {
+      const { content, category, book_theme_color, book_font_size } = res;
+      if (!content) {
+        this.context = null;
+        return;
+      }
+      this.category = category;
+      if (category === 'OC' || category.length === 0 || category === 'AILP') {
+        return this.$message.warning('该课件类型已被废弃');
+      }
+      if (category === 'NPC') {
+        this.context = JSON.parse(content);
+        this.themeColor = book_theme_color;
+        return;
+      }
+      if (category === 'NNPE') {
+        this.themeColor = book_theme_color;
+        this.context = JSON.parse(content);
+        return;
+      }
 
-        if (category === 'RLC') {
-          this.themeColor = book_theme_color;
-          this.bookFontSize = book_font_size;
-          this.context = JSON.parse(content);
-          return;
-        }
+      if (category === 'RLC') {
+        this.themeColor = book_theme_color;
+        this.bookFontSize = book_font_size;
+        this.context = JSON.parse(content);
+        return;
+      }
 
-        if (category === 'NEW') {
-          this.context = JSON.parse(content);
-          return;
-        }
+      if (category === 'NEW') {
+        this.context = JSON.parse(content);
+        return;
+      }
 
-        if (category === 'EEP') {
-          this.context = JSON.parse(content);
-          return;
-        }
+      if (category === 'EEP') {
+        this.context = res;
+        return;
       }
-    );
+    });
   },
   methods: {
     fullScreen() {

+ 6 - 6
src/views/teacher/create_course/step_three/components/preview/task_preview/components/CoursewareView.vue

@@ -56,13 +56,13 @@
       </template>
       <template v-if="category == 'EEP'">
         <BookEep
-          v-if="content.content && coursewareId"
+          v-if="context"
           :id="coursewareId"
-          :content="content.content"
-          :content-group-row-list="content.content_group_row_list"
-          :component-list="content.component_list"
-          :book-background="content.background"
-        ></BookEep>
+          :content="context.content"
+          :content-group-row-list="context.content_group_row_list"
+          :component-list="context.component_list"
+          :book-background="context.background"
+        />
       </template>
     </template>
   </div>