From be43f1a6a5c8c31b7046883d56a881404810d957 Mon Sep 17 00:00:00 2001 From: WuYongJie <549727955@qq.com> Date: Tue, 22 Sep 2026 18:43:07 +0800 Subject: [PATCH] feat: surface live clip metadata in search cards and share Include host and platform in keyword search, show date/host/platform on material cards and share detail, and reset live fields when switching material type. --- app/share/[id]/page.tsx | 20 ++++++++++++++++++++ components/UploadModal.tsx | 20 +++++++++++++++++++- components/home/MaterialCard.tsx | 10 ++++++++++ lib/material-query.ts | 2 ++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/app/share/[id]/page.tsx b/app/share/[id]/page.tsx index e9970bb5..28b5ea2a 100644 --- a/app/share/[id]/page.tsx +++ b/app/share/[id]/page.tsx @@ -38,6 +38,10 @@ interface Material { previewUrl: string productModel: string reportTitle?: string | null + liveDate?: string | Date | null + liveHost?: string | null + liveHostUserId?: string | null + livePlatform?: string | null categoryName: string sceneName: string platformName?: string // 平台分类 @@ -2063,6 +2067,22 @@ export default function SharePage() {

报告名称 / 检测对象

{material.reportTitle || '未填写'}

+ {material.materialType === '直播切片' && ( + <> +
+

直播日期

+

{material.liveDate ? String(material.liveDate).slice(0, 10) : '未填写'}

+
+
+

主播

+

{material.liveHost || '未填写'}

+
+
+

直播平台

+

{material.livePlatform || '未填写'}

+
+ + )}

文件数量

{reportViewerItems.length}

diff --git a/components/UploadModal.tsx b/components/UploadModal.tsx index 08d77270..e521d29a 100644 --- a/components/UploadModal.tsx +++ b/components/UploadModal.tsx @@ -189,6 +189,22 @@ export default function UploadModal({ onClose, onSuccess }: UploadModalProps) { const [liveHost, setLiveHost] = useState('') const [liveHostUserId, setLiveHostUserId] = useState('') const [livePlatform, setLivePlatform] = useState('') + + // 切换素材类型时清空直播切片字段,避免串类型残留 + useEffect(() => { + if (materialType !== '直播切片') { + setLiveDate('') + setLiveHost('') + setLiveHostUserId('') + setLivePlatform('') + } else if (!liveDate) { + const now = new Date() + const y = now.getFullYear() + const m = String(now.getMonth() + 1).padStart(2, '0') + const d = String(now.getDate()).padStart(2, '0') + setLiveDate(`${y}-${m}-${d}`) + } + }, [materialType]) const [uploading, setUploading] = useState(false) const [uploadProgress, setUploadProgress] = useState(0) @@ -1704,7 +1720,9 @@ export default function UploadModal({ onClose, onSuccess }: UploadModalProps) { ? '请填写任务号' : materialType === '材质' ? '请填写材质名称' - : '请填写SPU型号' + : materialType === '直播切片' + ? '请填写标题' + : '请填写SPU型号' ) return } diff --git a/components/home/MaterialCard.tsx b/components/home/MaterialCard.tsx index 4a2e5989..a8b7b821 100644 --- a/components/home/MaterialCard.tsx +++ b/components/home/MaterialCard.tsx @@ -18,6 +18,9 @@ export interface Material { id: string productModel: string reportTitle?: string | null + liveDate?: string | null + liveHost?: string | null + livePlatform?: string | null categoryName: string sceneName: string platformName?: string @@ -584,6 +587,13 @@ export default function MaterialCard({

{materialDisplayTitle}

+ {(material.materialType === '直播切片' && (material.liveDate || material.liveHost || material.livePlatform)) && ( +

+ {material.livePlatform && {material.livePlatform}} + {material.liveDate && {material.livePlatform ? ' · ' : ''}{String(material.liveDate).slice(0, 10)}} + {material.liveHost && · {material.liveHost}} +

+ )}

{fileSizeLabel && <>{fileSizeLabel} · } {material.authorName && <>{material.authorName} · } diff --git a/lib/material-query.ts b/lib/material-query.ts index fe947bde..9465e465 100644 --- a/lib/material-query.ts +++ b/lib/material-query.ts @@ -280,6 +280,8 @@ export async function buildMaterialSearchOrConditions(search: string): Promise 0) {