From 544496a09b5cfeffb8b3c80a621ac01125228f14 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 23 Dec 2021 19:35:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=94=AE=E5=85=B3=E9=97=AD=E7=AA=97=E5=8F=A3=E5=85=88?= =?UTF-8?q?=E5=85=B3=E7=BD=91=E9=A1=B5=E5=86=85=E7=9A=84=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main.js | 25 +++- package.json | 2 +- resources/assets/js/App.vue | 284 ++++++++++++++++++++---------------- 3 files changed, 178 insertions(+), 133 deletions(-) diff --git a/electron/main.js b/electron/main.js index 97395433..1620686a 100644 --- a/electron/main.js +++ b/electron/main.js @@ -3,6 +3,7 @@ const path = require('path') const XLSX = require('xlsx'); const {app, BrowserWindow, ipcMain, dialog} = require('electron') +let mainWindow = null; let willQuitApp = false, devloadCachePath = path.resolve(__dirname, ".devload"), devloadUrl = ""; @@ -29,7 +30,7 @@ function runNum(str, fixed) { } function createWindow() { - const mainWindow = new BrowserWindow({ + mainWindow = new BrowserWindow({ width: 1280, height: 800, webPreferences: { @@ -52,7 +53,7 @@ function createWindow() { mainWindow.on('close', function (e) { if (!willQuitApp) { e.preventDefault(); - app.hide(); + mainWindow.webContents.send("windowClose", {}) } }) } @@ -71,7 +72,7 @@ app.on('window-all-closed', function () { app.on('before-quit', () => { willQuitApp = true -}); +}) ipcMain.on('setDockBadge', (event, arg) => { if (runNum(arg) > 0) { @@ -79,6 +80,22 @@ ipcMain.on('setDockBadge', (event, arg) => { } else { app.dock.setBadge("") } +}) + +ipcMain.on('windowMax', function () { + if (mainWindow.isMaximized()) { + mainWindow.restore(); + } else { + mainWindow.maximize(); + } +}) + +ipcMain.on('windowHidden', () => { + app.hide(); +}) + +ipcMain.on('windowClose', () => { + mainWindow.close() }); ipcMain.on('saveSheet', (event, data, filename, opts) => { @@ -93,4 +110,4 @@ ipcMain.on('saveSheet', (event, data, filename, opts) => { }).then(o => { XLSX.writeFile(data, o.filePath, opts); }); -}); +}) diff --git a/package.json b/package.json index ae4acac4..24dce797 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "stylus-loader": "^6.2.0", "tinymce": "^5.10.2", "tui-calendar-hi": "^1.15.1-1", - "view-design-hi": "^4.7.0-1", + "view-design-hi": "^4.7.0-2", "vue": "^2.6.14", "vue-clipboard2": "^0.3.3", "vue-emoji-picker": "^1.0.3", diff --git a/resources/assets/js/App.vue b/resources/assets/js/App.vue index a3730a44..006b3b71 100755 --- a/resources/assets/js/App.vue +++ b/resources/assets/js/App.vue @@ -10,154 +10,182 @@