研发图纸文件管理系统-前端项目
iczer
2018-08-23 a12b100a8e410f5558f694eb997e4b77c6de38f7
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<template>
  <a-layout-sider class="sider" width="273">
    <setting-item title="整体风格设置">
      <img-check-box-group @change="onStyleChange">
        <img-check-box img="https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg" :checked="true" :value="{value: 1, name: 'Dark'}"/>
        <img-check-box img="https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg" :value="{value: 2, name: 'Light'}"/>
      </img-check-box-group>
    </setting-item>
    <setting-item title="主题色">
      <color-check-box-group @change="onColorChange" :defaultValues="['1', '2', '3']" :multiple="false">
        <color-check-box ref="colorNode" color="rgb(245, 34, 45)" value="1" />
        <color-check-box color="rgb(250, 84, 28)" value="2" />
        <color-check-box color="rgb(250, 173, 20)" value="3" />
        <color-check-box color="rgb(19, 194, 194)" value="4" />
        <color-check-box color="rgb(82, 196, 26)" value="5" />
        <color-check-box color="rgb(24, 144, 255)" value="6" />
        <color-check-box color="rgb(47, 84, 235)" value="7" />
        <color-check-box color="rgb(114, 46, 209)" value="8" />
      </color-check-box-group>
    </setting-item>
    <a-divider/>
    <setting-item title="导航设置">
      <img-check-box-group @change="onNaviChange">
        <img-check-box img="https://gw.alipayobjects.com/zos/rmsportal/JopDzEhOqwOjeNTXkoje.svg" :checked="true" :value="{value: 1, name: 'Side Navigation'}"/>
        <img-check-box img="https://gw.alipayobjects.com/zos/rmsportal/KDNDBbriJhLwuqMoxcAr.svg" :value="{value: 2, name: 'Top Navigation'}"/>
      </img-check-box-group>
    </setting-item>
    <setting-item>
      <a-list :split="false">
        <a-list-item>
          栅格模式
          <a-select size="small" defaultValue="1" slot="actions" style="width: 80px">
            <a-select-option value="1">流式</a-select-option>
            <a-select-option value="2">定宽</a-select-option>
          </a-select>
        </a-list-item>
        <a-list-item>
          固定Header
          <a-switch slot="actions" size="small" />
        </a-list-item>
        <a-list-item>
          固定Siderbar
          <a-switch slot="actions" size="small" />
        </a-list-item>
      </a-list>
    </setting-item>
    <a-divider />
    <setting-item title="其他设置">
      <a-list :split="false">
        <a-list-item>
          色弱模式
          <a-switch slot="actions" size="small" />
        </a-list-item>
        <a-list-item>
          显示抽屉按钮
          <a-switch slot="actions" size="small" />
        </a-list-item>
      </a-list>
    </setting-item>
    <a-divider />
    <a-button id="copyBtn" data-clipboard-text="Sorry, you copy nothing O(∩_∩)O~" @click="copyCode" style="width: 100%" icon="copy" >拷贝代码</a-button>
  </a-layout-sider>
</template>
 
<script>
import ALayoutSider from 'ant-design-vue/es/layout/Sider'
import AIcon from 'ant-design-vue/es/icon/icon'
import SettingItem from './SettingItem'
import StyleItem from './StyleItem'
import ADivider from 'ant-design-vue/es/divider/index'
import AList from 'ant-design-vue/es/list/index'
import AListItem from 'ant-design-vue/es/list/Item'
import AButton from 'ant-design-vue/es/button/button'
import ASwitch from 'ant-design-vue/es/switch/index'
import ASelect from 'ant-design-vue/es/select/index'
import ColorCheckBox from '../check/ColorCheckBox'
import ImgCheckBox from '../check/ImgCheckBox'
import Clipboard from 'clipboard'
 
const ASelectOption = ASelect.Option
const ColorCheckBoxGroup = ColorCheckBox.Group
const ImgCheckBoxGroup = ImgCheckBox.Group
 
export default {
  name: 'Setting',
  components: {
    ImgCheckBoxGroup,
    ImgCheckBox,
    ColorCheckBoxGroup,
    ColorCheckBox,
    ASelectOption,
    ASelect,
    ASwitch,
    AButton,
    AListItem,
    AList,
    ADivider,
    StyleItem,
    SettingItem,
    AIcon,
    ALayoutSider},
  methods: {
    onColorChange (values, colors) {
      if (colors.length > 0) {
        this.$message.info(`您选择了主题色 ${colors}`)
      }
    },
    onStyleChange (values) {
      if (values.length > 0) {
        this.$message.info(`您选择了 ${values[0].name} 风格`)
      }
    },
    onNaviChange (values) {
      if (values.length > 0) {
        this.$message.info(`您选择了 ${values[0].name} `)
      }
    },
    copyCode () {
      let clipboard = new Clipboard('#copyBtn')
      const _this = this
      clipboard.on('success', function () {
        _this.$message.success(`复制成功`)
        clipboard.destroy()
      })
    }
  }
}
</script>
 
<style lang="less" scoped>
  .sider{
    background-color: #fff;
    height: 100%;
    padding: 24px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    .flex{
      display: flex;
    }
  }
</style>