natasha 2 тижнів тому
батько
коміт
abd3615cb3

+ 0 - 9
src/api/project.js

@@ -326,12 +326,3 @@ export function DeleteLabel(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=project_resource_manager-DeleteLabel`, data);
 }
 
-/**
- * @description 得到模板章节结构展开列表
- * @param {object} data
- * @param {string} data.template_id 模板件ID
- * @param {'true' | 'false'} data.is_contain_root_node 是否包含根节点
- */
-export function GetTemplateChapterStructExpandList(data) {
-  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=template_manager-GetTemplateChapterStructExpandList`, data);
-}

+ 10 - 0
src/api/template.js

@@ -46,3 +46,13 @@ export function UpdateTemplateStatus(data) {
 export function GetTemplateInfo(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=template_manager-GetTemplateInfo`, data);
 }
+
+/**
+ * @description 得到模板章节结构展开列表
+ * @param {object} data
+ * @param {string} data.template_id 模板件ID
+ * @param {'true' | 'false'} data.is_contain_root_node 是否包含根节点
+ */
+export function GetTemplateChapterStructExpandList(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=template_manager-GetTemplateChapterStructExpandList`, data);
+}

+ 34 - 3
src/views/personal_workbench/template_list/preview/CommonPreview.vue

@@ -49,7 +49,8 @@
 import CoursewarePreview from '@/views/book/courseware/preview/CoursewarePreview.vue';
 import { isTrue } from '@/utils/validate';
 
-import { GetBookCoursewareInfo, GetTemplateChapterStructExpandList } from '@/api/project';
+import { GetBookCoursewareInfo } from '@/api/project';
+import { GetTemplateChapterStructExpandList, GetTemplateInfo } from '@/api/template';
 import { ContentGetCoursewareContent_View } from '@/api/book';
 
 export default {
@@ -118,19 +119,49 @@ export default {
         cover_image_file_url: '', // 封面图片URL
       },
       title_list: [],
+      node_list: [],
     };
   },
   computed: {},
   watch: {},
   created() {
     if (this.id) {
-      this.getBookCoursewareInfo(this.id);
-      this.getCoursewareComponentContent_View(this.id);
+      this.getTemplateInfo(this.id);
+      // this.getBookCoursewareInfo(this.id);
+      // this.getCoursewareComponentContent_View(this.id);
     }
   },
   mounted() {},
   methods: {
     /**
+     * 得到模板信息
+     * @param {string} id - 模板ID
+     */
+    getTemplateInfo(id) {
+      this.node_list = [];
+      GetTemplateInfo({ id }).then((res) => {
+        if (res.status === 1) {
+          if (res.template_info.type === 0) {
+            this.getBookCoursewareInfo(this.id);
+            this.getCoursewareComponentContent_View(this.id);
+          }
+        }
+      });
+    },
+    /**
+     * 得到模板章节结构展开列表
+     * @param {string} template_id - 模板ID
+     */
+    getTemplateChapterStructExpandList(template_id) {
+      this.node_list = [];
+      GetTemplateChapterStructExpandList({ template_id, is_contain_root_node: 'true' }).then((res) => {
+        if (res.status === 1) {
+          this.node_list = res.node_list;
+          console.log(this.node_list);
+        }
+      });
+    },
+    /**
      * 得到教材课件信息
      * @param {string} id - 课件ID
      */