添加启动验证功能
parent
51744eac8f
commit
fc337e951d
|
@ -13,6 +13,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"cesium": "^1.88.0",
|
||||
"regedit": "^5.1.2",
|
||||
"vue": "^3.2.26",
|
||||
"vue-cesium": "^3.0.4",
|
||||
"vuex": "^4.0.1"
|
||||
|
@ -23,7 +24,7 @@
|
|||
"autoprefixer": "^10.2.5",
|
||||
"cross-env": "^7.0.3",
|
||||
"electron": "^13.6.3",
|
||||
"electron-builder": "^22.10.5",
|
||||
"electron-builder": "^24.4.0",
|
||||
"postcss": "^8.2.10",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup-plugin-copy": "^3.4.0",
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
import { app, globalShortcut, BrowserWindow } from 'electron'
|
||||
import { app, globalShortcut, BrowserWindow, dialog } from 'electron'
|
||||
import { join } from "path"
|
||||
import { promisified as regedit } from 'regedit'
|
||||
// const regedit = require('regedit').promisified
|
||||
|
||||
const REG_DIR_PATH:string[] = ['HKCU\\SOFTWARE\\HwaSmart']
|
||||
async function checkLaunchEnv() {
|
||||
const result = await regedit.list(REG_DIR_PATH)
|
||||
// console.log(result[REG_DIR_PATH[0]].exists)
|
||||
return result[REG_DIR_PATH[0]].exists
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
|
@ -19,11 +28,17 @@ function createWindow() {
|
|||
}
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.whenReady().then(async () => {
|
||||
const checkReault = await checkLaunchEnv()
|
||||
if (checkReault) {
|
||||
createWindow()
|
||||
|
||||
// 屏蔽 F11 进入/退出全屏功能
|
||||
globalShortcut.register('F11', () => {return})
|
||||
} else {
|
||||
dialog.showErrorBox('系统提示', '软件启动出错,请联系售后技术支持人员')
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
|
|
Loading…
Reference in New Issue