Modified: pic-bed constructure for future

This commit is contained in:
Molunerfinn 2018-06-05 19:49:01 +08:00
parent a20299edaa
commit 947e49ab4a
3 changed files with 13 additions and 21 deletions

View File

@ -3,13 +3,15 @@ import qiniuUpload from '../main/utils/qiniuUpload'
import tcYunUpload from '../main/utils/tcYunUpload'
import upYunUpload from '../main/utils/upYunUpload'
import githubUpload from '../main/utils/githubUpload'
import smmsUpload from '../main/utils/smmsUpload'
const picBedHandler = {
weibo: weiboUpload,
qiniu: qiniuUpload,
tcyun: tcYunUpload,
upyun: upYunUpload,
github: githubUpload
github: githubUpload,
smms: smmsUpload
}
export default picBedHandler

View File

@ -1,11 +1,6 @@
import weiboUpload from './weiboUpload'
import qiniuUpload from './qiniuUpload'
import tcYunUpload from './tcYunUpload'
import upYunUpload from './upYunUpload'
import githubUpload from './githubUpload'
import smmsUpload from './smmsUpload'
import db from '../../datastore/index'
import { Notification } from 'electron'
import picBeds from '../../datastore/pic-bed-handler'
const checkUploader = (type) => {
const currentUploader = db.read().get(`picBed.${type}`).value()
@ -24,20 +19,7 @@ const uploader = (img, type, webContents) => {
notification.show()
const uploadType = db.read().get('picBed.current').value()
if (checkUploader(uploadType)) {
switch (uploadType) {
case 'weibo':
return weiboUpload(img, type, webContents)
case 'qiniu':
return qiniuUpload(img, type, webContents)
case 'tcyun':
return tcYunUpload(img, type, webContents)
case 'upyun':
return upYunUpload(img, type, webContents)
case 'github':
return githubUpload(img, type, webContents)
case 'smms':
return smmsUpload(img, type, webContents)
}
return picBeds[uploadType](img, type, webContents)
} else {
return false
}

View File

@ -5,6 +5,9 @@
<div class="view-title">
SM.MS设置
</div>
<div class="content">
感谢SM.MS提供的优质服务
</div>
<div style="text-align: center; margin-top: 20px;">
<el-button type="success" @click="confirm" round :disabled="defaultPicBed === 'smms'" size="mini">设为默认图床</el-button>
</div>
@ -40,4 +43,9 @@ export default {
font-size 20px
text-align center
margin 20px auto
#smms-view
.content
text-align center
font-size 14px
color #eee
</style>