loulijun2021
2023-01-03 318e9516c17d36a3bb5fbaa015c4f25222fee514
src/layout/components/Settings/index.vue
@@ -1,11 +1,66 @@
<template>
  <div class="drawer-container">
    <div>
      <h3 class="drawer-title">Page style setting</h3>
      <h3 class="drawer-title">项目配置</h3>
      <div class="drawer-item">
        <span>Theme Color</span>
        <span>主题颜色</span>
        <theme-picker style="float: right;height: 26px;margin: -3px 8px 0 0;" @change="themeChange" />
      </div>
      <div class="drawer-item" style="display: flex;justify-content: space-between">
        <span>头部颜色</span>
        <el-switch
          v-model="$store.state.settings.headBackgroundColorValue"
          style="display: block"
          active-color="#304156"
          inactive-color="#ccc"
          active-text="深色"
          inactive-text="浅色"
        />
      </div>
      <div class="drawer-item" style="display: flex;justify-content: space-between">
        <span>菜单模式</span>
        <el-switch
          v-model="$store.state.settings.menuIsHorizontal"
          style="display: block"
          :active-color="$store.state.settings.theme"
          inactive-color="#ccc"
          active-text="横向"
          inactive-text="竖向"
          @change="sidebar.opened=true"
        />
      </div>
      <div class="drawer-item" style="display: flex;justify-content: space-between">
        <span>左侧颜色</span>
        <el-switch
          v-model="$store.state.settings.leftBackgroundColorValue"
          style="display: block"
          active-color="#304156"
          :disabled="$store.state.settings.menuIsHorizontal"
          inactive-color="#ccc"
          active-text="深色"
          inactive-text="浅色"
        />
      </div>
      <div class="drawer-item" style="display: flex;justify-content: space-between">
        <span>动画类型</span>
        <el-select
          v-model="$store.state.settings.animationType"
          :popper-append-to-body="false"
          popper-class="animationTypePopperClass"
          style="width: 120px;"
          placeholder="请选择"
          size="mini"
          @change="animationTypeChange"
        >
          <el-option
            v-for="item in animationTypeArr"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
      <!--      此三个功能暂时不用-->
@@ -30,13 +85,28 @@
<script>
import ThemePicker from '@/components/ThemePicker'
import { mapGetters } from 'vuex'
export default {
  components: { ThemePicker },
  data() {
    return {}
    return {
      animationTypeArr: [
        { label: '默认类型', value: 'fade-transform' },
        { label: '淡入', value: 'el-fade-in-linear' },
        { label: '淡出', value: 'el-fade-in' },
        { label: '中间缩放', value: 'el-zoom-in-center' },
        { label: '顶部缩放', value: 'el-zoom-in-top' },
        { label: '底部缩放', value: 'el-zoom-in-bottom' },
        { label: '展开折叠', value: 'el-collapse-transition' },
        { label: '无动画', value: 'none' }
      ]
    }
  },
  computed: {
    ...mapGetters([
      'sidebar'
    ]),
    fixedHeader: {
      get() {
        return this.$store.state.settings.fixedHeader
@@ -71,18 +141,26 @@
      }
    }
  },
  methods: {
    themeChange(val) {
      this.$store.dispatch('settings/changeSetting', {
        key: 'theme',
        value: val
      })
    },
    animationTypeChange(val) {
      console.log(val, 1)
    }
  }
}
</script>
<style lang="scss" scoped>
::v-deep .animationTypePopperClass {
  left: auto !important;
}
.drawer-container {
  padding: 24px;
  font-size: 14px;
@@ -92,7 +170,7 @@
  .drawer-title {
    margin-bottom: 12px;
    color: rgba(0, 0, 0, .85);
    font-size: 14px;
    font-size: 18px;
    line-height: 22px;
  }