Browse Source

Merge remote-tracking branch 'origin/dev_1114' into dev_1114

master
尹作梅 6 years ago
parent
commit
cf0ff82b7c
  1. 339
      src/views/modules/oss/oss-config.vue

339
src/views/modules/oss/oss-config.vue

@ -1,6 +1,17 @@
<template> <template>
<el-dialog :visible.sync="visible" :title="$t('oss.config')" :close-on-click-modal="false" :close-on-press-escape="false"> <el-dialog
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px"> :visible.sync="visible"
:title="$t('oss.config')"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
label-width="120px"
>
<el-form-item :label="$t('oss.type')" size="mini"> <el-form-item :label="$t('oss.type')" size="mini">
<el-radio-group v-model="dataForm.type"> <el-radio-group v-model="dataForm.type">
<el-radio :label="1">{{ $t('oss.type1') }}</el-radio> <el-radio :label="1">{{ $t('oss.type1') }}</el-radio>
@ -12,95 +23,207 @@
</el-form-item> </el-form-item>
<template v-if="dataForm.type === 1"> <template v-if="dataForm.type === 1">
<el-form-item prop="qiniuDomain" :label="$t('oss.qiniuDomain')"> <el-form-item prop="qiniuDomain" :label="$t('oss.qiniuDomain')">
<el-input v-model="dataForm.qiniuDomain" :placeholder="$t('oss.qiniuDomainTips')"></el-input> <el-input
v-model="dataForm.qiniuDomain"
:placeholder="$t('oss.qiniuDomainTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuPrefix" :label="$t('oss.qiniuPrefix')"> <el-form-item prop="qiniuPrefix" :label="$t('oss.qiniuPrefix')">
<el-input v-model="dataForm.qiniuPrefix" :placeholder="$t('oss.qiniuPrefixTips')"></el-input> <el-input
v-model="dataForm.qiniuPrefix"
:placeholder="$t('oss.qiniuPrefixTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuAccessKey" :label="$t('oss.qiniuAccessKey')"> <el-form-item prop="qiniuAccessKey" :label="$t('oss.qiniuAccessKey')">
<el-input v-model="dataForm.qiniuAccessKey" :placeholder="$t('oss.qiniuAccessKeyTips')"></el-input> <el-input
v-model="dataForm.qiniuAccessKey"
:placeholder="$t('oss.qiniuAccessKeyTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuSecretKey" :label="$t('oss.qiniuSecretKey')"> <el-form-item prop="qiniuSecretKey" :label="$t('oss.qiniuSecretKey')">
<el-input v-model="dataForm.qiniuSecretKey" :placeholder="$t('oss.qiniuSecretKeyTips')"></el-input> <el-input
v-model="dataForm.qiniuSecretKey"
:placeholder="$t('oss.qiniuSecretKeyTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuBucketName" :label="$t('oss.qiniuBucketName')"> <el-form-item prop="qiniuBucketName" :label="$t('oss.qiniuBucketName')">
<el-input v-model="dataForm.qiniuBucketName" :placeholder="$t('oss.qiniuBucketNameTips')"></el-input> <el-input
v-model="dataForm.qiniuBucketName"
:placeholder="$t('oss.qiniuBucketNameTips')"
></el-input>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="dataForm.type === 2"> <template v-else-if="dataForm.type === 2">
<el-form-item prop="aliyunDomain" :label="$t('oss.aliyunDomain')"> <el-form-item prop="aliyunDomain" :label="$t('oss.aliyunDomain')">
<el-input v-model="dataForm.aliyunDomain" :placeholder="$t('oss.aliyunDomainTips')"></el-input> <el-input
v-model="dataForm.aliyunDomain"
:placeholder="$t('oss.aliyunDomainTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunPrefix" :label="$t('oss.aliyunPrefix')"> <el-form-item prop="aliyunPrefix" :label="$t('oss.aliyunPrefix')">
<el-input v-model="dataForm.aliyunPrefix" :placeholder="$t('oss.aliyunPrefixTips')"></el-input> <el-input
v-model="dataForm.aliyunPrefix"
:placeholder="$t('oss.aliyunPrefixTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunEndPoint" :label="$t('oss.aliyunEndPoint')"> <el-form-item prop="aliyunEndPoint" :label="$t('oss.aliyunEndPoint')">
<el-input v-model="dataForm.aliyunEndPoint" :placeholder="$t('oss.aliyunEndPointTips')"></el-input> <el-input
v-model="dataForm.aliyunEndPoint"
:placeholder="$t('oss.aliyunEndPointTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunAccessKeyId" :label="$t('oss.aliyunAccessKeyId')"> <el-form-item
<el-input v-model="dataForm.aliyunAccessKeyId" :placeholder="$t('oss.aliyunAccessKeyIdTips')"></el-input> prop="aliyunAccessKeyId"
:label="$t('oss.aliyunAccessKeyId')"
>
<el-input
v-model="dataForm.aliyunAccessKeyId"
:placeholder="$t('oss.aliyunAccessKeyIdTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunAccessKeySecret" :label="$t('oss.aliyunAccessKeySecret')"> <el-form-item
<el-input v-model="dataForm.aliyunAccessKeySecret" :placeholder="$t('oss.aliyunAccessKeySecretTips')"></el-input> prop="aliyunAccessKeySecret"
:label="$t('oss.aliyunAccessKeySecret')"
>
<el-input
v-model="dataForm.aliyunAccessKeySecret"
:placeholder="$t('oss.aliyunAccessKeySecretTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunBucketName" :label="$t('oss.aliyunBucketName')"> <el-form-item
<el-input v-model="dataForm.aliyunBucketName" :placeholder="$t('oss.aliyunBucketNameTips')"></el-input> prop="aliyunBucketName"
:label="$t('oss.aliyunBucketName')"
>
<el-input
v-model="dataForm.aliyunBucketName"
:placeholder="$t('oss.aliyunBucketNameTips')"
></el-input>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="dataForm.type === 3"> <template v-else-if="dataForm.type === 3">
<el-form-item prop="qcloudDomain" :label="$t('oss.qcloudDomain')"> <el-form-item prop="qcloudDomain" :label="$t('oss.qcloudDomain')">
<el-input v-model="dataForm.qcloudDomain" :placeholder="$t('oss.qcloudDomainTips')"></el-input> <el-input
v-model="dataForm.qcloudDomain"
:placeholder="$t('oss.qcloudDomainTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudPrefix" :label="$t('oss.qcloudPrefix')"> <el-form-item prop="qcloudPrefix" :label="$t('oss.qcloudPrefix')">
<el-input v-model="dataForm.qcloudPrefix" :placeholder="$t('oss.qcloudPrefixTips')"></el-input> <el-input
v-model="dataForm.qcloudPrefix"
:placeholder="$t('oss.qcloudPrefixTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudAppId" :label="$t('oss.qcloudAppId')"> <el-form-item prop="qcloudAppId" :label="$t('oss.qcloudAppId')">
<el-input v-model="dataForm.qcloudAppId" :placeholder="$t('oss.qcloudAppIdTips')"></el-input> <el-input
v-model="dataForm.qcloudAppId"
:placeholder="$t('oss.qcloudAppIdTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudSecretId" :label="$t('oss.qcloudSecretId')"> <el-form-item prop="qcloudSecretId" :label="$t('oss.qcloudSecretId')">
<el-input v-model="dataForm.qcloudSecretId" :placeholder="$t('oss.qcloudSecretIdTips')"></el-input> <el-input
v-model="dataForm.qcloudSecretId"
:placeholder="$t('oss.qcloudSecretIdTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudSecretKey" :label="$t('oss.qcloudSecretKey')"> <el-form-item prop="qcloudSecretKey" :label="$t('oss.qcloudSecretKey')">
<el-input v-model="dataForm.qcloudSecretKey" :placeholder="$t('oss.qcloudSecretKeyTips')"></el-input> <el-input
v-model="dataForm.qcloudSecretKey"
:placeholder="$t('oss.qcloudSecretKeyTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudBucketName" :label="$t('oss.qcloudBucketName')"> <el-form-item
<el-input v-model="dataForm.qcloudBucketName" :placeholder="$t('oss.qcloudBucketNameTips')"></el-input> prop="qcloudBucketName"
:label="$t('oss.qcloudBucketName')"
>
<el-input
v-model="dataForm.qcloudBucketName"
:placeholder="$t('oss.qcloudBucketNameTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudRegion" :label="$t('oss.qcloudRegion')"> <el-form-item prop="qcloudRegion" :label="$t('oss.qcloudRegion')">
<el-select v-model="dataForm.qcloudRegion" clearable :placeholder="$t('oss.qcloudRegionTips')" class="w-percent-100"> <el-select
<el-option value="ap-beijing-1" :label="$t('oss.qcloudRegionBeijing1')"></el-option> v-model="dataForm.qcloudRegion"
<el-option value="ap-beijing" :label="$t('oss.qcloudRegionBeijing')"></el-option> clearable
<el-option value="ap-shanghai" :label="$t('oss.qcloudRegionShanghai')"></el-option> :placeholder="$t('oss.qcloudRegionTips')"
<el-option value="ap-guangzhou" :label="$t('oss.qcloudRegionGuangzhou')"></el-option> class="w-percent-100"
<el-option value="ap-chengdu" :label="$t('oss.qcloudRegionChengdu')"></el-option> >
<el-option value="ap-chongqing" :label="$t('oss.qcloudRegionChongqing')"></el-option> <el-option
<el-option value="ap-singapore" :label="$t('oss.qcloudRegionSingapore')"></el-option> value="ap-beijing-1"
<el-option value="ap-hongkong" :label="$t('oss.qcloudRegionHongkong')"></el-option> :label="$t('oss.qcloudRegionBeijing1')"
<el-option value="na-toronto" :label="$t('oss.qcloudRegionToronto')"></el-option> ></el-option>
<el-option value="eu-frankfurt" :label="$t('oss.qcloudRegionFrankfurt')"></el-option> <el-option
value="ap-beijing"
:label="$t('oss.qcloudRegionBeijing')"
></el-option>
<el-option
value="ap-shanghai"
:label="$t('oss.qcloudRegionShanghai')"
></el-option>
<el-option
value="ap-guangzhou"
:label="$t('oss.qcloudRegionGuangzhou')"
></el-option>
<el-option
value="ap-chengdu"
:label="$t('oss.qcloudRegionChengdu')"
></el-option>
<el-option
value="ap-chongqing"
:label="$t('oss.qcloudRegionChongqing')"
></el-option>
<el-option
value="ap-singapore"
:label="$t('oss.qcloudRegionSingapore')"
></el-option>
<el-option
value="ap-hongkong"
:label="$t('oss.qcloudRegionHongkong')"
></el-option>
<el-option
value="na-toronto"
:label="$t('oss.qcloudRegionToronto')"
></el-option>
<el-option
value="eu-frankfurt"
:label="$t('oss.qcloudRegionFrankfurt')"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="dataForm.type === 4"> <template v-else-if="dataForm.type === 4">
<el-form-item prop="localDomain" :label="$t('oss.localDomain')"> <el-form-item prop="fastdfsDomain" :label="$t('oss.fastdfsDomain')">
<el-input v-model="dataForm.localDomain" :placeholder="$t('oss.localDomainTips')"></el-input> <el-input
v-model="dataForm.localDomain"
:placeholder="$t('oss.fastdfsDomainTips')"
></el-input>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="dataForm.type === 5"> <template v-else-if="dataForm.type === 5">
<el-form-item prop="fastdfsDomain" :label="$t('oss.fastdfsDomain')"> <el-form-item prop="localDomain" :label="$t('oss.localDomain')">
<el-input v-model="dataForm.fastdfsDomain" :placeholder="$t('oss.fastdfsDomainTips')"></el-input> <el-input
v-model="dataForm.fastdfsDomain"
:placeholder="$t('oss.localDomainTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="localPrefix" :label="$t('oss.localPrefix')"> <el-form-item prop="localPrefix" :label="$t('oss.localPrefix')">
<el-input v-model="dataForm.localPrefix" :placeholder="$t('oss.localPrefixTips')"></el-input> <el-input
v-model="dataForm.localPrefix"
:placeholder="$t('oss.localPrefixTips')"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="localPath" :label="$t('oss.localPath')"> <el-form-item prop="localPath" :label="$t('oss.localPath')">
<el-input v-model="dataForm.localPath" :placeholder="$t('oss.localPathTips')"></el-input> <el-input
v-model="dataForm.localPath"
:placeholder="$t('oss.localPathTips')"
></el-input>
</el-form-item> </el-form-item>
</template> </template>
</el-form> </el-form>
<template slot="footer"> <template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> <el-button type="primary" @click="dataFormSubmitHandle()">{{
$t('confirm')
}}</el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
@ -131,8 +254,8 @@ export default {
qcloudSecretKey: '', qcloudSecretKey: '',
qcloudBucketName: '', qcloudBucketName: '',
qcloudRegion: '', qcloudRegion: '',
localDomain: '',
fastdfsDomain: '', fastdfsDomain: '',
localDomain: '',
localPrefix: '', localPrefix: '',
localPath: '' localPath: ''
} }
@ -142,58 +265,130 @@ export default {
dataRule () { dataRule () {
return { return {
qiniuDomain: [ qiniuDomain: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qiniuAccessKey: [ qiniuAccessKey: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qiniuSecretKey: [ qiniuSecretKey: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qiniuBucketName: [ qiniuBucketName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
aliyunDomain: [ aliyunDomain: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
aliyunEndPoint: [ aliyunEndPoint: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
aliyunAccessKeyId: [ aliyunAccessKeyId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
aliyunAccessKeySecret: [ aliyunAccessKeySecret: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
aliyunBucketName: [ aliyunBucketName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qcloudDomain: [ qcloudDomain: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qcloudAppId: [ qcloudAppId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qcloudSecretId: [ qcloudSecretId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qcloudSecretKey: [ qcloudSecretKey: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qcloudBucketName: [ qcloudBucketName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
qcloudRegion: [ qcloudRegion: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
localDomain: [ localDomain: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
fastdfsDomain: [ fastdfsDomain: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
], ],
localPath: [ localPath: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } {
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
] ]
} }
} }
@ -213,20 +408,26 @@ export default {
}, },
// //
getInfo () { getInfo () {
this.$http.get('/oss/file/info').then(({ data: res }) => { this.$http
.get('/oss/file/info')
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.dataForm = res.data this.dataForm = res.data
}).catch(() => {}) })
.catch(() => {})
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(
this.$refs['dataForm'].validate((valid) => { function () {
this.$refs['dataForm'].validate(valid => {
if (!valid) { if (!valid) {
return false return false
} }
this.$http.post('/oss/file', this.dataForm).then(({ data: res }) => { this.$http
.post('/oss/file', this.dataForm)
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -239,9 +440,13 @@ export default {
this.$emit('refreshDataList') this.$emit('refreshDataList')
} }
}) })
}).catch(() => {})
}) })
}, 1000, { 'leading': true, 'trailing': false }) .catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
} }
} }
</script> </script>

Loading…
Cancel
Save