Added: tcyun cos custom url

This commit is contained in:
Molunerfinn 2018-03-09 21:08:10 +08:00
parent 25068a8949
commit e1c151e310
4 changed files with 25 additions and 10 deletions

View File

@ -52,13 +52,20 @@ const tcYunUpload = async (img, type, webContents) => {
webContents.send('uploadProgress', 30)
const singature = generateSignature()
const length = imgList.length
const tcYunOptions = db.read().get('picBed.tcyun').value()
const customUrl = tcYunOptions.customUrl
const path = tcYunOptions.path
for (let i in imgList) {
const options = postOptions(imgList[i].fileName, singature, imgList[i].base64Image)
const res = await request(options)
const body = JSON.parse(res)
if (body.message === 'SUCCESS') {
delete imgList[i].base64Image
if (customUrl) {
imgList[i]['imgUrl'] = `${customUrl}/${path}${imgList[i].fileName}`
} else {
imgList[i]['imgUrl'] = body.data.source_url
}
imgList[i]['type'] = 'tcyun'
if (i - length === -1) {
webContents.send('uploadProgress', 60)

View File

@ -24,4 +24,12 @@
width 100%
.el-button
width 50%
*::-webkit-scrollbar
width 8px
height 8px
*::-webkit-scrollbar-thumb
border-radius 4px
background #6f6f6f
*::-webkit-scrollbar-track
background-color transparent
</style>

View File

@ -111,14 +111,6 @@ export default {
padding 8px 0
overflow-y auto
overflow-x hidden
&::-webkit-scrollbar
width 8px
height 8px
&::-webkit-scrollbar-thumb
border-radius 4px
background #6f6f6f
&::&::-webkit-scrollbar-track
background-color transparent
.el-col
height 150px
position relative

View File

@ -56,6 +56,11 @@
>
<el-input v-model="form.path" @keyup.native.enter="confirm" placeholder="例如img/"></el-input>
</el-form-item>
<el-form-item
label="设定自定义域名"
>
<el-input v-model="form.customUrl" @keyup.native.enter="confirm" placeholder="例如https://xxxx.com"></el-input>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" @click="confirm" round>确定</el-button>
@ -80,7 +85,8 @@ export default {
bucket: '',
appId: '',
area: '',
path: ''
path: '',
customUrl: ''
}
}
},
@ -125,6 +131,8 @@ export default {
color #eee
.el-input__inner
border-radius 19px
&-item
margin-bottom 10.5px
.el-radio-group
width 100%
label