index.vue 2.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
<template>
  <div>
    <el-button type="primary" class="drawer-container" icon="el-icon-setting" @click="showSettingDrawar" />
    <el-drawer
      title="系统配置"
      :visible.sync="drawer"
      :direction="direction"
      :before-close="handleClose"
    >
      <div class="setting_body">
        <div class="setting_card">
          <div class="setting_title">侧边栏主题</div>
          <div class="setting_content">
            <div class="item" @click="chageMode('light')">
              <i v-if="sideMode === 'light'" class="el-icon-check check" />
              <img src="https://gw.alipayobjects.com/zos/antfincdn/NQ%24zoisaD2/jpRkZQMyYRryryPNtyIC.svg">
            </div>
            <div class="item" @click="chageMode('dark')">
              <i v-if="sideMode === 'dark'" class="el-icon-check check" />
              <img src="https://gw.alipayobjects.com/zos/antfincdn/XwFOFbLkSM/LCkqqYNmvBEbokSDscrm.svg">
            </div>
          </div>
        </div>
        <div class="setting_card">
          <div class="setting_title">主题色</div>
          <div class="">
            <theme-change style="width: 30px;height: 30px;margin-top: 20px" @change="themeChange" />
          </div>
        </div>
      </div>
    </el-drawer>

  </div>
</template>

<script>
import themeChange from '@/components/themeChange'
export default {
  data() {
    return {
      drawer: false,
      direction: 'rtl',
      sideMode: 'dark'
    }
  },
  components: {
    themeChange
  },
  methods: {
    handleClose() {
      this.drawer = false
    },
    showSettingDrawar() {
      this.drawer = true
    },
    chageMode(e) {
      this.sideMode = e
      this.$store.dispatch('app/changeSideMode')
    },
    themeChange(val) {
      this.$store.dispatch('app/changeTheme', val)
    }
  }
}
</script>

<style lang="scss" scoped>
.drawer-container {
  position: absolute;
  right: 0;
  top: 20%;
  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;
  -webkit-box-shadow: inset 0 0 6px rgb(0 ,0 ,0, 10%);
}
.setting_body{
  padding: 20px;
  .setting_card{
    margin-bottom: 20px;
  }
  .setting_content{
    margin-top: 20px;
    display: flex;
    .item{
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      .check{
        position: absolute;
        font-size: 20px;
        color: #00afff;
      }
      img{
        margin-right: 20px;
      }
    }
  }
}

</style>