Added: upload notification swtich

This commit is contained in:
Molunerfinn
2018-06-05 20:03:58 +08:00
parent 947e49ab4a
commit 3455512c47
2 changed files with 22 additions and 6 deletions
+7 -5
View File
@@ -12,11 +12,13 @@ const checkUploader = (type) => {
} }
const uploader = (img, type, webContents) => { const uploader = (img, type, webContents) => {
const notification = new Notification({ if (db.read().get('picBed.uploadNotification').value()) {
title: '上传进度', const notification = new Notification({
body: '正在上传' title: '上传进度',
}) body: '正在上传'
notification.show() })
notification.show()
}
const uploadType = db.read().get('picBed.current').value() const uploadType = db.read().get('picBed.current').value()
if (checkUploader(uploadType)) { if (checkUploader(uploadType)) {
return picBeds[uploadType](img, type, webContents) return picBeds[uploadType](img, type, webContents)
@@ -66,6 +66,16 @@
@change="handleAutoRename" @change="handleAutoRename"
></el-switch> ></el-switch>
</el-form-item> </el-form-item>
<el-form-item
label="开启上传提示"
>
<el-switch
v-model="form.uploadNotification"
active-text=""
inactive-text=""
@change="handleUploadNotification"
></el-switch>
</el-form-item>
<el-form-item <el-form-item
label="选择显示的图床" label="选择显示的图床"
> >
@@ -190,7 +200,8 @@ export default {
showPicBedList: [], showPicBedList: [],
autoStart: this.$db.get('picBed.autoStart').value() || false, autoStart: this.$db.get('picBed.autoStart').value() || false,
rename: this.$db.get('picBed.rename').value() || false, rename: this.$db.get('picBed.rename').value() || false,
autoRename: this.$db.get('picBed.autoRename').value() || false autoRename: this.$db.get('picBed.autoRename').value() || false,
uploadNotification: this.$db.get('picBed.uploadNotification').value() || false
}, },
picBed: this.$picBed, picBed: this.$picBed,
keyBindingVisible: false, keyBindingVisible: false,
@@ -302,6 +313,9 @@ export default {
}, },
cancelCheckVersion () { cancelCheckVersion () {
this.checkUpdateVisible = false this.checkUpdateVisible = false
},
handleUploadNotification (val) {
this.$db.read().set('picBed.uploadNotification', val).write()
} }
}, },
beforeDestroy () { beforeDestroy () {