|
1
2
3
4
5
6
7
8
9
10
11
12
|
<template>
<div class="setting-drawer">
<a-drawer
width="300"
placement="right"
:closable="false"
@close="onClose"
:visible="visible"
style="height: 100%;overflow: auto;"
>
<div class="setting-drawer-index-content">
<div :style="{ marginBottom: '24px' }">
|
|
13
|
<h4 class="setting-drawer-index-title">{{ $t('system.languageSettings') }}</h4>
|
|
14
|
<a-list-item>
|
|
15
|
<j-dict-select-tag type="radioButton" @change="handleLanguageChange" dictCode="sys_language" />
|
|
16
17
18
|
</a-list-item>
</div>
<div :style="{ marginBottom: '24px' }">
|
|
19
|
<h4 class="setting-drawer-index-title">{{ $t('system.themeSettings') }}</h4>
|
|
20
21
|
<div class="setting-drawer-index-blockChecbox">
<a-tooltip>
|
|
22
|
<template slot="title"> {{ $t('system.darkModeMenuStyle') }} </template>
|
|
23
|
<div class="setting-drawer-index-item" @click="handleMenuTheme('dark')">
|
|
24
|
<img src="https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg" alt="dark" />
|
|
25
|
<div class="setting-drawer-index-selectIcon" v-if="navTheme === 'dark'">
|
|
26
|
<a-icon type="check" />
|
|
27
28
29
30
|
</div>
</div>
</a-tooltip>
<a-tooltip>
|
|
31
|
<template slot="title"> {{ $t('system.lightModeMenuStyle') }} </template>
|
|
32
|
<div class="setting-drawer-index-item" @click="handleMenuTheme('light')">
|
|
33
|
<img src="https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg" alt="light" />
|
|
34
|
<div class="setting-drawer-index-selectIcon" v-if="navTheme !== 'dark'">
|
|
35
|
<a-icon type="check" />
|
|
36
37
38
39
40
|
</div>
</div>
</a-tooltip>
</div>
</div>
|
|
41
|
<a-divider />
|
|
42
|
<div :style="{ marginBottom: '24px' }">
|
|
43
|
<h4 class="setting-drawer-index-title">{{ $t('system.otherSettings') }}</h4>
|
|
44
45
46
|
<div>
<a-list :split="false">
<a-list-item>
|
|
47
|
<a-switch slot="actions" size="small" :defaultChecked="colorWeak" @change="onColorWeak" />
|
|
48
|
<a-list-item-meta>
|
|
49
|
<div slot="title">{{ $t('system.colorBlindnessMode') }}</div>
|
|
50
51
52
|
</a-list-item-meta>
</a-list-item>
<a-list-item>
|
|
53
|
<a-switch slot="actions" size="small" :defaultChecked="multipage" @change="onMultipageWeak" />
|
|
54
|
<a-list-item-meta>
|
|
55
|
<div slot="title">{{ $t('system.multiTabMode') }}</div>
|
|
56
57
58
59
60
61
62
|
</a-list-item-meta>
</a-list-item>
</a-list>
</div>
</div>
</div>
<div class="setting-drawer-index-handle" @click="toggle" v-if="visible">
|
|
63
|
<a-icon type="close" />
|
|
64
65
66
67
68
69
|
</div>
</a-drawer>
</div>
</template>
<script>
|
|
70
71
72
|
import DetailList from '@/components/tools/DetailList'
import SettingItem from '@/components/setting/SettingItem'
import config from '@/defaultSettings'
|
|
73
74
75
|
import { updateTheme, updateColorWeak, colorList } from '@/components/tools/setting'
import { mixin, mixinDevice } from '@/utils/mixin.js'
import { triggerWindowResizeEvent } from '@/utils/util'
|
|
76
|
|
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
export default {
components: {
DetailList,
SettingItem
},
mixins: [mixin, mixinDevice],
data() {
return {
visible: false,
colorList,
dataFixSiderbar: false
}
},
mounted() {
// 当主题色不是默认色时,才进行主题编译
if (this.primaryColor !== config.primaryColor) {
updateTheme(this.primaryColor)
}
if (this.colorWeak !== config.colorWeak) {
updateColorWeak(this.colorWeak)
}
if (this.multipage !== config.multipage) {
this.$store.dispatch('ToggleMultipage', this.multipage)
|
|
100
|
}
|
|
101
102
|
},
methods: {
|
|
103
|
handleLanguageChange(lang) {
|
|
104
|
this.$ls.set('language', lang)
|
|
105
106
|
window.location.reload()
},
|
|
107
108
|
showDrawer() {
this.visible = true
|
|
109
|
},
|
|
110
111
|
onClose() {
this.visible = false
|
|
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
|
toggle() {
this.visible = !this.visible
},
onColorWeak(checked) {
this.$store.dispatch('ToggleWeak', checked)
updateColorWeak(checked)
},
onMultipageWeak(checked) {
this.$store.dispatch('ToggleMultipage', checked)
},
handleMenuTheme(theme) {
this.$store.dispatch('ToggleTheme', theme)
},
handleLayout(mode) {
this.$store.dispatch('ToggleLayoutMode', mode)
// 因为顶部菜单不能固定左侧菜单栏,所以强制关闭
this.handleFixSiderbar(false)
// 触发窗口resize事件
triggerWindowResizeEvent()
},
handleContentWidthChange(type) {
this.$store.dispatch('ToggleContentWidth', type)
},
changeColor(color) {
if (this.primaryColor !== color) {
this.$store.dispatch('ToggleColor', color)
updateTheme(color)
|
|
140
141
|
}
},
|
|
142
143
144
145
146
147
148
149
150
151
152
153
154
|
handleFixedHeader(fixed) {
this.$store.dispatch('ToggleFixedHeader', fixed)
},
handleFixedHeaderHidden(autoHidden) {
this.$store.dispatch('ToggleFixedHeaderHidden', autoHidden)
},
handleFixSiderbar(fixed) {
if (this.layoutMode === 'topmenu') {
fixed = false
}
this.dataFixSiderbar = fixed
this.$store.dispatch('ToggleFixSiderbar', fixed)
}
|
|
155
|
}
|
|
156
|
}
|
|
157
158
159
|
</script>
<style lang="less" scoped>
|
|
160
161
162
|
.setting-drawer-index-content {
.setting-drawer-index-blockChecbox {
display: flex;
|
|
163
|
|
|
164
165
166
167
168
|
.setting-drawer-index-item {
margin-right: 16px;
position: relative;
border-radius: 4px;
cursor: pointer;
|
|
169
|
|
|
170
171
|
img {
width: 48px;
|
|
172
173
|
}
|
|
174
175
176
177
178
179
180
181
182
|
.setting-drawer-index-selectIcon {
position: absolute;
top: 0;
right: 0;
width: 100%;
padding-top: 15px;
padding-left: 24px;
height: 100%;
color: #1890ff;
|
|
183
|
font-size: 14px;
|
|
184
|
font-weight: 700;
|
|
185
186
187
188
|
}
}
}
|
|
189
190
191
192
193
|
.setting-drawer-theme-color-colorBlock {
width: 20px;
height: 20px;
border-radius: 2px;
float: left;
|
|
194
|
cursor: pointer;
|
|
195
196
197
|
margin-right: 8px;
padding-left: 0px;
padding-right: 0px;
|
|
198
|
text-align: center;
|
|
199
200
|
color: #fff;
font-weight: 700;
|
|
201
202
|
i {
|
|
203
|
font-size: 14px;
|
|
204
205
|
}
}
|
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
}
.setting-drawer-index-handle {
position: absolute;
top: 240px;
background: #1890ff;
width: 48px;
height: 48px;
right: 300px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
pointer-events: auto;
z-index: 1001;
text-align: center;
font-size: 16px;
border-radius: 4px 0 0 4px;
i {
color: rgb(255, 255, 255);
font-size: 20px;
}
}
|
|
230
|
</style>
|