Update App.jsx via upload script - 2026-11-12 17:18:38
This commit is contained in:
parent
5e116bf01b
commit
de707bdfa8
27
App.jsx
27
App.jsx
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useState, useEffect, useMemo, useRef } from 'react';
|
import React, { useState, useEffect, useMemo, useRef } from 'react';
|
||||||
import {
|
import {
|
||||||
Search, Plus, X, Mail, Edit2, Trash2, Check, Clock,
|
Search, Plus, X, Mail, Edit2, Trash2, Check, Clock,
|
||||||
Settings as SettingsIcon, Copy, ChevronRight, Upload, Eye,
|
Settings as SettingsIcon, Copy, ChevronRight, Upload, Eye, EyeOff,
|
||||||
Building2, Globe, Phone, Save, RefreshCw, LayoutDashboard, Users,
|
Building2, Globe, Phone, Save, RefreshCw, LayoutDashboard, Users,
|
||||||
Package, Layers, Zap, Tag, Inbox, Paperclip,
|
Package, Layers, Zap, Tag, Inbox, Paperclip,
|
||||||
Menu, LogOut, GripVertical, BookOpen, FileText, FolderTree, Lock, Sparkles, Printer, Image as ImageIcon,
|
Menu, LogOut, GripVertical, BookOpen, FileText, FolderTree, Lock, Sparkles, Printer, Image as ImageIcon,
|
||||||
|
|
@ -2184,6 +2184,9 @@ const Styles = () => (
|
||||||
.web-thumb.tall img { object-fit: cover; object-position: top; }
|
.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-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; }
|
.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; }
|
||||||
|
.brand-vis { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; font-weight: 500; }
|
||||||
|
.brand-vis button { display: inline-flex; align-items: center; gap: 3px; border: 0; background: transparent; font-size: 11px; padding: 1px 8px; cursor: pointer; color: var(--ink-soft); }
|
||||||
|
.brand-vis button.on { background: var(--ink); color: #fff; }
|
||||||
.tpl-badge.bad { color: #b42318 !important; background: #fde4e1 !important; font-weight: 600; }
|
.tpl-badge.bad { color: #b42318 !important; background: #fde4e1 !important; font-weight: 600; }
|
||||||
.tpl-warn { font-size: 12.5px; color: #b42318; background: #fef1ef; border: 1px solid #f5b5ac; border-radius: 8px; padding: 9px 12px; line-height: 1.6; }
|
.tpl-warn { font-size: 12.5px; color: #b42318; background: #fef1ef; border: 1px solid #f5b5ac; border-radius: 8px; padding: 9px 12px; line-height: 1.6; }
|
||||||
.tpl-warn-link { background: none; border: 0; padding: 0; color: #b42318; text-decoration: underline; cursor: pointer; font: inherit; }
|
.tpl-warn-link { background: none; border: 0; padding: 0; color: #b42318; text-decoration: underline; cursor: pointer; font: inherit; }
|
||||||
|
|
@ -9055,13 +9058,14 @@ function ProductForm({ draft, setDraft, onSave, onCancel, categories, onManage,
|
||||||
<div className="grid-2">
|
<div className="grid-2">
|
||||||
<div className="field">
|
<div className="field">
|
||||||
<div className="field-label-row">
|
<div className="field-label-row">
|
||||||
<span className="field-label">品牌</span>
|
<span className="field-label" style={{ display: 'flex', alignItems: 'center', gap: 8 }}>品牌<BrandVisibilityToggle hidden={!!draft.hideBrand} onChange={(h) => set({ hideBrand: h })} /></span>
|
||||||
<span className="field-manage-link" onClick={() => onManage('brand')}><Settings2 size={11} />品牌管理</span>
|
<span className="field-manage-link" onClick={() => onManage('brand')}><Settings2 size={11} />品牌管理</span>
|
||||||
</div>
|
</div>
|
||||||
<select className="select" value={draft.brand} disabled={!cat} onChange={e => set({ brand: e.target.value })}>
|
<select className="select" value={draft.brand} disabled={!cat} onChange={e => set({ brand: e.target.value })}>
|
||||||
<option value="">{!cat ? '请先选择产品大类' : brandOptions.length === 0 ? '该类目暂无品牌,点右上角管理添加' : '请选择'}</option>
|
<option value="">{!cat ? '请先选择产品大类' : brandOptions.length === 0 ? '该类目暂无品牌,点右上角管理添加' : '请选择'}</option>
|
||||||
{brandOptions.map(b => <option key={b} value={b}>{b}</option>)}
|
{brandOptions.map(b => <option key={b} value={b}>{b}</option>)}
|
||||||
</select>
|
</select>
|
||||||
|
{draft.hideBrand && <span style={{ fontSize: 12, color: 'var(--ink-soft)' }}>已隐藏:导出的技术参数表和网站参数表里不显示品牌</span>}
|
||||||
</div>
|
</div>
|
||||||
<div className="field">
|
<div className="field">
|
||||||
<div className="field-label-row">
|
<div className="field-label-row">
|
||||||
|
|
@ -9833,7 +9837,8 @@ function ProductDetail({ product: p, onEdit, onDelete, onCopy, copying, categori
|
||||||
<div className="panel-body" style={{ padding: 18 }}>
|
<div className="panel-body" style={{ padding: 18 }}>
|
||||||
<div className="grid-2" style={{ marginBottom: 16 }}>
|
<div className="grid-2" style={{ marginBottom: 16 }}>
|
||||||
<Info icon={<Layers size={13} />} label="分类" value={categoryBreadcrumb(p, categories)} />
|
<Info icon={<Layers size={13} />} label="分类" value={categoryBreadcrumb(p, categories)} />
|
||||||
<Info icon={<Building2 size={13} />} label="品牌" value={p.brand || '—'} />
|
<Info icon={<Building2 size={13} />} label={<>品牌{onPatch && <BrandVisibilityToggle hidden={!!p.hideBrand} onChange={(h) => { onPatch({ hideBrand: h }); onNotify && onNotify(h ? '品牌已隐藏:导出的参数表里不显示品牌' : '品牌已设为显示'); }} />}</>}
|
||||||
|
value={p.hideBrand ? <span style={{ color: 'var(--ink-soft)' }}>{p.brand || '—'}(已隐藏,不输出)</span> : (p.brand || '—')} />
|
||||||
{showMachineVariant && <Info icon={<Tag size={13} />} label="机型" value={p.machineVariant ? `${normalizeMachineVariant(p.machineVariant)} ${MACHINE_VARIANT_NOTES[normalizeMachineVariant(p.machineVariant)] || ''}`.trim() : '—'} />}
|
{showMachineVariant && <Info icon={<Tag size={13} />} label="机型" value={p.machineVariant ? `${normalizeMachineVariant(p.machineVariant)} ${MACHINE_VARIANT_NOTES[normalizeMachineVariant(p.machineVariant)] || ''}`.trim() : '—'} />}
|
||||||
{powerInfoItems(p, categories).map(item => (
|
{powerInfoItems(p, categories).map(item => (
|
||||||
<Info key={item.key} icon={<Zap size={13} />} label={item.label} value={item.value} />
|
<Info key={item.key} icon={<Zap size={13} />} label={item.label} value={item.value} />
|
||||||
|
|
@ -9876,7 +9881,7 @@ function ProductDetail({ product: p, onEdit, onDelete, onCopy, copying, categori
|
||||||
<table className="doc-table spec-sheet-table">
|
<table className="doc-table spec-sheet-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td className="spec-label">{L('型号')}</td><td>{p.name || '—'}</td></tr>
|
<tr><td className="spec-label">{L('型号')}</td><td>{p.name || '—'}</td></tr>
|
||||||
{p.brand && <tr><td className="spec-label">{L('品牌')}</td><td>{p.brand}</td></tr>}
|
{p.brand && !p.hideBrand && <tr><td className="spec-label">{L('品牌')}</td><td>{p.brand}</td></tr>}
|
||||||
<tr><td className="spec-label">{L('产品大类')}</td><td>{cat ? L(cat.name) : '—'}</td></tr>
|
<tr><td className="spec-label">{L('产品大类')}</td><td>{cat ? L(cat.name) : '—'}</td></tr>
|
||||||
{p.type && <tr><td className="spec-label">{L('细分品类')}</td><td>{L(p.type)}</td></tr>}
|
{p.type && <tr><td className="spec-label">{L('细分品类')}</td><td>{L(p.type)}</td></tr>}
|
||||||
{showMachineVariant && <tr><td className="spec-label">{L('机型')}</td><td>{`${L(normalizeMachineVariant(p.machineVariant))} ${MACHINE_VARIANT_NOTES[normalizeMachineVariant(p.machineVariant)] || ''}`.trim()}</td></tr>}
|
{showMachineVariant && <tr><td className="spec-label">{L('机型')}</td><td>{`${L(normalizeMachineVariant(p.machineVariant))} ${MACHINE_VARIANT_NOTES[normalizeMachineVariant(p.machineVariant)] || ''}`.trim()}</td></tr>}
|
||||||
|
|
@ -9899,7 +9904,7 @@ function ProductDetail({ product: p, onEdit, onDelete, onCopy, copying, categori
|
||||||
<img className="spec-sheet-image-full" src={`/uploads/${p.id}/${p.productImageFileName}`} alt={p.name || ''} />
|
<img className="spec-sheet-image-full" src={`/uploads/${p.id}/${p.productImageFileName}`} alt={p.name || ''} />
|
||||||
)}
|
)}
|
||||||
<div style={{ fontSize: 28, fontWeight: 800, marginTop: 20 }}>{p.name || '—'}</div>
|
<div style={{ fontSize: 28, fontWeight: 800, marginTop: 20 }}>{p.name || '—'}</div>
|
||||||
{p.brand && <div style={{ color: '#888', marginTop: 4, fontSize: 15 }}>{p.brand}</div>}
|
{p.brand && !p.hideBrand && <div style={{ color: '#888', marginTop: 4, fontSize: 15 }}>{p.brand}</div>}
|
||||||
{sellingPointLines.length > 0 && (
|
{sellingPointLines.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<div className="spec-sheet-bar" style={{ marginTop: 24 }}>{L('主要特点')}</div>
|
<div className="spec-sheet-bar" style={{ marginTop: 24 }}>{L('主要特点')}</div>
|
||||||
|
|
@ -9919,7 +9924,7 @@ function ProductDetail({ product: p, onEdit, onDelete, onCopy, copying, categori
|
||||||
<>
|
<>
|
||||||
<div style={{ marginBottom: 20 }}>
|
<div style={{ marginBottom: 20 }}>
|
||||||
<div style={{ fontSize: 26, fontWeight: 800 }}>{p.name || '—'}</div>
|
<div style={{ fontSize: 26, fontWeight: 800 }}>{p.name || '—'}</div>
|
||||||
{p.brand && <div style={{ color: '#888', marginTop: 4 }}>{p.brand}</div>}
|
{p.brand && !p.hideBrand && <div style={{ color: '#888', marginTop: 4 }}>{p.brand}</div>}
|
||||||
</div>
|
</div>
|
||||||
<div className="spec-sheet-bar">{L('产品规格书')}</div>
|
<div className="spec-sheet-bar">{L('产品规格书')}</div>
|
||||||
{specTable}
|
{specTable}
|
||||||
|
|
@ -10378,6 +10383,16 @@ function PackingListEditor({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 品牌"显示 / 隐藏"开关:隐藏后导出的技术参数表(PDF)和网站参数表都不显示品牌
|
||||||
|
function BrandVisibilityToggle({ hidden, onChange }) {
|
||||||
|
return (
|
||||||
|
<span className="brand-vis" role="group" aria-label="品牌显示或隐藏">
|
||||||
|
<button type="button" className={!hidden ? 'on' : ''} onClick={() => onChange(false)}><Eye size={11} />显示</button>
|
||||||
|
<button type="button" className={hidden ? 'on' : ''} onClick={() => onChange(true)}><EyeOff size={11} />隐藏</button>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function Info({ icon, label, value }) {
|
function Info({ icon, label, value }) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue