diff --git a/electron/main.js b/electron/main.js index 8d4e7e5f..1c8771da 100644 --- a/electron/main.js +++ b/electron/main.js @@ -66,7 +66,13 @@ function createMainWindow() { }) } - mainWindow.on('close', function (e) { + mainWindow.on('page-title-updated', (event, title) => { + if (title == "index.html") { + event.preventDefault() + } + }) + + mainWindow.on('close', (e) => { if (!willQuitApp) { e.preventDefault(); if (inheritClose) { @@ -103,6 +109,10 @@ function createSubWindow(args) { return; } } else { + let config = args.config || {}; + if (typeof args.title !== "undefined") { + config.title = args.title; + } browser = new BrowserWindow(Object.assign({ width: 1280, height: 800, @@ -115,8 +125,13 @@ function createSubWindow(args) { nodeIntegration: true, contextIsolation: false } - }, args.config || {})) - browser.on('close', function () { + }, config)) + browser.on('page-title-updated', (event, title) => { + if (title == "index.html" || args.titleFixed === true) { + event.preventDefault() + } + }) + browser.on('close', () => { let index = subWindow.findIndex(item => item.name == name); if (index > -1) { subWindow.splice(index, 1) diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index 752abd18..f7e9d514 100644 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -1187,6 +1187,8 @@ export default { config.minHeight = 600; } this.$Electron.ipcRenderer.send('windowRouter', { + title: this.taskDetail.name, + titleFixed: true, name: 'task-' + this.taskDetail.id, path: "/single/task/" + this.taskDetail.id, force: false, diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index 18b74f67..8be33d46 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -762,13 +762,15 @@ export default { openSingle(item) { this.$Electron.ipcRenderer.send('windowRouter', { + title: item.name, + titleFixed: true, name: 'file-' + item.id, path: "/single/file/" + item.id, force: false, // 如果窗口已存在不重新加载 config: { parent: null, - width: Math.min(window.screen.availWidth, 1280), - height: Math.min(window.screen.availHeight, 800), + width: Math.min(window.screen.availWidth, 1440), + height: Math.min(window.screen.availHeight, 900), } }); },