diff --git a/electron-builder.yml b/electron-builder.yml index 13478b8..ce62993 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -8,7 +8,10 @@ directories: # 定义要包含或排除在构建输出中的文件 files: - '!**/.vscode/*' # 排除VSCode配置文件 + - '!**/.cursor/*' # 排除cursor配置文件 + - '!**/.idea/*' # 排除idea配置文件 - '!src/*' # 排除源代码目录 + - '!**/*.log' # 排除日志文件 - '!electron.vite.config.{js,ts,mjs,cjs}' # 排除Electron构建配置文件 - '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}' # 排除开发和文档文件 - '!{.env,.env.*,.npmrc,pnpm-lock.yaml,*.zip,app.log}' # 排除环境和包管理配置文件 diff --git a/src/main/index.js b/src/main/index.js index b5468cc..6ff2476 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -91,9 +91,9 @@ if (!gotTheLock) { } }); - // 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. + //当Electron完成时,将调用此方法 +//初始化并准备创建浏览器窗口。 +//某些API只能在此事件发生后使用。 const { spawn } = require('child_process'); let child = null; let exePluginsExeList = []; @@ -220,5 +220,10 @@ if (!gotTheLock) { } }); } + // 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. + +ipcMain.handle('get-app-version', () => { + return app.getVersion(); +}); diff --git a/src/preload/index.js b/src/preload/index.js index 121f8c3..1717c90 100644 --- a/src/preload/index.js +++ b/src/preload/index.js @@ -1,4 +1,4 @@ -import { contextBridge, ipcRenderer } from 'electron' +import { contextBridge, ipcRenderer } from 'electron' import { electronAPI } from '@electron-toolkit/preload' // Custom APIs for renderer @@ -16,6 +16,10 @@ import { electronAPI } from '@electron-toolkit/preload' // return result; // } // } +// // 暴露获取版本号的方法 +// ipcMain.handle('get-app-version', () => { +// return app.getVersion(); // 返回当前应用版本(来自 package.json) +// }); // Use `contextBridge` APIs to expose Electron APIs to // renderer only if context isolation is enabled, otherwise @@ -23,12 +27,22 @@ import { electronAPI } from '@electron-toolkit/preload' // 使用contextBridge将Electron API和自定义的主进程方法API暴露给渲染进程页面。 if (process.contextIsolated) { try { - contextBridge.exposeInMainWorld('electron', electronAPI) + contextBridge.exposeInMainWorld('electron', { + ...electronAPI, + getAppVersion: async () => { + return await ipcRenderer.invoke('get-app-version'); + } + }) // contextBridge.exposeInMainWorld('api', api) } catch (error) { console.error(error) } } else { - window.electron = electronAPI + window.electron = { + ...electronAPI, + getAppVersion: async () => { + return await ipcRenderer.invoke('get-app-version'); + } + } // window.api = api } diff --git a/src/renderer/src/views/calibration/index.vue b/src/renderer/src/views/calibration/index.vue index bd09e57..3654105 100644 --- a/src/renderer/src/views/calibration/index.vue +++ b/src/renderer/src/views/calibration/index.vue @@ -2,7 +2,7 @@
- + 开始执行 @@ -10,10 +10,10 @@
刷新列表 - 设置 + 配置方案
-
+
系列: {{ activeScheme.series }} @@ -21,8 +21,13 @@ >框架: {{ activeScheme.framework }} 类型: {{ activeScheme.schemeType }}P位: {{ activeScheme.schemeType }} + 额定电流(A): {{ activeScheme.configParam.format[2].value }} +
+
{{ item.unit ? item.name + '(' + item.unit + ')' : item.name }}: {{ item.value }} @@ -30,25 +35,25 @@
- +
-

设备码: {{ device.deviceSN || '无' }}

+

芯片ID: {{ device.deviceSN || '无' }}

设备端口: {{ device.devicePort || '无' }}

标定结果: {{ device.result || '无' }}

- 失败描述: + 结果描述: {{ device.resultTxt || '无' }} @@ -104,6 +109,11 @@ + + + + + @@ -113,153 +123,192 @@

-
{{ version }}
+
V{{ version }}
-
-
- 新增方案 - 刷新 +
+ 新增方案 + 刷新 +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 断路器校准参数 +
+ + + +
+ + + + 校准精度(%) +
+ + + +
+ + 标定步骤 +
+
+ 添加步骤
- - - - - + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
+
+
设备: {{ activeDeviceInfo.id || '-' }}
+
芯片ID: {{ activeDeviceInfo.deviceSN || '-' }}
+
设备端口: {{ activeDeviceInfo.devicePort || '-' }}
+
标定结果: {{ activeDeviceInfo.result || '-' }}
+
结果描述: {{ activeDeviceInfo.resultTxt || '-' }}
+
+ + + + + + + + + + + + + + + + 错误日志 + + - 断路器校准参数 -
- - - -
- - - - 校准精度(%) -
- - - -
- - 标定步骤 -
-
- 添加步骤 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -