From c82cf46f993388e786b619414dc5265f43e49cff Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Thu, 18 Jul 2024 13:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=9C=BA=E8=87=AA=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/services/ipcMain.js | 9 ++++++++- src/renderer/views/setting/index.vue | 7 ++++++- static/setting.json | 9 ++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/services/ipcMain.js b/src/main/services/ipcMain.js index 052d85f..77695e1 100644 --- a/src/main/services/ipcMain.js +++ b/src/main/services/ipcMain.js @@ -1,4 +1,4 @@ -import { ipcMain, dialog, BrowserWindow } from 'electron' +import { ipcMain, dialog, BrowserWindow, app } from 'electron' import Server from '../server/index' import { winURL } from '../config/StaticPath' import downloadFile from './downloadFile' @@ -23,6 +23,13 @@ import { export default { Mainfunc(IsUseSysTitle) { const allUpdater = new Update(); + ipcMain.handle('set-start-up',async (event,checked) => { + app.setLoginItemSettings({ + openAtLogin: checked, + // 如果应用以管理员身份运行,设置此选项为true可避免UAC(用户账户控制)对话框在Windows上弹出。 + openAsHidden: false, // macOS特有的,当设置为true时,应用会隐藏式启动 + }) + }) ipcMain.handle('change-url', async (event, url) => { adminView.webContents.loadURL(url) }) diff --git a/src/renderer/views/setting/index.vue b/src/renderer/views/setting/index.vue index c321cb6..5c238bd 100644 --- a/src/renderer/views/setting/index.vue +++ b/src/renderer/views/setting/index.vue @@ -16,6 +16,9 @@ + + + 保存 重置 @@ -36,7 +39,8 @@ const form = ref({ adminWebUri: '', api: '', uploadApi: '', - isNotice: '' + isNotice: '', + isStartup: true }) form.value = JSON.parse(JSON.stringify(window.DEFAULTSETTING)) @@ -59,6 +63,7 @@ const saving = () => { duration: 3000 }) }) + ipcRenderer.invoke('set-start-up', form.value.isStartup) } }) } diff --git a/static/setting.json b/static/setting.json index 401c109..75a7437 100644 --- a/static/setting.json +++ b/static/setting.json @@ -1 +1,8 @@ -{"oaUri":"http://oa-sqhj-test.ali251.langye.net/admin/flow","adminWebUri":"http://contract-sqhj-test.ali251.langye.net/admin_test/#/","api":"http://contract-sqhj-test.ali251.langye.net/","uploadApi":"http://contract-sqhj-test.ali251.langye.net/api/admin/upload-file","isNotice":true} +{ + "oaUri":"http://oa-sqhj-test.ali251.langye.net/admin/flow", + "adminWebUri":"http://contract-sqhj-test.ali251.langye.net/admin_test/#/", + "api":"http://contract-sqhj-test.ali251.langye.net/", + "uploadApi":"http://contract-sqhj-test.ali251.langye.net/api/admin/upload-file", + "isNotice":true, + "isStartup":true +}