12-2
This commit is contained in:
@ -128,6 +128,19 @@ function createWindow(): void {
|
||||
allowRunningInsecureContent: true
|
||||
}
|
||||
})
|
||||
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||
// 条件:仅按了 Alt 键(无其他键组合、不是组合键、不是重复按键)
|
||||
if (
|
||||
input.key === 'Alt' && // 按键是 Alt
|
||||
!input.ctrl && // 未按 Ctrl
|
||||
!input.shift && // 未按 Shift
|
||||
!input.meta && // 未按 Meta(Win/Mac)
|
||||
!input.isComposing && // 非输入法组合态
|
||||
input.type === 'keyDown' // 仅拦截按下事件
|
||||
) {
|
||||
event.preventDefault(); // 阻止 Alt 键的默认行为(激活菜单)
|
||||
}
|
||||
});
|
||||
let ymlBatPath = process.env.NODE_ENV === 'development' ? path.resolve(app.getAppPath(), 'resources', 'java', 'app', 'application.yml') : path.join(process.resourcesPath, 'app.asar.unpacked', 'resources', 'java', 'app', 'application.yml')
|
||||
ymlBatPath = process.platform === 'win32' ? ymlBatPath.replace(/^(\w:)/, '/$1') : ymlBatPath
|
||||
let ymlPath = ymlBatPath.substring(1, 200)
|
||||
@ -389,6 +402,19 @@ function createWindow(): void {
|
||||
// closeCB(newWindow.id)
|
||||
});
|
||||
}
|
||||
newWindow.webContents.on('before-input-event', (event, input) => {
|
||||
// 条件:仅按了 Alt 键(无其他键组合、不是组合键、不是重复按键)
|
||||
if (
|
||||
input.key === 'Alt' && // 按键是 Alt
|
||||
!input.ctrl && // 未按 Ctrl
|
||||
!input.shift && // 未按 Shift
|
||||
!input.meta && // 未按 Meta(Win/Mac)
|
||||
!input.isComposing && // 非输入法组合态
|
||||
input.type === 'keyDown' // 仅拦截按下事件
|
||||
) {
|
||||
event.preventDefault(); // 阻止 Alt 键的默认行为(激活菜单)
|
||||
}
|
||||
});
|
||||
_winMap.set(id, newWindow.id);
|
||||
return _winMap
|
||||
} catch (error) {
|
||||
@ -594,7 +620,10 @@ if (!gotTheLock) {
|
||||
let string = data.toString().trim()
|
||||
// console.log(`批处理输出: ${string}`);
|
||||
// 临时处理:应用启动失败或项目文档地址出现时,认为服务初始化完成;后续需后端配合
|
||||
if (string.indexOf('APPLICATION FAILED TO START') !== -1 || string.indexOf('项目文档地址') !== -1) {
|
||||
if (string.indexOf('APPLICATION FAILED TO START') !== -1) {
|
||||
mainWindow.webContents.send('program-init', '后端服务未正常启动,尝试更换地址或端口')
|
||||
}
|
||||
else if (string.indexOf('项目文档地址') !== -1) {
|
||||
if (!isSeverInit) {
|
||||
isSeverInit = true
|
||||
if (isAppInit) {
|
||||
|
||||
Reference in New Issue
Block a user