jvs-ppt-ui 0.0.21 → 0.0.23
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.
- package/dist/lib/jvs-ppt-ui.es.js +18671 -18433
- package/dist/lib/jvs-ppt-ui.umd.js +86 -86
- package/dist/lib/style.css +1 -1
- package/package.json +2 -2
- package/src/components/CanvasArea.vue +25 -1
- package/src/components/PptEditor.vue +10 -2
- package/src/components/SidebarRight.vue +63 -11
- package/src/components/TemplateGallery.vue +23 -21
- package/src/components/material/CreateMaterialPanel.vue +7 -8
- package/src/components/material/MyAssetsPanel.vue +64 -24
- package/src/components/material/VideoCoverThumb.vue +411 -0
- package/src/composables/sidebar/useSidebarMultiSelect.ts +15 -1
- package/src/composables/useSlides.ts +19 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jvs-ppt-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.23",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/lib/jvs-ppt-ui.umd.js",
|
|
7
7
|
"module": "./dist/lib/jvs-ppt-ui.es.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"dev": "vite",
|
|
25
|
-
"build": "node scripts/patch-pptxtojson.cjs && vue-tsc -b && vite build",
|
|
25
|
+
"build": "node scripts/patch-pptxtojson.cjs && vue-tsc -b && vite build && vite build --config vite.config.lib.ts",
|
|
26
26
|
"build:web": "node scripts/patch-pptxtojson.cjs && vite build --config vite.config.web.ts",
|
|
27
27
|
"build:lib": "node scripts/patch-pptxtojson.cjs && vite build --config vite.config.lib.ts",
|
|
28
28
|
"preview": "vite preview",
|
|
@@ -1959,6 +1959,7 @@ function handleWindowMouseDown(e: MouseEvent) {
|
|
|
1959
1959
|
target.closest('.formula-dialog') ||
|
|
1960
1960
|
target.closest('.el-dialog') ||
|
|
1961
1961
|
target.closest('.el-overlay') ||
|
|
1962
|
+
target.closest('.el-image-viewer__wrapper') ||
|
|
1962
1963
|
target.closest('.custom-fullscreen-preview-modal') ||
|
|
1963
1964
|
target.closest('.placeholder-action-popover') ||
|
|
1964
1965
|
target.closest('.material-drawer-container')
|
|
@@ -5960,12 +5961,35 @@ function changeQuickTextAlign(el: any, align: string) {
|
|
|
5960
5961
|
}
|
|
5961
5962
|
if (targetEl.text && targetEl.text.content) {
|
|
5962
5963
|
targetEl.text.content = updateTextAlignInHtml(targetEl.text.content, align)
|
|
5964
|
+
} else if (typeof targetEl.text === 'string' && targetEl.text) {
|
|
5965
|
+
targetEl.text = updateTextAlignInHtml(targetEl.text, align)
|
|
5966
|
+
}
|
|
5967
|
+
const container = document.getElementById(`editable-${targetEl.id}`)
|
|
5968
|
+
if (container && (!targetEl.content || !targetEl.content.includes('<table')) && !targetEl.latex) {
|
|
5969
|
+
container.style.textAlign = align
|
|
5970
|
+
container.innerHTML = updateTextAlignInHtml(container.innerHTML, align)
|
|
5971
|
+
if (targetEl.type === 'shape') {
|
|
5972
|
+
if (targetEl.text && typeof targetEl.text === 'object') {
|
|
5973
|
+
targetEl.text.content = container.innerHTML
|
|
5974
|
+
} else {
|
|
5975
|
+
targetEl.text = container.innerHTML
|
|
5976
|
+
}
|
|
5977
|
+
} else if (targetEl.type === 'text') {
|
|
5978
|
+
targetEl.content = container.innerHTML
|
|
5979
|
+
}
|
|
5980
|
+
}
|
|
5981
|
+
if (targetEl.type === 'group' && Array.isArray(targetEl.elements)) {
|
|
5982
|
+
targetEl.elements.forEach((child: any) => {
|
|
5983
|
+
if (!child.style) child.style = {}
|
|
5984
|
+
child.style.textAlign = align
|
|
5985
|
+
syncHtmlAlign(child)
|
|
5986
|
+
})
|
|
5963
5987
|
}
|
|
5964
5988
|
}
|
|
5965
5989
|
|
|
5966
5990
|
if (selectedElementIds.value.length > 1 && activeSlide.value) {
|
|
5967
5991
|
// 嵌套感知解析:组合内子元素也要能命中(findElementInSlide 走 elementMaps,含组内子元素)
|
|
5968
|
-
|
|
5992
|
+
const els = selectedElementIds.value.map((id: string) => findElementInSlide(id)).filter((e: any) => Boolean(e))
|
|
5969
5993
|
els.forEach((item: any) => {
|
|
5970
5994
|
if (item.style) item.style.textAlign = align
|
|
5971
5995
|
syncHtmlAlign(item)
|
|
@@ -736,7 +736,7 @@ watch(
|
|
|
736
736
|
(val) => {
|
|
737
737
|
if (isInternalUpdating) return
|
|
738
738
|
if (!val) return
|
|
739
|
-
if (val === lastEmittedModelValue) return
|
|
739
|
+
if (val === lastEmittedModelValue || toRaw(val) === toRaw(lastEmittedModelValue)) return
|
|
740
740
|
loadDeck(val as any)
|
|
741
741
|
},
|
|
742
742
|
{ immediate: true, deep: true }
|
|
@@ -827,6 +827,14 @@ onBeforeUnmount(() => {
|
|
|
827
827
|
emitDeckNow()
|
|
828
828
|
})
|
|
829
829
|
|
|
830
|
+
// 阻止编辑器内部 img 点击事件冒泡到宿主容器(如 jvs-ai-ui chatBox 的全局图片灯箱监听)
|
|
831
|
+
function handleEditorRootClick(e: MouseEvent) {
|
|
832
|
+
const target = e.target as HTMLElement | null
|
|
833
|
+
if (target && (target.tagName === 'IMG' || target.closest('img'))) {
|
|
834
|
+
e.stopPropagation()
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
830
838
|
const editorApi: PptEditorApi = {
|
|
831
839
|
save,
|
|
832
840
|
getSaveData: () => getDeck(),
|
|
@@ -948,7 +956,7 @@ onMounted(async () => {
|
|
|
948
956
|
</script>
|
|
949
957
|
|
|
950
958
|
<template>
|
|
951
|
-
<div class="app-container jvs-ppt-editor-root" :class="{ 'is-readonly': readonly }">
|
|
959
|
+
<div class="app-container jvs-ppt-editor-root" :class="{ 'is-readonly': readonly }" @click="handleEditorRootClick">
|
|
952
960
|
<!-- Main top Navigation bar (支持完整 header 插槽替换或精细区域插槽定制) -->
|
|
953
961
|
<slot name="header" v-bind="headerSlotContext">
|
|
954
962
|
<Header ref="headerRef" :visible="showHeader" :show-menu="computedShowMenu" :toolbar-mode="computedToolbarMode" :slot-props="headerSlotContext">
|
|
@@ -574,14 +574,25 @@ function setStyleVal(prop: string, val: any) {
|
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
|
|
577
|
-
if (prop === 'fontFamily' || prop === 'fontSize') {
|
|
577
|
+
if (prop === 'fontFamily' || prop === 'fontSize' || prop === 'textAlign') {
|
|
578
578
|
const container = document.getElementById(`editable-${el.id}`)
|
|
579
|
-
if (container) {
|
|
580
|
-
if (prop === 'fontFamily')
|
|
581
|
-
|
|
582
|
-
|
|
579
|
+
if (container && (!el.content || !el.content.includes('<table')) && !el.latex) {
|
|
580
|
+
if (prop === 'fontFamily') {
|
|
581
|
+
container.style.fontFamily = val
|
|
582
|
+
container.innerHTML = applyTextStyleToHtml(container.innerHTML, { fontFamily: val })
|
|
583
|
+
} else if (prop === 'fontSize') {
|
|
584
|
+
container.style.fontSize = val
|
|
585
|
+
container.innerHTML = applyTextStyleToHtml(container.innerHTML, { fontSize: val })
|
|
586
|
+
} else if (prop === 'textAlign') {
|
|
587
|
+
container.style.textAlign = val
|
|
588
|
+
container.innerHTML = updateTextAlignInHtml(container.innerHTML, val)
|
|
589
|
+
}
|
|
583
590
|
if (el.type === 'shape') {
|
|
584
|
-
el.text
|
|
591
|
+
if (el.text && typeof el.text === 'object') {
|
|
592
|
+
el.text.content = container.innerHTML
|
|
593
|
+
} else {
|
|
594
|
+
el.text = container.innerHTML
|
|
595
|
+
}
|
|
585
596
|
} else {
|
|
586
597
|
el.content = container.innerHTML
|
|
587
598
|
}
|
|
@@ -667,13 +678,25 @@ function setStyleVal(prop: string, val: any) {
|
|
|
667
678
|
}
|
|
668
679
|
}
|
|
669
680
|
|
|
670
|
-
if (prop === 'fontFamily') {
|
|
681
|
+
if (prop === 'fontFamily' || prop === 'fontSize' || prop === 'textAlign') {
|
|
671
682
|
const container = document.getElementById(`editable-${el.id}`)
|
|
672
|
-
if (container) {
|
|
673
|
-
|
|
674
|
-
|
|
683
|
+
if (container && (!el.content || !el.content.includes('<table')) && !el.latex) {
|
|
684
|
+
if (prop === 'fontFamily') {
|
|
685
|
+
container.style.fontFamily = val
|
|
686
|
+
container.innerHTML = applyTextStyleToHtml(container.innerHTML, { fontFamily: val })
|
|
687
|
+
} else if (prop === 'fontSize') {
|
|
688
|
+
container.style.fontSize = val
|
|
689
|
+
container.innerHTML = applyTextStyleToHtml(container.innerHTML, { fontSize: val })
|
|
690
|
+
} else if (prop === 'textAlign') {
|
|
691
|
+
container.style.textAlign = val
|
|
692
|
+
container.innerHTML = updateTextAlignInHtml(container.innerHTML, val)
|
|
693
|
+
}
|
|
675
694
|
if (el.type === 'shape') {
|
|
676
|
-
el.text
|
|
695
|
+
if (el.text && typeof el.text === 'object') {
|
|
696
|
+
el.text.content = container.innerHTML
|
|
697
|
+
} else {
|
|
698
|
+
el.text = container.innerHTML
|
|
699
|
+
}
|
|
677
700
|
} else {
|
|
678
701
|
el.content = container.innerHTML
|
|
679
702
|
}
|
|
@@ -735,6 +758,35 @@ function setStyleVal(prop: string, val: any) {
|
|
|
735
758
|
} else if (prop === 'textAlign') {
|
|
736
759
|
child.text.content = updateTextAlignInHtml(child.text.content, val)
|
|
737
760
|
}
|
|
761
|
+
} else if (typeof child.text === 'string' && child.text) {
|
|
762
|
+
if (prop === 'fontFamily') {
|
|
763
|
+
child.text = applyTextStyleToHtml(child.text, { fontFamily: val })
|
|
764
|
+
} else if (prop === 'fontSize') {
|
|
765
|
+
child.text = applyTextStyleToHtml(child.text, { fontSize: val })
|
|
766
|
+
} else if (prop === 'color' || prop === 'textColor') {
|
|
767
|
+
child.text = applyTextStyleToHtml(child.text, { color: val })
|
|
768
|
+
} else if (prop === 'textBackground') {
|
|
769
|
+
child.text = applyTextStyleToHtml(child.text, { textBackground: val })
|
|
770
|
+
} else if (prop === 'textShadow') {
|
|
771
|
+
child.text = applyTextStyleToHtml(child.text, { textShadow: val })
|
|
772
|
+
} else if (prop === 'textAlign') {
|
|
773
|
+
child.text = updateTextAlignInHtml(child.text, val)
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (prop === 'fontFamily' || prop === 'fontSize' || prop === 'textAlign') {
|
|
777
|
+
const childContainer = document.getElementById(`editable-${child.id}`)
|
|
778
|
+
if (childContainer && (!child.content || !child.content.includes('<table')) && !child.latex) {
|
|
779
|
+
if (prop === 'fontFamily') {
|
|
780
|
+
childContainer.style.fontFamily = val
|
|
781
|
+
childContainer.innerHTML = applyTextStyleToHtml(childContainer.innerHTML, { fontFamily: val })
|
|
782
|
+
} else if (prop === 'fontSize') {
|
|
783
|
+
childContainer.style.fontSize = val
|
|
784
|
+
childContainer.innerHTML = applyTextStyleToHtml(childContainer.innerHTML, { fontSize: val })
|
|
785
|
+
} else if (prop === 'textAlign') {
|
|
786
|
+
childContainer.style.textAlign = val
|
|
787
|
+
childContainer.innerHTML = updateTextAlignInHtml(childContainer.innerHTML, val)
|
|
788
|
+
}
|
|
789
|
+
}
|
|
738
790
|
}
|
|
739
791
|
if (child.type === 'group' && Array.isArray(child.elements)) {
|
|
740
792
|
child.elements.forEach(applyToGroupChild)
|
|
@@ -15,6 +15,7 @@ import { isImagePlaceholder } from '../utils/canvas/elementStyles'
|
|
|
15
15
|
import { useDamAuth } from './material/useDamAuth'
|
|
16
16
|
import MyAssetsPanel from './material/MyAssetsPanel.vue'
|
|
17
17
|
import CreateMaterialPanel from './material/CreateMaterialPanel.vue'
|
|
18
|
+
import VideoCoverThumb from './material/VideoCoverThumb.vue'
|
|
18
19
|
|
|
19
20
|
const {
|
|
20
21
|
addElement,
|
|
@@ -855,7 +856,7 @@ function handleSelectMaterial(meta: MaterialItem) {
|
|
|
855
856
|
(resolveActivePlaceholderTargetId ? resolveActivePlaceholderTargetId() : null) ||
|
|
856
857
|
(explicitTargetId && (!currentSelectedEl || currentSelectedEl.id === explicitTargetId)
|
|
857
858
|
? explicitTargetId
|
|
858
|
-
: (currentSelectedEl && isImagePlaceholder(currentSelectedEl) ? currentSelectedEl.id : null))
|
|
859
|
+
: (currentSelectedEl && (isImagePlaceholder(currentSelectedEl) || (currentSelectedEl as any).isPlaceholderReplaced || (currentSelectedEl as any).replaced || (currentSelectedEl as any).fromImagePlaceholder) ? currentSelectedEl.id : null))
|
|
859
860
|
|
|
860
861
|
if (targetPlaceholderId && replacePlaceholderElement) {
|
|
861
862
|
const replaced = replacePlaceholderElement(targetPlaceholderId, targetUrl, {
|
|
@@ -893,6 +894,13 @@ function handleCloseDrawer() {
|
|
|
893
894
|
activeTab.value = null
|
|
894
895
|
}
|
|
895
896
|
|
|
897
|
+
function handleDrawerContainerClick(e: MouseEvent) {
|
|
898
|
+
const target = e.target as HTMLElement | null
|
|
899
|
+
if (target && (target.tagName === 'IMG' || target.closest('img'))) {
|
|
900
|
+
e.stopPropagation()
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
896
904
|
onMounted(() => {
|
|
897
905
|
fetchAllOverviewCategories()
|
|
898
906
|
window.addEventListener('keydown', handleKeydown)
|
|
@@ -911,7 +919,7 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
|
|
|
911
919
|
</script>
|
|
912
920
|
|
|
913
921
|
<template>
|
|
914
|
-
<div class="material-drawer-container">
|
|
922
|
+
<div class="material-drawer-container" @click="handleDrawerContainerClick">
|
|
915
923
|
<!-- 未登录点击「我的素材/创建素材」时的顶部轻量胶囊提示 -->
|
|
916
924
|
<transition name="guest-toast-fade">
|
|
917
925
|
<div v-if="guestToastVisible" class="guest-auth-toast">
|
|
@@ -1072,18 +1080,15 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
|
|
|
1072
1080
|
v-for="(item, idx) in overviewItemsMap[cat.key]"
|
|
1073
1081
|
:key="item.id || idx"
|
|
1074
1082
|
class="overview-thumb-card"
|
|
1075
|
-
@click="handleSelectMaterial(item)"
|
|
1083
|
+
@click.stop="handleSelectMaterial(item)"
|
|
1076
1084
|
>
|
|
1077
|
-
<
|
|
1078
|
-
v-if="isVideoUrl(getMaterialThumb(item))"
|
|
1079
|
-
:
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
playsinline
|
|
1085
|
+
<VideoCoverThumb
|
|
1086
|
+
v-if="cat.subType === 'Videos' || isVideoMaterial(item) || isVideoUrl(getMaterialThumb(item))"
|
|
1087
|
+
:video-url="item.sourceUrl || item.url || getMaterialThumb(item)"
|
|
1088
|
+
:cover-url="item.coverUrl || item.image || item.thumbnail || (!isVideoUrl(item.previewUrl) ? item.previewUrl : '')"
|
|
1089
|
+
:alt="item.title || cat.label"
|
|
1083
1090
|
class="overview-thumb-img"
|
|
1084
|
-
@
|
|
1085
|
-
@mouseenter="($event.target as HTMLVideoElement)?.play?.()"
|
|
1086
|
-
@mouseleave="($event.target as HTMLVideoElement)?.pause?.()"
|
|
1091
|
+
@loaded="updateRowScrollState(cat.key)"
|
|
1087
1092
|
/>
|
|
1088
1093
|
<img
|
|
1089
1094
|
v-else-if="getMaterialThumb(item)"
|
|
@@ -1215,17 +1220,14 @@ watch([() => materialApiUrl?.value, () => materialPageApiUrl?.value, () => mater
|
|
|
1215
1220
|
v-for="(item, idx) in colItems"
|
|
1216
1221
|
:key="item.id || idx"
|
|
1217
1222
|
class="detail-masonry-card"
|
|
1218
|
-
@click="handleSelectMaterial(item)"
|
|
1223
|
+
@click.stop="handleSelectMaterial(item)"
|
|
1219
1224
|
>
|
|
1220
|
-
<
|
|
1221
|
-
v-if="isVideoUrl(getMaterialThumb(item))"
|
|
1222
|
-
:
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
playsinline
|
|
1225
|
+
<VideoCoverThumb
|
|
1226
|
+
v-if="filterParams.activeSubType === 'Videos' || isVideoMaterial(item) || isVideoUrl(getMaterialThumb(item))"
|
|
1227
|
+
:video-url="item.sourceUrl || item.url || getMaterialThumb(item)"
|
|
1228
|
+
:cover-url="item.coverUrl || item.image || item.thumbnail || (!isVideoUrl(item.previewUrl) ? item.previewUrl : '')"
|
|
1229
|
+
:alt="item.title || '素材'"
|
|
1226
1230
|
class="detail-card-img"
|
|
1227
|
-
@mouseenter="($event.target as HTMLVideoElement)?.play?.()"
|
|
1228
|
-
@mouseleave="($event.target as HTMLVideoElement)?.pause?.()"
|
|
1229
1231
|
/>
|
|
1230
1232
|
<img
|
|
1231
1233
|
v-else-if="getMaterialThumb(item)"
|
|
@@ -3,6 +3,7 @@ import { ref, computed, onMounted, onUnmounted } from 'vue'
|
|
|
3
3
|
import { View, Plus, VideoPlay } from '@element-plus/icons-vue'
|
|
4
4
|
import { useSlides } from '../../composables/useSlides'
|
|
5
5
|
import { useDamAuth } from './useDamAuth'
|
|
6
|
+
import VideoCoverThumb from './VideoCoverThumb.vue'
|
|
6
7
|
import type { MaterialItem } from '../TemplateGallery.vue'
|
|
7
8
|
|
|
8
9
|
export interface ImageModelMetaVO {
|
|
@@ -1165,7 +1166,7 @@ defineExpose({
|
|
|
1165
1166
|
<div v-if="generatedResults.length > 0" class="generated-results-section">
|
|
1166
1167
|
<div class="results-header">
|
|
1167
1168
|
<span class="results-title">本次生成结果 ({{ generatedResults.length }})</span>
|
|
1168
|
-
<span class="results-sub"
|
|
1169
|
+
<span class="results-sub">已同步至「我的空间」</span>
|
|
1169
1170
|
</div>
|
|
1170
1171
|
|
|
1171
1172
|
<div class="results-grid">
|
|
@@ -1173,16 +1174,14 @@ defineExpose({
|
|
|
1173
1174
|
v-for="resItem in generatedResults"
|
|
1174
1175
|
:key="resItem.id"
|
|
1175
1176
|
class="result-card"
|
|
1176
|
-
@click="emit('select', resItem)"
|
|
1177
|
+
@click.stop="emit('select', resItem)"
|
|
1177
1178
|
>
|
|
1178
|
-
<
|
|
1179
|
+
<VideoCoverThumb
|
|
1179
1180
|
v-if="resItem.type === 'video'"
|
|
1180
|
-
:
|
|
1181
|
-
|
|
1182
|
-
|
|
1181
|
+
:video-url="resItem.sourceUrl || resItem.url"
|
|
1182
|
+
:cover-url="resItem.coverUrl || resItem.previewUrl"
|
|
1183
|
+
:alt="resItem.title"
|
|
1183
1184
|
class="result-media"
|
|
1184
|
-
@mouseenter="($event.target as HTMLVideoElement)?.play?.()"
|
|
1185
|
-
@mouseleave="($event.target as HTMLVideoElement)?.pause?.()"
|
|
1186
1185
|
/>
|
|
1187
1186
|
<img
|
|
1188
1187
|
v-else
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from '@element-plus/icons-vue'
|
|
9
9
|
import { useSlides } from '../../composables/useSlides'
|
|
10
10
|
import { useDamAuth } from './useDamAuth'
|
|
11
|
+
import VideoCoverThumb from './VideoCoverThumb.vue'
|
|
11
12
|
import type { MaterialItem } from '../TemplateGallery.vue'
|
|
12
13
|
|
|
13
14
|
export interface DamProjectItem {
|
|
@@ -204,11 +205,28 @@ function selectFolderNode(proj: DamProjectItem, folder: DamFolderNode) {
|
|
|
204
205
|
reloadAssets()
|
|
205
206
|
}
|
|
206
207
|
|
|
207
|
-
function
|
|
208
|
-
|
|
208
|
+
function isVideoUrlString(url?: string): boolean {
|
|
209
|
+
if (!url) return false
|
|
210
|
+
const u = String(url).split('?')[0].split('#')[0].toLowerCase()
|
|
211
|
+
return (
|
|
212
|
+
u.endsWith('.mp4') ||
|
|
213
|
+
u.endsWith('.webm') ||
|
|
214
|
+
u.endsWith('.mov') ||
|
|
215
|
+
u.endsWith('.m4v') ||
|
|
216
|
+
u.endsWith('.avi') ||
|
|
217
|
+
u.endsWith('.mkv')
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function isVideoAsset(raw: any, meta?: any): boolean {
|
|
222
|
+
const assetType = String(raw.assetType || raw.mediaType || raw.type || meta?.assetType || '').toUpperCase()
|
|
209
223
|
if (assetType === 'VIDEO') return true
|
|
210
|
-
const
|
|
211
|
-
|
|
224
|
+
const subType = String(raw.assetSubType || meta?.assetSubType || meta?.category || '').toLowerCase()
|
|
225
|
+
if (['videos', 'video', 'footage', 'motion-graphics', 'video-templates'].includes(subType)) return true
|
|
226
|
+
const ext = String(raw.fileExtension || '').toLowerCase()
|
|
227
|
+
if (['mp4', 'webm', 'mov', 'm4v', 'avi', 'mkv'].includes(ext)) return true
|
|
228
|
+
const u = String(raw.fileUrl || raw.url || raw.ossUrl || raw.imageUrl || meta?.sourceUrl || '')
|
|
229
|
+
return isVideoUrlString(u)
|
|
212
230
|
}
|
|
213
231
|
|
|
214
232
|
/**
|
|
@@ -219,7 +237,16 @@ function normalizeDamAsset(raw: any): MaterialItem | null {
|
|
|
219
237
|
// semantic/search 接口返回的条目可能包裹在 asset 属性中
|
|
220
238
|
const entity = raw.asset && typeof raw.asset === 'object' ? { ...raw.asset, score: raw.score } : raw
|
|
221
239
|
|
|
222
|
-
|
|
240
|
+
let meta: any = {}
|
|
241
|
+
if (entity.metaDataJson) {
|
|
242
|
+
try {
|
|
243
|
+
meta = typeof entity.metaDataJson === 'string' ? JSON.parse(entity.metaDataJson) : entity.metaDataJson
|
|
244
|
+
} catch {
|
|
245
|
+
meta = {}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const primaryFileUrl =
|
|
223
250
|
entity.fileUrl ||
|
|
224
251
|
entity.imageUrl ||
|
|
225
252
|
entity.ossUrl ||
|
|
@@ -228,17 +255,32 @@ function normalizeDamAsset(raw: any): MaterialItem | null {
|
|
|
228
255
|
entity.previewUrl ||
|
|
229
256
|
entity.sourceUrl ||
|
|
230
257
|
''
|
|
231
|
-
|
|
258
|
+
const metaSourceUrl = meta.sourceUrl || meta.videoUrl || meta.downloadUrl || ''
|
|
259
|
+
if (!primaryFileUrl && !metaSourceUrl) return null
|
|
260
|
+
|
|
261
|
+
const isVid = isVideoAsset(entity, meta)
|
|
262
|
+
|
|
263
|
+
// 针对视频资产,区分真实视频播放源地址 (sourceUrl) 与静态封面图 (coverUrl / previewUrl)
|
|
264
|
+
const videoPlayUrl = isVid
|
|
265
|
+
? (meta._fileIsCoverFallback
|
|
266
|
+
? (metaSourceUrl || primaryFileUrl)
|
|
267
|
+
: (isVideoUrlString(primaryFileUrl) ? primaryFileUrl : (metaSourceUrl || primaryFileUrl)))
|
|
268
|
+
: (primaryFileUrl || metaSourceUrl)
|
|
269
|
+
|
|
270
|
+
const staticCoverCandidate =
|
|
271
|
+
entity.coverUrl ||
|
|
272
|
+
entity.thumbnailUrl ||
|
|
273
|
+
(entity.previewUrl && !isVideoUrlString(entity.previewUrl) ? entity.previewUrl : '') ||
|
|
274
|
+
meta.coverUrl ||
|
|
275
|
+
meta.thumbnail ||
|
|
276
|
+
meta.poster ||
|
|
277
|
+
(meta.previewUrl && !isVideoUrlString(meta.previewUrl) ? meta.previewUrl : '') ||
|
|
278
|
+
(meta.image && !isVideoUrlString(meta.image) ? meta.image : '') ||
|
|
279
|
+
(isVid && primaryFileUrl && !isVideoUrlString(primaryFileUrl) ? primaryFileUrl : '') ||
|
|
280
|
+
''
|
|
232
281
|
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
if (entity.metaDataJson) {
|
|
236
|
-
try {
|
|
237
|
-
meta = typeof entity.metaDataJson === 'string' ? JSON.parse(entity.metaDataJson) : entity.metaDataJson
|
|
238
|
-
} catch {
|
|
239
|
-
meta = {}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
282
|
+
const url = videoPlayUrl || primaryFileUrl
|
|
283
|
+
const previewUrl = isVid ? (staticCoverCandidate || videoPlayUrl) : (entity.previewUrl || staticCoverCandidate || url)
|
|
242
284
|
|
|
243
285
|
const rawTitle =
|
|
244
286
|
entity.name ||
|
|
@@ -270,7 +312,8 @@ function normalizeDamAsset(raw: any): MaterialItem | null {
|
|
|
270
312
|
sourceType: sourceType || (activeSourceSubTab.value === 'ai' ? 'GENERATE' : 'UPLOAD'),
|
|
271
313
|
badgeLabel,
|
|
272
314
|
url,
|
|
273
|
-
previewUrl
|
|
315
|
+
previewUrl,
|
|
316
|
+
coverUrl: staticCoverCandidate || undefined,
|
|
274
317
|
sourceUrl: url,
|
|
275
318
|
originalWidth: w > 0 ? w : undefined,
|
|
276
319
|
originalHeight: h > 0 ? h : undefined,
|
|
@@ -812,17 +855,14 @@ defineExpose({
|
|
|
812
855
|
v-for="item in colItems"
|
|
813
856
|
:key="item.id"
|
|
814
857
|
class="mine-asset-card"
|
|
815
|
-
@click="emit('select', item)"
|
|
858
|
+
@click.stop="emit('select', item)"
|
|
816
859
|
>
|
|
817
|
-
<
|
|
860
|
+
<VideoCoverThumb
|
|
818
861
|
v-if="item.type === 'video'"
|
|
819
|
-
:
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
playsinline
|
|
862
|
+
:video-url="item.sourceUrl || item.url"
|
|
863
|
+
:cover-url="item.coverUrl || item.previewUrl"
|
|
864
|
+
:alt="item.title"
|
|
823
865
|
class="mine-card-media"
|
|
824
|
-
@mouseenter="($event.target as HTMLVideoElement)?.play?.()"
|
|
825
|
-
@mouseleave="($event.target as HTMLVideoElement)?.pause?.()"
|
|
826
866
|
/>
|
|
827
867
|
<img
|
|
828
868
|
v-else
|