This commit is contained in:
zh
2025-12-03 11:03:14 +08:00
parent 60d57ade66
commit afbf761354
12 changed files with 100 additions and 43 deletions

View File

@ -82,6 +82,7 @@ let mainWindow;
let isSeverInit = false
let isAppInit = false
let severError:any = undefined
function createWindow(): void {
// Create the browser window.
@ -172,7 +173,7 @@ function createWindow(): void {
ipcMain.on('splash-completed', () => {
// 启动页进度条已完成,可以关闭启动页并显示主窗口
if (isSeverInit) {
mainWindow.webContents.send('program-init')
mainWindow.webContents.send('program-init', severError)
}
isAppInit = true
setTimeout(() => {
@ -406,7 +407,7 @@ function createWindow(): void {
// 条件:仅按了 Alt 键(无其他键组合、不是组合键、不是重复按键)
if (
input.key === 'Alt' && // 按键是 Alt
!input.ctrl && // 未按 Ctrl
!input.control && // 未按 Ctrl
!input.shift && // 未按 Shift
!input.meta && // 未按 MetaWin/Mac
!input.isComposing && // 非输入法组合态
@ -621,20 +622,29 @@ if (!gotTheLock) {
// console.log(`批处理输出: ${string}`);
// 临时处理:应用启动失败或项目文档地址出现时,认为服务初始化完成;后续需后端配合
if (string.indexOf('APPLICATION FAILED TO START') !== -1) {
mainWindow.webContents.send('program-init', '后端服务未正常启动,尝试更换地址或端口')
severError = '后端服务未正常启动,尝试更换地址或端口'
if (!isSeverInit) {
isSeverInit = true
if (isAppInit) {
mainWindow.webContents.send('program-init', severError)
}
}
}
else if (string.indexOf('项目文档地址') !== -1) {
if (!isSeverInit) {
isSeverInit = true
if (isAppInit) {
mainWindow.webContents.send('program-init')
mainWindow.webContents.send('program-init', false)
}
}
}
});
ipcMain.on('judgment-isSeverInit', (event) => {
event.returnValue = isSeverInit
event.returnValue = {
isSeverInit: isSeverInit,
severError: severError
}
})
// 监听错误输出stderr