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 @@