From 1a0fcd1f411f39a718d92fcde1e7a89ec08c489f Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Thu, 13 Nov 2025 14:38:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=9C=8D=E5=8A=A1=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/index.ts | 75 ++++-- src/renderer/components.d.ts | 27 -- .../src/views/components/headers/index.vue | 1 + .../components/propertyBox/circleDiffuse.vue | 2 +- .../components/propertyBox/radarScan.vue | 2 +- .../propertyBox/radarScanStereoscopic.vue | 2 +- src/renderer/src/views/home/index.vue | 130 +++++++++- src/renderer/src/views/login/index.vue | 236 ++++++------------ 8 files changed, 250 insertions(+), 225 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index a90a9c3..b2abf14 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -78,6 +78,8 @@ stopBatPath = process.platform === 'win32' ? stopBatPath.replace(/^(\w:)/, '/$1' let isRestart = false let mainWindow; +let isSeverInit = false +let isAppInit = false function createWindow(): void { // Create the browser window. @@ -150,6 +152,10 @@ function createWindow(): void { // 监听启动页完成的消息 ipcMain.on('splash-completed', () => { // 启动页进度条已完成,可以关闭启动页并显示主窗口 + if(isSeverInit) { + mainWindow.webContents.send('program-init') + } + isAppInit = true setTimeout(() => { splashWindow.destroy() mainWindow.maximize() // 先最大化 @@ -562,38 +568,53 @@ if (!gotTheLock) { // buttons: ['确定'] // }) // 执行批处理文件 - exec(startBatPath.substring(1, 200), (error, stdout, stderr) => { - if (error) { - console.error(`执行错误: ${error.message}`); - return; + // exec(startBatPath.substring(1, 200), (error, stdout, stderr) => { + // if (error) { + // console.error(`执行错误: ${error.message}`); + // return; + // } + // if (stderr) { + // console.error(`错误输出: ${stderr}`); + // return; + // } + // console.log(`批处理输出: ${stdout}`); + // }); + + const batProcess = spawn('cmd.exe', ['/c', startBatPath.substring(1, 200)]); + // 实时监听标准输出(stdout) + batProcess.stdout.on('data', (data) => { + // data 是 Buffer 类型,转为字符串后输出 + let string = data.toString().trim() + // console.log(`批处理输出: ${string}`); + // 临时处理:应用启动失败或项目文档地址出现时,认为服务初始化完成;后续需后端配合 + if(string.indexOf('APPLICATION FAILED TO START') !== -1 || string.indexOf('项目文档地址') !== -1) { + if(!isSeverInit) { + isSeverInit = true + if(isAppInit) { + mainWindow.webContents.send('program-init') + } + } } - if (stderr) { - console.error(`错误输出: ${stderr}`); - return; - } - console.log(`批处理输出: ${stdout}`); }); - // const batProcess = spawn('cmd.exe', ['/c', startBatPath.substring(1, 200)]); - // // 实时监听标准输出(stdout) - // batProcess.stdout.on('data', (data) => { - // // data 是 Buffer 类型,转为字符串后输出 - // console.log(`批处理输出: ${data.toString().trim()}`); - // }); - // // 监听错误输出(stderr) - // batProcess.stderr.on('data', (data) => { - // console.error(`错误输出: ${data.toString().trim()}`); - // }); + ipcMain.on('judgment-isSeverInit', (event) => { + event.returnValue = isSeverInit + }) - // // 监听进程执行出错(如文件不存在、权限问题等) - // batProcess.on('error', (error) => { - // console.error(`执行错误: ${error.message}`); - // }); + // 监听错误输出(stderr) + batProcess.stderr.on('data', () => { + // console.error(`错误输出: ${data.toString().trim()}`); + }); - // // 监听进程退出事件(执行结束后触发) - // batProcess.on('close', (code) => { - // console.log(`批处理执行完毕,退出码: ${code}`); - // }); + // 监听进程执行出错 + batProcess.on('error', () => { + // console.error(`执行错误: ${error.message}`); + }); + + // 监听进程退出事件(执行结束后触发) + batProcess.on('close', (code) => { + console.log(`批处理执行完毕,退出码: ${code}`); + }); // Set app user model id for windows electronApp.setAppUserModelId('com.electron') diff --git a/src/renderer/components.d.ts b/src/renderer/components.d.ts index de57ab9..5f5348d 100644 --- a/src/renderer/components.d.ts +++ b/src/renderer/components.d.ts @@ -11,33 +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'] - ElButton: typeof import('element-plus/es')['ElButton'] - ElCard: typeof import('element-plus/es')['ElCard'] - ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] - ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] - ElCol: typeof import('element-plus/es')['ElCol'] - ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] - ElDialog: typeof import('element-plus/es')['ElDialog'] - ElForm: typeof import('element-plus/es')['ElForm'] - ElFormItem: typeof import('element-plus/es')['ElFormItem'] - ElIcon: typeof import('element-plus/es')['ElIcon'] - ElImage: typeof import('element-plus/es')['ElImage'] - ElInput: typeof import('element-plus/es')['ElInput'] - ElOption: typeof import('element-plus/es')['ElOption'] - ElPagination: typeof import('element-plus/es')['ElPagination'] - ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm'] - ElPopover: typeof import('element-plus/es')['ElPopover'] - 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'] - ElTabPane: typeof import('element-plus/es')['ElTabPane'] - ElTabs: typeof import('element-plus/es')['ElTabs'] - 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'] Pagination: typeof import('./src/components/Pagination/index.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/renderer/src/views/components/headers/index.vue b/src/renderer/src/views/components/headers/index.vue index ce6d614..1072d45 100644 --- a/src/renderer/src/views/components/headers/index.vue +++ b/src/renderer/src/views/components/headers/index.vue @@ -36,6 +36,7 @@