From ab755b8d04056d24fac35bc5d3df2cf4c225514c Mon Sep 17 00:00:00 2001 From: yml2213 Date: Sat, 17 Oct 2026 19:52:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E5=A2=9E=E5=8A=A0=E4=BD=9C?= =?UTF-8?q?=E6=88=98=E8=A1=A8=E4=B8=8E=E6=97=A5=E5=BF=97=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E5=8F=AF=E6=8B=96=E6=8B=BD=E8=B0=83=E8=8A=82?= =?UTF-8?q?=E5=88=86=E5=89=B2=E6=9D=A1=EF=BC=8C=E7=B4=A7=E5=87=91=E5=8C=96?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=88=97=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 布局增加左右可拖动分割条:支持按住拖拽自由调节左侧作战表与右侧面板宽度比例(30%~85%),双击恢复默认 62%,支持 localStorage 本地记忆 - 紧凑优化作战表列宽:各列宽度微调,scroll 改为 max-content,彻底解决小分辨率下最右侧'兑换记录'按钮被横向滚动条遮挡问题 - 升级版本号至 0.5.3 --- frontend/package.json | 2 +- frontend/src/App.tsx | 97 ++++++++++++++++++++++++++++++++----- frontend/src/styles.css | 60 ++++++++++++++++++++--- internal/version/version.go | 6 +-- wails.json | 2 +- 5 files changed, 144 insertions(+), 23 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 981099c..f0ff9de 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "huya-go-frontend", "private": true, - "version": "0.5.2", + "version": "0.5.3", "type": "module", "scripts": { "dev": "vite --host 127.0.0.1", diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index eb9cb91..3e40199 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -70,6 +70,8 @@ const defaultConcurrency = 30 const legacyDefaultSID = 2203 const defaultSID = 2277 const sidDefaultMigrationBase = 'huya-go.gui.sid-v2277.v1' +const defaultMainSplit = 62 +const splitStorageKeyBase = 'huya-go.gui.main-split.v1' // 界面本地存储保留的日志上限,与后端的增量拉取配合使用。 const maxClientLogs = 1000 @@ -774,6 +776,54 @@ export default function Dashboard() { const [debugLog, setDebugLog] = useState(false) const [instanceInfo, setInstanceInfo] = useState(null) const [appVersion, setAppVersion] = useState('') + const [mainSplit, setMainSplit] = useState(() => { + try { + const saved = Number(localStorage.getItem(scopedKey(splitStorageKeyBase))) + if (saved >= 30 && saved <= 85) return saved + } catch {} + return defaultMainSplit + }) + const [isDraggingSplit, setIsDraggingSplit] = useState(false) + const mainGridRef = useRef(null) + + const handleSplitMouseDown = (e: React.MouseEvent) => { + e.preventDefault() + setIsDraggingSplit(true) + + const container = mainGridRef.current + if (!container) return + + const rect = container.getBoundingClientRect() + + const onMouseMove = (moveEvent: MouseEvent) => { + const offsetX = moveEvent.clientX - rect.left + const percent = Math.min(85, Math.max(30, (offsetX / rect.width) * 100)) + setMainSplit(percent) + } + + const onMouseUp = () => { + setIsDraggingSplit(false) + window.removeEventListener('mousemove', onMouseMove) + window.removeEventListener('mouseup', onMouseUp) + setMainSplit((latest) => { + try { + localStorage.setItem(scopedKey(splitStorageKeyBase), String(Math.round(latest))) + } catch {} + return latest + }) + } + + window.addEventListener('mousemove', onMouseMove) + window.addEventListener('mouseup', onMouseUp) + } + + const handleSplitDoubleClick = () => { + setMainSplit(defaultMainSplit) + try { + localStorage.setItem(scopedKey(splitStorageKeyBase), String(defaultMainSplit)) + } catch {} + message.info('已恢复默认左右宽度 (62%)') + } const applyCookieEntries = async (entries: CookieEntry[], persist = true, refreshLatest = false) => { const normalizedEntries = entries @@ -1556,7 +1606,7 @@ export default function Dashboard() { () => [ { title: '账号', - width: 150, + width: 130, render: (_, row) => (
{row.uid || `第${row.line}行`} @@ -1574,7 +1624,7 @@ export default function Dashboard() { }, { title: '凭据', - width: 110, + width: 85, render: (_, row) => row.checkStatus ? ( cookieCheckTag(row.checkStatus, row.checkMessage) @@ -1586,18 +1636,18 @@ export default function Dashboard() { }, { title: '商品', - width: 150, + width: 120, ellipsis: true, render: () => currentPrize?.name || watchedName || '未选择', }, { title: '积分', - width: 84, + width: 70, render: (_, row) => scoreMap.get(row.uid)?.score ?? '-', }, { title: '兑换结果', - width: 190, + width: 150, render: (_, row) => { const exchange = exchangeByUID.get(row.uid) if (exchange?.success) { @@ -1654,11 +1704,12 @@ export default function Dashboard() { }, { title: '状态', - width: 98, + width: 80, render: (_, row) => categoryTag(latestResultByUID.get(row.uid)?.category), }, { title: '最后结果', + width: 130, ellipsis: true, render: (_, row) => { const result = latestResultByUID.get(row.uid) @@ -1667,7 +1718,7 @@ export default function Dashboard() { }, { title: '兑换记录', - width: 104, + width: 90, render: (_, row) => { const rec = recordsByUID.get(row.uid) const count = rec?.records?.length || 0 @@ -2254,8 +2305,17 @@ export default function Dashboard() { -
-
+
+
账号作战表 @@ -2288,11 +2348,26 @@ export default function Dashboard() { rowClassName={(row) => exchangeByUID.get(row.uid)?.success ? 'account-row-success' : '' } - scroll={{ x: 1040, y: 560 }} + scroll={{ x: 'max-content', y: 560 }} />
-
+
+
+
+ +
diff --git a/frontend/src/styles.css b/frontend/src/styles.css index e2b82b6..72096cf 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -357,11 +357,61 @@ body { } .main-grid { - display: grid; + display: flex; min-height: 0; - grid-template-columns: minmax(560px, 1.35fr) minmax(380px, 0.95fr); - gap: 14px; + gap: 0; padding: 14px 20px; + position: relative; + overflow: hidden; +} + +.main-resizer { + width: 14px; + margin: 0 4px; + flex-shrink: 0; + display: flex; + align-items: center; + justify-content: center; + cursor: col-resize; + user-select: none; + position: relative; + transition: background 0.15s ease; + z-index: 10; +} + +.main-resizer .resizer-bar { + width: 4px; + height: 52px; + border-radius: 4px; + background: #cbd5e1; + transition: all 0.2s ease; +} + +.main-resizer:hover .resizer-bar, +.main-resizer.active .resizer-bar { + background: #1677ff; + height: 96px; + box-shadow: 0 0 6px rgba(22, 119, 255, 0.4); +} + +.main-resizer:hover, +.main-resizer.active { + background: rgba(22, 119, 255, 0.08); + border-radius: 6px; +} + +.main-grid.dragging-split { + cursor: col-resize !important; + user-select: none !important; +} + +.main-grid.dragging-split * { + user-select: none !important; + pointer-events: none !important; +} + +.main-grid.dragging-split .main-resizer { + pointer-events: auto !important; } .account-panel, @@ -657,10 +707,6 @@ body { grid-template-columns: 280px minmax(0, 1fr); } - .main-grid { - grid-template-columns: 1fr; - } - .settings-grid, .settings-param-grid, .settings-switch-grid { diff --git a/internal/version/version.go b/internal/version/version.go index 8d32f39..fb3c084 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -5,10 +5,10 @@ package version // // 构建时可用 ldflags 覆盖(构建脚本就是这么做的): // -// go build -ldflags "-X huya-go/internal/version.Version=0.5.2" -var Version = "0.5.2" +// go build -ldflags "-X huya-go/internal/version.Version=0.5.3" +var Version = "0.5.3" -// Display 返回带 v 前缀的展示版本号,例如 v0.5.2。 +// Display 返回带 v 前缀的展示版本号,例如 v0.5.3。 func Display() string { return "v" + Version } diff --git a/wails.json b/wails.json index c621744..96255de 100644 --- a/wails.json +++ b/wails.json @@ -9,7 +9,7 @@ "info": { "companyName": "huya-go", "productName": "虎牙抢购助手", - "productVersion": "0.5.2", + "productVersion": "0.5.3", "copyright": "", "comments": "虎牙活动积分兑换/抢购工具" }