diff --git a/app/share/[id]/page.tsx b/app/share/[id]/page.tsx index e9970bb..28b5ea2 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 08d7727..e521d29 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 4a2e598..a8b7b82 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 fe947bd..9465e46 100644 --- a/lib/material-query.ts +++ b/lib/material-query.ts @@ -280,6 +280,8 @@ export async function buildMaterialSearchOrConditions(search: string): Promise 0) {