Browse Source

feat(Editor): add preview course button and handler

新增预览课程按钮及对应的点击回调函数,调用父窗口的preview方法实现课程预览功能
lsc 23 hours ago
parent
commit
fbd509baca
1 changed files with 15 additions and 0 deletions
  1. 15 0
      src/views/Editor/index3.vue

+ 15 - 0
src/views/Editor/index3.vue

@@ -147,6 +147,19 @@
           </svg>
           {{ lang.ssSave }}
         </button>
+        <button class="action-btn preview-btn" @click="handlePreview">
+          <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+            <g id="Component 1">
+              <path id="Vector"
+                d="M10 8C10 8.53043 9.78929 9.03914 9.41421 9.41421C9.03914 9.78929 8.53043 10 8 10C7.46957 10 6.96086 9.78929 6.58579 9.41421C6.21071 9.03914 6 8.53043 6 8C6 7.46957 6.21071 6.96086 6.58579 6.58579C6.96086 6.21071 7.46957 6 8 6C8.53043 6 9.03914 6.21071 9.41421 6.58579C9.78929 6.96086 10 7.46957 10 8Z"
+                stroke="#374151" stroke-width="1.33333" />
+              <path id="Vector_2"
+                d="M1.63867 8.00065C2.48801 5.29598 5.01534 3.33398 8.00001 3.33398C10.9853 3.33398 13.512 5.29598 14.3613 8.00065C13.512 10.7053 10.9853 12.6673 8.00001 12.6673C5.01534 12.6673 2.48801 10.7053 1.63867 8.00065Z"
+                stroke="#374151" stroke-width="1.33333" />
+            </g>
+          </svg>
+          {{ lang.ssPreview }}
+        </button>
         <button class="action-btn publish-btn" @click="handlePublish">
           <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
             <g id="Component 1">
@@ -232,6 +245,7 @@ interface ParentWindowWithToolList extends Window {
   copyCourse?: () => void;
   deleteCourse?: () => void;
   publishCourse?: () => void;
+  preview?: () => void;
   openCourseSettings?: () => void;
 }
 const parentWindow = window.parent as ParentWindowWithToolList
@@ -349,6 +363,7 @@ const handleCourseLoaded = (data: any) => {
 
 const handlePreview = () => {
   console.log('预览课程')
+  parentWindow.preview?.()
 }
 
 const handleSave = () => {