diff --git a/package.json b/package.json index 6607e5e..cec97dc 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "css-loader": "^0.28.4", "del": "^3.0.0", "devtron": "^1.4.0", - "electron": "^1.7.5", + "electron": "1.8.7", "electron-builder": "^19.19.1", "electron-debug": "^1.4.0", "electron-devtools-installer": "^2.2.0", diff --git a/src/main/index.js b/src/main/index.js index cf0c138..b0d430b 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -354,6 +354,9 @@ const uploadClipboardFiles = async () => { notification.show() window.webContents.send('clipboardFiles', []) window.webContents.send('uploadFiles', img) + if (settingWindow) { + settingWindow.webContents.send('updateGallery') + } } else { const notification = new Notification({ title: '上传不成功', @@ -396,6 +399,9 @@ ipcMain.on('uploadClipboardFiles', async (evt, file) => { notification.show() window.webContents.send('clipboardFiles', []) window.webContents.send('uploadFiles', img) + if (settingWindow) { + settingWindow.webContents.send('updateGallery') + } } else { uploadFailed() } @@ -423,6 +429,9 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => { } clipboard.writeText(pasteText) window.webContents.send('uploadFiles', imgs) + if (settingWindow) { + settingWindow.webContents.send('updateGallery') + } } else { uploadFailed() } diff --git a/src/main/utils/smmsUpload.js b/src/main/utils/smmsUpload.js index 91a30de..6d66179 100644 --- a/src/main/utils/smmsUpload.js +++ b/src/main/utils/smmsUpload.js @@ -34,6 +34,7 @@ const smmsUpload = async function (img, type, webContents) { if (body.code === 'success') { delete imgList[i].base64Image imgList[i]['imgUrl'] = body.data.url + imgList[i]['type'] = 'smms' } else { webContents.send('uploadProgress', -1) return new Error() diff --git a/src/renderer/components/SettingView/Gallery.vue b/src/renderer/components/SettingView/Gallery.vue index 765e104..7f2c392 100644 --- a/src/renderer/components/SettingView/Gallery.vue +++ b/src/renderer/components/SettingView/Gallery.vue @@ -103,10 +103,18 @@ export default { }, created () { this.getGallery() + this.$electron.ipcRenderer.on('updateGallery', (event) => { + this.filterList = this.getGallery() + }) }, computed: { - filterList (val) { - return this.getGallery() + filterList: { + get () { + return this.getGallery() + }, + set (val) { + return this.val + } } }, methods: { @@ -264,6 +272,9 @@ export default { toggleHandleBar () { this.handleBarActive = !this.handleBarActive } + }, + beforeDestroy () { + this.$electron.ipcRenderer.removeAllListeners('updateGallery') } } diff --git a/yarn.lock b/yarn.lock index c6ffbc0..09565a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2982,9 +2982,9 @@ electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.27: version "1.3.27" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d" -electron@^1.7.5: - version "1.8.1" - resolved "https://registry.yarnpkg.com/electron/-/electron-1.8.1.tgz#19b6f39f2013e204a91a60bc3086dc7a4a07ed88" +electron@1.8.7: + version "1.8.7" + resolved "http://registry.npm.taobao.org/electron/download/electron-1.8.7.tgz#373c1dc4589d7ab4acd49aff8db4a1c0a6c3bcc1" dependencies: "@types/node" "^8.0.24" electron-download "^3.0.1"