2018-06-27 10:57:15 -04:00
|
|
|
|
<template>
|
|
|
|
|
<div id="imgur-view">
|
|
|
|
|
<el-row :gutter="16">
|
|
|
|
|
<el-col :span="16" :offset="4">
|
|
|
|
|
<div class="view-title">
|
|
|
|
|
Imgur图床设置
|
|
|
|
|
</div>
|
2019-12-19 06:17:21 -05:00
|
|
|
|
<el-form
|
2018-06-27 10:57:15 -04:00
|
|
|
|
ref="imgur"
|
|
|
|
|
label-position="right"
|
|
|
|
|
label-width="120px"
|
|
|
|
|
:model="form"
|
|
|
|
|
size="mini">
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="设定ClientId"
|
|
|
|
|
prop="clientId"
|
|
|
|
|
:rules="{
|
|
|
|
|
required: true, message: 'ClientId不能为空', trigger: 'blur'
|
|
|
|
|
}">
|
|
|
|
|
<el-input v-model="form.clientId" placeholder="ClientId" @keyup.native.enter="confirm"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="设定代理"
|
|
|
|
|
prop="proxy"
|
|
|
|
|
>
|
|
|
|
|
<el-input v-model="form.proxy" placeholder="例如:http://127.0.0.1:1080" @keyup.native.enter="confirm"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button-group>
|
|
|
|
|
<el-button type="primary" @click="confirm" round>确定</el-button>
|
|
|
|
|
<el-button type="success" @click="setDefaultPicBed('imgur')" round :disabled="defaultPicBed === 'imgur'">设为默认图床</el-button>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2019-12-21 04:28:29 -05:00
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { Component, Vue } from 'vue-property-decorator'
|
2018-12-18 05:58:31 -05:00
|
|
|
|
import mixin from '@/utils/ConfirmButtonMixin'
|
2019-12-21 04:28:29 -05:00
|
|
|
|
@Component({
|
2018-06-27 10:57:15 -04:00
|
|
|
|
name: 'imgur',
|
2019-12-21 04:28:29 -05:00
|
|
|
|
mixins: [mixin]
|
|
|
|
|
})
|
|
|
|
|
export default class extends Vue {
|
|
|
|
|
form: IImgurConfig = {
|
|
|
|
|
clientId: '',
|
|
|
|
|
proxy: ''
|
|
|
|
|
}
|
2018-06-27 10:57:15 -04:00
|
|
|
|
created () {
|
2019-12-21 04:28:29 -05:00
|
|
|
|
const config = this.$db.get('picBed.imgur') as IImgurConfig
|
2018-06-27 10:57:15 -04:00
|
|
|
|
if (config) {
|
2019-12-21 04:28:29 -05:00
|
|
|
|
this.form = Object.assign({}, config)
|
2018-06-27 10:57:15 -04:00
|
|
|
|
}
|
2019-12-21 04:28:29 -05:00
|
|
|
|
}
|
|
|
|
|
confirm () {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
this.$refs.imgur.validate((valid) => {
|
|
|
|
|
if (valid) {
|
2019-12-26 07:15:41 -05:00
|
|
|
|
this.letPicGoSaveData({
|
|
|
|
|
'picBed.imgur': this.form
|
|
|
|
|
})
|
2019-12-21 04:28:29 -05:00
|
|
|
|
const successNotification = new Notification('设置结果', {
|
|
|
|
|
body: '设置成功'
|
|
|
|
|
})
|
|
|
|
|
successNotification.onclick = () => {
|
|
|
|
|
return true
|
2018-06-27 10:57:15 -04:00
|
|
|
|
}
|
2019-12-21 04:28:29 -05:00
|
|
|
|
} else {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
})
|
2018-06-27 10:57:15 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang='stylus'>
|
|
|
|
|
#imgur-view
|
|
|
|
|
.el-form
|
2019-12-19 06:17:21 -05:00
|
|
|
|
label
|
2018-06-27 10:57:15 -04:00
|
|
|
|
line-height 22px
|
|
|
|
|
padding-bottom 0
|
|
|
|
|
color #eee
|
|
|
|
|
.el-input__inner
|
|
|
|
|
border-radius 19px
|
|
|
|
|
&-item
|
|
|
|
|
margin-bottom 10.5px
|
|
|
|
|
.el-radio-group
|
|
|
|
|
width 100%
|
|
|
|
|
label
|
2019-12-19 06:17:21 -05:00
|
|
|
|
width 25%
|
2018-06-27 10:57:15 -04:00
|
|
|
|
.el-radio-button__inner
|
|
|
|
|
width 100%
|
|
|
|
|
.el-radio-button:first-child
|
|
|
|
|
.el-radio-button__inner
|
|
|
|
|
border-left none
|
|
|
|
|
border-radius 14px 0 0 14px
|
|
|
|
|
.el-radio-button:last-child
|
|
|
|
|
.el-radio-button__inner
|
|
|
|
|
border-left none
|
|
|
|
|
border-radius 0 14px 14px 0
|
|
|
|
|
.el-switch__label
|
|
|
|
|
color #eee
|
|
|
|
|
&.is-active
|
|
|
|
|
color #409EFF
|
|
|
|
|
.el-icon-question
|
|
|
|
|
font-size 20px
|
|
|
|
|
float right
|
|
|
|
|
margin-top 9px
|
|
|
|
|
color #eee
|
|
|
|
|
cursor pointer
|
|
|
|
|
transition .2s color ease-in-out
|
|
|
|
|
&:hover
|
|
|
|
|
color #409EFF
|
2019-12-19 06:17:21 -05:00
|
|
|
|
</style>
|