fix: update uploadImgDialog component

This commit is contained in:
yanglbme 2020-09-13 21:36:51 +08:00
parent d33412b75d
commit 761b2fc7b2

View File

@ -2,7 +2,7 @@
<el-dialog title="本地上传" class="upload__dialog" :visible="value" @close="$emit('close')"> <el-dialog title="本地上传" class="upload__dialog" :visible="value" @close="$emit('close')">
<el-tabs type="card" :value="'upload'"> <el-tabs type="card" :value="'upload'">
<el-tab-pane class="upload-panel" label="选择上传" name="upload"> <el-tab-pane class="upload-panel" label="选择上传" name="upload">
<el-select v-model="imgHost" @change="changeimgHost" placeholder="请选择" size="small"> <el-select v-model="imgHost" @change="changeImgHost" placeholder="请选择" size="small">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
@ -120,8 +120,13 @@ export default {
} }
}, },
methods: { methods: {
changeimgHost() { changeImgHost() {
localStorage.setItem("imgHost", this.imgHost); localStorage.setItem("imgHost", this.imgHost);
this.$message({
showClose: true,
message: '已成功切换图床',
type: "success",
});
}, },
saveGitHubConfiguration() { saveGitHubConfiguration() {
if (!(this.formGitHub.repo && this.formGitHub.accessToken)) { if (!(this.formGitHub.repo && this.formGitHub.accessToken)) {
@ -179,7 +184,7 @@ export default {
return false; return false;
}, },
validateConfig() { validateConfig() {
switch (this.imgHost) { switch (localStorage.getItem('imgHost')) {
case "github": case "github":
const { const {
repo, accessToken repo, accessToken
@ -189,6 +194,7 @@ export default {
this.$message.error("请先配置 GitHub 图床参数"); this.$message.error("请先配置 GitHub 图床参数");
return false; return false;
} }
break;
case 'aliOSS': case 'aliOSS':
const { const {
accessKeyId, accessKeySecret, bucket, region, path accessKeyId, accessKeySecret, bucket, region, path