zhuhao_dev #246
|
@ -3,7 +3,14 @@ import path from 'path'
|
||||||
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import WindiCSS from "vite-plugin-windicss"
|
import WindiCSS from "vite-plugin-windicss"
|
||||||
|
/*import electron from 'vite-plugin-electron'
|
||||||
|
plugins: [electron({
|
||||||
|
main: {
|
||||||
|
builderOptions: {
|
||||||
|
asar: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})],*/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
main: {
|
main: {
|
||||||
plugins: [externalizeDepsPlugin()]
|
plugins: [externalizeDepsPlugin()]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "aix-win",
|
"name": "aix-win",
|
||||||
"version": "2.0.2",
|
"version": "2.0.4",
|
||||||
"description": "An Electron application with Vue",
|
"description": "An Electron application with Vue",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "example.com",
|
"author": "example.com",
|
||||||
|
@ -45,10 +45,12 @@
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"jsondiffpatch": "0.6.0",
|
"jsondiffpatch": "0.6.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"node-addon-api": "^8.1.0",
|
||||||
"pdfjs-dist": "4.4.168",
|
"pdfjs-dist": "4.4.168",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"pinia-plugin-persistedstate": "^3.2.1",
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
"spark-md5": "^3.0.2",
|
"spark-md5": "^3.0.2",
|
||||||
|
"vite-plugin-electron": "^0.28.8",
|
||||||
"vue-qr": "^4.0.9",
|
"vue-qr": "^4.0.9",
|
||||||
"vue-router": "^4.4.0",
|
"vue-router": "^4.4.0",
|
||||||
"xgplayer": "^3.0.19",
|
"xgplayer": "^3.0.19",
|
||||||
|
|
|
@ -21,6 +21,27 @@ File({ app, shell, BrowserWindow, ipcMain })
|
||||||
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
|
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
|
||||||
let mainWindow, loginWindow
|
let mainWindow, loginWindow
|
||||||
|
|
||||||
|
const additionalData = {myKey:'ys_axi_smarttalk'}
|
||||||
|
const gotTheLock = app.requestSingleInstanceLock(additionalData)
|
||||||
|
|
||||||
|
if(!gotTheLock){
|
||||||
|
app.quit()
|
||||||
|
}else{
|
||||||
|
app.on('second-instance',(event,commandLine,workingDirectory,additionalData)=>{
|
||||||
|
//输入从第二个实例中接收到的数据
|
||||||
|
console.log(additionalData)
|
||||||
|
//有人试图运行第二个实例,我们应该关注我们的窗口
|
||||||
|
if(mainWindow){
|
||||||
|
if(mainWindow.isMinimized()) mainWindow.restore()
|
||||||
|
mainWindow.focus()
|
||||||
|
}
|
||||||
|
if(loginWindow){
|
||||||
|
if(loginWindow.isMinimized()) loginWindow.restore()
|
||||||
|
loginWindow.focus()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//登录窗口
|
//登录窗口
|
||||||
function createLoginWindow() {
|
function createLoginWindow() {
|
||||||
if (loginWindow) return
|
if (loginWindow) return
|
||||||
|
@ -53,7 +74,7 @@ function createLoginWindow() {
|
||||||
updateInit(loginWindow)
|
updateInit(loginWindow)
|
||||||
}
|
}
|
||||||
|
|
||||||
loginWindow.webContents.openDevTools()
|
// loginWindow.webContents.openDevTools()
|
||||||
loginWindow.once('ready-to-show', () => {
|
loginWindow.once('ready-to-show', () => {
|
||||||
loginWindow.show()
|
loginWindow.show()
|
||||||
})
|
})
|
||||||
|
@ -101,7 +122,7 @@ function createMainWindow() {
|
||||||
shell.openExternal(details.url)
|
shell.openExternal(details.url)
|
||||||
return { action: 'deny' }
|
return { action: 'deny' }
|
||||||
})
|
})
|
||||||
mainWindow.webContents.openDevTools()
|
// mainWindow.webContents.openDevTools()
|
||||||
|
|
||||||
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
||||||
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
|
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
|
||||||
|
|
Loading…
Reference in New Issue