2021-06-28 10:53:46 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div>
|
2021-06-29 14:46:47 +08:00
|
|
|
|
<el-button type="primary" class="drawer-container" icon="el-icon-setting" @click="showSettingDrawer" />
|
2021-06-28 10:53:46 +08:00
|
|
|
|
<el-drawer
|
2021-06-29 14:46:47 +08:00
|
|
|
|
title="系统配置"
|
|
|
|
|
:visible.sync="drawer"
|
|
|
|
|
:direction="direction"
|
|
|
|
|
:before-close="handleClose"
|
2021-06-28 10:53:46 +08:00
|
|
|
|
>
|
|
|
|
|
<div class="setting_body">
|
|
|
|
|
<div class="setting_card">
|
2021-06-29 15:28:39 +08:00
|
|
|
|
<div class="setting_title">侧边栏主题 (注:自定义请先配置背景色)</div>
|
2021-06-28 10:53:46 +08:00
|
|
|
|
<div class="setting_content">
|
2021-06-29 14:46:47 +08:00
|
|
|
|
<div class="theme-box">
|
|
|
|
|
<div class="item" @click="changeMode('light')">
|
2021-06-29 15:28:39 +08:00
|
|
|
|
<i v-if="mode === 'light'" class="el-icon-check check" />
|
2021-06-29 14:46:47 +08:00
|
|
|
|
<img src="https://gw.alipayobjects.com/zos/antfincdn/NQ%24zoisaD2/jpRkZQMyYRryryPNtyIC.svg">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="item" @click="changeMode('dark')">
|
2021-06-29 15:28:39 +08:00
|
|
|
|
<i v-if="mode === 'dark'" class="el-icon-check check" />
|
2021-06-29 14:46:47 +08:00
|
|
|
|
<img src="https://gw.alipayobjects.com/zos/antfincdn/XwFOFbLkSM/LCkqqYNmvBEbokSDscrm.svg">
|
|
|
|
|
</div>
|
2021-06-28 10:53:46 +08:00
|
|
|
|
</div>
|
2021-06-29 14:46:47 +08:00
|
|
|
|
<div class="color-box">
|
|
|
|
|
<div>
|
|
|
|
|
<div class="setting_title">自定义背景色</div>
|
|
|
|
|
<el-color-picker :value="sideMode" @change="changeMode" />
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="setting_title">自定义基础色</div>
|
|
|
|
|
<el-color-picker :value="baseColor" @change="changeBaseColor" />
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="setting_title">活跃色</div>
|
|
|
|
|
<el-color-picker :value="activeColor" @change="activeColorChange" />
|
|
|
|
|
</div>
|
2021-06-28 10:53:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-06-29 14:46:47 +08:00
|
|
|
|
import { mapGetters } from 'vuex'
|
2021-06-28 10:53:46 +08:00
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
drawer: false,
|
2021-06-29 14:46:47 +08:00
|
|
|
|
direction: 'rtl'
|
2021-06-28 10:53:46 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-06-29 14:46:47 +08:00
|
|
|
|
computed: {
|
2021-06-29 15:28:39 +08:00
|
|
|
|
...mapGetters('user', ['sideMode', 'baseColor', 'activeColor', 'mode'])
|
2021-06-28 10:53:46 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleClose() {
|
|
|
|
|
this.drawer = false
|
|
|
|
|
},
|
2021-06-29 14:46:47 +08:00
|
|
|
|
showSettingDrawer() {
|
2021-06-28 10:53:46 +08:00
|
|
|
|
this.drawer = true
|
|
|
|
|
},
|
2021-06-29 14:46:47 +08:00
|
|
|
|
changeMode(e) {
|
|
|
|
|
if (e === null) {
|
|
|
|
|
this.$store.dispatch('user/changeSideMode', 'dark')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$store.dispatch('user/changeSideMode', e)
|
|
|
|
|
},
|
|
|
|
|
changeBaseColor(e) {
|
|
|
|
|
if (e === null) {
|
|
|
|
|
this.$store.dispatch('user/changeBaseColor', '#fff')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$store.dispatch('user/changeBaseColor', e)
|
2021-06-28 10:53:46 +08:00
|
|
|
|
},
|
2021-06-29 14:46:47 +08:00
|
|
|
|
activeColorChange(e) {
|
|
|
|
|
if (e === null) {
|
|
|
|
|
this.$store.dispatch('user/changeActiveColor', '#1890ff')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$store.dispatch('user/changeActiveColor', e)
|
2021-06-28 10:53:46 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.drawer-container {
|
2021-06-29 16:35:47 +08:00
|
|
|
|
position: fixed;
|
2021-06-28 10:53:46 +08:00
|
|
|
|
right: 0;
|
2021-06-29 16:35:47 +08:00
|
|
|
|
bottom: 15%;
|
2021-06-28 10:53:46 +08:00
|
|
|
|
height: 40px;
|
|
|
|
|
width: 40px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
z-index: 999;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border-radius: 4px 0 0 4px;
|
|
|
|
|
cursor: pointer;
|
2021-06-30 14:47:31 +08:00
|
|
|
|
-webkit-box-shadow: inset 0 0 6px rgba(0 ,0 ,0, 10%);
|
2021-06-28 10:53:46 +08:00
|
|
|
|
}
|
|
|
|
|
.setting_body{
|
|
|
|
|
padding: 20px;
|
|
|
|
|
.setting_card{
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
.setting_content{
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
display: flex;
|
2021-06-29 14:46:47 +08:00
|
|
|
|
flex-direction: column;
|
|
|
|
|
>.theme-box{
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
>.color-box{
|
|
|
|
|
div{
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-28 10:53:46 +08:00
|
|
|
|
.item{
|
|
|
|
|
position: relative;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
.check{
|
|
|
|
|
position: absolute;
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
color: #00afff;
|
|
|
|
|
}
|
|
|
|
|
img{
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|