From 632b7b67a907037faead412f1ca61e29aa70e5ac Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 5 Nov 2026 11:57:33 +0800 Subject: [PATCH] Update App.jsx via upload script - 2026-11-05 11:57:23 --- App.jsx | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/App.jsx b/App.jsx index 8a9c1b0..db38e68 100644 --- a/App.jsx +++ b/App.jsx @@ -2532,6 +2532,10 @@ function MainApp({ username, onLogout }) { const [dragCustomerIdx, setDragCustomerIdx] = useState(null); const [dragCustomerVip, setDragCustomerVip] = useState(false); // 正在拖拽的卡片属于VIP组还是普通组 const [dragGroupState, setDragGroupState] = useState(null); // { category, index } + // 产品分组:各大类默认收拢(只显示类目名、数量、品牌、类型),点类目标题展开产品列表;离开页面再进来又是全部收拢 + const [groupsOpen, setGroupsOpen] = useState(() => new Set()); + useEffect(() => { if (view === 'groups') setGroupsOpen(new Set()); }, [view]); + const toggleGroup = (id) => setGroupsOpen(prev => { const n = new Set(prev); if (n.has(id)) n.delete(id); else n.add(id); return n; }); const [pwCurrent, setPwCurrent] = useState(''); const [pwNew, setPwNew] = useState(''); @@ -4026,13 +4030,24 @@ function MainApp({ username, onLogout }) { {view === 'groups' && ( <> -
按产品大类分组浏览;每个类目右上角管理品牌,类目内第二行管理类型;新建产品时先选类目,再从对应的品牌 / 类型里选。
+
按产品大类分组浏览;每个类目右上角管理品牌,类目内第二行管理类型;新建产品时先选类目,再从对应的品牌 / 类型里选。点类目名称展开或收拢产品列表。
+
+ + +
{productCategories.map(cat => { const items = products.filter(p => p.category === cat.id); + const open = groupsOpen.has(cat.id); return (
-
{cat.name}({items.length})
+
toggleGroup(cat.id)} + onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleGroup(cat.id); } }}> + + {cat.name}({items.length}) +
-
+ {open &&
{items.length === 0 ? (
暂无产品
) : items.map((p, idx) => ( @@ -4073,7 +4088,7 @@ function MainApp({ username, onLogout }) {
))} -
+
}
); })}