feature: night theme for upload-image-dialog

This commit is contained in:
JimQing 2020-09-02 21:09:56 +08:00
parent eacc33c598
commit 488a259950
2 changed files with 161 additions and 158 deletions

View File

@ -65,7 +65,7 @@
color: @nightWhiteColor; color: @nightWhiteColor;
} }
} }
.insert__dialog, .about__dialog, .reset__dialog { .insert__dialog, .about__dialog, .reset__dialog, .upload__dialog {
.el-dialog { .el-dialog {
background-color: @nightBgColor; background-color: @nightBgColor;
} }
@ -75,6 +75,15 @@
.el-dialog__title, .el-form-item__label { .el-dialog__title, .el-form-item__label {
color: @nightWhiteColor; color: @nightWhiteColor;
} }
.el-tabs__item {
color: @nightActiveCodeMirrorColor;
}
.is-active {
color: @nightWhiteColor;
}
.el-upload-dragger {
background-color: @nightButtonBg;
}
} }
/deep/ .el-icon-upload, .el-icon-download, .el-icon-refresh, .el-icon-s-grid { /deep/ .el-icon-upload, .el-icon-download, .el-icon-refresh, .el-icon-s-grid {
color: @nightWhiteColor; color: @nightWhiteColor;

View File

@ -1,26 +1,14 @@
<template> <template>
<el-dialog title="插入图片" class="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 <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
v-for="item in options" </el-option>
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select> </el-select>
<el-upload <el-upload drag action :headers="{'Content-Type': 'multipart/form-data'}" :show-file-list="false"
drag :multiple="true" accept=".jpg, .jpeg, .png, .gif" name="file" :before-upload="beforeUpload"
action v-loading="uploadingImg">
:headers="{'Content-Type': 'multipart/form-data'}"
:show-file-list="false"
:multiple="true"
accept=".jpg, .jpeg, .png, .gif"
name="file"
:before-upload="beforeUpload"
v-loading="uploadingImg"
>
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text"> <div class="el-upload__text">
将文件拖到此处 将文件拖到此处
@ -29,19 +17,16 @@
</el-upload> </el-upload>
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="github-panel" label="GitHub 图床" name="github"> <el-tab-pane class="github-panel" label="GitHub 图床" name="github">
<el-form <el-form class="setting-form" ref="form" :model="formGitHub" label-position="right" label-width="100px">
class="setting-form"
ref="form"
:model="formGitHub"
label-position="right"
label-width="100px"
>
<el-form-item label="GitHub 仓库"> <el-form-item label="GitHub 仓库">
<el-input v-model="formGitHub.repo" placeholder="如github.com/yanglbme/resource"></el-input> <el-input v-model="formGitHub.repo" placeholder="如github.com/yanglbme/resource"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="token"> <el-form-item label="token">
<el-input v-model="formGitHub.accessToken" placeholder="如cc1d0c1426d0fd0902bd2d7184b14da61b8abc46"></el-input> <el-input v-model="formGitHub.accessToken"
<el-link type="primary" href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token" target="_blank">如何获取 GitHub token</el-link> placeholder="如cc1d0c1426d0fd0902bd2d7184b14da61b8abc46"></el-input>
<el-link type="primary"
href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token"
target="_blank">如何获取 GitHub token</el-link>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit">保存配置</el-button> <el-button type="primary" @click="onSubmit">保存配置</el-button>
@ -53,7 +38,9 @@
</template> </template>
<script> <script>
import { uploadImgFile } from "../../assets/scripts/uploadImageFile"; import {
uploadImgFile
} from "../../assets/scripts/uploadImageFile";
export default { export default {
props: { props: {
@ -68,8 +55,7 @@ export default {
repo: "", repo: "",
accessToken: "", accessToken: "",
}, },
options: [ options: [{
{
value: "default", value: "default",
label: "默认图床", label: "默认图床",
}, },
@ -137,7 +123,10 @@ export default {
validateConfig() { validateConfig() {
switch (this.imgHost) { switch (this.imgHost) {
case "github": case "github":
const { repo, accessToken } = this.formGitHub; const {
repo, accessToken
} = this.formGitHub;
if (!repo || !accessToken) { if (!repo || !accessToken) {
this.$message.error("未配置 GitHub 参数"); this.$message.error("未配置 GitHub 参数");
return false; return false;
@ -156,21 +145,26 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
text-align: center; text-align: center;
.el-select { .el-select {
align-self: flex-end; align-self: flex-end;
margin: 0 67.75px 20px; margin: 0 67.75px 20px;
width: 100px; width: 100px;
} }
} }
.github-panel { .github-panel {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.setting-form { .setting-form {
width: 70%; width: 70%;
.el-form-item { .el-form-item {
margin: 15px; margin: 15px;
} }
.el-form-item:last-child { .el-form-item:last-child {
text-align: right; text-align: right;
} }