Fixiaobai
2023-10-13 e8308ddac0ba4a1f406e8f63d7e6b6f2541cb770
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
144
145
146
147
148
149
<template>
  <span class="setting">
    <div
      :class="{'setting__shade--show':isShade}"
      class="setting__shade"
      @click="close"/>
    <div
      :class="{'setting__content--show':box}"
      class="setting__content">
      <div class="setting__header">版权信息</div>
      <div class="setting__body setting__about">
        <p>Version:ztt 3.9.0</p>
        <p>Copyright: ztt ©2018-2025</p>
      </div>
      <div class="setting__header">设置
        <small>(滑动鼠标下面还有更多设置)</small>
      </div>
      <el-scrollbar style="height:500px">
        <div class="setting__body setting__form">
          <avue-form
            v-model="form"
            :option="option"/>
        </div>
      </el-scrollbar>
    </div>
  </span>
</template>
 
<script>
import { mapState, mapGetters } from 'vuex'
import { option, list } from '@/const/setting/'
export default {
  data() {
    return {
      box: false,
      form: {},
      list: list,
      option: option(this)
    }
  },
  computed: {
    ...mapGetters(['isShade']),
    ...mapState({
      showTag: state => state.common.showTag,
      showDebug: state => state.common.showDebug,
      showLock: state => state.common.showLock,
      showColor: state => state.common.showColor,
      showFullScreen: state => state.common.showFullScreen,
      showCollapse: state => state.common.showCollapse,
      showSearch: state => state.common.showSearch,
      showMenu: state => state.common.showMenu,
      showTheme: state => state.common.showTheme
    })
  },
  created() {
    setTimeout(() => {
      this.init()
    }, 0)
  },
  methods: {
    close() {
      this.box = false
      this.$store.commit('SET_SHADE', false)
    },
    set(key) {
      const ele = this.find(key)
      this.$store.commit(ele.commit, eval(this.form[ele.key]))
    },
    find(key) {
      return this.list.filter(ele => ele.key === key)[0]
    },
    init() {
      this.list.forEach(ele => {
        this.form[ele.key] = this.validatenull(this[ele.key]) ? 'true' : this[ele.key] + ''
        this.set(ele.key)
      })
    },
    open() {
      this.box = true
      this.$store.commit('SET_SHADE', true)
    }
  }
}
</script>
 
<style lang="scss" scoped>
.setting {
  margin-left: 10px;
  &__icon {
    color:#fff;
    font-size: 20px;
    transform: rotate(90deg);
  }
  &__header {
    height: 42px;
    line-height: 42px;
    padding: 0 15px;
    border-bottom: 1px solid #f6f6f6;
    color: #333;
    border-radius: 2px 2px 0 0;
    font-size: 14px;
    small {
      margin-left: 8px;
      color: #999;
    }
  }
  &__body {
    padding: 10px 15px;
    line-height: 24px;
  }
  &__about {
    font-size: 14px;
    line-height: 30px;
  }
  &__shade {
    position: fixed;
    display: none;
    width: 100%;
    height: 100%;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 2048;
    &--show {
      display: block;
    }
  }
  &__form {
    width: 230px;
    margin: 0 auto;
  }
  &__content {
    box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    position: fixed;
    width: 320px;
    height: 100%;
    right: -450px;
    top: 0;
    z-index: 2048;
    background-color: #fff;
    &--show {
      right: 0;
    }
  }
}
</style>