From 5e2c1f76ebdd502167d5aef85cb55ba2238931a5 Mon Sep 17 00:00:00 2001 From: shy3130 Date: Sun, 25 Oct 2026 20:14:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E5=9B=9E=E6=B5=8B=E9=A1=B5?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E9=80=89=E6=8B=A9=E5=8C=BA=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E8=B0=83=E9=AB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 策略列表底部新增拖拽手柄 (指针捕获, 80-480px, 键盘上下方向键微调), 高度记忆到 localStorage, 刷新自动恢复。 Signed-off-by: shy3130 --- .../src/pages/backtest/StrategyBacktest.tsx | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/backtest/StrategyBacktest.tsx b/frontend/src/pages/backtest/StrategyBacktest.tsx index 370a31c2..36154a90 100644 --- a/frontend/src/pages/backtest/StrategyBacktest.tsx +++ b/frontend/src/pages/backtest/StrategyBacktest.tsx @@ -1654,6 +1654,32 @@ export function StrategyBacktest({ loadCandidate, onLoadConsumed }: { .map(([key, label]) => ({ key, label, value: Number(executionStats[key] ?? 0) })) .filter(item => item.value > 0) + // 策略选择区高度: 底部手柄上下拖动调整 (80–480px), 记忆到 localStorage + const [strategyListMaxH, setStrategyListMaxH] = useState(() => { + try { + const v = parseInt(localStorage.getItem('bt_strategy_list_maxh') || '', 10) + return v >= 80 && v <= 480 ? v : 128 + } catch { return 128 } + }) + useEffect(() => { + try { localStorage.setItem('bt_strategy_list_maxh', String(strategyListMaxH)) } catch { /* 私有模式等 */ } + }, [strategyListMaxH]) + const listResize = useRef<{ startY: number; startH: number } | null>(null) + const onListResizeStart = (e: React.PointerEvent) => { + listResize.current = { startY: e.clientY, startH: strategyListMaxH } + e.currentTarget.setPointerCapture(e.pointerId) + } + const onListResizeMove = (e: React.PointerEvent) => { + const st = listResize.current + if (!st) return + setStrategyListMaxH(Math.min(480, Math.max(80, st.startH + (e.clientY - st.startY)))) + } + const onListResizeEnd = (e: React.PointerEvent) => { + if (!listResize.current) return + listResize.current = null + e.currentTarget.releasePointerCapture(e.pointerId) + } + return (
{/* 配置面板 */} @@ -1733,7 +1759,7 @@ export function StrategyBacktest({ loadCandidate, onLoadConsumed }: { ))}
-
+
{strategies.isLoading && ( 加载中… )} @@ -1763,6 +1789,24 @@ export function StrategyBacktest({ loadCandidate, onLoadConsumed }: { ))}
+ {/* 底部拖拽手柄: 上下拉动调整策略列表高度 */} +
{ + if (e.key === 'ArrowDown') setStrategyListMaxH(h => Math.min(480, h + 16)) + else if (e.key === 'ArrowUp') setStrategyListMaxH(h => Math.max(80, h - 16)) + }} + className="group flex h-2 shrink-0 cursor-ns-resize items-center justify-center border-t border-border/50 bg-base/40 transition-colors hover:bg-accent/10 focus:outline-none focus-visible:bg-accent/15" + > + +