From 6c299f1a1d0f3454de0a5fff0f0905bc849377a9 Mon Sep 17 00:00:00 2001 From: jacy <18049821889@163.com> Date: Wed, 22 Jul 2026 11:45:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E8=AF=A6=E6=83=85=EF=BC=88=E5=AE=A1=E6=A0=B8=E6=8A=BD=E5=B1=89?= =?UTF-8?q?=EF=BC=89=E5=8A=A0=E4=B8=8A=E3=80=8C=E5=AE=A1=E6=A0=B8=E6=9D=90?= =?UTF-8?q?=E6=96=99=E3=80=8D=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/admin-web/src/pages/StoresPage.tsx | 220 +++++++++++++++++++++++- 1 file changed, 213 insertions(+), 7 deletions(-) diff --git a/apps/admin-web/src/pages/StoresPage.tsx b/apps/admin-web/src/pages/StoresPage.tsx index d4ab23d..411203b 100644 --- a/apps/admin-web/src/pages/StoresPage.tsx +++ b/apps/admin-web/src/pages/StoresPage.tsx @@ -19,8 +19,15 @@ import { message, } from 'antd'; import type { ColumnsType } from 'antd/es/table'; +import { FilePdfOutlined, LinkOutlined } from '@ant-design/icons'; import { request, type Paginated } from '../lib/api'; -import { ADMIN_OPTIONS_PAGE_SIZE, STORE_AUDIT_STATUS_LABELS, STORE_STATUS_LABELS, fmtTime } from '../lib/constants'; +import { + ADMIN_OPTIONS_PAGE_SIZE, + RESOURCE_BIZ_TYPE_LABELS, + STORE_AUDIT_STATUS_LABELS, + STORE_STATUS_LABELS, + fmtTime, +} from '../lib/constants'; import { validateStoreCreateStep1, validateStoreCreateStep3, @@ -37,6 +44,209 @@ const CREATE_STEPS = [ { title: '结算资质' }, ]; +type StoreMediaItem = { + id?: string; + bizType?: string; + mediaType?: string; + url?: string | null; +}; + +function isImageMedia(url: string, mediaType?: string) { + if (mediaType === 'IMAGE') return true; + if (mediaType === 'VIDEO' || mediaType === 'FILE') { + return /\.(png|jpe?g|gif|webp|bmp|heic)(\?|#|$)/i.test(url); + } + return /\.(png|jpe?g|gif|webp|bmp|heic)(\?|#|$)/i.test(url); +} + +function isPdfUrl(url: string) { + return /\.pdf(\?|#|$)/i.test(url); +} + +function collectMediaUrls(detail: Record) { + const media = Array.isArray(detail.media) ? (detail.media as StoreMediaItem[]) : []; + const byType = (bizType: string) => + media + .filter((item) => String(item.bizType || '').toUpperCase() === bizType) + .map((item) => ({ + id: String(item.id || item.url || ''), + url: String(item.url || '').trim(), + mediaType: item.mediaType ? String(item.mediaType) : undefined, + })) + .filter((item) => item.url); + + const covers = byType('COVER'); + const coverUrl = detail.coverUrl ? String(detail.coverUrl).trim() : ''; + if (coverUrl && !covers.some((item) => item.url === coverUrl)) { + covers.unshift({ id: 'cover', url: coverUrl, mediaType: 'IMAGE' }); + } + + return { + covers, + envs: byType('ENV'), + contracts: byType('CONTRACT'), + }; +} + +function StoreAuditMediaSection({ detail }: { detail: Record }) { + const { covers, envs, contracts } = collectMediaUrls(detail); + const [pdfUrl, setPdfUrl] = useState(null); + const gallery = [...covers, ...envs].filter((item) => isImageMedia(item.url, item.mediaType)); + + if (covers.length === 0 && envs.length === 0 && contracts.length === 0) { + return ( + + ); + } + + return ( +
+ + 审核材料 + + + {(covers.length > 0 || envs.length > 0) && ( +
+ + 门头照 / 环境照(点击可放大浏览) + + + + {gallery.map((item) => ( +
+ +
+ {covers.some((c) => c.id === item.id) ? '门头照' : '环境照'} +
+
+ ))} +
+
+
+ )} + + {contracts.length > 0 && ( +
+ + 签约合同 + + + {contracts.map((item, index) => { + const imageLike = isImageMedia(item.url, item.mediaType); + const pdf = isPdfUrl(item.url); + return ( +
+ {imageLike ? ( + + + + ) : ( +
+ +
+ )} + + + {RESOURCE_BIZ_TYPE_LABELS.CONTRACT || '合同'} + {contracts.length > 1 ? ` ${index + 1}` : ''} + + + {item.url} + + + {imageLike ? ( + 点击缩略图放大查看 + ) : null} + {pdf ? ( + + ) : null} + + + +
+ ); + })} +
+
+ )} + + setPdfUrl(null)} + width={900} + footer={[ + , + , + ]} + destroyOnClose + > + {pdfUrl ? ( +