perf: 懒加载TemplateGallery组件,扩展动画类型选项

- 将Animation/Exercise/CoursewareDetail中的TemplateGallery改为异步组件加载
  减少页面初始加载体积,仅在用户打开模板库时才加载294KB的游戏模板代码
- 为教学动画添加更多学科类型:语文、英语、历史,同时更新typeLabel映射
This commit is contained in:
Zhang Jing Xuan
2026-07-30 11:17:57 +08:00
parent 0dde4460b8
commit 351fcdb4ec
3 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -208,7 +208,7 @@ import { exportHtml } from '@/api/ai'
import { publishResource } from '@/api/resource'
import HtmlPreview from '@/components/common/HtmlPreview.vue'
import MaterialPicker from '@/components/common/MaterialPicker.vue'
import TemplateGallery from '@/components/common/TemplateGallery.vue'
const TemplateGallery = defineAsyncComponent(() => import('@/components/common/TemplateGallery.vue'))
import { useUserStore } from '@/stores/user'
import { downloadBlob } from '@/utils/download'
import { buildMaterialPromptBlock, type MaterialContextItem } from '@/utils/materialContext'
@@ -544,6 +544,9 @@ function typeLabel(type: string) {
chemistry: '化学',
biology: '生物',
geography: '地理',
chinese: '语文',
english: '英语',
history: '历史',
general: '通用',
}
return map[type] || '通用'
+1 -1
View File
@@ -169,7 +169,7 @@ import { exportHtml } from '@/api/ai'
import { createCoursewareShare, exportCoursewareDocx, getCourseware, updateCourseware } from '@/api/courseware'
import { publishResource } from '@/api/resource'
import HtmlPreview from '@/components/common/HtmlPreview.vue'
import TemplateGallery from '@/components/common/TemplateGallery.vue'
const TemplateGallery = defineAsyncComponent(() => import('@/components/common/TemplateGallery.vue'))
import { downloadBlob } from '@/utils/download'
import { coursewareThemes, applyThemeToPage, detectPageTheme, getTheme } from '@/utils/coursewareThemes'
+1 -1
View File
@@ -289,7 +289,7 @@ import { aiGenerateExercise, createExercise, deleteExercise, exportExerciseDocx,
import { publishResource } from '@/api/resource'
import MarkdownContent from '@/components/common/MarkdownContent.vue'
import HtmlPreview from '@/components/common/HtmlPreview.vue'
import TemplateGallery from '@/components/common/TemplateGallery.vue'
const TemplateGallery = defineAsyncComponent(() => import('@/components/common/TemplateGallery.vue'))
import MaterialPicker from '@/components/common/MaterialPicker.vue'
import { useUserStore } from '@/stores/user'
import { downloadBlob } from '@/utils/download'