From 66dbd559bb2a8287f29ae16bf4db03e89b383c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Thu, 15 May 2025 17:47:53 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E9=81=BF=E5=85=8D=20=E2=80=9C?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E8=A2=AB=E5=8D=A0=E7=94=A8=E2=80=9D=20?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=E6=A1=86=E8=BF=9E=E7=BB=AD=E5=BC=B9?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gui/src/bridge/error/front.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/gui/src/bridge/error/front.js b/packages/gui/src/bridge/error/front.js index ab1efbd..2b11216 100644 --- a/packages/gui/src/bridge/error/front.js +++ b/packages/gui/src/bridge/error/front.js @@ -1,3 +1,5 @@ +let latestConfirmTime = null + function install (app, api) { api.ipc.on('error.core', (event, message) => { console.error('view on error', message) @@ -13,11 +15,20 @@ function install (app, api) { function handleServerStartError (message, err, app, api) { if (message.value === 'EADDRINUSE') { + // 避免重复弹窗 + const now = Date.now() + if (latestConfirmTime != null && now - latestConfirmTime < 1000) { + if (now - latestConfirmTime > 5000) { + latestConfirmTime = null + } + return + } + latestConfirmTime = now + app.$confirm({ title: '端口被占用,代理服务启动失败', content: '是否要杀掉占用进程?您也可以点击取消,然后前往加速服务->基本设置中修改代理端口', onOk () { - // TODO 杀掉进程 api.config.get().then((config) => { console.log('config:', config) api.shell.killByPort({ port: config.server.port }).then((ret) => {