Compare commits

...

2 Commits

Author SHA1 Message Date
qubiaobiao d06c66ad39 修复软件关闭时的bug 2024-04-08 09:25:44 +08:00
qubiaobiao 78e1b7128a 主要版本 2024-04-08 09:14:25 +08:00
2 changed files with 24 additions and 64 deletions

View File

@ -121,46 +121,20 @@ const getDisplayOrigin = (display: any) => {
return origin return origin
} }
var windows:Array<BrowserWindow> = [];
function createWindow(option: any, url: any) { function createWindow(option: any, url: any) {
const win = new BrowserWindow(option) const win = new BrowserWindow(option)
if (URl_REGEX.test(url)) { if (URl_REGEX.test(url)) {
win.loadURL(url) win.loadURL(url)
} else { } else {
win.loadFile(url) win.loadFile(url)
} }
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() if(process.env.NODE_ENV === 'development') win.webContents.openDevTools()
windows.push(win);
}
ipcMain.on('CLOSE', (event) => { ipcMain.on('CLOSE', (event) => {
const res = dialog.showMessageBox({ const res = dialog.showMessageBox({
type: 'warning', type: 'warning',
title: '警告', title: '警告',
@ -173,13 +147,15 @@ function createWindow(option: any, url: any) {
res.then((data)=>{ res.then((data)=>{
if(data.response == 0){ if(data.response == 0){
win.close() windows.forEach((key:BrowserWindow) => {
key.close();
});
windows = [];
}else{ }else{
console.log('not close software') console.log('not close software')
} }
}) })
}) })
}
app.whenReady().then(() => { app.whenReady().then(() => {
launch() launch()

View File

@ -6,26 +6,10 @@
<div class="label">  </div> <div class="label">  </div>
<div class="content">{{ baseInfo.longitude ? baseInfo.longitude : '' }}</div> <div class="content">{{ baseInfo.longitude ? baseInfo.longitude : '' }}</div>
</div> </div>
<div>
<div class="label">经度度分</div>
<div class="content">{{ baseInfo.longitude ? longitudeD + ' ' + longitudeM : '' }}</div>
</div>
<div>
<div class="label">经度分秒</div>
<div class="content">{{ baseInfo.longitude ? longitudeD + ' ' + longitudeM + ' ' + longitudeS : '' }}</div>
</div>
<div> <div>
<div class="label">  </div> <div class="label">  </div>
<div class="content">{{ baseInfo.latitude ? baseInfo.latitude : '' }}</div> <div class="content">{{ baseInfo.latitude ? baseInfo.latitude : '' }}</div>
</div> </div>
<div>
<div class="label">纬度度分</div>
<div class="content">{{ baseInfo.latitude ? latitudeD + ' ' + latitudeM : '' }}</div>
</div>
<div>
<div class="label">纬度分秒</div>
<div class="content">{{ baseInfo.latitude ? latitudeD + ' ' + latitudeM + ' ' + latitudeS : '' }}</div>
</div>
<div> <div>
<div class="label">  </div> <div class="label">  </div>
<div class="content">{{ baseInfo.altitude }}</div> <div class="content">{{ baseInfo.altitude }}</div>