From d6fb3b57e22a4dbf33aad48cdfd81814c36afe08 Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Wed, 5 Nov 2025 18:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/main/index.ts | 155 ++++---- src/renderer/components.d.ts | 7 +- src/renderer/public/startUp/startUp.html | 13 +- src/renderer/public/tree/jquery.ztree.core.js | 2 +- src/renderer/src/I18n/zh-CN.ts | 9 +- src/renderer/src/I18n/zh-EN.ts | 7 + src/renderer/src/I18n/zh-TW.ts | 9 +- src/renderer/src/assets/styles/global.css | 155 +++++++- .../src/components/dialog/directory.vue | 4 +- src/renderer/src/views/TS/components/grid.vue | 1 + .../src/views/TS/components/rightMenuTs.vue | 1 + src/renderer/src/views/TS/deduction.vue | 8 +- src/renderer/src/views/TS/edit.vue | 10 +- src/renderer/src/views/TS/element.vue | 1 + src/renderer/src/views/TS/list.vue | 10 +- src/renderer/src/views/TS/newEvent.vue | 1 + src/renderer/src/views/TS/newPlan.vue | 1 + .../components/bottomSide/bottomSide.vue | 23 +- .../headers/components/setTool/setTool.vue | 32 +- .../components/leftSide/leftSideFirst.vue | 6 +- .../components/leftSide/leftSideSecond.vue | 32 +- .../views/components/propertyBox/FlyRoam.vue | 4 +- .../propertyBox/GoodsSearchCircle.vue | 4 +- .../components/propertyBox/addGroundText.vue | 4 +- .../components/propertyBox/addStandText.vue | 3 + .../propertyBox/trajectoryMotion.vue | 3 +- .../views/components/tree/hooks/treeNode.ts | 65 ++-- .../src/views/components/tree/index.vue | 6 +- src/renderer/src/views/login/index.vue | 342 +++++++++++------- 30 files changed, 580 insertions(+), 340 deletions(-) diff --git a/package.json b/package.json index 4f4087f..af4dff4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "dzsp_shijingjun_offline_Y_save", "version": "v4.0.0", - "description": "An Electron application with Vue and TypeScript", + "description": "", "main": "./out/main/index.js", "author": "example.com", "homepage": "https://electron-vite.org", diff --git a/src/main/index.ts b/src/main/index.ts index 21412b1..1fcc74d 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -72,6 +72,7 @@ stopBatPath = process.platform === 'win32' ? stopBatPath.replace(/^(\w:)/, '/$1' // ? `${join(app.getAppPath(), 'src/renderer/public/startUp/startUp.html')}` // : `file://${join(app.getAppPath(), 'resources/app.asar/out/renderer/startUp/startUp.html')}` let isRestart = false +let mainWindow; function createWindow(): void { // Create the browser window. @@ -98,10 +99,10 @@ function createWindow(): void { splashWindow.loadURL(splashURL) splashWindow.show() // 创建主窗口(保持原有配置,但先不显示) - const mainWindow = new BrowserWindow({ - // minWidth: 1780, // 添加最小宽度限制 - // minHeight: 920, // 添加最小高度限制 - // fullscreen: true, + mainWindow = new BrowserWindow({ + minWidth: 1280, // 添加最小宽度限制 + minHeight: 768, // 添加最小高度限制 + fullscreen: true, show: false, frame: true, autoHideMenuBar: true, @@ -429,77 +430,9 @@ function createWindow(): void { } } -// This method will be called when Electron has finished -// initialization and is ready to create browser windows. -// Some APIs can only be used after this event occurs. -app.whenReady().then(() => { - // alert(devSplashURL) - // alert(prodSplashURL) - // dialog.showMessageBox({ - // type: 'info', - // title: '信息1', - // message: devSplashURL, - // buttons: ['确定'] - // }) - // 执行批处理文件 - exec(startBatPath.substring(1, 200), (error, stdout, stderr) => { - if (error) { - console.error(`执行错误: ${error.message}`); - return; - } - if (stderr) { - console.error(`错误输出: ${stderr}`); - return; - } - console.log(`批处理输出: ${stdout}`); - }); - // Set app user model id for windows - electronApp.setAppUserModelId('com.electron') - - // Default open or close DevTools by F12 in development - // and ignore CommandOrControl + R in production. - // see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils - app.on('browser-window-created', (_, window) => { - optimizer.watchWindowShortcuts(window) - }) - - // IPC test - ipcMain.on('ping', () => console.log('pong')) - - createWindow() - - app.on('activate', function () { - // On macOS it's common to re-create a window in the app when the - // dock icon is clicked and there are no other windows open. - if (BrowserWindow.getAllWindows().length === 0) createWindow() - }) -}) - -// Quit when all windows are closed, except on macOS. There, it's common -// for applications and their menu bar to stay active until the user quits -// explicitly with Cmd + Q. -// app.on('window-all-closed', () => { -// if (process.platform !== 'darwin') { -// getServer().close(() => { -// // 关闭后台服务 -// exec(stopBatPath.substring(1, 200), () => { -// app.quit() -// }); -// }) -// } -// }) -// 退出时注销所有快捷键 -app.on('will-quit', () => { - globalShortcut.unregisterAll() -}) - // 用于跟踪是否正在执行退出流程 let isQuitting = false; -app.on('window-all-closed', () => { - windowAllClosed() -}); - function windowAllClosed() { // 防止重复触发退出流程 if (isQuitting) return; @@ -581,10 +514,80 @@ function closeAllWindows() { }); } -console.log('=================================================') -global.sharedObject = { - hasService: false, -}; +const gotTheLock = app.requestSingleInstanceLock(); + +if (!gotTheLock) { + app.quit(); +} else { + if (app.isReady()) { + } + + app.whenReady().then(() => { + // alert(devSplashURL) + // alert(prodSplashURL) + // dialog.showMessageBox({ + // type: 'info', + // title: '信息1', + // message: devSplashURL, + // buttons: ['确定'] + // }) + // 执行批处理文件 + exec(startBatPath.substring(1, 200), (error, stdout, stderr) => { + if (error) { + console.error(`执行错误: ${error.message}`); + return; + } + if (stderr) { + console.error(`错误输出: ${stderr}`); + return; + } + console.log(`批处理输出: ${stdout}`); + }); + // Set app user model id for windows + electronApp.setAppUserModelId('com.electron') + + // Default open or close DevTools by F12 in development + // and ignore CommandOrControl + R in production. + // see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils + app.on('browser-window-created', (_, window) => { + optimizer.watchWindowShortcuts(window) + }) + + // IPC test + ipcMain.on('ping', () => console.log('pong')) + + createWindow() + + app.on('activate', function () { + // On macOS it's common to re-create a window in the app when the + // dock icon is clicked and there are no other windows open. + if (BrowserWindow.getAllWindows().length === 0) createWindow() + }) + }) + + // 退出时注销所有快捷键 + app.on('will-quit', () => { + globalShortcut.unregisterAll() + }) + + app.on('window-all-closed', () => { + windowAllClosed() + }); + + app.on("second-instance", () => { + // 当运行第二个实例时,将会聚焦到myWindow这个窗口 + if (mainWindow) { + if (mainWindow.isMinimized()) mainWindow.restore(); + mainWindow.focus(); + } + }); + + + // testNapi() + global.sharedObject = { + hasService: false, + }; +} // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here. diff --git a/src/renderer/components.d.ts b/src/renderer/components.d.ts index c553028..37cb211 100644 --- a/src/renderer/components.d.ts +++ b/src/renderer/components.d.ts @@ -11,8 +11,6 @@ declare module 'vue' { BaseDialog: typeof import('./src/components/dialog/baseDialog.vue')['default'] Directory: typeof import('./src/components/dialog/directory.vue')['default'] DirectoryEdit: typeof import('./src/components/dialog/directoryEdit.vue')['default'] - ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer'] - ElBotton: typeof import('element-plus/es')['ElBotton'] ElButton: typeof import('element-plus/es')['ElButton'] ElCard: typeof import('element-plus/es')['ElCard'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] @@ -28,18 +26,15 @@ declare module 'vue' { ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm'] - ElRadio: typeof import('element-plus/es')['ElRadio'] - ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSlider: typeof import('element-plus/es')['ElSlider'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] - ElTableV2: typeof import('element-plus/es')['ElTableV2'] ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] - ElTimePicker: typeof import('element-plus/es')['ElTimePicker'] + ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTree: typeof import('element-plus/es')['ElTree'] ElUpload: typeof import('element-plus/es')['ElUpload'] Index_b: typeof import('./src/components/SvgIcon/index_b.vue')['default'] diff --git a/src/renderer/public/startUp/startUp.html b/src/renderer/public/startUp/startUp.html index 98e6e60..fa24297 100644 --- a/src/renderer/public/startUp/startUp.html +++ b/src/renderer/public/startUp/startUp.html @@ -28,7 +28,7 @@ } .progress-container { - width: 400px; + width: 334px; text-align: center; } @@ -52,7 +52,7 @@ } .progress-bar-container { - height: 16px; + height: 12px; /* background-color: #222; */ border-radius: 14px 0px 14px 0px; overflow: hidden; @@ -136,12 +136,11 @@ .box_middle_content { width: 400px; - color: #ADF1FF; + color: #e6f7ff; font-size: 20px; font-weight: 400; letter-spacing: 0px; line-height: 27px; - color: rgba(var(--color-text2), 1); text-align: justify; vertical-align: top; font-family: 'Alibaba'; @@ -161,13 +160,13 @@
- 实景三维数字孪生系统
+ 实景三维电子沙盘系统