diff --git a/App.jsx b/App.jsx index 0292153..134bad8 100644 --- a/App.jsx +++ b/App.jsx @@ -2184,6 +2184,7 @@ const Styles = () => ( .web-thumb.tall img { object-fit: cover; object-position: top; } .web-thumb-add { width: 88px; height: 88px; border: 1px dashed var(--line); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--ink-soft); cursor: pointer; } .web-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-size: 11px; font-weight: 500; color: #1d7a3e; background: #dcf1e2; padding: 2px 8px; border-radius: 99px; } + .tpl-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 11px; font-weight: 500; color: #1e4f8a; background: #e1ecf8; padding: 2px 8px; border-radius: 99px; white-space: nowrap; } .web-tier-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; } .web-tier-preview div { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-variant-numeric: tabular-nums; } .web-tier-preview span { color: var(--ink-soft); } @@ -4287,7 +4288,7 @@ function MainApp({ username, onLogout }) { exportLang={productExportLang} onExportLangChange={setProductExportLang} exportLabels={productExportLabels} exportLoading={productExportLoading} onExportPdf={handleExportProductPdf} exportPdfBusy={productExportPdfBusy} - backPanelTemplates={backPanelTemplates} + backPanelTemplates={backPanelTemplates} webDetailTemplates={webDetailTemplates} onPatch={(patch) => setProducts(list => list.map(x => (x.id === selectedProduct.id ? { ...x, ...patch } : x)))} onNotify={notify} /> @@ -7617,6 +7618,12 @@ function DetailTemplateManager({ templates, setTemplates, products, setProducts, const active = templates.find(t => t.id === activeId) || null; const usage = (id) => products.filter(p => Array.isArray(p.webDetailTemplateIds) && p.webDetailTemplateIds.includes(id)).length; const update = (id, patch) => setTemplates(list => list.map(t => (t.id === id ? { ...t, ...patch } : t))); + // 搜索:模板名称,或者用了这个模板的产品型号(忽略大小写、空格、斜杠和横线) + const [tplQ, setTplQ] = useState(''); + const norm = (x) => String(x || '').toLowerCase().replace(/[\s/\-_]+/g, ''); + const tq = norm(tplQ); + const modelHits = (t) => (tq ? products.filter(p => Array.isArray(p.webDetailTemplateIds) && p.webDetailTemplateIds.includes(t.id) && (norm(p.name).includes(tq) || norm(p.model).includes(tq))) : []); + const shownTemplates = tq ? templates.filter(t => norm(t.name).includes(tq) || modelHits(t).length) : templates; function addTemplate() { const t = { id: newTemplateId(), name: `新模板 ${templates.length + 1}`, kind: 'images', images: [] }; @@ -7670,11 +7677,20 @@ function DetailTemplateManager({ templates, setTemplates, products, setProducts, const body = (