fix(product-detail): 修素材类型标签映射 + 审核态只显送审类

- PD_ASSET_TYPE_LABEL 改对并补全:person→角色(原误为「模特上身图」)、scene→场景(原误为
  「平台套图」)、补 model_portrait/model_tryon/platform_kit/free_create/storyboard/video_clip
  (老数据里分镜=scene、形象图=person 因此前张冠李戴)
- 审核态(火山人像审核)只渲染在送审三类(person/tri_view/storyboard)上;其余素材根本不送审,
  此前一律标「待审核」是误导,现不显

验收:tsc+build 绿;无头核对(角色显「角色」+待审核、商品图无审核态、0 console error)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
seaislee1209
2026-06-21 22:13:36 +08:00
parent 725f7aa001
commit 3fda75ce65
2 changed files with 43 additions and 4 deletions
+20 -4
View File
@@ -545,9 +545,22 @@ function pdAssetPreview(asset?: Asset): string {
if (!asset) return "";
return asset.files?.find((file) => file.is_primary)?.preview_url || asset.files?.[0]?.preview_url || "";
}
// AI 素材分类 → 中文类型标签(用于缩图左上角 type-pill)
// 送审类(火山人像审核真实作用的只有视频流程人脸三类):只有这几类才显审核态
const PD_REVIEW_CATS = new Set(["person", "tri_view", "storyboard"]);
// AI 素材分类 → 中文类型标签(用于缩图左上角 type-pill)。与资产库 CATEGORY_LABELS 保持一致。
const PD_ASSET_TYPE_LABEL: Record<string, string> = {
product_image: "商品图", person: "模特上身图", scene: "平台套图", tri_view: "三视图", background: "背景图"
product_image: "商品图",
person: "角色",
model_portrait: "模特形象图",
tri_view: "三视图",
model_tryon: "模特上身图",
platform_kit: "平台套图",
free_create: "自由创作",
scene: "场景",
storyboard: "分镜图",
video_clip: "视频素材",
final_video: "最终成片",
background: "背景图"
};
function pdAssetTypeLabel(asset: Asset): string {
return PD_ASSET_TYPE_LABEL[asset.category] || PD_ASSET_TYPE_LABEL[asset.asset_type] || asset.category || "素材";
@@ -1086,8 +1099,11 @@ export function ProductDetailPage({ product, projects, initialTab = "assets", na
{url ? null : <span className="ph-frame">3:4</span>}
</div>
<div className="meta">
{/* 审核状态(只读):团队审核给出 通过 / 不通过,未定论显示 待审核 —— 不再是可点切换的按钮 */}
<span className={`pill ${status}`} data-status={status} title="素材审核状态 · 由团队审核决定">{PD_ASSET_STATUS_LABEL[status]}</span>
{/* 审核状态(只读):仅视频流程人脸三类(角色/三视图/分镜)才真送火山审核 → 才显审核态;
其余素材无需审核,不显(此前一律标「待审核」是误导)。 */}
{PD_REVIEW_CATS.has(asset.category) && (
<span className={`pill ${status}`} data-status={status} title="火山人像审核状态(仅含人脸的视频素材送审)">{PD_ASSET_STATUS_LABEL[status]}</span>
)}
<span className="date">{(asset.created_at || "").slice(0, 10)}</span>
</div>
</div>
+23
View File
@@ -0,0 +1,23 @@
import { chromium } from "playwright";
import path from "node:path"; import fs from "node:fs";
const PID="53d7a7c3-2f41-431b-82d3-3acc97900310";
const OUT=path.resolve("../../../_qa_shots/pd"); fs.mkdirSync(OUT,{recursive:true});
const b=await chromium.launch({headless:true}); const r={consoleErrors:[]};
const p=await (await b.newContext({viewport:{width:1440,height:1000}})).newPage();
p.on("console",m=>{if(m.type()==="error")r.consoleErrors.push(m.text())}); p.on("pageerror",e=>r.consoleErrors.push("PE:"+e.message));
await p.goto("http://localhost:5200/login"); await p.waitForTimeout(300);
await p.fill("#auth-username","airshelf"); await p.fill("#auth-pwd","Restraint2026");
await p.click("button.btn-cta"); await p.waitForFunction(()=>!location.pathname.startsWith("/login"),{timeout:12000});
await p.goto("http://localhost:5200/products/"+PID); await p.waitForTimeout(3000);
// 收集每张素材卡的 类型标签 + 是否有审核态
const cards=await p.locator(".asset-card").count();
const rows=[];
for(let i=0;i<Math.min(cards,20);i++){
const c=p.locator(".asset-card").nth(i);
const type=await c.locator(".type-pill").innerText().catch(()=>"");
const status=await c.locator(".meta .pill").innerText().catch(()=>"");
rows.push({type, status: status||"(无)"});
}
r.cards=cards; r.sample=rows;
await p.locator("#asset-grid, .asset-grid").first().screenshot({path:path.join(OUT,"pd-materials.png")}).catch(()=>p.screenshot({path:path.join(OUT,"pd-full.png"),fullPage:true}));
await b.close(); console.log(JSON.stringify(r,null,2));