jvs-ppt-ui 0.0.27 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,146 @@ export interface ReferenceItem {
30
30
  sourceType?: string
31
31
  }
32
32
 
33
+ export interface InfographicTemplateItemVO {
34
+ template: string
35
+ name: string
36
+ isDefault?: boolean
37
+ }
38
+
39
+ export interface InfographicCategoryMetaVO {
40
+ category: string
41
+ categoryName: string
42
+ description?: string
43
+ defaultTemplate?: string
44
+ templates: InfographicTemplateItemVO[]
45
+ }
46
+
47
+ export interface InfographicGenerateParams {
48
+ prompt?: string
49
+ category?: string
50
+ template?: string
51
+ title?: string
52
+ desc?: string
53
+ dataSpec?: any
54
+ theme?: any
55
+ dsl?: string
56
+ format?: 'png' | 'svg' | string
57
+ dpr?: number
58
+ backgroundColor?: string
59
+ width?: number
60
+ height?: number
61
+ model?: string
62
+ projectId?: string
63
+ folderId?: string
64
+ }
65
+
66
+ const DEFAULT_DSL_CATEGORIES: InfographicCategoryMetaVO[] = [
67
+ {
68
+ category: 'sequence',
69
+ categoryName: '步骤序列与时间线类',
70
+ description: '适用于强先后顺序的业务步骤图、时间轴里程碑、蛇形流程、转化漏斗、阶梯晋升及金字塔步骤图',
71
+ defaultTemplate: 'sequence-steps-badge-card',
72
+ templates: [
73
+ { template: 'sequence-steps-badge-card', name: '步骤徽章卡片图', isDefault: true },
74
+ { template: 'horizontal-arrow-steps', name: '横向箭头步骤图', isDefault: false },
75
+ { template: 'sequence-color-snake-steps-horizontal-icon-line', name: '蛇形序列步骤图', isDefault: false },
76
+ { template: 'sequence-funnel-simple', name: '漏斗转化步骤图', isDefault: false },
77
+ { template: 'sequence-ascending-stairs-3d-simple', name: '3D阶梯上升步骤图', isDefault: false },
78
+ { template: 'sequence-timeline-done-list', name: '垂直已完成时间线', isDefault: false },
79
+ { template: 'sequence-roadmap-vertical-pill-badge', name: '竖向公路时序图', isDefault: false },
80
+ { template: 'sequence-pyramid-simple', name: '金字塔极简步骤图', isDefault: false }
81
+ ]
82
+ },
83
+ {
84
+ category: 'compare',
85
+ categoryName: '对比分析类',
86
+ description: '适用于方案优劣 PK、竞品多维对照、架构选型对比及 SWOT 战略分析矩阵',
87
+ defaultTemplate: 'compare-binary-horizontal-badge-card-arrow',
88
+ templates: [
89
+ { template: 'compare-binary-horizontal-badge-card-arrow', name: '左右对比-徽章与箭头', isDefault: true },
90
+ { template: 'compare-hierarchy-left-right-circle-node-pill-badge', name: '左右对称层级对比', isDefault: false },
91
+ { template: 'compare-binary-horizontal-compact-card-fold', name: '左右对比-紧凑折叠卡片', isDefault: false },
92
+ { template: 'compare-binary-horizontal-underline-text-arrow', name: '左右对比-下划线文本', isDefault: false },
93
+ { template: 'compare-hierarchy-row-letter-card-compact-card', name: '多项层级行对比图', isDefault: false },
94
+ { template: 'compare-swot', name: 'SWOT 分析矩阵', isDefault: false }
95
+ ]
96
+ },
97
+ {
98
+ category: 'quadrant',
99
+ categoryName: '四象限评估类',
100
+ description: '适用于 2x2 十字象限矩阵对比、需求优先级评估(重要/紧急)、波士顿矩阵定位分析',
101
+ defaultTemplate: 'compare-quadrant-quarter-simple-card',
102
+ templates: [
103
+ { template: 'compare-quadrant-quarter-simple-card', name: '四象限图-矩形卡片', isDefault: true },
104
+ { template: 'compare-quadrant-quarter-circular', name: '四象限图-圆弧分区', isDefault: false }
105
+ ]
106
+ },
107
+ {
108
+ category: 'hierarchy',
109
+ categoryName: '层级架构与思维导图类',
110
+ description: '适用于企业组织架构树、系统分层结构图、放射状知识拆解树及多级思维导图(脑图)',
111
+ defaultTemplate: 'hierarchy-structure',
112
+ templates: [
113
+ { template: 'hierarchy-structure', name: '层级树状架构图', isDefault: true },
114
+ { template: 'hierarchy-structure-mirror', name: '对称层级架构图', isDefault: false },
115
+ { template: 'hierarchy-mindmap-branch-gradient-capsule-item', name: '渐变分支脑图-胶囊卡片', isDefault: false },
116
+ { template: 'hierarchy-mindmap-level-gradient-compact-card', name: '渐变层级脑图-紧凑卡片', isDefault: false },
117
+ { template: 'hierarchy-tree-tech-style-ribbon-card', name: '层级树-科技风丝带', isDefault: false },
118
+ { template: 'hierarchy-tree-distributed-origin-compact-card', name: '放射状分布树状图', isDefault: false }
119
+ ]
120
+ },
121
+ {
122
+ category: 'list',
123
+ categoryName: '列表与网格矩阵类',
124
+ description: '适用于产品核心特性盘点、功能模块网格卡片、KPI 进度达成率看板、多维度并列要点汇总',
125
+ defaultTemplate: 'list-grid-badge-card',
126
+ templates: [
127
+ { template: 'list-grid-badge-card', name: '列表网格-徽章卡片', isDefault: true },
128
+ { template: 'list-grid-candy-card-lite', name: '列表网格-精美糖果色', isDefault: false },
129
+ { template: 'list-grid-circular-progress', name: '列表网格-环形进度条', isDefault: false },
130
+ { template: 'list-grid-progress-card', name: '列表网格-进度条卡片', isDefault: false },
131
+ { template: 'list-grid-ribbon-card', name: '列表网格-缎带卡片', isDefault: false },
132
+ { template: 'list-row-horizontal-icon-arrow', name: '双侧交替步骤图-横向箭头', isDefault: false }
133
+ ]
134
+ },
135
+ {
136
+ category: 'relation',
137
+ categoryName: '关系拓扑与流向图类',
138
+ description: '适用于系统服务调用拓扑、双向业务流向图、多分支网状依赖、环形生态协同及星形网络图',
139
+ defaultTemplate: 'relation-dagre-flow-lr-badge-card',
140
+ templates: [
141
+ { template: 'relation-dagre-flow-lr-badge-card', name: '双向流向图-徽章卡片', isDefault: true },
142
+ { template: 'relation-dagre-flow-lr-animated-capsule', name: '双向流向图-胶囊卡片', isDefault: false },
143
+ { template: 'relation-dagre-flow-tb-badge-card', name: '双向流向图-徽章卡片(纵向)', isDefault: false },
144
+ { template: 'relation-circle-icon-badge', name: '环形图标徽章', isDefault: false },
145
+ { template: 'relation-network-icon-badge', name: '星形网络图标徽章', isDefault: false }
146
+ ]
147
+ }
148
+ ]
149
+
150
+ const DIMENSION_PRESETS: Array<{ label: string; value: string; width: number | null; height: number | null }> = [
151
+ { label: '自适应尺寸(无留白)', value: 'auto', width: null, height: null },
152
+ { label: '文档定宽 1200px(高度自适应)', value: '1200xauto', width: 1200, height: null },
153
+ { label: '720P 标清横屏 (1280x720)', value: '1280x720', width: 1280, height: 720 },
154
+ { label: '1080P 全高清横屏 (1920x1080)', value: '1920x1080', width: 1920, height: 1080 },
155
+ { label: '2K 超清横屏 (2560x1440)', value: '2560x1440', width: 2560, height: 1440 },
156
+ { label: '4K 大屏超清 (3840x2160)', value: '3840x2160', width: 3840, height: 2160 },
157
+ { label: '4:3 报告插图 (1600x1200)', value: '1600x1200', width: 1600, height: 1200 },
158
+ { label: '9:16 手机竖屏海报 (1080x1920)', value: '1080x1920', width: 1080, height: 1920 },
159
+ { label: '3:4 社媒图文卡片 (1080x1440)', value: '1080x1440', width: 1080, height: 1440 },
160
+ { label: '1:1 正方形卡片 (1080x1080)', value: '1080x1080', width: 1080, height: 1080 },
161
+ { label: '公众号高清封面 (1800x766)', value: '1800x766', width: 1800, height: 766 },
162
+ { label: 'A4 竖版打印 (2480x3508)', value: '2480x3508', width: 2480, height: 3508 },
163
+ { label: 'A4 横版打印 (3508x2480)', value: '3508x2480', width: 3508, height: 2480 }
164
+ ]
165
+
166
+ const INFOGRAPHIC_DEMO_PROMPTS = [
167
+ '企业数字化转型四阶段演进路线:1. 业务信息化 2. 数据线上化 3. 流程自动化 4. 决策智能化',
168
+ '云计算架构选型对比:私有云 vs 公有云(从建设成本、数据安全、弹性扩容、运维复杂度四方面对比)',
169
+ '产品需求四象限评估矩阵:高价值低成本(立即执行)、高价值高成本(重点规划)、低价值低成本(穿插迭代)、低价值高成本(暂缓推进)',
170
+ '企业级 AI 中台三层技术架构:基础设施层(算力集群/向量库)、模型服务层(大语言模型/多模态生图)、业务应用层(智能PPT/数字资产库)'
171
+ ]
172
+
33
173
  const DEFAULT_IMAGE_MODELS: ImageModelMetaVO[] = [
34
174
  {
35
175
  provider: 'DASHSCOPE',
@@ -159,8 +299,66 @@ const hasActivePlaceholderTarget = computed(() => {
159
299
  })
160
300
  const { damFetchJson, isDamLoggedIn } = useDamAuth()
161
301
 
162
- // 生成器模式:image (图片生成器 - 图二) | video (视频生成)
163
- const createMode = ref<'image' | 'video'>('image')
302
+ // 生成器模式:image (图片生成器 - 图二) | infographic (信息图生成) | video (视频生成)
303
+ const createMode = ref<'image' | 'infographic' | 'video'>('image')
304
+
305
+ // 信息图生成 (DSL Generator) 状态
306
+ const dslCategories = ref<InfographicCategoryMetaVO[]>([...DEFAULT_DSL_CATEGORIES])
307
+ const selectedDslCascader = ref<string[]>([''])
308
+ const selectedDslCategory = ref<string>('')
309
+ const selectedDslTemplate = ref<string>('')
310
+ const selectedDslTemplateName = ref<string>('')
311
+ const dslFormat = ref<'png' | 'svg'>('png')
312
+ const dslSizePreset = ref<string>('auto')
313
+ const isDslTemplatesLoaded = ref(false)
314
+ const demoPromptIndex = ref(0)
315
+
316
+ const dslCascaderProps = {
317
+ expandTrigger: 'hover' as const
318
+ }
319
+
320
+ const dslFallbackPlacements = ['bottom-start']
321
+
322
+ function formatShortCategoryLabel(category: string, categoryName: string): string {
323
+ const shortMap: Record<string, string> = {
324
+ sequence: '步骤与时间线',
325
+ compare: '对比分析',
326
+ quadrant: '四象限评估',
327
+ hierarchy: '层级与脑图',
328
+ list: '列表与网格',
329
+ relation: '关系与拓扑'
330
+ }
331
+ return shortMap[category] || (categoryName || '').replace(/类$/, '')
332
+ }
333
+
334
+ const dslCascaderOptions = computed(() => {
335
+ const options: Array<{
336
+ value: string
337
+ label: string
338
+ isDefault?: boolean
339
+ children?: Array<{ value: string; label: string; isDefault?: boolean }>
340
+ }> = [
341
+ {
342
+ value: '',
343
+ label: 'AI 自动识别'
344
+ }
345
+ ]
346
+
347
+ dslCategories.value.forEach(cat => {
348
+ const children = (cat.templates || []).map(tpl => ({
349
+ value: tpl.template,
350
+ label: tpl.name,
351
+ isDefault: tpl.isDefault
352
+ }))
353
+ options.push({
354
+ value: cat.category,
355
+ label: formatShortCategoryLabel(cat.category, cat.categoryName),
356
+ children
357
+ })
358
+ })
359
+
360
+ return options
361
+ })
164
362
 
165
363
  // 模型列表与选择状态
166
364
  const imageModels = ref<ImageModelMetaVO[]>([...DEFAULT_IMAGE_MODELS])
@@ -272,6 +470,126 @@ async function fetchSupportedImageModels() {
272
470
  }
273
471
  }
274
472
 
473
+ async function fetchDslTemplates() {
474
+ if (isDslTemplatesLoaded.value || !isDamLoggedIn.value) return
475
+ try {
476
+ const res = await damFetchJson('/infographic/generate/templates')
477
+ const rawList =
478
+ (Array.isArray(res?.data?.data) && res.data.data) ||
479
+ (Array.isArray(res?.data) && res.data) ||
480
+ (Array.isArray(res) && res) ||
481
+ null
482
+ if (rawList && rawList.length > 0) {
483
+ dslCategories.value = rawList
484
+ isDslTemplatesLoaded.value = true
485
+ }
486
+ } catch {
487
+ // 保持内置 DEFAULT_DSL_CATEGORIES
488
+ }
489
+ }
490
+
491
+ function handleDslCascaderChange(val: any) {
492
+ const arr = Array.isArray(val) ? val : []
493
+ if (arr.length === 0 || !arr[0]) {
494
+ selectedDslCascader.value = ['']
495
+ selectedDslCategory.value = ''
496
+ selectedDslTemplate.value = ''
497
+ selectedDslTemplateName.value = ''
498
+ return
499
+ }
500
+ const catKey = arr[0] || ''
501
+ const tplKey = arr[1] || ''
502
+ selectedDslCategory.value = catKey
503
+ selectedDslTemplate.value = tplKey
504
+ const foundCat = dslCategories.value.find(c => c.category === catKey)
505
+ const foundTpl = foundCat?.templates?.find(t => t.template === tplKey)
506
+ selectedDslTemplateName.value = foundTpl?.name || tplKey
507
+ }
508
+
509
+ function fillInfographicDemoPrompt() {
510
+ promptText.value = INFOGRAPHIC_DEMO_PROMPTS[demoPromptIndex.value % INFOGRAPHIC_DEMO_PROMPTS.length]
511
+ demoPromptIndex.value = (demoPromptIndex.value + 1) % INFOGRAPHIC_DEMO_PROMPTS.length
512
+ }
513
+
514
+ function handleSwitchCreateMode(mode: 'image' | 'infographic' | 'video') {
515
+ if (mode === 'video') return
516
+ closeAllPopovers()
517
+ createMode.value = mode
518
+ if (mode === 'infographic') {
519
+ void fetchDslTemplates()
520
+ }
521
+ }
522
+
523
+ /**
524
+ * 解析 DSL 生成输入内容,按 dsl > dataSpec > prompt 三种模式构建 InfographicGenerateDTO 请求体
525
+ * (1:1 对齐 jvs-material-ui ToolControlPanel.vue)
526
+ */
527
+ function buildInfographicGenerateParams(rawInput: string): InfographicGenerateParams {
528
+ const stripCodeFence = (text: string): string => {
529
+ const trimmed = text.trim()
530
+ const match = trimmed.match(/^```(?:[a-zA-Z0-9_-]+)?\s*\r?\n([\s\S]*?)\r?\n?```$/)
531
+ return match ? (match[1] || '').trim() : trimmed
532
+ }
533
+
534
+ const stripped = stripCodeFence(rawInput)
535
+ const firstLine = stripped.split(/\r?\n/).find(l => l.trim().length > 0)?.trim() || ''
536
+
537
+ const format = dslFormat.value || 'png'
538
+ const matchedPreset = dslSizePreset.value
539
+ ? DIMENSION_PRESETS.find(item => item.value === dslSizePreset.value)
540
+ : undefined
541
+ const validWidth = matchedPreset?.width ?? undefined
542
+ const validHeight = matchedPreset?.height ?? undefined
543
+
544
+ const baseParams: InfographicGenerateParams = {
545
+ format,
546
+ ...(format === 'png' ? { dpr: 2 } : {}),
547
+ backgroundColor: '#FFFFFF',
548
+ ...(validWidth ? { width: validWidth } : {}),
549
+ ...(validHeight ? { height: validHeight } : {})
550
+ }
551
+
552
+ // 模式3:原始 2 空格缩进 AntV Infographic DSL 源码直传(首行以 infographic 开头)
553
+ if (/^infographic(\s+|$)/i.test(firstLine)) {
554
+ return {
555
+ ...baseParams,
556
+ dsl: stripped,
557
+ ...(selectedDslCategory.value ? { category: selectedDslCategory.value } : {})
558
+ }
559
+ }
560
+
561
+ // 模式2:结构化 JSON 数据规格(dataSpec)直传
562
+ if ((stripped.startsWith('{') && stripped.endsWith('}')) || (stripped.startsWith('[') && stripped.endsWith(']'))) {
563
+ try {
564
+ const parsed = JSON.parse(stripped)
565
+ if (parsed && typeof parsed === 'object') {
566
+ const isEnvelope =
567
+ !Array.isArray(parsed) &&
568
+ (parsed.data || parsed.compares || parsed.root || parsed.lists || parsed.sequences || parsed.nodes)
569
+ return {
570
+ ...baseParams,
571
+ dataSpec: isEnvelope && parsed.data ? parsed.data : parsed,
572
+ category: selectedDslCategory.value || parsed.category || undefined,
573
+ template: selectedDslTemplate.value || parsed.template || undefined,
574
+ title: parsed.title || undefined,
575
+ desc: parsed.desc || undefined,
576
+ theme: parsed.theme || undefined
577
+ }
578
+ }
579
+ } catch {
580
+ // 非合法 JSON,自动降级按自然语言提示词处理
581
+ }
582
+ }
583
+
584
+ // 模式1:自然语言需求描述驱动(推荐主链路)
585
+ return {
586
+ ...baseParams,
587
+ prompt: rawInput,
588
+ ...(selectedDslCategory.value ? { category: selectedDslCategory.value } : {}),
589
+ ...(selectedDslTemplate.value ? { template: selectedDslTemplate.value } : {})
590
+ }
591
+ }
592
+
275
593
  function closeAllPopovers() {
276
594
  showModelDropdown.value = false
277
595
  showTemplatePopover.value = false
@@ -478,15 +796,69 @@ async function handleRefFileChange(e: Event) {
478
796
  }
479
797
 
480
798
  /**
481
- * 执行 AI 生图或生视频
799
+ * 执行 AI 生图、信息图生成或生视频
482
800
  */
483
801
  async function handleGenerate() {
484
802
  const rawPrompt = promptText.value.trim()
485
803
  if (!rawPrompt) {
486
- notify(createMode.value === 'image' ? '请输入您想要生成的画面描述提示词' : '请输入视频画面与运镜描述提示词')
804
+ if (createMode.value === 'infographic') {
805
+ notify('请输入信息图需求描述、结构化 JSON 或 DSL 源码')
806
+ } else if (createMode.value === 'image') {
807
+ notify('请输入您想要生成的画面描述提示词')
808
+ } else {
809
+ notify('请输入视频画面与运镜描述提示词')
810
+ }
811
+ return
812
+ }
813
+
814
+ // 分支一:信息图生成模式 -> 对接 /jvs-dam/infographic/generate
815
+ if (createMode.value === 'infographic') {
816
+ isGenerating.value = true
817
+ try {
818
+ const dslParams = buildInfographicGenerateParams(rawPrompt)
819
+ const res = await damFetchJson('/infographic/generate', {
820
+ method: 'POST',
821
+ body: JSON.stringify(dslParams)
822
+ })
823
+
824
+ const data = res?.data?.data || res?.data || res
825
+ const code = res?.code ?? res?.data?.code ?? 0
826
+ if ((code === 0 || code === 200) && data) {
827
+ const imgUrl = data.imageUrl || data.fileUrl || data.url || ''
828
+ if (imgUrl) {
829
+ const fmt = String(data.format || dslParams.format || 'png').toUpperCase()
830
+ const newItem: MaterialItem = {
831
+ id: String(data.assetId || data.recordId || `infographic-${Date.now()}`),
832
+ title: data.title || data.templateName || rawPrompt,
833
+ type: 'image',
834
+ assetType: 'IMAGE',
835
+ sourceType: 'GENERATE',
836
+ badgeLabel: `DSL 信息图 · ${fmt}`,
837
+ url: imgUrl,
838
+ previewUrl: imgUrl,
839
+ sourceUrl: imgUrl,
840
+ originalWidth: Number(data.width) || dslParams.width || 1280,
841
+ originalHeight: Number(data.height) || dslParams.height || 720,
842
+ model: data.model || 'DIRECT_DSL'
843
+ }
844
+ generatedResults.value.unshift(newItem)
845
+ emit('generated', newItem)
846
+ notify('信息图生成成功!点击下方卡片即可插入画布')
847
+ } else {
848
+ throw new Error(res?.msg || '信息图生成接口未返回有效图片地址')
849
+ }
850
+ } else {
851
+ throw new Error(res?.msg || '信息图生成失败')
852
+ }
853
+ } catch (err: any) {
854
+ notify(`信息图生成失败: ${err.message || '请检查输入格式或后端服务'}`)
855
+ } finally {
856
+ isGenerating.value = false
857
+ }
487
858
  return
488
859
  }
489
860
 
861
+ // 分支二:标准 AI 图像生成模式 -> 对接 /jvs-dam/image/generate
490
862
  if (createMode.value === 'image') {
491
863
  const meta = currentImageModelMeta.value
492
864
  if (referenceList.value.length > 0 && meta && meta.supportsRefImage === false) {
@@ -632,9 +1004,8 @@ onUnmounted(() => {
632
1004
 
633
1005
  defineExpose({
634
1006
  addReferenceItem,
635
- switchCreateMode: (mode: 'image' | 'video') => {
636
- if (mode === 'video') return
637
- createMode.value = mode
1007
+ switchCreateMode: (mode: 'image' | 'infographic' | 'video') => {
1008
+ handleSwitchCreateMode(mode)
638
1009
  }
639
1010
  })
640
1011
  </script>
@@ -650,17 +1021,25 @@ defineExpose({
650
1021
  @change="handleRefFileChange"
651
1022
  />
652
1023
 
653
- <!-- 1. 顶部工具栏:图片生成器 / 视频生成(暂禁用) 分段切换(模板库暂隐藏) -->
1024
+ <!-- 1. 顶部工具栏:图片生成器 / 信息图生成 / 视频生成(暂禁用) 分段切换 -->
654
1025
  <div class="create-sub-header">
655
1026
  <div class="mode-segmented-box">
656
1027
  <button
657
1028
  type="button"
658
1029
  class="mode-seg-btn"
659
1030
  :class="{ active: createMode === 'image' }"
660
- @click="createMode = 'image'"
1031
+ @click="handleSwitchCreateMode('image')"
661
1032
  >
662
1033
  <span>图片生成器</span>
663
1034
  </button>
1035
+ <button
1036
+ type="button"
1037
+ class="mode-seg-btn"
1038
+ :class="{ active: createMode === 'infographic' }"
1039
+ @click="handleSwitchCreateMode('infographic')"
1040
+ >
1041
+ <span>信息图生成</span>
1042
+ </button>
664
1043
  <button
665
1044
  type="button"
666
1045
  class="mode-seg-btn is-disabled"
@@ -674,8 +1053,8 @@ defineExpose({
674
1053
 
675
1054
  <!-- 2. 主滚动表单区 -->
676
1055
  <div class="create-scroll-body">
677
- <!-- ==================== 模型选择 (Model Selection) ==================== -->
678
- <div class="control-block">
1056
+ <!-- ==================== 模型选择 (Model Selection - 信息图模式隐藏) ==================== -->
1057
+ <div v-if="createMode !== 'infographic'" class="control-block">
679
1058
  <label class="block-label">模型选择</label>
680
1059
  <div class="model-select-wrap" @click.stop>
681
1060
  <button
@@ -747,7 +1126,7 @@ defineExpose({
747
1126
  </div>
748
1127
  </div>
749
1128
 
750
- <!-- ==================== 参考素材 (References) ==================== -->
1129
+ <!-- ==================== 参考素材 (References - 信息图模式隐藏) ==================== -->
751
1130
  <!-- A. 图片生成模式:1:1 还原图二(风格参考 / 角色参考 / 添加素材 0/8) -->
752
1131
  <div v-if="createMode === 'image'" class="control-block">
753
1132
  <div class="block-header-line">
@@ -817,7 +1196,7 @@ defineExpose({
817
1196
  </div>
818
1197
 
819
1198
  <!-- B. 视频生成模式:起始帧 / 结束帧 -->
820
- <div v-else class="control-block">
1199
+ <div v-else-if="createMode === 'video'" class="control-block">
821
1200
  <div class="block-header-line">
822
1201
  <label class="block-label">参考素材 (首尾帧)</label>
823
1202
  </div>
@@ -864,7 +1243,7 @@ defineExpose({
864
1243
 
865
1244
  <!-- 参考素材快速选择面板 (支持画布当前选中图 / 本地上传 / 预设风格 / 我的资产) -->
866
1245
  <transition name="pop-fade">
867
- <div v-if="refPickerVisible" class="ref-picker-drawer-card" @click.stop>
1246
+ <div v-if="refPickerVisible && createMode !== 'infographic'" class="ref-picker-drawer-card" @click.stop>
868
1247
  <div class="picker-top-bar">
869
1248
  <span class="picker-title">
870
1249
  {{ refPickerTargetMode === 'style' ? '选择风格参考' : refPickerTargetMode === 'character' ? '选择角色参考' : '添加参考素材' }}
@@ -935,24 +1314,39 @@ defineExpose({
935
1314
 
936
1315
  <!-- ==================== 提示词描述 (Prompt Box - 1:1 还原图二) ==================== -->
937
1316
  <div class="control-block">
938
- <label class="block-label">提示词描述</label>
1317
+ <div class="block-header-line">
1318
+ <label class="block-label">提示词描述</label>
1319
+ <span
1320
+ v-if="createMode === 'infographic'"
1321
+ class="demo-prompt-link"
1322
+ @click="fillInfographicDemoPrompt"
1323
+ >
1324
+ + 填入示例需求
1325
+ </span>
1326
+ </div>
939
1327
  <div class="prompt-card-box">
940
1328
  <textarea
941
1329
  v-model="promptText"
942
- rows="4"
1330
+ :rows="createMode === 'infographic' ? 5 : 4"
943
1331
  class="prompt-textarea"
944
- :placeholder="createMode === 'image' ? '描述您想要生成的画面—可输入 @ 引入参考图' : '描述您想要生成的视频画面与镜头运动...'"
1332
+ :placeholder="
1333
+ createMode === 'infographic'
1334
+ ? '输入自然语言信息图需求、结构化 JSON 或 2 空格缩进 Infographic DSL...'
1335
+ : createMode === 'image'
1336
+ ? '描述您想要生成的画面—可输入 @ 引入参考图'
1337
+ : '描述您想要生成的视频画面与镜头运动...'
1338
+ "
945
1339
  ></textarea>
946
1340
 
947
1341
  <div class="prompt-bottom-toolbar">
948
1342
  <!-- 左侧 AI 提示词增强开关 -->
949
1343
  <div
950
1344
  class="ai-enhance-switch"
951
- @click="createMode === 'image' ? (isAiPromptOn = !isAiPromptOn) : (videoMotionOn = !videoMotionOn)"
1345
+ @click="createMode === 'video' ? (videoMotionOn = !videoMotionOn) : (isAiPromptOn = !isAiPromptOn)"
952
1346
  >
953
1347
  <span
954
1348
  class="switch-track"
955
- :class="{ 'is-on': createMode === 'image' ? isAiPromptOn : videoMotionOn }"
1349
+ :class="{ 'is-on': createMode === 'video' ? videoMotionOn : isAiPromptOn }"
956
1350
  >
957
1351
  <span class="switch-thumb"></span>
958
1352
  </span>
@@ -985,21 +1379,21 @@ defineExpose({
985
1379
  </div>
986
1380
  </div>
987
1381
 
988
- <!-- 2. 风格标签词 -->
1382
+ <!-- 2. 风格标签词 / 信息图示例 -->
989
1383
  <div class="icon-pop-anchor">
990
1384
  <button
991
1385
  type="button"
992
1386
  class="tool-icon-btn"
993
1387
  :class="{ active: showTagPopover }"
994
- title="插入常用修饰词"
995
- @click="showTagPopover = !showTagPopover; showSeedPopover = false"
1388
+ :title="createMode === 'infographic' ? '插入示例信息图需求' : '插入常用修饰词'"
1389
+ @click="createMode === 'infographic' ? fillInfographicDemoPrompt() : (showTagPopover = !showTagPopover, showSeedPopover = false)"
996
1390
  >
997
1391
  <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">
998
1392
  <path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z" />
999
1393
  <line x1="7" y1="7" x2="7.01" y2="7" />
1000
1394
  </svg>
1001
1395
  </button>
1002
- <div v-if="showTagPopover" class="mini-floating-popover tags-pop">
1396
+ <div v-if="showTagPopover && createMode !== 'infographic'" class="mini-floating-popover tags-pop">
1003
1397
  <div class="pop-card-title">点击追加风格词</div>
1004
1398
  <div class="quick-tags-wrap">
1005
1399
  <span
@@ -1046,8 +1440,147 @@ defineExpose({
1046
1440
  </div>
1047
1441
  </div>
1048
1442
 
1443
+ <!-- ==================== 信息图生成专属配置项 (模板选择 / 生成类型 / 生成宽高) ==================== -->
1444
+ <template v-if="createMode === 'infographic'">
1445
+ <!-- 1. 模板选择 (二级级联下拉:一级分类 -> 二级模板) -->
1446
+ <div class="control-block dsl-config-section">
1447
+ <label class="block-label">模板选择</label>
1448
+ <el-cascader
1449
+ v-model="selectedDslCascader"
1450
+ :options="dslCascaderOptions"
1451
+ :props="dslCascaderProps"
1452
+ filterable
1453
+ placeholder="AI 自动识别推荐模板"
1454
+ separator=" / "
1455
+ class="dsl-full-cascader"
1456
+ popper-class="dsl-custom-cascader-popper"
1457
+ placement="bottom-start"
1458
+ :fallback-placements="dslFallbackPlacements"
1459
+ :show-arrow="false"
1460
+ :offset="6"
1461
+ @change="handleDslCascaderChange"
1462
+ >
1463
+ <template #default="{ node, data }">
1464
+ <div class="dsl-select-option-row">
1465
+ <span class="dsl-opt-name" :title="data.label">{{ data.label }}</span>
1466
+ <div class="dsl-opt-right">
1467
+ <span v-if="node.isLeaf && data.isDefault" class="dsl-opt-default-tag">推荐</span>
1468
+ <svg
1469
+ v-if="node.isLeaf && node.isChecked"
1470
+ class="dsl-opt-check"
1471
+ viewBox="0 0 24 24"
1472
+ width="15"
1473
+ height="15"
1474
+ fill="none"
1475
+ stroke="currentColor"
1476
+ stroke-width="2.5"
1477
+ stroke-linecap="round"
1478
+ stroke-linejoin="round"
1479
+ >
1480
+ <polyline points="20 6 9 17 4 12" />
1481
+ </svg>
1482
+ </div>
1483
+ </div>
1484
+ </template>
1485
+ </el-cascader>
1486
+ </div>
1487
+
1488
+ <!-- 2. 生成类型 (PNG / SVG) -->
1489
+ <div class="control-block dsl-config-section">
1490
+ <label class="block-label">生成类型</label>
1491
+ <el-select
1492
+ v-model="dslFormat"
1493
+ class="dsl-full-select"
1494
+ popper-class="dsl-custom-select-popper"
1495
+ placement="bottom-start"
1496
+ :fallback-placements="dslFallbackPlacements"
1497
+ :show-arrow="false"
1498
+ :offset="6"
1499
+ >
1500
+ <el-option label="PNG (高清位图)" value="png">
1501
+ <div class="dsl-select-option-row">
1502
+ <span class="dsl-opt-name">PNG (高清位图)</span>
1503
+ <svg
1504
+ v-if="dslFormat === 'png'"
1505
+ class="dsl-opt-check"
1506
+ viewBox="0 0 24 24"
1507
+ width="15"
1508
+ height="15"
1509
+ fill="none"
1510
+ stroke="currentColor"
1511
+ stroke-width="2.5"
1512
+ stroke-linecap="round"
1513
+ stroke-linejoin="round"
1514
+ >
1515
+ <polyline points="20 6 9 17 4 12" />
1516
+ </svg>
1517
+ </div>
1518
+ </el-option>
1519
+ <el-option label="SVG (矢量图)" value="svg">
1520
+ <div class="dsl-select-option-row">
1521
+ <span class="dsl-opt-name">SVG (矢量图)</span>
1522
+ <svg
1523
+ v-if="dslFormat === 'svg'"
1524
+ class="dsl-opt-check"
1525
+ viewBox="0 0 24 24"
1526
+ width="15"
1527
+ height="15"
1528
+ fill="none"
1529
+ stroke="currentColor"
1530
+ stroke-width="2.5"
1531
+ stroke-linecap="round"
1532
+ stroke-linejoin="round"
1533
+ >
1534
+ <polyline points="20 6 9 17 4 12" />
1535
+ </svg>
1536
+ </div>
1537
+ </el-option>
1538
+ </el-select>
1539
+ </div>
1540
+
1541
+ <!-- 3. 生成宽高 (PNG / SVG 均可设置) -->
1542
+ <div class="control-block dsl-config-section">
1543
+ <label class="block-label">生成宽高 (PX)</label>
1544
+ <el-select
1545
+ v-model="dslSizePreset"
1546
+ placeholder="自适应尺寸(无留白)"
1547
+ class="dsl-full-select"
1548
+ popper-class="dsl-custom-select-popper"
1549
+ placement="bottom-start"
1550
+ :fallback-placements="dslFallbackPlacements"
1551
+ :show-arrow="false"
1552
+ :offset="6"
1553
+ >
1554
+ <el-option
1555
+ v-for="sizeOpt in DIMENSION_PRESETS"
1556
+ :key="sizeOpt.value"
1557
+ :label="sizeOpt.label"
1558
+ :value="sizeOpt.value"
1559
+ >
1560
+ <div class="dsl-select-option-row">
1561
+ <span class="dsl-opt-name">{{ sizeOpt.label }}</span>
1562
+ <svg
1563
+ v-if="dslSizePreset === sizeOpt.value"
1564
+ class="dsl-opt-check"
1565
+ viewBox="0 0 24 24"
1566
+ width="15"
1567
+ height="15"
1568
+ fill="none"
1569
+ stroke="currentColor"
1570
+ stroke-width="2.5"
1571
+ stroke-linecap="round"
1572
+ stroke-linejoin="round"
1573
+ >
1574
+ <polyline points="20 6 9 17 4 12" />
1575
+ </svg>
1576
+ </div>
1577
+ </el-option>
1578
+ </el-select>
1579
+ </div>
1580
+ </template>
1581
+
1049
1582
  <!-- ==================== 参数控制胶囊行 (- 1 +, 1:1, 1K · High) ==================== -->
1050
- <div v-if="createMode === 'image'" class="params-pills-row" @click.stop>
1583
+ <div v-else-if="createMode === 'image'" class="params-pills-row" @click.stop>
1051
1584
  <!-- 数量步进器 -->
1052
1585
  <div class="stepper-pill">
1053
1586
  <button type="button" class="step-btn" @click="batchCount = Math.max(1, batchCount - 1)">-</button>
@@ -1107,7 +1640,7 @@ defineExpose({
1107
1640
  </div>
1108
1641
 
1109
1642
  <!-- 视频模式参数胶囊行 -->
1110
- <div v-else class="params-pills-row" @click.stop>
1643
+ <div v-else-if="createMode === 'video'" class="params-pills-row" @click.stop>
1111
1644
  <div class="param-pill-anchor">
1112
1645
  <button
1113
1646
  type="button"
@@ -1194,6 +1727,7 @@ defineExpose({
1194
1727
  v-for="resItem in generatedResults"
1195
1728
  :key="resItem.id"
1196
1729
  class="result-card"
1730
+ :class="{ 'is-wide': resItem.badgeLabel?.includes('信息图') }"
1197
1731
  @click.stop="emit('select', resItem)"
1198
1732
  >
1199
1733
  <VideoCoverThumb
@@ -1219,6 +1753,10 @@ defineExpose({
1219
1753
  @error="markImgBroken(`res_${resItem.id}`)"
1220
1754
  />
1221
1755
 
1756
+ <span v-if="resItem.badgeLabel?.includes('信息图')" class="dsl-tag-pill">
1757
+ {{ resItem.badgeLabel }}
1758
+ </span>
1759
+
1222
1760
  <span v-if="resItem.type === 'video'" class="video-badge">
1223
1761
  <el-icon><VideoPlay /></el-icon>
1224
1762
  </span>
@@ -1289,21 +1827,27 @@ defineExpose({
1289
1827
 
1290
1828
  .mode-segmented-box {
1291
1829
  display: inline-flex;
1830
+ width: 100%;
1292
1831
  background: #f1f5f9;
1293
- padding: 2px;
1832
+ padding: 2.5px;
1294
1833
  border-radius: 7px;
1295
1834
  }
1296
1835
 
1297
1836
  .mode-seg-btn {
1837
+ flex: 1;
1298
1838
  border: none;
1299
1839
  background: transparent;
1300
- padding: 4px 10px;
1840
+ padding: 4.5px 6px;
1301
1841
  border-radius: 5px;
1302
1842
  font-size: 12px;
1303
1843
  font-weight: 500;
1304
1844
  color: #64748b;
1305
1845
  cursor: pointer;
1306
1846
  transition: all 0.15s ease;
1847
+ display: inline-flex;
1848
+ align-items: center;
1849
+ justify-content: center;
1850
+ white-space: nowrap;
1307
1851
 
1308
1852
  &:hover:not(.is-disabled) {
1309
1853
  color: #0f172a;
@@ -2197,6 +2741,65 @@ defineExpose({
2197
2741
  gap: 8px;
2198
2742
  }
2199
2743
 
2744
+ .demo-prompt-link {
2745
+ font-size: 11px;
2746
+ font-weight: 500;
2747
+ color: #3b5bdb;
2748
+ cursor: pointer;
2749
+ user-select: none;
2750
+ transition: color 0.15s ease;
2751
+
2752
+ &:hover {
2753
+ color: #2563eb;
2754
+ text-decoration: underline;
2755
+ }
2756
+ }
2757
+
2758
+ /* 信息图生成专属配置项样式 (模板下拉、生成类型、生成宽高) */
2759
+ .dsl-config-section {
2760
+ .dsl-full-select,
2761
+ .dsl-full-cascader {
2762
+ width: 100%;
2763
+
2764
+ :deep(.el-select__wrapper),
2765
+ :deep(.el-input__wrapper) {
2766
+ min-height: 38px;
2767
+ padding: 0 12px;
2768
+ border-radius: 10px;
2769
+ background-color: #ffffff;
2770
+ box-shadow: 0 0 0 1px #dcdfe6 inset;
2771
+ transition: all 0.18s ease;
2772
+
2773
+ &:hover {
2774
+ box-shadow: 0 0 0 1px #94a3b8 inset;
2775
+ }
2776
+
2777
+ &.is-focused,
2778
+ &.is-focus {
2779
+ box-shadow: 0 0 0 1.5px #2563eb inset, 0 0 0 3.5px rgba(37, 99, 235, 0.14) !important;
2780
+ }
2781
+
2782
+ &.is-disabled {
2783
+ opacity: 0.6;
2784
+ cursor: not-allowed;
2785
+ background-color: #f1f5f9;
2786
+ box-shadow: 0 0 0 1px #e2e8f0 inset;
2787
+ }
2788
+ }
2789
+
2790
+ :deep(.el-select__selected-item),
2791
+ :deep(.el-input__inner) {
2792
+ color: #1e293b;
2793
+ font-size: 13px;
2794
+ font-weight: 500;
2795
+ }
2796
+
2797
+ :deep(.el-select__placeholder.is-transparent) {
2798
+ color: #94a3b8;
2799
+ }
2800
+ }
2801
+ }
2802
+
2200
2803
  .result-card {
2201
2804
  position: relative;
2202
2805
  border-radius: 8px;
@@ -2205,6 +2808,31 @@ defineExpose({
2205
2808
  aspect-ratio: 1 / 1;
2206
2809
  cursor: pointer;
2207
2810
 
2811
+ &.is-wide {
2812
+ grid-column: span 2;
2813
+ aspect-ratio: 16 / 9;
2814
+ background: #ffffff;
2815
+ border: 1px solid #e2e8f0;
2816
+
2817
+ .result-media {
2818
+ object-fit: contain;
2819
+ background: #ffffff;
2820
+ }
2821
+ }
2822
+
2823
+ .dsl-tag-pill {
2824
+ position: absolute;
2825
+ top: 6px;
2826
+ left: 6px;
2827
+ padding: 1px 6px;
2828
+ border-radius: 4px;
2829
+ background: rgba(37, 99, 235, 0.9);
2830
+ color: #ffffff;
2831
+ font-size: 10px;
2832
+ font-weight: 600;
2833
+ pointer-events: none;
2834
+ }
2835
+
2208
2836
  .result-media {
2209
2837
  width: 100%;
2210
2838
  height: 100%;
@@ -2287,3 +2915,183 @@ defineExpose({
2287
2915
  to { transform: rotate(360deg); }
2288
2916
  }
2289
2917
  </style>
2918
+
2919
+ <style lang="scss">
2920
+ /* DSL 下拉弹出面板与二级级联弹出面板全局样式(挂载于 body 下,固定在输入框正下方浮动且适配右侧栏宽度) */
2921
+ .el-popper.dsl-custom-select-popper,
2922
+ .el-popper.dsl-custom-cascader-popper {
2923
+ border-radius: 12px !important;
2924
+ border: 1px solid #f1f5f9 !important;
2925
+ background: #ffffff !important;
2926
+ box-shadow: 0 10px 30px rgba(15, 23, 42, 0.09), 0 2px 8px rgba(15, 23, 42, 0.04) !important;
2927
+ overflow: hidden !important;
2928
+
2929
+ .el-popper__arrow {
2930
+ display: none !important;
2931
+ }
2932
+
2933
+ .el-select-dropdown,
2934
+ .el-cascader-panel {
2935
+ border: none !important;
2936
+ background: transparent !important;
2937
+ }
2938
+
2939
+ .el-select-dropdown__wrap,
2940
+ .el-cascader-menu__wrap.el-scrollbar__wrap,
2941
+ .el-cascader__suggestion-panel {
2942
+ max-height: 240px !important;
2943
+ }
2944
+
2945
+ .el-cascader__suggestion-panel {
2946
+ width: 276px !important;
2947
+ }
2948
+
2949
+ .el-cascader-menu {
2950
+ border-right: 1px solid #f1f5f9 !important;
2951
+
2952
+ &:only-child {
2953
+ width: 276px !important;
2954
+ min-width: 276px !important;
2955
+ }
2956
+
2957
+ &:first-child:not(:only-child) {
2958
+ width: 116px !important;
2959
+ min-width: 116px !important;
2960
+ }
2961
+
2962
+ &:last-child:not(:only-child) {
2963
+ width: 160px !important;
2964
+ min-width: 160px !important;
2965
+ }
2966
+
2967
+ &:last-child {
2968
+ border-right: none !important;
2969
+ }
2970
+ }
2971
+
2972
+ .el-select-dropdown__list,
2973
+ .el-cascader-menu__list,
2974
+ .el-cascader__suggestion-list {
2975
+ padding: 4px 6px !important;
2976
+ margin: 0 !important;
2977
+ }
2978
+
2979
+ .el-select-dropdown__item,
2980
+ .el-cascader-node,
2981
+ .el-cascader__suggestion-item {
2982
+ height: 34px !important;
2983
+ line-height: 34px !important;
2984
+ padding: 0 8px !important;
2985
+ margin: 1px 0 !important;
2986
+ border-radius: 7px !important;
2987
+ font-size: 12px !important;
2988
+ font-weight: 400 !important;
2989
+ color: #1e293b !important;
2990
+ background: transparent !important;
2991
+ display: flex !important;
2992
+ align-items: center !important;
2993
+ justify-content: space-between !important;
2994
+ transition: background-color 0.15s ease, color 0.15s ease !important;
2995
+
2996
+ &::after {
2997
+ display: none !important;
2998
+ }
2999
+
3000
+ &.is-hovering:not(.is-selected),
3001
+ &:hover:not(.is-selected):not(.is-active):not(.in-active-path) {
3002
+ background-color: #f8fafc !important;
3003
+ color: #0f172a !important;
3004
+ }
3005
+
3006
+ &.is-selected,
3007
+ &.is-active,
3008
+ &.in-active-path,
3009
+ &.is-checked {
3010
+ background-color: #eff6ff !important;
3011
+ color: #2563eb !important;
3012
+ font-weight: 600 !important;
3013
+ }
3014
+ }
3015
+
3016
+ /* 当展开二级分类路径时,一级菜单中仅高亮当前展开分类(避免 AI 自动识别 与悬停分类同时蓝底高亮) */
3017
+ .el-cascader-menu:first-child:has(.in-active-path) .el-cascader-node.is-active:not(.in-active-path) {
3018
+ background-color: transparent !important;
3019
+ color: #1e293b !important;
3020
+ font-weight: 400 !important;
3021
+
3022
+ .dsl-opt-check {
3023
+ display: none !important;
3024
+ }
3025
+ }
3026
+
3027
+ .el-cascader-node__prefix {
3028
+ display: none !important;
3029
+ }
3030
+
3031
+ .el-cascader-node__label {
3032
+ padding: 0 !important;
3033
+ flex: 1 !important;
3034
+ overflow: hidden !important;
3035
+ }
3036
+
3037
+ .el-cascader-node__postfix {
3038
+ position: static !important;
3039
+ margin-left: 4px !important;
3040
+ color: #94a3b8 !important;
3041
+ }
3042
+
3043
+ .el-cascader-node.in-active-path .el-cascader-node__postfix {
3044
+ color: #2563eb !important;
3045
+ }
3046
+
3047
+ .dsl-select-option-row {
3048
+ display: flex;
3049
+ align-items: center;
3050
+ justify-content: space-between;
3051
+ gap: 6px;
3052
+ width: 100%;
3053
+ overflow: hidden;
3054
+
3055
+ .dsl-opt-name {
3056
+ overflow: hidden;
3057
+ text-overflow: ellipsis;
3058
+ white-space: nowrap;
3059
+ line-height: 1.4;
3060
+ }
3061
+
3062
+ .dsl-opt-right {
3063
+ display: inline-flex;
3064
+ align-items: center;
3065
+ gap: 4px;
3066
+ flex-shrink: 0;
3067
+ }
3068
+
3069
+ .dsl-opt-default-tag {
3070
+ padding: 0 5px;
3071
+ height: 16px;
3072
+ line-height: 16px;
3073
+ border-radius: 999px;
3074
+ font-size: 10px;
3075
+ font-weight: 600;
3076
+ background: #dbeafe;
3077
+ color: #2563eb;
3078
+ }
3079
+
3080
+ .dsl-opt-check {
3081
+ flex-shrink: 0;
3082
+ color: #2563eb;
3083
+ }
3084
+ }
3085
+
3086
+ .el-scrollbar__bar.is-vertical {
3087
+ width: 4px !important;
3088
+ right: 2px !important;
3089
+
3090
+ .el-scrollbar__thumb {
3091
+ background-color: #cbd5e1 !important;
3092
+ border-radius: 999px !important;
3093
+ opacity: 1 !important;
3094
+ }
3095
+ }
3096
+ }
3097
+ </style>