Updated: electron version & fixed smms pic type

This commit is contained in:
Molunerfinn 2018-08-08 11:21:08 +08:00
parent 4ab782e8dc
commit d4c04ee1e6
5 changed files with 27 additions and 6 deletions

View File

@ -111,7 +111,7 @@
"css-loader": "^0.28.4", "css-loader": "^0.28.4",
"del": "^3.0.0", "del": "^3.0.0",
"devtron": "^1.4.0", "devtron": "^1.4.0",
"electron": "^1.7.5", "electron": "1.8.7",
"electron-builder": "^19.19.1", "electron-builder": "^19.19.1",
"electron-debug": "^1.4.0", "electron-debug": "^1.4.0",
"electron-devtools-installer": "^2.2.0", "electron-devtools-installer": "^2.2.0",

View File

@ -354,6 +354,9 @@ const uploadClipboardFiles = async () => {
notification.show() notification.show()
window.webContents.send('clipboardFiles', []) window.webContents.send('clipboardFiles', [])
window.webContents.send('uploadFiles', img) window.webContents.send('uploadFiles', img)
if (settingWindow) {
settingWindow.webContents.send('updateGallery')
}
} else { } else {
const notification = new Notification({ const notification = new Notification({
title: '上传不成功', title: '上传不成功',
@ -396,6 +399,9 @@ ipcMain.on('uploadClipboardFiles', async (evt, file) => {
notification.show() notification.show()
window.webContents.send('clipboardFiles', []) window.webContents.send('clipboardFiles', [])
window.webContents.send('uploadFiles', img) window.webContents.send('uploadFiles', img)
if (settingWindow) {
settingWindow.webContents.send('updateGallery')
}
} else { } else {
uploadFailed() uploadFailed()
} }
@ -423,6 +429,9 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => {
} }
clipboard.writeText(pasteText) clipboard.writeText(pasteText)
window.webContents.send('uploadFiles', imgs) window.webContents.send('uploadFiles', imgs)
if (settingWindow) {
settingWindow.webContents.send('updateGallery')
}
} else { } else {
uploadFailed() uploadFailed()
} }

View File

@ -34,6 +34,7 @@ const smmsUpload = async function (img, type, webContents) {
if (body.code === 'success') { if (body.code === 'success') {
delete imgList[i].base64Image delete imgList[i].base64Image
imgList[i]['imgUrl'] = body.data.url imgList[i]['imgUrl'] = body.data.url
imgList[i]['type'] = 'smms'
} else { } else {
webContents.send('uploadProgress', -1) webContents.send('uploadProgress', -1)
return new Error() return new Error()

View File

@ -103,10 +103,18 @@ export default {
}, },
created () { created () {
this.getGallery() this.getGallery()
this.$electron.ipcRenderer.on('updateGallery', (event) => {
this.filterList = this.getGallery()
})
}, },
computed: { computed: {
filterList (val) { filterList: {
return this.getGallery() get () {
return this.getGallery()
},
set (val) {
return this.val
}
} }
}, },
methods: { methods: {
@ -264,6 +272,9 @@ export default {
toggleHandleBar () { toggleHandleBar () {
this.handleBarActive = !this.handleBarActive this.handleBarActive = !this.handleBarActive
} }
},
beforeDestroy () {
this.$electron.ipcRenderer.removeAllListeners('updateGallery')
} }
} }
</script> </script>

View File

@ -2982,9 +2982,9 @@ electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.27:
version "1.3.27" version "1.3.27"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d"
electron@^1.7.5: electron@1.8.7:
version "1.8.1" version "1.8.7"
resolved "https://registry.yarnpkg.com/electron/-/electron-1.8.1.tgz#19b6f39f2013e204a91a60bc3086dc7a4a07ed88" resolved "http://registry.npm.taobao.org/electron/download/electron-1.8.7.tgz#373c1dc4589d7ab4acd49aff8db4a1c0a6c3bcc1"
dependencies: dependencies:
"@types/node" "^8.0.24" "@types/node" "^8.0.24"
electron-download "^3.0.1" electron-download "^3.0.1"