mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +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()
|
||||
// 创建托盘
|
||||
if (['darwin', 'win32'].includes(process.platform)) {
|
||||
mainTray = new Tray(process.platform === 'darwin' ? config.trayIcon.mac : config.trayIcon.win);
|
||||
if (['darwin', 'win32'].includes(process.platform) && utils.isJson(config.trayIcon)) {
|
||||
mainTray = new Tray(path.join(__dirname, config.trayIcon[devloadUrl ? 'dev' : 'prod'][process.platform === 'darwin' ? 'mac' : 'win']));
|
||||
mainTray.on('click', () => {
|
||||
utils.setShowWindow(mainWindow)
|
||||
})
|
||||
mainTray.on('double-click', () => {
|
||||
utils.setShowWindow(mainWindow)
|
||||
})
|
||||
mainTray.setToolTip(config.name)
|
||||
if (process.platform === 'win32') {
|
||||
const trayMenu = Menu.buildFromTemplate([{
|
||||
label: '显示',
|
||||
click: () => {
|
||||
utils.setShowWindow(mainWindow)
|
||||
}
|
||||
}, {
|
||||
label: '退出',
|
||||
click: () => {
|
||||
app.quit()
|
||||
@ -221,7 +223,7 @@ ipcMain.on('windowRouter', (event, args) => {
|
||||
})
|
||||
|
||||
/**
|
||||
* 隐藏窗口(mac|win隐藏,其他关闭)
|
||||
* 隐藏窗口(mac、win隐藏,其他关闭)
|
||||
*/
|
||||
ipcMain.on('windowHidden', (event) => {
|
||||
if (['darwin', 'win32'].includes(process.platform)) {
|
||||
@ -242,7 +244,7 @@ ipcMain.on('windowClose', (event) => {
|
||||
})
|
||||
|
||||
/**
|
||||
* 关闭窗口(强制)
|
||||
* 销毁窗口
|
||||
*/
|
||||
ipcMain.on('windowDestroy', (event) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender);
|
||||
@ -250,6 +252,26 @@ ipcMain.on('windowDestroy', (event) => {
|
||||
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}
|
||||
|
||||
@ -48,8 +48,14 @@
|
||||
"pdf-lib": "^1.17.1"
|
||||
},
|
||||
"trayIcon": {
|
||||
"mac": "../resources/assets/statics/public/images/tray/logo-trayTemplate.png",
|
||||
"win": "../resources/assets/statics/public/images/logo-app.ico"
|
||||
"dev": {
|
||||
"mac": "../resources/assets/statics/public/images/tray/logo-trayTemplate.png",
|
||||
"win": "../resources/assets/statics/public/images/logo-app.ico"
|
||||
},
|
||||
"prod": {
|
||||
"mac": "./public/images/tray/logo-trayTemplate.png",
|
||||
"win": "./public/images/logo-app.ico"
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"appId": "com.dootask.task",
|
||||
|
||||
@ -125,6 +125,10 @@ export default {
|
||||
},
|
||||
activated() {
|
||||
this.loginType = 'login'
|
||||
//
|
||||
if (this.$Electron) {
|
||||
this.$Electron.sendMessage('subWindowDestroyAll')
|
||||
}
|
||||
},
|
||||
deactivated() {
|
||||
this.loginJump = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user