feat: 节点图片支持逐张标题与默认收缩展开,修复C端放大后无法拖动
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -255,11 +255,8 @@
|
||||
<n-form-item :label="t('pages.artwork.nodeDesc')">
|
||||
<n-input v-model:value="nodeForm.description" type="textarea" :rows="2" />
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('pages.artwork.nodeImages')">
|
||||
<media-upload v-model="nodeForm.images" type="image" :max="6" />
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('pages.artwork.nodeVideos')">
|
||||
<media-upload v-model="nodeForm.videos" type="video" :max="3" />
|
||||
<n-form-item :label="t('pages.artwork.nodeMedia')">
|
||||
<media-sorter v-model="nodeForm.media" :captionable="true" :max="12" />
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
@@ -408,21 +405,24 @@ async function saveBasic() {
|
||||
const nodeModal = ref(false);
|
||||
const nodeSaving = ref(false);
|
||||
const editingNode = ref<number | null>(null);
|
||||
const nodeForm = reactive<any>({ nodeType: NodeType.CREATE, title: '', occurredAt: null, location: '', description: '', images: [], videos: [] });
|
||||
const nodeForm = reactive<any>({ nodeType: NodeType.CREATE, title: '', occurredAt: null, location: '', description: '', media: [] });
|
||||
function isVideoMedia(m: any) {
|
||||
return m.type === 'video' || /\.(mp4|webm|mov|m4v)$/i.test(m.url || m.key || '');
|
||||
}
|
||||
function openNode(n?: any) {
|
||||
editingNode.value = n?.id ?? null;
|
||||
const media = (n?.media ?? []).map((m: any) => ({ key: m.key || m.url, url: m.url, name: m.name, type: m.type }));
|
||||
Object.assign(nodeForm, {
|
||||
nodeType: n?.nodeType ?? NodeType.CREATE,
|
||||
title: n?.title ?? '',
|
||||
occurredAt: n?.occurredAt ? fmtDate(n.occurredAt) : null,
|
||||
location: n?.location ?? '',
|
||||
description: n?.description ?? '',
|
||||
images: media.filter((m: any) => !isVideoMedia(m)),
|
||||
videos: media.filter((m: any) => isVideoMedia(m)),
|
||||
media: (n?.media ?? []).map((m: any) => ({
|
||||
key: m.key || m.url,
|
||||
url: m.url,
|
||||
name: m.name,
|
||||
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
|
||||
})),
|
||||
});
|
||||
nodeModal.value = true;
|
||||
}
|
||||
@@ -439,10 +439,11 @@ async function saveNode() {
|
||||
occurredAt: nodeForm.occurredAt || undefined,
|
||||
location: nodeForm.location,
|
||||
description: nodeForm.description,
|
||||
mediaFiles: [
|
||||
...nodeForm.images.map((m: any) => ({ key: m.key, name: m.name, type: 'image' })),
|
||||
...nodeForm.videos.map((m: any) => ({ key: m.key, name: m.name, type: 'video' })),
|
||||
],
|
||||
mediaFiles: nodeForm.media.map((m: any) => ({
|
||||
key: m.key,
|
||||
name: m.name,
|
||||
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
|
||||
})),
|
||||
};
|
||||
if (editingNode.value) await artworkApi.updateNode(editingNode.value, payload);
|
||||
else await artworkApi.createNode(artworkId.value, payload);
|
||||
|
||||
Reference in New Issue
Block a user