From 7c8b2477d52b0ce12473262c96aeadb27f52a97b Mon Sep 17 00:00:00 2001 From: fhysy <1149505133@qq.com> Date: Thu, 24 Jul 2025 09:31:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(export):=20=E5=AE=9E=E7=8E=B0=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?,=E8=A7=A3=E5=86=B3=E6=97=A5=E5=BF=97=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E5=BA=95=E9=83=A8bug=EF=BC=8C=E5=8D=87?= =?UTF-8?q?=E7=BA=A71.0.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加导出生产数据的接口和相关逻辑 - 新增导出时间范围选择功能 - 优化日志滚动和结果显示 - 调整标定日志结构判断逻辑 - 更新 UI 样式,增加配置密钥功能 --- package.json | 2 +- resources/service/config/config.yaml | 4 +- src/preload/index.js | 25 ++++- src/renderer/src/views/calibration/index.vue | 111 +++++++++++++++---- 4 files changed, 116 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index fe2260f..17e0ea6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gy-calibration", - "version": "1.0.7", + "version": "1.0.9", "description": "谷云开发部开发的断路器标定软件", "main": "./out/main/index.js", "author": "example.com", diff --git a/resources/service/config/config.yaml b/resources/service/config/config.yaml index deefde0..62f1190 100644 --- a/resources/service/config/config.yaml +++ b/resources/service/config/config.yaml @@ -16,4 +16,6 @@ startAddr: 3 #测试源电压波动比例 fluctuateRatioU: 90 #测试源电压波动比例 -fluctuateRatioI: 90 \ No newline at end of file +fluctuateRatioI: 90 +#配置密钥 +secretKey: "1dd53c82958d1de56df4035d3ed9fd82" \ No newline at end of file diff --git a/src/preload/index.js b/src/preload/index.js index 695c4e0..17d2ba0 100644 --- a/src/preload/index.js +++ b/src/preload/index.js @@ -2,6 +2,7 @@ import { contextBridge, ipcRenderer } from 'electron' import { electronAPI } from '@electron-toolkit/preload' const fs = require('fs'); const path = require('path'); +const { shell } = require('electron'); // Custom APIs for renderer // 自定义的主进程方法API @@ -36,6 +37,18 @@ function getConfigPath() { return configPath; } +function getExportPath() { + // __dirname 是 win-unpacked/resources/app + + let configPath = path.resolve('./resources/app.asar.unpacked/resources/service'); + //单独配置测试环境 + if (process.env.NODE_ENV === 'development') { + configPath = path.resolve('./resources/service'); + } + + return configPath; +} + // Use `contextBridge` APIs to expose Electron APIs to // renderer only if context isolation is enabled, otherwise @@ -56,7 +69,11 @@ if (process.contextIsolated) { return require(configPath); } return {}; - } + }, + shell: { + openPath: shell.openPath + }, + exePath: getExportPath() }) // contextBridge.exposeInMainWorld('api', api) } catch (error) { @@ -76,7 +93,11 @@ if (process.contextIsolated) { return require(configPath); } return {}; - } + }, + shell: { + openPath: shell.openPath + }, + exePath: getExportPath() } // window.api = api } diff --git a/src/renderer/src/views/calibration/index.vue b/src/renderer/src/views/calibration/index.vue index 30731c6..ad35691 100644 --- a/src/renderer/src/views/calibration/index.vue +++ b/src/renderer/src/views/calibration/index.vue @@ -12,8 +12,7 @@