mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
no message
This commit is contained in:
parent
e0a3259765
commit
91f4b2fd9d
36
electron/electron.js
vendored
36
electron/electron.js
vendored
@ -158,17 +158,19 @@ if (!getTheLock) {
|
|||||||
// 创建主窗口
|
// 创建主窗口
|
||||||
createMainWindow()
|
createMainWindow()
|
||||||
// 创建托盘
|
// 创建托盘
|
||||||
if (['darwin', 'win32'].includes(process.platform)) {
|
if (['darwin', 'win32'].includes(process.platform) && utils.isJson(config.trayIcon)) {
|
||||||
mainTray = new Tray(process.platform === 'darwin' ? config.trayIcon.mac : config.trayIcon.win);
|
mainTray = new Tray(path.join(__dirname, config.trayIcon[devloadUrl ? 'dev' : 'prod'][process.platform === 'darwin' ? 'mac' : 'win']));
|
||||||
mainTray.on('click', () => {
|
mainTray.on('click', () => {
|
||||||
utils.setShowWindow(mainWindow)
|
utils.setShowWindow(mainWindow)
|
||||||
})
|
})
|
||||||
mainTray.on('double-click', () => {
|
|
||||||
utils.setShowWindow(mainWindow)
|
|
||||||
})
|
|
||||||
mainTray.setToolTip(config.name)
|
mainTray.setToolTip(config.name)
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
const trayMenu = Menu.buildFromTemplate([{
|
const trayMenu = Menu.buildFromTemplate([{
|
||||||
|
label: '显示',
|
||||||
|
click: () => {
|
||||||
|
utils.setShowWindow(mainWindow)
|
||||||
|
}
|
||||||
|
}, {
|
||||||
label: '退出',
|
label: '退出',
|
||||||
click: () => {
|
click: () => {
|
||||||
app.quit()
|
app.quit()
|
||||||
@ -221,7 +223,7 @@ ipcMain.on('windowRouter', (event, args) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 隐藏窗口(mac|win隐藏,其他关闭)
|
* 隐藏窗口(mac、win隐藏,其他关闭)
|
||||||
*/
|
*/
|
||||||
ipcMain.on('windowHidden', (event) => {
|
ipcMain.on('windowHidden', (event) => {
|
||||||
if (['darwin', 'win32'].includes(process.platform)) {
|
if (['darwin', 'win32'].includes(process.platform)) {
|
||||||
@ -242,7 +244,7 @@ ipcMain.on('windowClose', (event) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭窗口(强制)
|
* 销毁窗口
|
||||||
*/
|
*/
|
||||||
ipcMain.on('windowDestroy', (event) => {
|
ipcMain.on('windowDestroy', (event) => {
|
||||||
const win = BrowserWindow.fromWebContents(event.sender);
|
const win = BrowserWindow.fromWebContents(event.sender);
|
||||||
@ -250,6 +252,26 @@ ipcMain.on('windowDestroy', (event) => {
|
|||||||
event.returnValue = "ok"
|
event.returnValue = "ok"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭所有子窗口
|
||||||
|
*/
|
||||||
|
ipcMain.on('subWindowCloseAll', () => {
|
||||||
|
subWindow.some(item => {
|
||||||
|
item.close()
|
||||||
|
})
|
||||||
|
event.returnValue = "ok"
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销毁所有子窗口
|
||||||
|
*/
|
||||||
|
ipcMain.on('subWindowDestroyAll', () => {
|
||||||
|
subWindow.some(item => {
|
||||||
|
item.destroy()
|
||||||
|
})
|
||||||
|
event.returnValue = "ok"
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置窗口尺寸
|
* 设置窗口尺寸
|
||||||
* @param args {width, height, autoZoom, minWidth, minHeight, maxWidth, maxHeight}
|
* @param args {width, height, autoZoom, minWidth, minHeight, maxWidth, maxHeight}
|
||||||
|
|||||||
@ -48,9 +48,15 @@
|
|||||||
"pdf-lib": "^1.17.1"
|
"pdf-lib": "^1.17.1"
|
||||||
},
|
},
|
||||||
"trayIcon": {
|
"trayIcon": {
|
||||||
|
"dev": {
|
||||||
"mac": "../resources/assets/statics/public/images/tray/logo-trayTemplate.png",
|
"mac": "../resources/assets/statics/public/images/tray/logo-trayTemplate.png",
|
||||||
"win": "../resources/assets/statics/public/images/logo-app.ico"
|
"win": "../resources/assets/statics/public/images/logo-app.ico"
|
||||||
},
|
},
|
||||||
|
"prod": {
|
||||||
|
"mac": "./public/images/tray/logo-trayTemplate.png",
|
||||||
|
"win": "./public/images/logo-app.ico"
|
||||||
|
}
|
||||||
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "com.dootask.task",
|
"appId": "com.dootask.task",
|
||||||
"artifactName": "${productName}-v${version}-${os}-${arch}.${ext}",
|
"artifactName": "${productName}-v${version}-${os}-${arch}.${ext}",
|
||||||
|
|||||||
@ -125,6 +125,10 @@ export default {
|
|||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.loginType = 'login'
|
this.loginType = 'login'
|
||||||
|
//
|
||||||
|
if (this.$Electron) {
|
||||||
|
this.$Electron.sendMessage('subWindowDestroyAll')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
deactivated() {
|
deactivated() {
|
||||||
this.loginJump = false;
|
this.loginJump = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user