浏览代码

教材管理预览页默认显示第一个课件

dsy 6 天之前
父节点
当前提交
825b0a55fa
共有 1 个文件被更改,包括 4 次插入 和 8 次删除
  1. 4 8
      src/components/CommonPreview.vue

+ 4 - 8
src/components/CommonPreview.vue

@@ -1053,14 +1053,10 @@ export default {
             });
             });
           }
           }
 
 
-          // 项目预览页面,默认选中第一个节点
-          if (this.type === 'project-preview') {
-            this.node_list.find((item) => {
-              if (item.is_leaf_chapter === 'true') {
-                this.selectChapterNode(item.id, true);
-                return true;
-              }
-            });
+          // 项目预览页面,默认选中第一个课件(叶子节点)
+          if (this.type === 'project_preview') {
+            const firstCourseware = this.node_list.find((item) => item.is_leaf_chapter === 'true');
+            if (firstCourseware) this.selectChapterNode(firstCourseware.id, true);
           }
           }
         }
         }
       });
       });