jvs-ppt-ui 0.0.25 → 0.0.26

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.
@@ -64,6 +64,9 @@ export type StockSubType =
64
64
  | 'Photos'
65
65
  | 'Illustrations'
66
66
  | 'Videos'
67
+ | 'Icons'
68
+ | 'Music'
69
+ | 'Sound_Effects'
67
70
 
68
71
  interface OverviewCategoryConfig {
69
72
  key: StockSubType
@@ -72,7 +75,7 @@ interface OverviewCategoryConfig {
72
75
  tags: string[]
73
76
  }
74
77
 
75
- // 图二:固定 4 大核心分类区块配置,每个分类对应后端 subType 参数独立请求一次接口
78
+ // 图二:固定 7 大核心分类区块配置(矢量图 / 照片 / 插画 / 高清视频 / 图标元素 / 背景音乐 / 音效),每个分类对应后端 subType 参数独立请求一次接口
76
79
  const overviewCategories: OverviewCategoryConfig[] = [
77
80
  {
78
81
  key: 'Vectors',
@@ -97,6 +100,24 @@ const overviewCategories: OverviewCategoryConfig[] = [
97
100
  label: '高清视频',
98
101
  subType: 'Videos',
99
102
  tags: ['风景', '商务', '科技', '自然', '城市', '航拍', '办公']
103
+ },
104
+ {
105
+ key: 'Icons',
106
+ label: '图标元素',
107
+ subType: 'Icons',
108
+ tags: ['箭头', '商务', '科技', '办公', '社交', '图表', '医疗']
109
+ },
110
+ {
111
+ key: 'Music',
112
+ label: '背景音乐',
113
+ subType: 'Music',
114
+ tags: ['轻快', '商务', '舒缓', '科技', '钢琴', '振奋', '环境']
115
+ },
116
+ {
117
+ key: 'Sound_Effects',
118
+ label: '音效',
119
+ subType: 'Sound_Effects',
120
+ tags: ['点击', '转场', '提示音', '掌声', '倒计时', '自然', '科技']
100
121
  }
101
122
  ]
102
123
 
@@ -104,7 +125,21 @@ const subTypeNameMap: Record<StockSubType, string> = {
104
125
  Vectors: '矢量图',
105
126
  Photos: '照片',
106
127
  Illustrations: '插画',
107
- Videos: '高清视频'
128
+ Videos: '高清视频',
129
+ Icons: '图标元素',
130
+ Music: '背景音乐',
131
+ Sound_Effects: '音效'
132
+ }
133
+
134
+ // 后端 /jvs-dam/stock/search 在未输入搜索词时的默认分类回退词(对齐 jvs-material-ui)
135
+ const defaultCategoryKeywordMap: Record<StockSubType, string> = {
136
+ Vectors: 'vectors',
137
+ Photos: 'photos',
138
+ Illustrations: 'illustrations',
139
+ Videos: 'videos',
140
+ Icons: 'icons',
141
+ Music: 'music',
142
+ Sound_Effects: 'sound-effects'
108
143
  }
109
144
 
110
145
  // 顶层 3-Tab 状态(联网搜索 / AI生成 / 我的空间)与 jvs_session_v3 鉴权
@@ -325,13 +360,58 @@ const detailHeaderTitle = computed(() => {
325
360
  return baseDetailTitle.value || subTypeNameMap[filterParams.activeSubType] || '素材库'
326
361
  })
327
362
 
363
+ function normalizeIconifyUrl(rawUrl?: string): string {
364
+ if (!rawUrl) return ''
365
+ if (rawUrl.includes('api.iconify.design') && rawUrl.includes('.svg')) {
366
+ if (!rawUrl.includes('width=') && !rawUrl.includes('height=')) {
367
+ const sep = rawUrl.includes('?') ? '&' : '?'
368
+ return `${rawUrl}${sep}width=256&height=256`
369
+ }
370
+ }
371
+ return rawUrl
372
+ }
373
+
374
+ function isAudioUrl(url?: string): boolean {
375
+ if (!url) return false
376
+ const clean = url.split('?')[0].split('#')[0].toLowerCase()
377
+ return (
378
+ clean.endsWith('.mp3') ||
379
+ clean.endsWith('.wav') ||
380
+ clean.endsWith('.flac') ||
381
+ clean.endsWith('.aac') ||
382
+ clean.endsWith('.m4a')
383
+ )
384
+ }
385
+
386
+ function isAudioMaterial(item: MaterialItem): boolean {
387
+ return (
388
+ item.type === 'audio' ||
389
+ String(item.assetType || '').toUpperCase() === 'AUDIO' ||
390
+ item.assetSubType === 'Music' ||
391
+ item.assetSubType === 'Sound_Effects' ||
392
+ item.subType === 'Music' ||
393
+ item.subType === 'Sound_Effects' ||
394
+ isAudioUrl(item.sourceUrl || item.url || item.downloadUrl)
395
+ )
396
+ }
397
+
398
+ function isIconMaterial(item: MaterialItem): boolean {
399
+ return (
400
+ item.assetSubType === 'Icons' ||
401
+ item.subType === 'Icons' ||
402
+ String(item.sourcePlatform || '').toUpperCase() === 'ICONIFY' ||
403
+ String(item.previewUrl || item.url || '').includes('api.iconify.design')
404
+ )
405
+ }
406
+
328
407
  function isVideoUrl(url?: string): boolean {
329
408
  if (!url) return false
330
409
  const clean = url.split('?')[0].toLowerCase()
331
- return clean.endsWith('.mp4') || clean.endsWith('.webm') || clean.endsWith('.mov') || clean.endsWith('.m4v') || clean.endsWith('.ogg')
410
+ return clean.endsWith('.mp4') || clean.endsWith('.webm') || clean.endsWith('.mov') || clean.endsWith('.m4v')
332
411
  }
333
412
 
334
413
  function isVideoMaterial(item: MaterialItem): boolean {
414
+ if (isAudioMaterial(item)) return false
335
415
  return (
336
416
  item.type === 'video' ||
337
417
  item.assetType === 'VIDEO' ||
@@ -341,16 +421,44 @@ function isVideoMaterial(item: MaterialItem): boolean {
341
421
  )
342
422
  }
343
423
 
424
+ function getAudioCoverImg(item: MaterialItem): string {
425
+ const candidates = [item.coverUrl, item.image, item.thumbnail, item.previewUrl]
426
+ for (const c of candidates) {
427
+ if (c && typeof c === 'string' && !isAudioUrl(c) && !isVideoUrl(c) && !c.split('?')[0].toLowerCase().endsWith('.ogg')) {
428
+ return c
429
+ }
430
+ }
431
+ return ''
432
+ }
433
+
344
434
  function getMaterialThumb(item: MaterialItem): string {
345
- return item.previewUrl || item.image || item.coverUrl || item.thumbnail || item.url || item.sourceUrl || item.downloadUrl || ''
435
+ if (isAudioMaterial(item)) {
436
+ return getAudioCoverImg(item)
437
+ }
438
+ const raw = item.previewUrl || item.image || item.coverUrl || item.thumbnail || item.url || item.sourceUrl || item.downloadUrl || ''
439
+ return normalizeIconifyUrl(raw)
440
+ }
441
+
442
+ function formatAudioDuration(seconds?: number | string): string {
443
+ const num = Number(seconds)
444
+ if (!Number.isFinite(num) || num <= 0) return ''
445
+ const totalSec = Math.max(1, Math.round(num))
446
+ const mins = Math.floor(totalSec / 60)
447
+ const secs = totalSec % 60
448
+ return `${mins}:${secs < 10 ? '0' : ''}${secs}`
346
449
  }
347
450
 
348
451
  function getItemFormat(item: MaterialItem): string {
349
452
  if (item.format) return item.format.toUpperCase()
350
453
  const u = (item.sourceUrl || item.url || item.previewUrl || item.fileName || '').toLowerCase()
454
+ if (u.includes('.mp3')) return 'MP3'
455
+ if (u.includes('.wav')) return 'WAV'
456
+ if (u.includes('.flac')) return 'FLAC'
457
+ if (u.includes('.m4a') || u.includes('.aac')) return 'AAC'
458
+ if (isAudioMaterial(item)) return 'MP3'
351
459
  if (u.includes('.mp4')) return 'MP4'
352
460
  if (u.includes('.mov') || u.includes('.webm')) return 'VIDEO'
353
- if (u.includes('.svg')) return 'SVG'
461
+ if (u.includes('.svg') || isIconMaterial(item)) return 'SVG'
354
462
  if (u.includes('.png')) return 'PNG'
355
463
  if (u.includes('.gif')) return 'GIF'
356
464
  if (item.assetSubType === 'Videos' || item.type === 'video') return 'MP4'
@@ -358,10 +466,55 @@ function getItemFormat(item: MaterialItem): string {
358
466
  return 'JPG'
359
467
  }
360
468
 
361
- // 全屏大图/视频预览状态
469
+ // 抽屉内联音频试听控制(背景音乐 / 音效卡片直接点击播放按钮即可试听)
470
+ const playingAudioId = ref<string | number | null>(null)
471
+ let inlineAudioPlayer: HTMLAudioElement | null = null
472
+
473
+ function stopInlineAudio() {
474
+ if (inlineAudioPlayer) {
475
+ inlineAudioPlayer.pause()
476
+ inlineAudioPlayer.currentTime = 0
477
+ }
478
+ playingAudioId.value = null
479
+ }
480
+
481
+ function toggleInlineAudioPlay(item: MaterialItem, e?: Event) {
482
+ if (e) {
483
+ e.stopPropagation()
484
+ e.preventDefault()
485
+ }
486
+ const audioSrc = item.sourceUrl || item.url || item.downloadUrl || item.previewUrl || ''
487
+ if (!audioSrc) {
488
+ notify('该音频暂无可用试听地址')
489
+ return
490
+ }
491
+ if (playingAudioId.value === item.id && inlineAudioPlayer && !inlineAudioPlayer.paused) {
492
+ stopInlineAudio()
493
+ return
494
+ }
495
+ if (!inlineAudioPlayer) {
496
+ inlineAudioPlayer = new Audio()
497
+ inlineAudioPlayer.addEventListener('ended', () => {
498
+ playingAudioId.value = null
499
+ })
500
+ inlineAudioPlayer.addEventListener('error', () => {
501
+ playingAudioId.value = null
502
+ })
503
+ }
504
+ inlineAudioPlayer.pause()
505
+ inlineAudioPlayer.src = audioSrc
506
+ playingAudioId.value = item.id
507
+ inlineAudioPlayer.play().catch(() => {
508
+ playingAudioId.value = null
509
+ notify('音频加载失败或暂不支持在线试听')
510
+ })
511
+ }
512
+
513
+ // 全屏大图/视频/音频预览状态
362
514
  interface PreviewItem {
363
515
  url: string
364
516
  isVideo: boolean
517
+ isAudio: boolean
365
518
  title: string
366
519
  format: string
367
520
  meta: MaterialItem
@@ -382,9 +535,12 @@ function openPreview(item: MaterialItem, e?: Event) {
382
535
  e.stopPropagation()
383
536
  e.preventDefault()
384
537
  }
538
+ stopInlineAudio()
385
539
 
386
- const currentUrl = isVideoMaterial(item)
387
- ? (item.sourceUrl || item.url || item.downloadUrl || getMaterialThumb(item))
540
+ const isAud = isAudioMaterial(item)
541
+ const isVid = !isAud && isVideoMaterial(item)
542
+ const currentUrl = (isAud || isVid)
543
+ ? (item.sourceUrl || item.url || item.downloadUrl || item.previewUrl || getMaterialThumb(item))
388
544
  : getMaterialThumb(item)
389
545
 
390
546
  if (!currentUrl) {
@@ -399,14 +555,16 @@ function openPreview(item: MaterialItem, e?: Event) {
399
555
 
400
556
  const validItems: PreviewItem[] = []
401
557
  sourceList.forEach(m => {
402
- const isVid = isVideoMaterial(m)
403
- const u = isVid
404
- ? (m.sourceUrl || m.url || m.downloadUrl || getMaterialThumb(m))
558
+ const mAud = isAudioMaterial(m)
559
+ const mVid = !mAud && isVideoMaterial(m)
560
+ const u = (mAud || mVid)
561
+ ? (m.sourceUrl || m.url || m.downloadUrl || m.previewUrl || getMaterialThumb(m))
405
562
  : getMaterialThumb(m)
406
563
  if (u) {
407
564
  validItems.push({
408
565
  url: u,
409
- isVideo: isVid && isVideoUrl(u),
566
+ isVideo: mVid && isVideoUrl(u),
567
+ isAudio: mAud,
410
568
  title: m.title || '素材预览',
411
569
  format: getItemFormat(m),
412
570
  meta: m
@@ -420,7 +578,8 @@ function openPreview(item: MaterialItem, e?: Event) {
420
578
  } else {
421
579
  validItems.unshift({
422
580
  url: currentUrl,
423
- isVideo: isVideoMaterial(item) && isVideoUrl(currentUrl),
581
+ isVideo: isVid && isVideoUrl(currentUrl),
582
+ isAudio: isAud,
424
583
  title: item.title || '素材预览',
425
584
  format: getItemFormat(item),
426
585
  meta: item
@@ -440,15 +599,18 @@ function openPreview(item: MaterialItem, e?: Event) {
440
599
  previewVisible.value = true
441
600
  }
442
601
 
443
- // 供「我的素材」与「创建素材」子面板复用的全屏大图/视频预览
602
+ // 供「我的素材」与「创建素材」子面板复用的全屏大图/视频/音频预览
444
603
  function openCustomListPreview(item: MaterialItem, list: MaterialItem[], e?: Event) {
445
604
  if (e) {
446
605
  e.stopPropagation()
447
606
  e.preventDefault()
448
607
  }
608
+ stopInlineAudio()
449
609
 
450
- const currentUrl = isVideoMaterial(item)
451
- ? (item.sourceUrl || item.url || item.downloadUrl || getMaterialThumb(item))
610
+ const isAud = isAudioMaterial(item)
611
+ const isVid = !isAud && isVideoMaterial(item)
612
+ const currentUrl = (isAud || isVid)
613
+ ? (item.sourceUrl || item.url || item.downloadUrl || item.previewUrl || getMaterialThumb(item))
452
614
  : getMaterialThumb(item)
453
615
 
454
616
  if (!currentUrl) {
@@ -460,14 +622,16 @@ function openCustomListPreview(item: MaterialItem, list: MaterialItem[], e?: Eve
460
622
  const validItems: PreviewItem[] = []
461
623
 
462
624
  sourceList.forEach(m => {
463
- const isVid = isVideoMaterial(m)
464
- const u = isVid
465
- ? (m.sourceUrl || m.url || m.downloadUrl || getMaterialThumb(m))
625
+ const mAud = isAudioMaterial(m)
626
+ const mVid = !mAud && isVideoMaterial(m)
627
+ const u = (mAud || mVid)
628
+ ? (m.sourceUrl || m.url || m.downloadUrl || m.previewUrl || getMaterialThumb(m))
466
629
  : getMaterialThumb(m)
467
630
  if (u) {
468
631
  validItems.push({
469
632
  url: u,
470
- isVideo: isVid && isVideoUrl(u),
633
+ isVideo: mVid && isVideoUrl(u),
634
+ isAudio: mAud,
471
635
  title: m.title || '素材预览',
472
636
  format: getItemFormat(m),
473
637
  meta: m
@@ -481,7 +645,8 @@ function openCustomListPreview(item: MaterialItem, list: MaterialItem[], e?: Eve
481
645
  } else {
482
646
  validItems.unshift({
483
647
  url: currentUrl,
484
- isVideo: isVideoMaterial(item) && isVideoUrl(currentUrl),
648
+ isVideo: isVid && isVideoUrl(currentUrl),
649
+ isAudio: isAud,
485
650
  title: item.title || '素材预览',
486
651
  format: getItemFormat(item),
487
652
  meta: item
@@ -606,13 +771,21 @@ function normalizeMaterialItem(item: any, defaultSubType: StockSubType = 'Photos
606
771
  const subType = (item.assetSubType || item.subType || defaultSubType) as StockSubType
607
772
  let type = item.type || ''
608
773
  if (!type) {
609
- if (subType === 'Videos' || item.assetType === 'VIDEO') type = 'video'
610
- else if (subType === 'Vectors') type = 'svg'
611
- else type = 'image'
774
+ if (subType === 'Music' || subType === 'Sound_Effects' || String(item.assetType || '').toUpperCase() === 'AUDIO') {
775
+ type = 'audio'
776
+ } else if (subType === 'Videos' || item.assetType === 'VIDEO') {
777
+ type = 'video'
778
+ } else if (subType === 'Vectors' || subType === 'Icons') {
779
+ type = 'svg'
780
+ } else {
781
+ type = 'image'
782
+ }
612
783
  }
613
784
 
614
- const previewUrl = item.previewUrl || item.image || item.coverUrl || item.thumbnail || item.url || item.downloadUrl || item.sourceUrl || ''
615
- const sourceUrl = item.sourceUrl || item.downloadUrl || item.url || previewUrl
785
+ const rawPreviewUrl = item.previewUrl || item.image || item.coverUrl || item.thumbnail || item.url || item.downloadUrl || item.sourceUrl || ''
786
+ const rawSourceUrl = item.sourceUrl || item.downloadUrl || item.url || rawPreviewUrl
787
+ const previewUrl = normalizeIconifyUrl(rawPreviewUrl)
788
+ const sourceUrl = normalizeIconifyUrl(rawSourceUrl)
616
789
  const url = sourceUrl || previewUrl
617
790
 
618
791
  const platform = item.sourcePlatform || (item.id && typeof item.id === 'string' && item.id.includes('_') ? item.id.split('_')[0].toUpperCase() : '')
@@ -622,6 +795,9 @@ function normalizeMaterialItem(item: any, defaultSubType: StockSubType = 'Photos
622
795
  if (!ratio && item.width && item.height) {
623
796
  ratio = `${item.width} / ${item.height}`
624
797
  }
798
+ if (subType === 'Icons') {
799
+ ratio = '1 / 1'
800
+ }
625
801
 
626
802
  return {
627
803
  ...item,
@@ -639,8 +815,8 @@ function normalizeMaterialItem(item: any, defaultSubType: StockSubType = 'Photos
639
815
  color: item.color || item.primaryColor || '',
640
816
  primaryColor: item.primaryColor || item.color || '',
641
817
  aspectRatio: ratio || '4 / 3',
642
- originalWidth: item.width || item.originalWidth,
643
- originalHeight: item.height || item.originalHeight,
818
+ originalWidth: item.width || item.originalWidth || (subType === 'Icons' ? 256 : undefined),
819
+ originalHeight: item.height || item.originalHeight || (subType === 'Icons' ? 256 : undefined),
644
820
  tags: Array.isArray(item.tags) ? item.tags : []
645
821
  }
646
822
  }
@@ -665,32 +841,63 @@ function parseMaterialList(data: any, defaultSubType: StockSubType = 'Photos'):
665
841
  }
666
842
 
667
843
  // ============================================================================
668
- // 图二:概览页 4 大固定类型(Vectors / Photos / Illustrations / Videos),每个类型独立请求一次接口
844
+ // 图二:概览页 7 大固定类型(Vectors / Photos / Illustrations / Videos / Icons / Music / Sound_Effects),每个类型独立请求一次接口
669
845
  // ============================================================================
670
846
  const overviewItemsMap = reactive<Record<StockSubType, MaterialItem[]>>({
671
847
  Vectors: [],
672
848
  Photos: [],
673
849
  Illustrations: [],
674
- Videos: []
850
+ Videos: [],
851
+ Icons: [],
852
+ Music: [],
853
+ Sound_Effects: []
675
854
  })
676
855
 
677
856
  const overviewLoadingMap = reactive<Record<StockSubType, boolean>>({
678
857
  Vectors: false,
679
858
  Photos: false,
680
859
  Illustrations: false,
681
- Videos: false
860
+ Videos: false,
861
+ Icons: false,
862
+ Music: false,
863
+ Sound_Effects: false
682
864
  })
683
865
 
684
- const rowRefs = reactive<Record<string, HTMLElement | null>>({})
866
+ const rowRefs: Record<string, HTMLElement | null> = {}
685
867
  const rowScrollState = reactive<Record<StockSubType, { canLeft: boolean; canRight: boolean }>>({
686
868
  Vectors: { canLeft: false, canRight: false },
687
869
  Photos: { canLeft: false, canRight: false },
688
870
  Illustrations: { canLeft: false, canRight: false },
689
- Videos: { canLeft: false, canRight: false }
871
+ Videos: { canLeft: false, canRight: false },
872
+ Icons: { canLeft: false, canRight: false },
873
+ Music: { canLeft: false, canRight: false },
874
+ Sound_Effects: { canLeft: false, canRight: false }
690
875
  })
691
876
 
877
+ let trackResizeObserver: ResizeObserver | null = null
878
+
879
+ function ensureTrackObservers() {
880
+ if (typeof window === 'undefined') return
881
+ if (!trackResizeObserver && typeof ResizeObserver !== 'undefined') {
882
+ trackResizeObserver = new ResizeObserver(() => {
883
+ updateAllRowScrollStates()
884
+ })
885
+ }
886
+ }
887
+
692
888
  function setRowRef(key: StockSubType, el: any) {
693
- rowRefs[key] = el as HTMLElement | null
889
+ const prevEl = rowRefs[key] || null
890
+ const nextEl = (el as HTMLElement | null) || null
891
+ if (prevEl === nextEl) return
892
+ if (prevEl && trackResizeObserver) {
893
+ trackResizeObserver.unobserve(prevEl)
894
+ }
895
+ rowRefs[key] = nextEl
896
+ if (nextEl) {
897
+ ensureTrackObservers()
898
+ trackResizeObserver?.observe(nextEl)
899
+ requestAnimationFrame(() => updateRowScrollState(key))
900
+ }
694
901
  }
695
902
 
696
903
  function updateRowScrollState(key: StockSubType) {
@@ -698,7 +905,17 @@ function updateRowScrollState(key: StockSubType) {
698
905
  if (!el) return
699
906
  const canLeft = el.scrollLeft > 4
700
907
  const canRight = el.scrollWidth - el.clientWidth - el.scrollLeft > 4
701
- rowScrollState[key] = { canLeft, canRight }
908
+ const state = rowScrollState[key]
909
+ if (state) {
910
+ if (state.canLeft !== canLeft) state.canLeft = canLeft
911
+ if (state.canRight !== canRight) state.canRight = canRight
912
+ }
913
+ }
914
+
915
+ function updateAllRowScrollStates() {
916
+ overviewCategories.forEach(cat => {
917
+ updateRowScrollState(cat.key)
918
+ })
702
919
  }
703
920
 
704
921
  function scrollCategoryRow(key: StockSubType, dir: 'left' | 'right') {
@@ -709,8 +926,33 @@ function scrollCategoryRow(key: StockSubType, dir: 'left' | 'right') {
709
926
  setTimeout(() => updateRowScrollState(key), 260)
710
927
  }
711
928
 
712
- // 统一追加筛选条件到 URLSearchParams(与 jvs-material-ui StockSearchParams 1:1 对齐)
713
- function appendStockFilterParams(params: URLSearchParams) {
929
+ // 高清视频、背景音乐、音效不支持颜色/画幅/题材/尺寸筛选条件
930
+ function isNonImageFilterSubType(subType: StockSubType): boolean {
931
+ return (
932
+ subType === 'Videos' ||
933
+ subType === 'Music' ||
934
+ subType === 'Sound_Effects'
935
+ )
936
+ }
937
+
938
+ const isCurrentDetailFilterDisabled = computed(() => {
939
+ return viewMode.value === 'detail' && isNonImageFilterSubType(filterParams.activeSubType)
940
+ })
941
+
942
+ function resolveEffectiveKeyword(rawKeyword: string, subType: StockSubType): string {
943
+ const trimmed = (rawKeyword || '').trim()
944
+ if (trimmed) return trimmed
945
+ if (!isNonImageFilterSubType(subType) && filterParams.category) {
946
+ return filterParams.category
947
+ }
948
+ return defaultCategoryKeywordMap[subType] || 'wallpaper'
949
+ }
950
+
951
+ // 统一追加筛选条件到 URLSearchParams(与 jvs-material-ui StockSearchParams 1:1 对齐,非图片类型不传图片专属过滤项)
952
+ function appendStockFilterParams(params: URLSearchParams, subType: StockSubType) {
953
+ if (isNonImageFilterSubType(subType)) {
954
+ return
955
+ }
714
956
  if (filterParams.color) {
715
957
  params.append('color', filterParams.color)
716
958
  }
@@ -742,11 +984,8 @@ async function fetchOverviewCategory(cat: OverviewCategoryConfig, keyword = '')
742
984
  params.append('current', '1')
743
985
  params.append('size', '12')
744
986
  params.append('subType', cat.subType)
745
- const trimmedKeyword = keyword.trim()
746
- if (trimmedKeyword) {
747
- params.append('keyword', trimmedKeyword)
748
- }
749
- appendStockFilterParams(params)
987
+ params.append('keyword', resolveEffectiveKeyword(keyword, cat.subType))
988
+ appendStockFilterParams(params, cat.subType)
750
989
 
751
990
  const fullUrl = `${stockUrl}${stockUrl.includes('?') ? '&' : '?'}${params.toString()}`
752
991
  const data = await safeFetchJson(fullUrl, {
@@ -766,19 +1005,30 @@ async function fetchOverviewCategory(cat: OverviewCategoryConfig, keyword = '')
766
1005
  overviewLoadingMap[cat.key] = false
767
1006
  nextTick(() => {
768
1007
  updateRowScrollState(cat.key)
769
- setTimeout(() => updateRowScrollState(cat.key), 300)
1008
+ requestAnimationFrame(() => updateRowScrollState(cat.key))
1009
+ setTimeout(() => updateRowScrollState(cat.key), 120)
1010
+ setTimeout(() => updateRowScrollState(cat.key), 350)
770
1011
  })
771
1012
  }
772
1013
  }
773
1014
 
774
- // 遍历 4 种固定类型,每一个类型单独请求一次接口
1015
+ // 遍历 7 种固定类型,每一个类型单独请求一次接口
775
1016
  function fetchAllOverviewCategories(keyword = overviewQuery.value) {
776
1017
  overviewCategories.forEach(cat => {
777
1018
  fetchOverviewCategory(cat, keyword)
778
1019
  })
779
1020
  }
780
1021
 
781
- // 统一触发当前视图检索(概览页或分类详情页共用搜索框与筛选面板)
1022
+ // 仅刷新支持图片筛选条件的分类(不对高清视频、背景音乐、音效生效)
1023
+ function fetchImageOnlyOverviewCategories(keyword = overviewQuery.value) {
1024
+ overviewCategories.forEach(cat => {
1025
+ if (!isNonImageFilterSubType(cat.subType)) {
1026
+ fetchOverviewCategory(cat, keyword)
1027
+ }
1028
+ })
1029
+ }
1030
+
1031
+ // 关键词搜索触发(概览页刷新全部 7 类,详情页刷新当前类)
782
1032
  function triggerSearchNow() {
783
1033
  filterParams.query = overviewQuery.value.trim()
784
1034
  if (viewMode.value === 'detail') {
@@ -792,23 +1042,47 @@ function triggerSearchNow() {
792
1042
  }
793
1043
  }
794
1044
 
1045
+ // 筛选条件变更触发(对高清视频、背景音乐、音效不生效)
1046
+ function triggerFilterChange() {
1047
+ filterParams.query = overviewQuery.value.trim()
1048
+ if (viewMode.value === 'detail') {
1049
+ if (isNonImageFilterSubType(filterParams.activeSubType)) {
1050
+ return
1051
+ }
1052
+ currentPage.value = 1
1053
+ pagedMaterials.value = []
1054
+ reachEnd.value = false
1055
+ loadFailed.value = false
1056
+ fetchMaterials(1, false)
1057
+ } else {
1058
+ fetchImageOnlyOverviewCategories(overviewQuery.value)
1059
+ }
1060
+ }
1061
+
795
1062
  function toggleFilterPopover(forceState?: boolean) {
1063
+ if (isCurrentDetailFilterDisabled.value) {
1064
+ filterPopoverOpen.value = false
1065
+ return
1066
+ }
796
1067
  filterPopoverOpen.value = typeof forceState === 'boolean' ? forceState : !filterPopoverOpen.value
797
1068
  }
798
1069
 
799
1070
  function selectColorFilter(val: StockColor | '') {
1071
+ if (isCurrentDetailFilterDisabled.value) return
800
1072
  filterParams.color = filterParams.color === val ? '' : val
801
- triggerSearchNow()
1073
+ triggerFilterChange()
802
1074
  }
803
1075
 
804
1076
  function selectOrientationFilter(val: StockOrientation | '') {
1077
+ if (isCurrentDetailFilterDisabled.value) return
805
1078
  filterParams.orientation = filterParams.orientation === val ? '' : val
806
- triggerSearchNow()
1079
+ triggerFilterChange()
807
1080
  }
808
1081
 
809
1082
  function selectTopicFilter(val: StockTopicCategory | '') {
1083
+ if (isCurrentDetailFilterDisabled.value) return
810
1084
  filterParams.category = filterParams.category === val ? '' : val
811
- triggerSearchNow()
1085
+ triggerFilterChange()
812
1086
  }
813
1087
 
814
1088
  function toggleShowAllTopics() {
@@ -816,6 +1090,7 @@ function toggleShowAllTopics() {
816
1090
  }
817
1091
 
818
1092
  function selectSizePresetFilter(id: '' | 'hd' | 'fhd' | 'qhd' | 'uhd') {
1093
+ if (isCurrentDetailFilterDisabled.value) return
819
1094
  const preset = SIZE_PRESETS.find(p => p.id === id)
820
1095
  if (!preset || id === '' || filterParams.sizePresetId === id) {
821
1096
  filterParams.sizePresetId = ''
@@ -830,10 +1105,11 @@ function selectSizePresetFilter(id: '' | 'hd' | 'fhd' | 'qhd' | 'uhd') {
830
1105
  customMinWidthInput.value = preset.minWidth ? String(preset.minWidth) : ''
831
1106
  customMinHeightInput.value = preset.minHeight ? String(preset.minHeight) : ''
832
1107
  }
833
- triggerSearchNow()
1108
+ triggerFilterChange()
834
1109
  }
835
1110
 
836
1111
  function handleCustomSizeInput() {
1112
+ if (isCurrentDetailFilterDisabled.value) return
837
1113
  const wVal = parseInt(customMinWidthInput.value, 10)
838
1114
  const hVal = parseInt(customMinHeightInput.value, 10)
839
1115
  filterParams.minWidth = !Number.isNaN(wVal) && wVal > 0 ? wVal : undefined
@@ -850,7 +1126,7 @@ function handleCustomSizeInput() {
850
1126
 
851
1127
  if (customSizeDebounceTimer) clearTimeout(customSizeDebounceTimer)
852
1128
  customSizeDebounceTimer = setTimeout(() => {
853
- triggerSearchNow()
1129
+ triggerFilterChange()
854
1130
  }, 380)
855
1131
  }
856
1132
 
@@ -864,11 +1140,12 @@ function clearAllFilters() {
864
1140
  filterParams.minHeight = undefined
865
1141
  customMinWidthInput.value = ''
866
1142
  customMinHeightInput.value = ''
867
- triggerSearchNow()
1143
+ triggerFilterChange()
868
1144
  }
869
1145
 
870
1146
  // 从图二点击「查看全部」进入图三(保留当前搜索词与筛选条件)
871
1147
  async function openCategoryDetail(subType: StockSubType) {
1148
+ stopInlineAudio()
872
1149
  const cat = overviewCategories.find(c => c.subType === subType)
873
1150
  filterParams.activeSubType = subType
874
1151
  const q = overviewQuery.value.trim()
@@ -897,6 +1174,7 @@ function clearOverviewQuery() {
897
1174
 
898
1175
  // 图三点击左上角返回箭头回到图二
899
1176
  function backToOverview() {
1177
+ stopInlineAudio()
900
1178
  filterPopoverOpen.value = false
901
1179
  viewMode.value = 'overview'
902
1180
  fetchAllOverviewCategories(overviewQuery.value)
@@ -936,12 +1214,8 @@ async function fetchMaterials(page = 1, append = false) {
936
1214
  params.append('current', String(page))
937
1215
  params.append('size', String(pageSize))
938
1216
  params.append('subType', filterParams.activeSubType)
939
-
940
- const q = filterParams.query.trim()
941
- if (q) {
942
- params.append('keyword', q)
943
- }
944
- appendStockFilterParams(params)
1217
+ params.append('keyword', resolveEffectiveKeyword(filterParams.query, filterParams.activeSubType))
1218
+ appendStockFilterParams(params, filterParams.activeSubType)
945
1219
 
946
1220
  const fullUrl = `${stockUrl}${stockUrl.includes('?') ? '&' : '?'}${params.toString()}`
947
1221
  const data = await safeFetchJson(fullUrl, {
@@ -1004,14 +1278,20 @@ const waterfallColumns = computed<[MaterialItem[], MaterialItem[]]>(() => {
1004
1278
 
1005
1279
  displayedMaterials.value.forEach((item, idx) => {
1006
1280
  let ratio = 0.75
1007
- const w = Number(item.originalWidth || item.width)
1008
- const h = Number(item.originalHeight || item.height)
1009
- if (w > 0 && h > 0) {
1010
- ratio = Math.max(0.45, Math.min(1.8, h / w))
1011
- } else if (idx % 3 === 1) {
1012
- ratio = 1.25
1013
- } else if (idx % 4 === 2) {
1281
+ if (isAudioMaterial(item)) {
1014
1282
  ratio = 0.65
1283
+ } else if (isIconMaterial(item)) {
1284
+ ratio = 1
1285
+ } else {
1286
+ const w = Number(item.originalWidth || item.width)
1287
+ const h = Number(item.originalHeight || item.height)
1288
+ if (w > 0 && h > 0) {
1289
+ ratio = Math.max(0.45, Math.min(1.8, h / w))
1290
+ } else if (idx % 3 === 1) {
1291
+ ratio = 1.25
1292
+ } else if (idx % 4 === 2) {
1293
+ ratio = 0.65
1294
+ }
1015
1295
  }
1016
1296
 
1017
1297
  if (leftHeight <= rightHeight) {
@@ -1049,9 +1329,10 @@ function formatMaterialTitle(title?: string, fallback = '素材', maxLen = 12):
1049
1329
  return text.length > maxLen ? `${text.slice(0, maxLen)}...` : text
1050
1330
  }
1051
1331
 
1052
- // 点击素材卡片插入画布(区分视频与图片/矢量/插画,若当前处于图片占位符替换状态则优先替换占位符)
1332
+ // 点击素材卡片插入画布(区分音频、视频与图片/矢量/插画/图标,若当前处于图片占位符替换状态则优先替换占位符)
1053
1333
  function handleSelectMaterial(meta: MaterialItem) {
1054
- const isVid = isVideoMaterial(meta)
1334
+ const isAud = isAudioMaterial(meta)
1335
+ const isVid = !isAud && isVideoMaterial(meta)
1055
1336
  const targetUrl = meta.sourceUrl || meta.url || meta.downloadUrl || meta.previewUrl
1056
1337
 
1057
1338
  if (!targetUrl) {
@@ -1059,6 +1340,17 @@ function handleSelectMaterial(meta: MaterialItem) {
1059
1340
  return
1060
1341
  }
1061
1342
 
1343
+ if (isAud) {
1344
+ stopInlineAudio()
1345
+ addElement('audio', targetUrl)
1346
+ const audioTypeLabel =
1347
+ meta.subType === 'Sound_Effects' || meta.assetSubType === 'Sound_Effects'
1348
+ ? '音效'
1349
+ : '背景音乐'
1350
+ notify(`已成功添加${audioTypeLabel} "${formatMaterialTitle(meta.title, audioTypeLabel, 12)}" 到画布`)
1351
+ return
1352
+ }
1353
+
1062
1354
  const rawW = meta.originalWidth || meta.width
1063
1355
  const rawH = meta.originalHeight || meta.height
1064
1356
 
@@ -1089,7 +1381,9 @@ function handleSelectMaterial(meta: MaterialItem) {
1089
1381
  }
1090
1382
 
1091
1383
  let initialDimensions: { width?: number; height?: number } | undefined = undefined
1092
- if (rawW && rawH && rawW > 0 && rawH > 0) {
1384
+ if (isIconMaterial(meta)) {
1385
+ initialDimensions = { width: 120, height: 120 }
1386
+ } else if (rawW && rawH && rawW > 0 && rawH > 0) {
1093
1387
  const maxWidth = 480
1094
1388
  const maxHeight = 360
1095
1389
  const scale = Math.min(maxWidth / rawW, maxHeight / rawH, 1)
@@ -1104,11 +1398,12 @@ function handleSelectMaterial(meta: MaterialItem) {
1104
1398
  notify(`已成功添加视频 "${formatMaterialTitle(meta.title, '高清视频', 12)}" 到画布`)
1105
1399
  } else {
1106
1400
  addElement('image', targetUrl, undefined, undefined, undefined, initialDimensions)
1107
- notify(`已成功添加素材 "${formatMaterialTitle(meta.title, '图片', 12)}" 到画布`)
1401
+ notify(`已成功添加素材 "${formatMaterialTitle(meta.title, isIconMaterial(meta) ? '图标' : '图片', 12)}" 到画布`)
1108
1402
  }
1109
1403
  }
1110
1404
 
1111
1405
  function handleCloseDrawer() {
1406
+ stopInlineAudio()
1112
1407
  activeTab.value = null
1113
1408
  }
1114
1409
 
@@ -1139,10 +1434,22 @@ onMounted(() => {
1139
1434
  })
1140
1435
 
1141
1436
  onUnmounted(() => {
1437
+ stopInlineAudio()
1438
+ trackResizeObserver?.disconnect()
1142
1439
  window.removeEventListener('keydown', handleKeydown)
1143
1440
  window.removeEventListener('mousedown', handleGlobalMouseDown, true)
1144
1441
  })
1145
1442
 
1443
+ watch(
1444
+ [() => materialPopoverVisible?.value, () => activeTab?.value, () => activeMainTab.value, () => viewMode.value],
1445
+ () => {
1446
+ nextTick(() => {
1447
+ updateAllRowScrollStates()
1448
+ setTimeout(() => updateAllRowScrollStates(), 140)
1449
+ })
1450
+ }
1451
+ )
1452
+
1146
1453
  watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => materialTreeApiUrl?.value], () => {
1147
1454
  fetchAllOverviewCategories()
1148
1455
  if (viewMode.value === 'detail') {
@@ -1260,14 +1567,14 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1260
1567
  <!-- 顶部共用搜索框 + 筛选按钮 + 已选标签条 + 悬浮复合筛选面板 -->
1261
1568
  <div class="stock-search-filter-header">
1262
1569
  <div class="stock-search-bar-wrapper">
1263
- <div class="stock-search-box" :class="{ 'is-filter-open': filterPopoverOpen }">
1570
+ <div class="stock-search-box" :class="{ 'is-filter-open': filterPopoverOpen && !isCurrentDetailFilterDisabled }">
1264
1571
  <el-icon class="stock-search-icon" @click="handleOverviewSearch">
1265
1572
  <Search />
1266
1573
  </el-icon>
1267
1574
  <input
1268
1575
  v-model="overviewQuery"
1269
1576
  type="text"
1270
- placeholder="搜索图片、插画、图标、视频..."
1577
+ placeholder="搜索图片、插画、图标、视频、音乐、音效..."
1271
1578
  class="stock-search-input"
1272
1579
  @keyup.enter="handleOverviewSearch"
1273
1580
  />
@@ -1284,8 +1591,12 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1284
1591
  <button
1285
1592
  type="button"
1286
1593
  class="stock-filter-trigger-btn"
1287
- :class="{ 'is-active': filterPopoverOpen || activeFilterCount > 0 }"
1288
- title="筛选条件"
1594
+ :disabled="isCurrentDetailFilterDisabled"
1595
+ :class="{
1596
+ 'is-active': !isCurrentDetailFilterDisabled && (filterPopoverOpen || activeFilterCount > 0),
1597
+ 'is-disabled': isCurrentDetailFilterDisabled
1598
+ }"
1599
+ :title="isCurrentDetailFilterDisabled ? '高清视频、背景音乐、音效不支持该筛选条件' : '筛选条件'"
1289
1600
  @click.stop="toggleFilterPopover()"
1290
1601
  >
1291
1602
  <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
@@ -1296,14 +1607,14 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1296
1607
  <line x1="4" y1="18" x2="20" y2="18" />
1297
1608
  <circle cx="10" cy="18" r="2" fill="#fff" />
1298
1609
  </svg>
1299
- <span v-if="activeFilterCount > 0" class="stock-filter-count-dot">
1610
+ <span v-if="!isCurrentDetailFilterDisabled && activeFilterCount > 0" class="stock-filter-count-dot">
1300
1611
  {{ activeFilterCount }}
1301
1612
  </span>
1302
1613
  </button>
1303
1614
  </div>
1304
1615
 
1305
1616
  <!-- 已选筛选条件胶囊条 -->
1306
- <div v-if="activeFilterCount > 0" class="stock-active-filter-chips">
1617
+ <div v-if="!isCurrentDetailFilterDisabled && activeFilterCount > 0" class="stock-active-filter-chips">
1307
1618
  <div
1308
1619
  v-if="filterParams.color"
1309
1620
  class="stock-filter-chip"
@@ -1354,8 +1665,11 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1354
1665
  </div>
1355
1666
 
1356
1667
  <!-- 悬浮复合筛选面板 Popover -->
1357
- <div v-if="filterPopoverOpen" class="stock-filter-popover" @click.stop>
1668
+ <div v-if="filterPopoverOpen && !isCurrentDetailFilterDisabled" class="stock-filter-popover" @click.stop>
1358
1669
  <div class="stock-filter-popover-body">
1670
+ <div class="stock-filter-scope-tip">
1671
+ <span>仅对矢量图、照片、插画、图标生效(对视频、音乐、音效不生效)</span>
1672
+ </div>
1359
1673
  <!-- 1. 颜色 -->
1360
1674
  <div class="stock-filter-section">
1361
1675
  <div class="stock-filter-section-header">
@@ -1516,8 +1830,8 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1516
1830
 
1517
1831
  <!-- 图二:素材库分类概览视图 -->
1518
1832
  <div v-if="viewMode === 'overview'" class="material-overview-body">
1519
- <!-- 4大固定分类横向预览列表(Vectors / Photos / Illustrations / Videos) -->
1520
- <div class="overview-sections-scroll">
1833
+ <!-- 7大固定分类横向预览列表(Vectors / Photos / Illustrations / Videos / Icons / Music / Sound_Effects) -->
1834
+ <div class="overview-sections-scroll" @scroll.passive="updateAllRowScrollStates">
1521
1835
  <div
1522
1836
  v-for="cat in overviewCategories"
1523
1837
  :key="cat.key"
@@ -1530,7 +1844,7 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1530
1844
  </button>
1531
1845
  </div>
1532
1846
 
1533
- <div class="section-carousel-container">
1847
+ <div class="section-carousel-container" @mouseenter="updateRowScrollState(cat.key)">
1534
1848
  <div
1535
1849
  :ref="el => setRowRef(cat.key, el)"
1536
1850
  class="section-carousel-track"
@@ -1547,29 +1861,97 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1547
1861
  v-for="(item, idx) in overviewItemsMap[cat.key]"
1548
1862
  :key="item.id || idx"
1549
1863
  class="overview-thumb-card"
1864
+ :class="{
1865
+ 'is-icon-card': cat.subType === 'Icons' || isIconMaterial(item),
1866
+ 'is-audio-card': cat.subType === 'Music' || cat.subType === 'Sound_Effects' || isAudioMaterial(item)
1867
+ }"
1550
1868
  @click.stop="handleSelectMaterial(item)"
1551
1869
  >
1870
+ <!-- 音频/音效横向卡片 -->
1871
+ <div
1872
+ v-if="cat.subType === 'Music' || cat.subType === 'Sound_Effects' || isAudioMaterial(item)"
1873
+ class="overview-audio-inner"
1874
+ :class="{
1875
+ 'is-sfx': cat.subType === 'Sound_Effects' || item.assetSubType === 'Sound_Effects' || item.subType === 'Sound_Effects',
1876
+ 'is-playing': playingAudioId === item.id
1877
+ }"
1878
+ >
1879
+ <div class="overview-audio-top">
1880
+ <button
1881
+ type="button"
1882
+ class="audio-play-toggle-btn"
1883
+ :title="playingAudioId === item.id ? '暂停试听' : '试听音频'"
1884
+ @click.stop="toggleInlineAudioPlay(item, $event)"
1885
+ >
1886
+ <svg
1887
+ v-if="playingAudioId === item.id"
1888
+ viewBox="0 0 24 24"
1889
+ width="12"
1890
+ height="12"
1891
+ fill="currentColor"
1892
+ >
1893
+ <rect x="6" y="5" width="4" height="14" rx="1" />
1894
+ <rect x="14" y="5" width="4" height="14" rx="1" />
1895
+ </svg>
1896
+ <svg
1897
+ v-else
1898
+ viewBox="0 0 24 24"
1899
+ width="12"
1900
+ height="12"
1901
+ fill="currentColor"
1902
+ >
1903
+ <polygon points="7 4 20 12 7 20 7 4" />
1904
+ </svg>
1905
+ </button>
1906
+ <div class="audio-wave-bars" :class="{ active: playingAudioId === item.id }">
1907
+ <span></span>
1908
+ <span></span>
1909
+ <span></span>
1910
+ <span></span>
1911
+ <span></span>
1912
+ </div>
1913
+ <span class="audio-duration-tag">
1914
+ {{ formatAudioDuration(item.duration) || (cat.subType === 'Sound_Effects' ? 'SFX' : 'BGM') }}
1915
+ </span>
1916
+ </div>
1917
+ <div class="overview-audio-title" :title="item.title">
1918
+ {{ item.title || cat.label }}
1919
+ </div>
1920
+ </div>
1921
+
1922
+ <!-- 视频卡片 -->
1552
1923
  <VideoCoverThumb
1553
- v-if="cat.subType === 'Videos' || isVideoMaterial(item) || isVideoUrl(getMaterialThumb(item))"
1924
+ v-else-if="cat.subType === 'Videos' || isVideoMaterial(item) || isVideoUrl(getMaterialThumb(item))"
1554
1925
  :video-url="item.sourceUrl || item.url || getMaterialThumb(item)"
1555
1926
  :cover-url="item.coverUrl || item.image || item.thumbnail || (!isVideoUrl(item.previewUrl) ? item.previewUrl : '')"
1556
1927
  :alt="item.title || cat.label"
1557
1928
  class="overview-thumb-img"
1558
1929
  @loaded="updateRowScrollState(cat.key)"
1559
1930
  />
1931
+
1932
+ <!-- 图片 / 矢量 / 插画 / 图标卡片 -->
1560
1933
  <img
1561
1934
  v-else-if="getMaterialThumb(item)"
1562
1935
  :src="getMaterialThumb(item)"
1563
1936
  :alt="item.title || cat.label"
1564
1937
  loading="lazy"
1565
1938
  class="overview-thumb-img"
1939
+ :class="{ 'is-icon-img': cat.subType === 'Icons' || isIconMaterial(item) }"
1566
1940
  @load="updateRowScrollState(cat.key)"
1567
1941
  />
1568
1942
  <span v-if="cat.subType === 'Videos' || isVideoMaterial(item)" class="video-badge-icon">
1569
1943
  <el-icon><VideoPlay /></el-icon>
1570
1944
  </span>
1571
1945
  <button
1572
- v-if="isDamLoggedIn && cat.subType !== 'Videos' && !isVideoMaterial(item) && getMaterialThumb(item)"
1946
+ v-if="
1947
+ isDamLoggedIn &&
1948
+ cat.subType !== 'Videos' &&
1949
+ cat.subType !== 'Music' &&
1950
+ cat.subType !== 'Sound_Effects' &&
1951
+ !isVideoMaterial(item) &&
1952
+ !isAudioMaterial(item) &&
1953
+ getMaterialThumb(item)
1954
+ "
1573
1955
  type="button"
1574
1956
  class="overview-card-ref-btn"
1575
1957
  title="作为参考图发送到「AI生成」"
@@ -1635,21 +2017,85 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1635
2017
  v-for="(item, idx) in colItems"
1636
2018
  :key="item.id || idx"
1637
2019
  class="detail-masonry-card"
2020
+ :class="{
2021
+ 'is-icon-card': filterParams.activeSubType === 'Icons' || isIconMaterial(item),
2022
+ 'is-audio-card': filterParams.activeSubType === 'Music' || filterParams.activeSubType === 'Sound_Effects' || isAudioMaterial(item)
2023
+ }"
1638
2024
  @click.stop="handleSelectMaterial(item)"
1639
2025
  >
2026
+ <!-- 详情页音频/音效卡片 -->
2027
+ <div
2028
+ v-if="filterParams.activeSubType === 'Music' || filterParams.activeSubType === 'Sound_Effects' || isAudioMaterial(item)"
2029
+ class="detail-audio-inner"
2030
+ :class="{
2031
+ 'is-sfx': filterParams.activeSubType === 'Sound_Effects' || item.assetSubType === 'Sound_Effects' || item.subType === 'Sound_Effects',
2032
+ 'is-playing': playingAudioId === item.id
2033
+ }"
2034
+ >
2035
+ <div class="detail-audio-header">
2036
+ <button
2037
+ type="button"
2038
+ class="audio-play-toggle-btn"
2039
+ :title="playingAudioId === item.id ? '暂停试听' : '点击试听'"
2040
+ @click.stop="toggleInlineAudioPlay(item, $event)"
2041
+ >
2042
+ <svg
2043
+ v-if="playingAudioId === item.id"
2044
+ viewBox="0 0 24 24"
2045
+ width="13"
2046
+ height="13"
2047
+ fill="currentColor"
2048
+ >
2049
+ <rect x="6" y="5" width="4" height="14" rx="1" />
2050
+ <rect x="14" y="5" width="4" height="14" rx="1" />
2051
+ </svg>
2052
+ <svg
2053
+ v-else
2054
+ viewBox="0 0 24 24"
2055
+ width="13"
2056
+ height="13"
2057
+ fill="currentColor"
2058
+ >
2059
+ <polygon points="7 4 20 12 7 20 7 4" />
2060
+ </svg>
2061
+ </button>
2062
+ <div class="audio-wave-bars" :class="{ active: playingAudioId === item.id }">
2063
+ <span></span>
2064
+ <span></span>
2065
+ <span></span>
2066
+ <span></span>
2067
+ <span></span>
2068
+ <span></span>
2069
+ </div>
2070
+ </div>
2071
+ <div class="detail-audio-title" :title="item.title">
2072
+ {{ item.title || subTypeNameMap[filterParams.activeSubType] }}
2073
+ </div>
2074
+ <div class="detail-audio-meta">
2075
+ <span class="detail-audio-badge">{{ getItemFormat(item) }}</span>
2076
+ <span v-if="formatAudioDuration(item.duration)" class="detail-audio-dur">
2077
+ {{ formatAudioDuration(item.duration) }}
2078
+ </span>
2079
+ </div>
2080
+ </div>
2081
+
2082
+ <!-- 详情页视频卡片 -->
1640
2083
  <VideoCoverThumb
1641
- v-if="filterParams.activeSubType === 'Videos' || isVideoMaterial(item) || isVideoUrl(getMaterialThumb(item))"
2084
+ v-else-if="filterParams.activeSubType === 'Videos' || isVideoMaterial(item) || isVideoUrl(getMaterialThumb(item))"
1642
2085
  :video-url="item.sourceUrl || item.url || getMaterialThumb(item)"
1643
2086
  :cover-url="item.coverUrl || item.image || item.thumbnail || (!isVideoUrl(item.previewUrl) ? item.previewUrl : '')"
1644
2087
  :alt="item.title || '素材'"
1645
2088
  class="detail-card-img"
1646
2089
  />
2090
+
2091
+ <!-- 详情页图片 / 矢量 / 插画 / 图标卡片 -->
1647
2092
  <img
1648
2093
  v-else-if="getMaterialThumb(item)"
1649
2094
  :src="getMaterialThumb(item)"
1650
2095
  :alt="item.title || '素材'"
1651
2096
  loading="lazy"
1652
2097
  class="detail-card-img"
2098
+ :class="{ 'is-icon-img': filterParams.activeSubType === 'Icons' || isIconMaterial(item) }"
1653
2099
  />
1654
2100
  <div v-else class="detail-card-placeholder">
1655
2101
  <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#94a3b8" stroke-width="1.5">
@@ -1665,7 +2111,15 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1665
2111
 
1666
2112
  <!-- 悬浮设为参考图按钮 -->
1667
2113
  <button
1668
- v-if="isDamLoggedIn && filterParams.activeSubType !== 'Videos' && !isVideoMaterial(item) && getMaterialThumb(item)"
2114
+ v-if="
2115
+ isDamLoggedIn &&
2116
+ filterParams.activeSubType !== 'Videos' &&
2117
+ filterParams.activeSubType !== 'Music' &&
2118
+ filterParams.activeSubType !== 'Sound_Effects' &&
2119
+ !isVideoMaterial(item) &&
2120
+ !isAudioMaterial(item) &&
2121
+ getMaterialThumb(item)
2122
+ "
1669
2123
  type="button"
1670
2124
  class="detail-card-ref-btn"
1671
2125
  title="作为参考图发送到「AI生成」"
@@ -1676,10 +2130,10 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1676
2130
 
1677
2131
  <!-- 悬浮预览小按钮 -->
1678
2132
  <button
1679
- v-if="getMaterialThumb(item)"
2133
+ v-if="getMaterialThumb(item) || isAudioMaterial(item)"
1680
2134
  type="button"
1681
2135
  class="detail-card-preview-btn"
1682
- title="大图预览"
2136
+ :title="isAudioMaterial(item) ? '全屏试听' : '大图预览'"
1683
2137
  @click.stop.prevent="openPreview(item, $event)"
1684
2138
  >
1685
2139
  <el-icon><View /></el-icon>
@@ -1788,8 +2242,27 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
1788
2242
  </button>
1789
2243
 
1790
2244
  <div class="preview-stage-viewport" @click.self="closePreview">
2245
+ <div
2246
+ v-if="currentPreviewItem?.isAudio && currentPreviewItem?.url"
2247
+ class="preview-audio-stage-card"
2248
+ >
2249
+ <div class="preview-audio-disc">
2250
+ <svg viewBox="0 0 24 24" width="38" height="38" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
2251
+ <path d="M9 18V5l12-2v13" />
2252
+ <circle cx="6" cy="18" r="3" />
2253
+ <circle cx="18" cy="16" r="3" />
2254
+ </svg>
2255
+ </div>
2256
+ <div class="preview-audio-stage-title">{{ currentPreviewItem.title }}</div>
2257
+ <audio
2258
+ :src="currentPreviewItem.url"
2259
+ controls
2260
+ autoplay
2261
+ class="preview-stage-audio-el"
2262
+ />
2263
+ </div>
1791
2264
  <video
1792
- v-if="currentPreviewItem?.isVideo && currentPreviewItem?.url"
2265
+ v-else-if="currentPreviewItem?.isVideo && currentPreviewItem?.url"
1793
2266
  :src="currentPreviewItem.url"
1794
2267
  controls
1795
2268
  autoplay
@@ -2096,7 +2569,7 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
2096
2569
  transition: all 0.15s;
2097
2570
  flex-shrink: 0;
2098
2571
 
2099
- &:hover {
2572
+ &:hover:not(.is-disabled) {
2100
2573
  color: #1e293b;
2101
2574
  }
2102
2575
 
@@ -2104,6 +2577,12 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
2104
2577
  background: transparent;
2105
2578
  color: #2563eb;
2106
2579
  }
2580
+
2581
+ &.is-disabled {
2582
+ color: #cbd5e1;
2583
+ cursor: not-allowed;
2584
+ opacity: 0.55;
2585
+ }
2107
2586
  }
2108
2587
 
2109
2588
  .stock-filter-count-dot {
@@ -2215,6 +2694,17 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
2215
2694
  }
2216
2695
  }
2217
2696
 
2697
+ .stock-filter-scope-tip {
2698
+ margin-bottom: 12px;
2699
+ padding: 5px 8px;
2700
+ border-radius: 6px;
2701
+ background: #f8fafc;
2702
+ border: 1px solid #e2e8f0;
2703
+ font-size: 11px;
2704
+ line-height: 1.4;
2705
+ color: #64748b;
2706
+ }
2707
+
2218
2708
  .stock-filter-section {
2219
2709
  margin-bottom: 14px;
2220
2710
 
@@ -2665,6 +3155,24 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
2665
3155
  cursor: pointer;
2666
3156
  position: relative;
2667
3157
 
3158
+ &.is-icon-card {
3159
+ width: 84px;
3160
+ border: 1px solid #f1f5f9;
3161
+ background-color: #f8fafc;
3162
+ background-image:
3163
+ linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
3164
+ linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
3165
+ linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
3166
+ linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
3167
+ background-size: 12px 12px;
3168
+ background-position: 0 0, 0 6px, 6px -6px, -6px 0;
3169
+ }
3170
+
3171
+ &.is-audio-card {
3172
+ width: 146px;
3173
+ height: 84px;
3174
+ }
3175
+
2668
3176
  &:hover .overview-thumb-img {
2669
3177
  transform: scale(1.04);
2670
3178
  }
@@ -2705,6 +3213,152 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
2705
3213
  display: block;
2706
3214
  border-radius: 8px;
2707
3215
  transition: transform 0.25s ease;
3216
+
3217
+ &.is-icon-img {
3218
+ width: 84px;
3219
+ height: 84px;
3220
+ min-width: 84px;
3221
+ max-width: 84px;
3222
+ object-fit: contain;
3223
+ padding: 16px;
3224
+ box-sizing: border-box;
3225
+ }
3226
+ }
3227
+
3228
+ /* 概览与详情音频卡片样式 */
3229
+ .overview-audio-inner {
3230
+ width: 100%;
3231
+ height: 100%;
3232
+ padding: 10px 10px 8px;
3233
+ box-sizing: border-box;
3234
+ display: flex;
3235
+ flex-direction: column;
3236
+ justify-content: space-between;
3237
+ background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
3238
+ border: 1px solid #dbeafe;
3239
+ border-radius: 8px;
3240
+ transition: all 0.18s ease;
3241
+
3242
+ &.is-sfx {
3243
+ background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
3244
+ border-color: #ccfbf1;
3245
+ }
3246
+
3247
+ &.is-playing {
3248
+ border-color: #3b82f6;
3249
+ box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.28);
3250
+ }
3251
+
3252
+ &:hover {
3253
+ filter: brightness(0.98);
3254
+ }
3255
+ }
3256
+
3257
+ .overview-audio-top {
3258
+ display: flex;
3259
+ align-items: center;
3260
+ justify-content: space-between;
3261
+ gap: 6px;
3262
+ }
3263
+
3264
+ .audio-play-toggle-btn {
3265
+ width: 26px;
3266
+ height: 26px;
3267
+ border-radius: 50%;
3268
+ border: none;
3269
+ background: #2563eb;
3270
+ color: #ffffff;
3271
+ display: inline-flex;
3272
+ align-items: center;
3273
+ justify-content: center;
3274
+ cursor: pointer;
3275
+ flex-shrink: 0;
3276
+ padding: 0;
3277
+ box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
3278
+ transition: transform 0.15s ease, background 0.15s ease;
3279
+
3280
+ &:hover {
3281
+ background: #1d4ed8;
3282
+ transform: scale(1.08);
3283
+ }
3284
+ }
3285
+
3286
+ .is-sfx .audio-play-toggle-btn {
3287
+ background: #0d9488;
3288
+ box-shadow: 0 2px 6px rgba(13, 148, 136, 0.26);
3289
+
3290
+ &:hover {
3291
+ background: #0f766e;
3292
+ }
3293
+ }
3294
+
3295
+ .audio-wave-bars {
3296
+ display: inline-flex;
3297
+ align-items: center;
3298
+ gap: 2.5px;
3299
+ height: 16px;
3300
+ flex: 1;
3301
+ justify-content: center;
3302
+
3303
+ span {
3304
+ display: inline-block;
3305
+ width: 2.5px;
3306
+ border-radius: 2px;
3307
+ background: #60a5fa;
3308
+ transition: height 0.2s ease;
3309
+
3310
+ &:nth-child(1) { height: 6px; }
3311
+ &:nth-child(2) { height: 12px; }
3312
+ &:nth-child(3) { height: 8px; }
3313
+ &:nth-child(4) { height: 14px; }
3314
+ &:nth-child(5) { height: 7px; }
3315
+ &:nth-child(6) { height: 10px; }
3316
+ }
3317
+
3318
+ &.active span {
3319
+ background: #2563eb;
3320
+ animation: audioWavePulse 0.75s ease-in-out infinite alternate;
3321
+
3322
+ &:nth-child(2) { animation-delay: 0.12s; }
3323
+ &:nth-child(3) { animation-delay: 0.24s; }
3324
+ &:nth-child(4) { animation-delay: 0.08s; }
3325
+ &:nth-child(5) { animation-delay: 0.2s; }
3326
+ &:nth-child(6) { animation-delay: 0.3s; }
3327
+ }
3328
+ }
3329
+
3330
+ .is-sfx .audio-wave-bars span {
3331
+ background: #2dd4bf;
3332
+ }
3333
+
3334
+ .is-sfx .audio-wave-bars.active span {
3335
+ background: #0d9488;
3336
+ }
3337
+
3338
+ @keyframes audioWavePulse {
3339
+ 0% { height: 4px; }
3340
+ 100% { height: 15px; }
3341
+ }
3342
+
3343
+ .audio-duration-tag {
3344
+ font-size: 10px;
3345
+ font-weight: 600;
3346
+ color: #475569;
3347
+ background: rgba(255, 255, 255, 0.75);
3348
+ padding: 1px 5px;
3349
+ border-radius: 4px;
3350
+ flex-shrink: 0;
3351
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
3352
+ }
3353
+
3354
+ .overview-audio-title {
3355
+ font-size: 11.5px;
3356
+ font-weight: 500;
3357
+ color: #1e293b;
3358
+ white-space: nowrap;
3359
+ overflow: hidden;
3360
+ text-overflow: ellipsis;
3361
+ line-height: 1.3;
2708
3362
  }
2709
3363
 
2710
3364
  .video-badge-icon {
@@ -2816,6 +3470,23 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
2816
3470
  background: #f1f5f9;
2817
3471
  cursor: pointer;
2818
3472
 
3473
+ &.is-icon-card {
3474
+ aspect-ratio: 1 / 1;
3475
+ border: 1px solid #f1f5f9;
3476
+ background-color: #f8fafc;
3477
+ background-image:
3478
+ linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
3479
+ linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
3480
+ linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
3481
+ linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
3482
+ background-size: 14px 14px;
3483
+ background-position: 0 0, 0 7px, 7px -7px, -7px 0;
3484
+ }
3485
+
3486
+ &.is-audio-card {
3487
+ background: transparent;
3488
+ }
3489
+
2819
3490
  &:hover .detail-card-img {
2820
3491
  transform: scale(1.03);
2821
3492
  }
@@ -2826,6 +3497,76 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
2826
3497
  }
2827
3498
  }
2828
3499
 
3500
+ .detail-audio-inner {
3501
+ width: 100%;
3502
+ padding: 10px 10px 9px;
3503
+ box-sizing: border-box;
3504
+ display: flex;
3505
+ flex-direction: column;
3506
+ gap: 7px;
3507
+ background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
3508
+ border: 1px solid #dbeafe;
3509
+ border-radius: 8px;
3510
+ transition: all 0.18s ease;
3511
+
3512
+ &.is-sfx {
3513
+ background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
3514
+ border-color: #ccfbf1;
3515
+ }
3516
+
3517
+ &.is-playing {
3518
+ border-color: #3b82f6;
3519
+ box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.3);
3520
+ }
3521
+ }
3522
+
3523
+ .detail-audio-header {
3524
+ display: flex;
3525
+ align-items: center;
3526
+ gap: 8px;
3527
+ padding-right: 22px;
3528
+ }
3529
+
3530
+ .detail-audio-title {
3531
+ font-size: 12px;
3532
+ font-weight: 600;
3533
+ color: #1e293b;
3534
+ line-height: 1.35;
3535
+ display: -webkit-box;
3536
+ -webkit-line-clamp: 2;
3537
+ -webkit-box-orient: vertical;
3538
+ overflow: hidden;
3539
+ word-break: break-word;
3540
+ }
3541
+
3542
+ .detail-audio-meta {
3543
+ display: flex;
3544
+ align-items: center;
3545
+ justify-content: space-between;
3546
+ gap: 6px;
3547
+ }
3548
+
3549
+ .detail-audio-badge {
3550
+ font-size: 9.5px;
3551
+ font-weight: 700;
3552
+ color: #2563eb;
3553
+ background: rgba(255, 255, 255, 0.85);
3554
+ padding: 1px 5px;
3555
+ border-radius: 4px;
3556
+ letter-spacing: 0.3px;
3557
+ }
3558
+
3559
+ .is-sfx .detail-audio-badge {
3560
+ color: #0d9488;
3561
+ }
3562
+
3563
+ .detail-audio-dur {
3564
+ font-size: 10.5px;
3565
+ font-weight: 500;
3566
+ color: #64748b;
3567
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
3568
+ }
3569
+
2829
3570
  .detail-card-ref-btn {
2830
3571
  position: absolute;
2831
3572
  left: 6px;
@@ -2857,6 +3598,16 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
2857
3598
  display: block;
2858
3599
  border-radius: 8px;
2859
3600
  transition: transform 0.25s ease;
3601
+
3602
+ &.is-icon-img {
3603
+ width: 100%;
3604
+ height: 100%;
3605
+ min-height: 84px;
3606
+ max-height: none;
3607
+ object-fit: contain;
3608
+ padding: 18%;
3609
+ box-sizing: border-box;
3610
+ }
2860
3611
  }
2861
3612
 
2862
3613
  .detail-card-placeholder {
@@ -3103,6 +3854,48 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
3103
3854
  transition: transform 0.25s ease;
3104
3855
  }
3105
3856
 
3857
+ .preview-audio-stage-card {
3858
+ width: min(440px, 88vw);
3859
+ padding: 32px 28px 28px;
3860
+ border-radius: 18px;
3861
+ background: rgba(30, 41, 59, 0.88);
3862
+ border: 1px solid rgba(255, 255, 255, 0.14);
3863
+ box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
3864
+ display: flex;
3865
+ flex-direction: column;
3866
+ align-items: center;
3867
+ gap: 16px;
3868
+ }
3869
+
3870
+ .preview-audio-disc {
3871
+ width: 78px;
3872
+ height: 78px;
3873
+ border-radius: 50%;
3874
+ background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
3875
+ color: #ffffff;
3876
+ display: flex;
3877
+ align-items: center;
3878
+ justify-content: center;
3879
+ box-shadow: 0 10px 25px rgba(37, 99, 235, 0.45);
3880
+ }
3881
+
3882
+ .preview-audio-stage-title {
3883
+ color: #f8fafc;
3884
+ font-size: 15px;
3885
+ font-weight: 600;
3886
+ text-align: center;
3887
+ max-width: 100%;
3888
+ overflow: hidden;
3889
+ text-overflow: ellipsis;
3890
+ white-space: nowrap;
3891
+ }
3892
+
3893
+ .preview-stage-audio-el {
3894
+ width: 100%;
3895
+ height: 40px;
3896
+ outline: none;
3897
+ }
3898
+
3106
3899
  .preview-arrow-btn {
3107
3900
  position: absolute;
3108
3901
  top: 50%;