From 9eae24e4e08d597c4aa05e5bad7317db647143e1 Mon Sep 17 00:00:00 2001 From: ILoveBingLu Date: Thu, 12 Mar 2026 20:12:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=A1=8C=E4=B8=BA=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=89=98=E7=9B=98=E6=9C=80=E5=B0=8F=E5=8C=96=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=B8=83=E5=B1=80=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main.ts | 13 ++++-- package-lock.json | 81 +++++++++++++++++++++++++++++++++++++ package.json | 1 + src/App.tsx | 2 +- src/pages/OpenApiPage.tsx | 5 ++- src/pages/SettingsPage.scss | 2 +- 6 files changed, 97 insertions(+), 7 deletions(-) diff --git a/electron/main.ts b/electron/main.ts index 2fb7a9d..e38a41e 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -243,18 +243,25 @@ function createWindow() { // 获取关闭行为配置 const closeToTray = configService?.get('closeToTray') - + // 如果配置为关闭到托盘(默认为 true) if (closeToTray !== false) { event.preventDefault() win.hide() - + // 确保托盘已创建 if (!tray) { createTray() } + + return } - // 否则允许窗口关闭,应用退出 + + // 配置为直接退出时,需要显式退出应用。 + // 否则主窗口关闭后托盘仍然存在,进程不会真正结束。 + event.preventDefault() + app.isQuitting = true + app.quit() }) // 开发环境加载 vite 服务器 diff --git a/package-lock.json b/package-lock.json index e75fa21..4ce13de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "koffi": "^2.9.0", "lucide-react": "^0.562.0", "marked": "^17.0.1", + "motion": "^12.35.2", "onnxruntime-node": "^1.23.2", "openai": "^4.70.0", "react": "^19.2.3", @@ -6552,6 +6553,39 @@ "node": ">=0.8" } }, + "node_modules/framer-motion": { + "version": "12.35.2", + "resolved": "https://registry.npmmirror.com/framer-motion/-/framer-motion-12.35.2.tgz", + "integrity": "sha512-dhfuEMaNo0hc+AEqyHiIfiJRNb9U9UQutE9FoKm5pjf7CMitp9xPEF1iWZihR1q86LBmo6EJ7S8cN8QXEy49AA==", + "license": "MIT", + "dependencies": { + "motion-dom": "^12.35.2", + "motion-utils": "^12.29.2", + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@emotion/is-prop-valid": "*", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@emotion/is-prop-valid": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/framer-motion/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/fs-constants/-/fs-constants-1.0.0.tgz", @@ -8015,6 +8049,53 @@ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", "license": "MIT" }, + "node_modules/motion": { + "version": "12.35.2", + "resolved": "https://registry.npmmirror.com/motion/-/motion-12.35.2.tgz", + "integrity": "sha512-8zCi1DkNyU6a/tgEHn/GnnXZDcaMpDHbDOGORY1Rg/6lcNMSOuvwDB3i4hMSOvxqMWArc/vrGaw/Xek1OP69/A==", + "license": "MIT", + "dependencies": { + "framer-motion": "^12.35.2", + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@emotion/is-prop-valid": "*", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@emotion/is-prop-valid": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/motion-dom": { + "version": "12.35.2", + "resolved": "https://registry.npmmirror.com/motion-dom/-/motion-dom-12.35.2.tgz", + "integrity": "sha512-pWXFMTwvGDbx1Fe9YL5HZebv2NhvGBzRtiNUv58aoK7+XrsuaydQ0JGRKK2r+bTKlwgSWwWxHbP5249Qr/BNpg==", + "license": "MIT", + "dependencies": { + "motion-utils": "^12.29.2" + } + }, + "node_modules/motion-utils": { + "version": "12.29.2", + "resolved": "https://registry.npmmirror.com/motion-utils/-/motion-utils-12.29.2.tgz", + "integrity": "sha512-G3kc34H2cX2gI63RqU+cZq+zWRRPSsNIOjpdl9TN4AQwC4sgwYPl/Q/Obf/d53nOm569T0fYK+tcoSV50BWx8A==", + "license": "MIT" + }, + "node_modules/motion/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", diff --git a/package.json b/package.json index f0a4982..00d4529 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "koffi": "^2.9.0", "lucide-react": "^0.562.0", "marked": "^17.0.1", + "motion": "^12.35.2", "onnxruntime-node": "^1.23.2", "openai": "^4.70.0", "react": "^19.2.3", diff --git a/src/App.tsx b/src/App.tsx index b8cfd53..56d459c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -460,7 +460,7 @@ function App() { } // 主窗口 - 完整布局 - const disableContentOverflow = ['/data-management', '/settings', '/open-api'].includes(location.pathname) + const disableContentOverflow = ['/data-management', '/settings'].includes(location.pathname) return (
diff --git a/src/pages/OpenApiPage.tsx b/src/pages/OpenApiPage.tsx index 757f206..3c2636f 100644 --- a/src/pages/OpenApiPage.tsx +++ b/src/pages/OpenApiPage.tsx @@ -552,8 +552,9 @@ function OpenApiPage() { return ( <> - - + {/* 独立页面布局:抵消 App 主内容区的 padding,完整占据空间 */} + +