feat: 新增媒体排序组件,支持图片与视频的拖拽排序与上传,优化媒体查看器功能

This commit is contained in:
Nixevol
2026-06-28 23:49:49 +08:00
parent 658d9571da
commit d18b7c592d
15 changed files with 1363 additions and 95 deletions
+11 -3
View File
@@ -54,7 +54,7 @@
</n-grid>
<n-divider style="margin: 4px 0 16px">{{ t('pages.artwork.images') }}</n-divider>
<media-upload v-model="form.images" type="image" :max="8" />
<media-sorter v-model="form.images" :max="12" />
</n-form>
<div style="text-align: right; margin-top: 16px">
<n-button type="primary" :loading="saving" :disabled="!auth.canWrite" @click="saveBasic">
@@ -251,6 +251,7 @@ import { ArtworkStatus, CertType, NodeType } from '@artveris/shared';
import { artworkApi, templateApi, traceCodeApi } from '@/api';
import { useAuthStore } from '@/stores/auth';
import MediaUpload from '@/components/MediaUpload.vue';
import MediaSorter from '@/components/MediaSorter.vue';
import { message, dialog } from '@/utils/feedback';
import { fmt, fmtDate, statusType } from '@/utils/format';
@@ -310,7 +311,10 @@ async function loadArtwork() {
form.artist = a.artist;
form.status = a.status;
form.dynamicFields = a.dynamicFields || {};
form.images = a.images || [];
form.images = (a.images || []).map((m: any) => ({
...m,
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
}));
nodes.value = a.traceNodes || [];
certs.value = a.certificates || [];
}
@@ -329,7 +333,11 @@ async function saveBasic() {
artist: form.artist,
status: form.status,
dynamicFields: form.dynamicFields,
images: form.images.map((m: any) => ({ key: m.key, name: m.name })),
images: form.images.map((m: any) => ({
key: m.key,
name: m.name,
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
})),
};
if (isNew.value) {
const created: any = await artworkApi.create(payload);