Compare commits

..

No commits in common. "b2d97a922749552077b2aa3ec7bbbc2daa034567" and "342712f219d30f9fdd3631cb0ee9c4ed3c99d3a2" have entirely different histories.

3 changed files with 51 additions and 46 deletions

View File

@ -17,7 +17,6 @@
"echarts": "^5.1.0",
"electron-store": "^8.0.0",
"nmea": "http://git.hwasmart.com/bd_group/node-nmea.git",
"postcss": "^8.4.38",
"serialport": "10.0.0",
"vue": "^3.2.26",
"vue-cesium": "3.0.2-beta.13",
@ -31,6 +30,7 @@
"electron": "^13.6.3",
"electron-builder": "^22.10.5",
"electron-rebuild": "2.3.5",
"postcss": "^8.2.10",
"rimraf": "^3.0.2",
"rollup-plugin-copy": "^3.4.0",
"tailwindcss": "^2.1.1",

View File

@ -121,41 +121,65 @@ const getDisplayOrigin = (display: any) => {
return origin
}
var windows:Array<BrowserWindow> = [];
function createWindow(option: any, url: any) {
const win = new BrowserWindow(option)
if (URl_REGEX.test(url)) {
win.loadURL(url)
} else {
win.loadFile(url)
}
if(process.env.NODE_ENV === 'development') win.webContents.openDevTools()
windows.push(win);
}
ipcMain.on('CLOSE', (event) => {
const res = dialog.showMessageBox({
type: 'warning',
title: '警告',
message: '确定要关闭软件吗?',
detail: '关闭软件',
cancelId: 1, // 按esc默认点击索引按钮
defaultId: 0, // 默认高亮的按钮下标
buttons: ['确认', '取消'], // 按钮按索引从右往左排序
})
res.then((data)=>{
if(data.response == 0){
windows.forEach((key:BrowserWindow) => {
key.close();
});
windows = [];
}else{
console.log('not close software')
const isWindows = process.platform === 'win32';
let needsFocusFix = false;
let triggeringProgrammaticBlur = false;
//弹出警报窗口后 input获取不到焦点
win.on('blur', (event: any) => {
if(!triggeringProgrammaticBlur) {
needsFocusFix = true;
}
})
})
win.on('focus', (event: any) => {
if(isWindows && needsFocusFix) {
needsFocusFix = false;
triggeringProgrammaticBlur = true;
//弹出弹窗后重新聚焦导致windows任务栏显示重新隐藏底部windows任务栏
win.minimize(); //最小化函数
win.restore(); //取消最小化函数(从最小化窗口还原函数)
setTimeout(function () {
win.blur(); //失去焦点函数
win.focus(); //获取焦点函数
setTimeout(function () {
triggeringProgrammaticBlur = false;
}, 100);
}, 100);
}
})
if(process.env.NODE_ENV === 'development') win.webContents.openDevTools()
ipcMain.on('CLOSE', (event) => {
const res = dialog.showMessageBox({
type: 'warning',
title: '警告',
message: '确定要关闭软件吗?',
detail: '关闭软件',
cancelId: 1, // 按esc默认点击索引按钮
defaultId: 0, // 默认高亮的按钮下标
buttons: ['确认', '取消'], // 按钮按索引从右往左排序
})
res.then((data)=>{
if(data.response == 0){
win.close()
}else{
console.log('not close software')
}
})
})
}
app.whenReady().then(() => {
launch()

View File

@ -2577,11 +2577,6 @@ nanoid@^3.1.30:
resolved "https://registry.npmmirror.com/nanoid/download/nanoid-3.1.30.tgz#63f93cc548d2a113dc5dfbc63bfa09e2b9b64362"
integrity sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==
nanoid@^3.3.7:
version "3.3.7"
resolved "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8"
integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==
napi-build-utils@^1.0.1:
version "1.0.2"
resolved "https://registry.npm.taobao.org/napi-build-utils/download/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806"
@ -3005,7 +3000,7 @@ postcss@^8.1.10:
picocolors "^1.0.0"
source-map-js "^1.0.1"
postcss@^8.1.6:
postcss@^8.1.6, postcss@^8.2.10:
version "8.2.10"
resolved "https://registry.npm.taobao.org/postcss/download/postcss-8.2.10.tgz#ca7a042aa8aff494b334d0ff3e9e77079f6f702b"
integrity sha1-ynoEKqiv9JSzNND/Pp53B59vcCs=
@ -3023,15 +3018,6 @@ postcss@^8.2.1:
nanoid "^3.1.20"
source-map "^0.6.1"
postcss@^8.4.38:
version "8.4.38"
resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e"
integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==
dependencies:
nanoid "^3.3.7"
picocolors "^1.0.0"
source-map-js "^1.2.0"
prebuild-install@^7.0.0:
version "7.1.1"
resolved "https://registry.npmmirror.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45"
@ -3494,11 +3480,6 @@ source-map-js@^1.0.1:
resolved "https://registry.npmmirror.com/source-map-js/download/source-map-js-1.0.1.tgz?cache=0&sync_timestamp=1636402309628&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fsource-map-js%2Fdownload%2Fsource-map-js-1.0.1.tgz#a1741c131e3c77d048252adfa24e23b908670caf"
integrity sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==
source-map-js@^1.2.0:
version "1.2.0"
resolved "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af"
integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==
source-map-support@^0.5.17, source-map-support@^0.5.19:
version "0.5.19"
resolved "https://registry.npm.taobao.org/source-map-support/download/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"