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.
This commit is contained in:
WuYongJie 2026-09-22 18:43:07 +08:00
parent d8d843e6ad
commit be43f1a6a5
4 changed files with 51 additions and 1 deletions

View File

@ -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() {
<p className="mb-1 text-[12px] text-[#86898e]">报告名称 / 检测对象</p>
<p className="text-[15px] font-medium text-[#1a1c1d]">{material.reportTitle || '未填写'}</p>
</div>
{material.materialType === '直播切片' && (
<>
<div>
<p className="mb-1 text-[12px] text-[#86898e]">直播日期</p>
<p className="text-[15px] font-medium text-[#1a1c1d]">{material.liveDate ? String(material.liveDate).slice(0, 10) : '未填写'}</p>
</div>
<div>
<p className="mb-1 text-[12px] text-[#86898e]">主播</p>
<p className="text-[15px] font-medium text-[#1a1c1d]">{material.liveHost || '未填写'}</p>
</div>
<div>
<p className="mb-1 text-[12px] text-[#86898e]">直播平台</p>
<p className="text-[15px] font-medium text-[#1a1c1d]">{material.livePlatform || '未填写'}</p>
</div>
</>
)}
<div>
<p className="mb-1 text-[12px] text-[#86898e]">文件数量</p>
<p className="text-[15px] font-medium text-[#1a1c1d]">{reportViewerItems.length}</p>

View File

@ -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
}

View File

@ -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({
<h3 className="truncate font-display text-[16px] font-semibold tracking-[-0.03em] text-[#1a1c1d]">
{materialDisplayTitle}
</h3>
{(material.materialType === '直播切片' && (material.liveDate || material.liveHost || material.livePlatform)) && (
<p className="mt-1 truncate text-[12px] leading-relaxed text-[#86898e]">
{material.livePlatform && <span>{material.livePlatform}</span>}
{material.liveDate && <span>{material.livePlatform ? ' · ' : ''}{String(material.liveDate).slice(0, 10)}</span>}
{material.liveHost && <span> · {material.liveHost}</span>}
</p>
)}
<p className="mt-1.5 truncate text-[12px] leading-relaxed text-[#86898e]">
{fileSizeLabel && <><span className="font-en tabular-nums tracking-[0.04em]">{fileSizeLabel}</span> · </>}
{material.authorName && <><span>{material.authorName}</span> · </>}

View File

@ -280,6 +280,8 @@ export async function buildMaterialSearchOrConditions(search: string): Promise<a
{ categoryName: { contains: keyword, mode: 'insensitive' } },
{ sceneName: { contains: keyword, mode: 'insensitive' } },
{ authorName: { contains: keyword, mode: 'insensitive' } },
{ liveHost: { contains: keyword, mode: 'insensitive' } },
{ livePlatform: { contains: keyword, mode: 'insensitive' } },
]
if (skuMaterialIds.length > 0) {