From 3619929195b8a14678522b1bb5ed64f7c5caff35 Mon Sep 17 00:00:00 2001 From: Nixevol Date: Sun, 5 Jul 2026 05:07:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aidocs/project_context.md | 1 + apps/admin/src/views/ArtworkEdit.vue | 44 ++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/aidocs/project_context.md b/aidocs/project_context.md index 0293963..af70e4b 100644 --- a/aidocs/project_context.md +++ b/aidocs/project_context.md @@ -158,6 +158,7 @@ - 客户端基础信息字段排版(2026-07-05):溯源详情页基础信息字段行由 flex 改为 grid,标签列桌面端固定 132px、窄屏 118px,值列自适应;标签单行省略、值列加粗并允许换行,避免“创作年代 / 出品时间”等长标签把字段行撑乱或与值错位。 - 图片预览滚轮缩放兜底(2026-07-05):后台和客户端共用的 `openMediaViewer` 在 PhotoSwipe `wheel` 事件中补充自定义缩放处理,拦截默认滚轮行为并按鼠标位置缩放当前图片;缩放上限至少放宽到初始比例 6 倍或 4 倍,避免认证文件、较小证书图等因 PhotoSwipe 默认上限判断导致鼠标滚轮看似无法放大。视频项仍通过 `isZoomable()` 自动跳过。 - 后台排序媒体预览分流(2026-07-05):`MediaSorter` 用于作品主图和溯源节点媒体排序上传;点击图片时现在只把图片项传入 PhotoSwipe 预览队列,打开样式与认证文件等图片预览保持一致,避免混入视频项影响图片查看体验。点击视频仍沿用原有媒体预览逻辑。 +- 后台详情页图片预览统一(2026-07-05):艺术品详情页中溯源时间轴图片和认证文件封面不再使用 Naive UI `n-image` 预览层,统一改为普通缩略图点击后调用后台 `openMediaViewer`。这样打开样式与后台其他图片预览一致,并能使用 PhotoSwipe 的鼠标滚轮缩放兜底;视频仍保持原页面内原生 video 控件。 ## 当前代码基准与注意事项 diff --git a/apps/admin/src/views/ArtworkEdit.vue b/apps/admin/src/views/ArtworkEdit.vue index 11e3af3..90534c4 100644 --- a/apps/admin/src/views/ArtworkEdit.vue +++ b/apps/admin/src/views/ArtworkEdit.vue @@ -181,7 +181,13 @@ preload="metadata" style="max-height: 90px; border-radius: 6px; background: #000" /> - + @@ -203,7 +209,13 @@
{{ c.issuer || '-' }}
@@ -324,6 +336,7 @@ import { artworkApi, templateApi } from '@/api'; import { useAuthStore } from '@/stores/auth'; import MediaUpload from '@/components/MediaUpload.vue'; import MediaSorter from '@/components/MediaSorter.vue'; +import { openMediaViewer } from '@/composables/openMediaViewer'; import { message, dialog } from '@/utils/feedback'; import { fmtDate, fmtSecond } from '@/utils/format'; @@ -659,6 +672,19 @@ const nodeForm = reactive({ nodeType: NodeType.CREATE, title: '', occurredA function isVideoMedia(m: any) { return m.type === 'video' || /\.(mp4|webm|mov|m4v)$/i.test(m.url || m.key || ''); } +function toViewerItem(m: any) { + return { url: m.url || m.key, name: m.name || m.key, type: m.type }; +} +function previewNodeImage(media: any[] = [], current: any) { + const images = (media || []).filter((item) => !isVideoMedia(item) && (item.url || item.key)); + const index = images.findIndex((item) => item === current); + void openMediaViewer(images.map(toViewerItem), Math.max(index, 0)); +} +function previewCert(cert: any) { + const url = cert.watermarkUrl || cert.originUrl; + if (!url) return; + void openMediaViewer([{ url, name: cert.name || cert.originKey || cert.watermarkKey }]); +} function openNode(n?: any) { editingNode.value = n?.id ?? null; editingNodeLocalId.value = n?.localId ?? null; @@ -810,10 +836,24 @@ onMounted(async () => { margin-top: 6px; flex-wrap: wrap; } +.node-media-image { + width: 64px; + height: 64px; + border-radius: 6px; + object-fit: cover; + cursor: zoom-in; +} .cert-meta { font-size: 12px; color: #6b7280; } +.cert-preview-image { + width: 100%; + height: 140px; + object-fit: cover; + cursor: zoom-in; + display: block; +} .cert-pending { height: 140px; display: flex;