Browse Source

refactor(CreateCourseDialog): 重新排列课程创建选项并优化代码格式

调整选项卡片顺序,将空白创建选项设为可用状态,优化文件上传处理函数的格式
lsc 1 day ago
parent
commit
2ce3c9542f
1 changed files with 25 additions and 23 deletions
  1. 25 23
      src/components/CreateCourseDialog.vue

+ 25 - 23
src/components/CreateCourseDialog.vue

@@ -12,18 +12,6 @@
       <h2>{{ lang.ssCreateCourse }}</h2>
       <h2>{{ lang.ssCreateCourse }}</h2>
       <p class="subtitle">{{ lang.ssCreateCourseSubtitle }}</p>
       <p class="subtitle">{{ lang.ssCreateCourseSubtitle }}</p>
       <div class="options-grid">
       <div class="options-grid">
-        <div class="option-card disabled">
-          <div class="option-icon">
-            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
-              <path d="M12 2L2 7l10 5 10-5-10-5z" />
-              <path d="M2 17l10 5 10-5" />
-              <path d="M2 12l10 5 10-5" />
-            </svg>
-          </div>
-          <h3>{{ lang.ssCreateFromAI }}</h3>
-          <p>{{ lang.ssAIGenerateContent }}</p>
-          <div class="coming-soon">{{ lang.ssComingSoon }}</div>
-        </div>
         <FileInput accept="application/vnd.openxmlformats-officedocument.presentationml.presentation"
         <FileInput accept="application/vnd.openxmlformats-officedocument.presentationml.presentation"
           @change="handleFileUpload">
           @change="handleFileUpload">
           <div class="option-card">
           <div class="option-card">
@@ -38,34 +26,46 @@
             <p>{{ lang.ssUploadPPTFile }}</p>
             <p>{{ lang.ssUploadPPTFile }}</p>
           </div>
           </div>
         </FileInput>
         </FileInput>
-        <div class="option-card disabled">
+        <div class="option-card" @click="handleOptionClick('blank')">
           <div class="option-icon">
           <div class="option-icon">
             <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
             <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
               <g id="Component 1">
               <g id="Component 1">
                 <path id="Vector"
                 <path id="Vector"
-                  d="M3.5 10.5007L14 2.33398L24.5 10.5007V23.334C24.5 23.9528 24.2542 24.5463 23.8166 24.9839C23.379 25.4215 22.7855 25.6673 22.1667 25.6673H5.83333C5.21449 25.6673 4.621 25.4215 4.18342 24.9839C3.74583 24.5463 3.5 23.9528 3.5 23.334V10.5007Z"
+                  d="M16.3332 2.33398H6.99984C6.381 2.33398 5.78751 2.57982 5.34992 3.0174C4.91234 3.45499 4.6665 4.04848 4.6665 4.66732V23.334C4.6665 23.9528 4.91234 24.5463 5.34992 24.9839C5.78751 25.4215 6.381 25.6673 6.99984 25.6673H20.9998C21.6187 25.6673 22.2122 25.4215 22.6498 24.9839C23.0873 24.5463 23.3332 23.9528 23.3332 23.334V9.33398L16.3332 2.33398Z"
                   stroke="currentColor" stroke-width="2.33333" />
                   stroke="currentColor" stroke-width="2.33333" />
-                <path id="Vector_2" d="M10.5 25.6667V14H17.5V25.6667" stroke="currentColor" stroke-width="2.33333" />
+                <path id="Vector_2" d="M16.3335 2.33398V9.33398H23.3335" stroke="currentColor" stroke-width="2.33333" />
               </g>
               </g>
             </svg>
             </svg>
           </div>
           </div>
-          <h3>{{ lang.ssImportFromLibrary }}</h3>
-          <p>{{ lang.ssSelectExistingContent }}</p>
+          <h3>{{ lang.ssCreateBlank }}</h3>
+          <p>{{ lang.ssStartFromScratch }}</p>
+        </div>
+        <div class="option-card disabled">
+          <div class="option-icon">
+            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+              <path d="M12 2L2 7l10 5 10-5-10-5z" />
+              <path d="M2 17l10 5 10-5" />
+              <path d="M2 12l10 5 10-5" />
+            </svg>
+          </div>
+          <h3>{{ lang.ssCreateFromAI }}</h3>
+          <p>{{ lang.ssAIGenerateContent }}</p>
           <div class="coming-soon">{{ lang.ssComingSoon }}</div>
           <div class="coming-soon">{{ lang.ssComingSoon }}</div>
         </div>
         </div>
-        <div class="option-card" @click="handleOptionClick('blank')">
+        <div class="option-card disabled">
           <div class="option-icon">
           <div class="option-icon">
             <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
             <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
               <g id="Component 1">
               <g id="Component 1">
                 <path id="Vector"
                 <path id="Vector"
-                  d="M16.3332 2.33398H6.99984C6.381 2.33398 5.78751 2.57982 5.34992 3.0174C4.91234 3.45499 4.6665 4.04848 4.6665 4.66732V23.334C4.6665 23.9528 4.91234 24.5463 5.34992 24.9839C5.78751 25.4215 6.381 25.6673 6.99984 25.6673H20.9998C21.6187 25.6673 22.2122 25.4215 22.6498 24.9839C23.0873 24.5463 23.3332 23.9528 23.3332 23.334V9.33398L16.3332 2.33398Z"
+                  d="M3.5 10.5007L14 2.33398L24.5 10.5007V23.334C24.5 23.9528 24.2542 24.5463 23.8166 24.9839C23.379 25.4215 22.7855 25.6673 22.1667 25.6673H5.83333C5.21449 25.6673 4.621 25.4215 4.18342 24.9839C3.74583 24.5463 3.5 23.9528 3.5 23.334V10.5007Z"
                   stroke="currentColor" stroke-width="2.33333" />
                   stroke="currentColor" stroke-width="2.33333" />
-                <path id="Vector_2" d="M16.3335 2.33398V9.33398H23.3335" stroke="currentColor" stroke-width="2.33333" />
+                <path id="Vector_2" d="M10.5 25.6667V14H17.5V25.6667" stroke="currentColor" stroke-width="2.33333" />
               </g>
               </g>
             </svg>
             </svg>
           </div>
           </div>
-          <h3>{{ lang.ssCreateBlank }}</h3>
-          <p>{{ lang.ssStartFromScratch }}</p>
+          <h3>{{ lang.ssImportFromLibrary }}</h3>
+          <p>{{ lang.ssSelectExistingContent }}</p>
+          <div class="coming-soon">{{ lang.ssComingSoon }}</div>
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>
@@ -137,7 +137,9 @@ const handleFileUpload = async (files: FileList) => {
     const signal = parsingAbortController.value.signal
     const signal = parsingAbortController.value.signal
 
 
     // 调用importPPTXFile并传入signal
     // 调用importPPTXFile并传入signal
-    await importPPTXFile(files, { signal, onclose: () => {emit('setTitle', file.name.replace(/\.[^/.]+$/, '')); emit('close')} })
+    await importPPTXFile(files, { signal, onclose: () => {
+      emit('setTitle', file.name.replace(/\.[^/.]+$/, '')); emit('close')
+    } })
   }
   }
   catch (error) {
   catch (error) {
     if (error instanceof DOMException && error.name === 'AbortError') {
     if (error instanceof DOMException && error.name === 'AbortError') {