优化脚本

This commit is contained in:
Azmat@qq.com
2026-08-21 10:28:35 +08:00
parent 6c588a7fee
commit c2d3a786a3
23 changed files with 1461 additions and 287 deletions
+7 -4
View File
@@ -79,7 +79,7 @@ export function ProjectWizardPage({ products, projects = [], preselectProductId,
useEffect(() => {
const p = products.find((item) => item.id === productId);
const seed: Record<string, boolean> = {};
(p?.selling_points || []).forEach((sp) => { seed[sp.title] = false; });
(p?.selling_points || []).forEach((sp) => { seed[sp.id || sp.title] = false; });
setPoints(seed);
}, [productId, products]);
@@ -344,12 +344,15 @@ export function ProjectWizardPage({ products, projects = [], preselectProductId,
<div className="nw-field">
<span>关键卖点<small>可勾选要重点突出的</small></span>
<div className="nw-pills">
{Object.entries(points).map(([key, on]) => (
{Object.entries(points).map(([key, on]) => {
const label = product?.selling_points?.find((sp) => (sp.id || sp.title) === key)?.title || key;
return (
<button className={`nw-pill${on ? " on" : ""}`} type="button" key={key} aria-pressed={on} onClick={() => setPoints((prev) => ({ ...prev, [key]: !prev[key] }))}>
{on && <Check size={13} />}
<span>{key}</span>
<span>{label}</span>
</button>
))}
);
})}
</div>
</div>
)}