xto-fronted 0.4.24 → 0.4.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,870 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, onMounted, onUnmounted } from 'vue'
3
+ import { useRoute, useRouter } from 'vue-router'
4
+ import { useMenuStore } from '@/stores/menu'
5
+ import { useAppStore } from '@/stores/app'
6
+ import { useUserStore } from '@/stores/user'
7
+ import { useAuthStore } from '@/stores/auth'
8
+ import { Menu, MenuItem } from '@xto/navigation'
9
+ import { Icon } from '@xto/base'
10
+ import { Drawer } from '@xto/feedback'
11
+
12
+ const route = useRoute()
13
+ const router = useRouter()
14
+ const menuStore = useMenuStore()
15
+ const appStore = useAppStore()
16
+ const userStore = useUserStore()
17
+ const authStore = useAuthStore()
18
+
19
+ // 当前激活的一级菜单
20
+ const activeTopMenu = computed(() => appStore.activeTopMenuPath)
21
+
22
+ // 菜单主题相关
23
+ const menuBgColor = computed(() => appStore.isDark ? '#1d1e1f' : '#fff')
24
+ const menuTextColor = computed(() => appStore.isDark ? '#cfd3dc' : '#303133')
25
+ const menuActiveTextColor = computed(() => '#409eff')
26
+
27
+ // 下拉菜单
28
+ const dropdownVisible = ref(false)
29
+ const dropdownRef = ref<HTMLElement | null>(null)
30
+ const isFullscreen = ref(false)
31
+ const drawerVisible = ref(false)
32
+ const greyMode = ref(false)
33
+
34
+ // 已知的图标名称列表
35
+ const knownIcons = new Set([
36
+ 'arrow-up', 'arrow-down', 'arrow-left', 'arrow-right',
37
+ 'caret-down', 'caret-right', 'plus', 'minus', 'close', 'check',
38
+ 'edit', 'delete', 'copy', 'download', 'upload', 'refresh', 'search',
39
+ 'filter', 'more', 'setting', 'share', 'loading', 'info', 'success',
40
+ 'warning', 'error', 'question', 'user', 'user-add', 'user-group',
41
+ 'logout', 'login', 'file', 'folder', 'folder-open', 'document',
42
+ 'image', 'video', 'music', 'camera', 'mail', 'phone', 'chat',
43
+ 'bell', 'message', 'eye', 'eye-off', 'calendar', 'clock', 'history',
44
+ 'timer', 'location', 'map', 'globe', 'star', 'heart', 'thumb-up',
45
+ 'link', 'external-link', 'lock', 'unlock', 'key', 'home', 'menu',
46
+ 'menu-fold', 'menu-unfold', 'sidebar-fold', 'sidebar-expand',
47
+ 'sidebar-left', 'dashboard', 'chart', 'chart-pie', 'chart-line',
48
+ 'report', 'analytics', 'system', 'permission', 'role', 'user-manage',
49
+ 'log', 'notification', 'app', 'list', 'grid', 'fullscreen',
50
+ 'fullscreen-exit', 'zoom-in', 'zoom-out', 'print', 'bookmark',
51
+ 'tag', 'code', 'terminal', 'database', 'server', 'cloud', 'gift',
52
+ 'moon', 'sun', 'theme', 'skin'
53
+ ])
54
+
55
+ // 获取菜单图标名称
56
+ const getMenuIcon = (icon?: string): string => {
57
+ if (!icon || icon === '') return ''
58
+
59
+ if (icon.startsWith('tineco-icon-')) {
60
+ const iconName = icon.replace('tineco-icon-', '')
61
+ const tinecoIconMap: Record<string, string> = {
62
+ home: 'home',
63
+ dashboard: 'dashboard',
64
+ system: 'system',
65
+ user: 'user',
66
+ role: 'role',
67
+ menu: 'list',
68
+ setting: 'setting',
69
+ file: 'file',
70
+ folder: 'folder',
71
+ chart: 'chart',
72
+ report: 'report',
73
+ analytics: 'analytics'
74
+ }
75
+ return tinecoIconMap[iconName] || iconName
76
+ }
77
+
78
+ const iconMap: Record<string, string> = {
79
+ dashboard: 'dashboard',
80
+ system: 'system',
81
+ user: 'user',
82
+ role: 'role',
83
+ menu: 'list',
84
+ setting: 'setting',
85
+ home: 'home',
86
+ chart: 'chart',
87
+ report: 'report',
88
+ analytics: 'analytics',
89
+ permission: 'permission',
90
+ log: 'log',
91
+ notification: 'notification',
92
+ app: 'app',
93
+ list: 'list',
94
+ grid: 'grid'
95
+ }
96
+
97
+ return iconMap[icon] || icon
98
+ }
99
+
100
+ const getFirstChar = (name?: string): string => {
101
+ if (!name) return ''
102
+ return name.charAt(0)
103
+ }
104
+
105
+ const iconExists = (iconName: string): boolean => {
106
+ return knownIcons.has(iconName)
107
+ }
108
+
109
+ // 点击一级菜单
110
+ const handleTopMenuClick = (menuUrl: string) => {
111
+ appStore.setActiveTopMenuPath(menuUrl)
112
+
113
+ // 找到对应的菜单
114
+ const menu = menuStore.menuList.find(m => m.menuUrl === menuUrl)
115
+ if (menu) {
116
+ // 有二级菜单:跳转到第一个二级菜单
117
+ if (menu.children && menu.children.length > 0) {
118
+ const firstChild = menu.children[0]
119
+ if (firstChild.menuUrl !== route.path) {
120
+ router.push(firstChild.menuUrl)
121
+ }
122
+ } else {
123
+ // 没有二级菜单:直接跳转一级菜单
124
+ if (menuUrl !== route.path) {
125
+ router.push(menuUrl)
126
+ }
127
+ }
128
+ }
129
+ }
130
+
131
+ // 切换主题
132
+ const toggleTheme = () => {
133
+ appStore.toggleTheme()
134
+ drawerVisible.value = false
135
+ }
136
+
137
+ // 切换全屏
138
+ const toggleFullscreen = () => {
139
+ if (!document.fullscreenElement) {
140
+ document.documentElement.requestFullscreen()
141
+ } else {
142
+ document.exitFullscreen()
143
+ }
144
+ }
145
+
146
+ // 监听全屏变化
147
+ const handleFullscreenChange = () => {
148
+ isFullscreen.value = !!document.fullscreenElement
149
+ }
150
+
151
+ // 切换下拉菜单
152
+ const toggleDropdown = () => {
153
+ dropdownVisible.value = !dropdownVisible.value
154
+ }
155
+
156
+ // 关闭下拉菜单
157
+ const closeDropdowns = () => {
158
+ dropdownVisible.value = false
159
+ }
160
+
161
+ // 打开设置抽屉
162
+ const openSettingsDrawer = () => {
163
+ drawerVisible.value = true
164
+ }
165
+
166
+ // 切换灰色模式
167
+ const handleGreyModeChange = (value: boolean) => {
168
+ greyMode.value = value
169
+ const html = document.documentElement
170
+ if (value) {
171
+ html.classList.add('grey-mode')
172
+ } else {
173
+ html.classList.remove('grey-mode')
174
+ }
175
+ }
176
+
177
+ // 抽屉内灰色模式开关
178
+ const handleGreyModeToggle = () => {
179
+ handleGreyModeChange(!greyMode.value)
180
+ drawerVisible.value = false
181
+ }
182
+
183
+ // 抽屉内暗黑模式开关
184
+ const handleDarkModeToggle = () => {
185
+ appStore.toggleTheme()
186
+ drawerVisible.value = false
187
+ }
188
+
189
+ // 布局模式选项
190
+ type LayoutMode = 'sidebar' | 'top' | 'mix'
191
+ const layoutOptions: { value: LayoutMode; label: string }[] = [
192
+ { value: 'sidebar', label: '左侧菜单' },
193
+ { value: 'top', label: '顶部菜单' },
194
+ { value: 'mix', label: '混合菜单' }
195
+ ]
196
+
197
+ const currentLayout = computed(() => appStore.layout)
198
+
199
+ // 切换布局模式
200
+ const handleLayoutChange = (mode: LayoutMode) => {
201
+ appStore.setLayout(mode)
202
+ drawerVisible.value = false
203
+ }
204
+
205
+ // 主题色选项
206
+ const colorOptions = [
207
+ { value: '#409eff', label: '默认蓝' },
208
+ { value: '#1890ff', label: '科技蓝' },
209
+ { value: '#52c41a', label: '极光绿' },
210
+ { value: '#faad14', label: '日落橙' },
211
+ { value: '#f5222d', label: '薄暮红' },
212
+ { value: '#722ed1', label: '酱紫' }
213
+ ]
214
+
215
+ // 设置主题色
216
+ const handleColorChange = (color: string) => {
217
+ appStore.setPrimaryColor(color)
218
+ drawerVisible.value = false
219
+ }
220
+
221
+ // 个人信息
222
+ const handleProfile = () => {
223
+ closeDropdowns()
224
+ router.push('/profile')
225
+ }
226
+
227
+ // 修改密码
228
+ const handleChangePassword = () => {
229
+ closeDropdowns()
230
+ router.push('/change-password')
231
+ }
232
+
233
+ // 退出登录
234
+ const handleLogout = () => {
235
+ closeDropdowns()
236
+ authStore.logout()
237
+ userStore.clearUserInfo()
238
+ menuStore.clearMenu()
239
+ router.push('/login')
240
+ }
241
+
242
+ // 点击外部关闭下拉菜单
243
+ const handleClickOutside = (event: MouseEvent) => {
244
+ if (dropdownRef.value && !dropdownRef.value.contains(event.target as Node)) {
245
+ closeDropdowns()
246
+ }
247
+ }
248
+
249
+ onMounted(() => {
250
+ document.addEventListener('click', handleClickOutside)
251
+ document.addEventListener('fullscreenchange', handleFullscreenChange)
252
+ greyMode.value = document.documentElement.classList.contains('grey-mode')
253
+ })
254
+
255
+ onUnmounted(() => {
256
+ document.removeEventListener('click', handleClickOutside)
257
+ document.removeEventListener('fullscreenchange', handleFullscreenChange)
258
+ })
259
+ </script>
260
+
261
+ <template>
262
+ <div class="mix-top-menu">
263
+ <!-- Logo区域 -->
264
+ <div class="mix-top-menu__logo">
265
+ <span class="mix-top-menu__logo-text">{{ appStore.appName }}</span>
266
+ </div>
267
+
268
+ <!-- 一级菜单(水平排列) -->
269
+ <Menu
270
+ :default-active="activeTopMenu"
271
+ mode="horizontal"
272
+ :background-color="menuBgColor"
273
+ :text-color="menuTextColor"
274
+ :active-text-color="menuActiveTextColor"
275
+ class="mix-top-menu__menu"
276
+ @select="handleTopMenuClick"
277
+ >
278
+ <MenuItem
279
+ v-for="menu in menuStore.menuList"
280
+ :key="menu.menuUrl"
281
+ :index="menu.menuUrl"
282
+ >
283
+ <span class="mix-top-menu__menu-icon">
284
+ <Icon v-if="iconExists(getMenuIcon(menu.icon))" :name="getMenuIcon(menu.icon)" :size="16" />
285
+ <span v-else class="mix-top-menu__menu-char">{{ getFirstChar(menu.menuName) }}</span>
286
+ </span>
287
+ <span>{{ menu.menuName }}</span>
288
+ </MenuItem>
289
+ </Menu>
290
+
291
+ <!-- 右侧操作区域 -->
292
+ <div class="mix-top-menu__actions">
293
+ <!-- 全屏切换 -->
294
+ <div class="mix-top-menu__action" @click="toggleFullscreen" :title="isFullscreen ? '退出全屏' : '全屏'">
295
+ <Icon :name="isFullscreen ? 'fullscreen-exit' : 'fullscreen'" :size="16" />
296
+ </div>
297
+
298
+ <!-- 换肤设置 -->
299
+ <div class="mix-top-menu__action" @click="openSettingsDrawer" title="换肤设置">
300
+ <Icon name="skin" :size="16" />
301
+ </div>
302
+
303
+ <!-- 主题切换 -->
304
+ <div class="mix-top-menu__action" @click="toggleTheme" title="切换主题">
305
+ <Icon :name="appStore.isDark ? 'sun' : 'moon'" :size="16" />
306
+ </div>
307
+
308
+ <!-- 用户头像 -->
309
+ <div class="mix-top-menu__user" ref="dropdownRef">
310
+ <div class="mix-top-menu__user-trigger" @click.stop="toggleDropdown">
311
+ <div class="mix-top-menu__avatar">
312
+ <span>{{ userStore.userName?.charAt(0) || 'U' }}</span>
313
+ </div>
314
+ <span class="mix-top-menu__user-name">{{ userStore.userName }}</span>
315
+ <span class="mix-top-menu__user-arrow" :class="{ 'is-active': dropdownVisible }">▼</span>
316
+ </div>
317
+
318
+ <!-- 下拉菜单 -->
319
+ <Transition name="dropdown">
320
+ <div v-if="dropdownVisible" class="mix-top-menu__dropdown">
321
+ <div class="mix-top-menu__dropdown-header">
322
+ <div class="mix-top-menu__dropdown-avatar">
323
+ <span>{{ userStore.userName?.charAt(0) || 'U' }}</span>
324
+ </div>
325
+ <div class="mix-top-menu__dropdown-info">
326
+ <div class="mix-top-menu__dropdown-name">{{ userStore.userName }}</div>
327
+ <div class="mix-top-menu__dropdown-role">{{ userStore.departmentName }}</div>
328
+ </div>
329
+ </div>
330
+ <div class="mix-top-menu__dropdown-divider"></div>
331
+ <div class="mix-top-menu__dropdown-menu">
332
+ <div class="mix-top-menu__dropdown-item" @click="handleProfile">
333
+ <Icon name="user" :size="16" />
334
+ <span>个人信息</span>
335
+ </div>
336
+ <div class="mix-top-menu__dropdown-item" @click="handleChangePassword">
337
+ <Icon name="lock" :size="16" />
338
+ <span>修改密码</span>
339
+ </div>
340
+ <div class="mix-top-menu__dropdown-divider"></div>
341
+ <div class="mix-top-menu__dropdown-item mix-top-menu__dropdown-item--danger" @click="handleLogout">
342
+ <Icon name="logout" :size="16" />
343
+ <span>退出登录</span>
344
+ </div>
345
+ </div>
346
+ </div>
347
+ </Transition>
348
+ </div>
349
+ </div>
350
+
351
+ <!-- 换肤设置抽屉 -->
352
+ <Drawer
353
+ v-model="drawerVisible"
354
+ title="换肤设置"
355
+ direction="rtl"
356
+ size="320px"
357
+ >
358
+ <div class="settings-drawer">
359
+ <!-- 布局模式 -->
360
+ <div class="settings-section">
361
+ <div class="settings-title">布局模式</div>
362
+ <div class="settings-layout-options">
363
+ <div
364
+ v-for="option in layoutOptions"
365
+ :key="option.value"
366
+ :class="['layout-option', { 'is-active': currentLayout === option.value }]"
367
+ @click="handleLayoutChange(option.value)"
368
+ >
369
+ <div class="layout-option__preview">
370
+ <div v-if="option.value === 'sidebar'" class="layout-preview-sidebar">
371
+ <div class="preview-aside"></div>
372
+ <div class="preview-main">
373
+ <div class="preview-header"></div>
374
+ <div class="preview-content"></div>
375
+ </div>
376
+ </div>
377
+ <div v-else-if="option.value === 'top'" class="layout-preview-top">
378
+ <div class="preview-header-full"></div>
379
+ <div class="preview-content-full"></div>
380
+ </div>
381
+ <div v-else class="layout-preview-mix">
382
+ <div class="preview-header-mix">
383
+ <div class="preview-mix-left"></div>
384
+ </div>
385
+ <div class="preview-mix-body">
386
+ <div class="preview-mix-aside"></div>
387
+ <div class="preview-mix-content"></div>
388
+ </div>
389
+ </div>
390
+ </div>
391
+ <span class="layout-option__label">{{ option.label }}</span>
392
+ </div>
393
+ </div>
394
+ </div>
395
+
396
+ <!-- 主题色 -->
397
+ <div class="settings-section">
398
+ <div class="settings-title">主题色</div>
399
+ <div class="settings-color-options">
400
+ <div
401
+ v-for="color in colorOptions"
402
+ :key="color.value"
403
+ :class="['color-option', { 'is-active': appStore.primaryColor === color.value }]"
404
+ :style="{ backgroundColor: color.value }"
405
+ :title="color.label"
406
+ @click="handleColorChange(color.value)"
407
+ >
408
+ <Icon v-if="appStore.primaryColor === color.value" name="check" :size="12" color="#fff" />
409
+ </div>
410
+ </div>
411
+ </div>
412
+
413
+ <!-- 功能开关 -->
414
+ <div class="settings-section">
415
+ <div class="settings-title">功能设置</div>
416
+ <div class="settings-switch-list">
417
+ <div class="settings-switch-item">
418
+ <span>灰色模式</span>
419
+ <div class="switch-wrapper" :class="{ 'is-checked': greyMode }" @click="handleGreyModeToggle">
420
+ <span class="switch-core"></span>
421
+ </div>
422
+ </div>
423
+ <div class="settings-switch-item">
424
+ <span>暗黑模式</span>
425
+ <div class="switch-wrapper" :class="{ 'is-checked': appStore.isDark }" @click="handleDarkModeToggle">
426
+ <span class="switch-core"></span>
427
+ </div>
428
+ </div>
429
+ </div>
430
+ </div>
431
+ </div>
432
+ </Drawer>
433
+ </div>
434
+ </template>
435
+
436
+ <style lang="scss" scoped>
437
+ .mix-top-menu {
438
+ width: 100%;
439
+ height: 50px;
440
+ display: flex;
441
+ align-items: center;
442
+ padding: 0 20px;
443
+ background-color: var(--bg-color);
444
+ border-bottom: 1px solid var(--color-border-lighter);
445
+
446
+ // Logo区域
447
+ &__logo {
448
+ display: flex;
449
+ align-items: center;
450
+ padding-right: 20px;
451
+ margin-right: 20px;
452
+ }
453
+
454
+ &__logo-text {
455
+ font-size: 16px;
456
+ font-weight: 600;
457
+ color: var(--color-primary);
458
+ }
459
+
460
+ // 菜单区域
461
+ &__menu {
462
+ flex: 1;
463
+ border-bottom: none;
464
+ height: 100%;
465
+ }
466
+
467
+ &__menu-icon {
468
+ display: inline-flex;
469
+ align-items: center;
470
+ justify-content: center;
471
+ width: 16px;
472
+ height: 16px;
473
+ margin-right: 8px;
474
+ }
475
+
476
+ &__menu-char {
477
+ display: inline-flex;
478
+ align-items: center;
479
+ justify-content: center;
480
+ width: 16px;
481
+ height: 16px;
482
+ font-size: 12px;
483
+ font-weight: 600;
484
+ color: var(--color-primary);
485
+ background-color: var(--color-primary-light-8);
486
+ border-radius: 4px;
487
+ }
488
+
489
+ // 右侧操作区域
490
+ &__actions {
491
+ display: flex;
492
+ align-items: center;
493
+ gap: 8px;
494
+ }
495
+
496
+ &__action {
497
+ width: 32px;
498
+ height: 32px;
499
+ display: flex;
500
+ align-items: center;
501
+ justify-content: center;
502
+ cursor: pointer;
503
+ border-radius: var(--border-radius-base);
504
+ color: var(--color-text-regular);
505
+ transition: all 0.2s;
506
+
507
+ &:hover {
508
+ background-color: var(--color-fill);
509
+ color: var(--color-primary);
510
+ }
511
+ }
512
+
513
+ // 用户头像
514
+ &__user {
515
+ position: relative;
516
+ margin-left: 8px;
517
+
518
+ &-trigger {
519
+ display: flex;
520
+ align-items: center;
521
+ gap: 8px;
522
+ cursor: pointer;
523
+ padding: 4px 8px;
524
+ border-radius: var(--border-radius-base);
525
+ transition: background-color 0.2s;
526
+
527
+ &:hover {
528
+ background-color: var(--color-fill);
529
+ }
530
+ }
531
+
532
+ &-name {
533
+ font-size: 14px;
534
+ color: var(--color-text-primary);
535
+ max-width: 100px;
536
+ overflow: hidden;
537
+ text-overflow: ellipsis;
538
+ white-space: nowrap;
539
+ }
540
+
541
+ &-arrow {
542
+ font-size: 10px;
543
+ color: var(--color-text-secondary);
544
+ transition: transform 0.2s;
545
+
546
+ &.is-active {
547
+ transform: rotate(180deg);
548
+ }
549
+ }
550
+ }
551
+
552
+ &__avatar {
553
+ width: 32px;
554
+ height: 32px;
555
+ border-radius: 50%;
556
+ background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light-3));
557
+ display: flex;
558
+ align-items: center;
559
+ justify-content: center;
560
+ color: #fff;
561
+ font-size: 14px;
562
+ font-weight: 500;
563
+ }
564
+
565
+ // 下拉菜单
566
+ &__dropdown {
567
+ position: absolute;
568
+ top: calc(100% + 8px);
569
+ right: 0;
570
+ min-width: 200px;
571
+ background-color: var(--bg-color);
572
+ border-radius: var(--border-radius-base);
573
+ box-shadow: var(--box-shadow);
574
+ overflow: hidden;
575
+ z-index: 100;
576
+
577
+ &-header {
578
+ display: flex;
579
+ align-items: center;
580
+ gap: 12px;
581
+ padding: 16px;
582
+ }
583
+
584
+ &-avatar {
585
+ width: 40px;
586
+ height: 40px;
587
+ border-radius: 50%;
588
+ background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light-3));
589
+ display: flex;
590
+ align-items: center;
591
+ justify-content: center;
592
+ color: #fff;
593
+ font-size: 16px;
594
+ font-weight: 500;
595
+ }
596
+
597
+ &-info {
598
+ flex: 1;
599
+ }
600
+
601
+ &-name {
602
+ font-size: 14px;
603
+ font-weight: 500;
604
+ color: var(--color-text-primary);
605
+ }
606
+
607
+ &-role {
608
+ font-size: 12px;
609
+ color: var(--color-text-secondary);
610
+ margin-top: 2px;
611
+ }
612
+
613
+ &-divider {
614
+ height: 1px;
615
+ background-color: var(--color-border-lighter);
616
+ }
617
+
618
+ &-menu {
619
+ padding: 8px 0;
620
+ }
621
+
622
+ &-item {
623
+ display: flex;
624
+ align-items: center;
625
+ gap: 10px;
626
+ padding: 10px 16px;
627
+ cursor: pointer;
628
+ font-size: 14px;
629
+ color: var(--color-text-regular);
630
+ transition: all 0.2s;
631
+
632
+ &:hover {
633
+ background-color: var(--color-fill);
634
+ color: var(--color-text-primary);
635
+ }
636
+
637
+ &--danger {
638
+ color: var(--color-danger);
639
+
640
+ &:hover {
641
+ background-color: var(--color-danger-light);
642
+ color: var(--color-danger);
643
+ }
644
+ }
645
+ }
646
+ }
647
+ }
648
+
649
+ // 设置抽屉内容
650
+ .settings-drawer {
651
+ .settings-section {
652
+ margin-bottom: 24px;
653
+ }
654
+
655
+ .settings-title {
656
+ font-size: 14px;
657
+ font-weight: 500;
658
+ color: var(--color-text-primary);
659
+ margin-bottom: 12px;
660
+ }
661
+
662
+ .settings-layout-options {
663
+ display: flex;
664
+ gap: 12px;
665
+ }
666
+
667
+ .layout-option {
668
+ flex: 1;
669
+ display: flex;
670
+ flex-direction: column;
671
+ align-items: center;
672
+ gap: 8px;
673
+ padding: 12px;
674
+ border: 1px solid var(--color-border);
675
+ border-radius: var(--border-radius-base);
676
+ cursor: pointer;
677
+ transition: all 0.2s;
678
+
679
+ &:hover {
680
+ border-color: var(--color-primary-light-5);
681
+ }
682
+
683
+ &.is-active {
684
+ border-color: var(--color-primary);
685
+ background-color: var(--color-primary-light-9);
686
+ }
687
+
688
+ &__preview {
689
+ width: 48px;
690
+ height: 36px;
691
+ border: 1px solid var(--color-border-light);
692
+ border-radius: 2px;
693
+ overflow: hidden;
694
+ }
695
+
696
+ &__label {
697
+ font-size: 12px;
698
+ color: var(--color-text-regular);
699
+ }
700
+ }
701
+
702
+ // 布局预览样式
703
+ .layout-preview-sidebar {
704
+ display: flex;
705
+ height: 100%;
706
+
707
+ .preview-aside {
708
+ width: 25%;
709
+ height: 100%;
710
+ background-color: var(--color-primary-light-7);
711
+ }
712
+
713
+ .preview-main {
714
+ flex: 1;
715
+ display: flex;
716
+ flex-direction: column;
717
+
718
+ .preview-header {
719
+ height: 20%;
720
+ background-color: var(--color-border-light);
721
+ }
722
+
723
+ .preview-content {
724
+ flex: 1;
725
+ background-color: var(--bg-color-page);
726
+ }
727
+ }
728
+ }
729
+
730
+ .layout-preview-top {
731
+ display: flex;
732
+ flex-direction: column;
733
+ height: 100%;
734
+
735
+ .preview-header-full {
736
+ height: 25%;
737
+ background-color: var(--color-primary-light-7);
738
+ }
739
+
740
+ .preview-content-full {
741
+ flex: 1;
742
+ background-color: var(--bg-color-page);
743
+ }
744
+ }
745
+
746
+ .layout-preview-mix {
747
+ display: flex;
748
+ flex-direction: column;
749
+ height: 100%;
750
+
751
+ .preview-header-mix {
752
+ height: 30%;
753
+ background-color: var(--color-primary-light-7);
754
+ display: flex;
755
+
756
+ .preview-mix-left {
757
+ width: 30%;
758
+ background-color: var(--color-primary);
759
+ }
760
+ }
761
+
762
+ .preview-mix-body {
763
+ flex: 1;
764
+ display: flex;
765
+
766
+ .preview-mix-aside {
767
+ width: 25%;
768
+ background-color: var(--color-primary-light-8);
769
+ }
770
+
771
+ .preview-mix-content {
772
+ flex: 1;
773
+ background-color: var(--bg-color-page);
774
+ }
775
+ }
776
+ }
777
+
778
+ .settings-color-options {
779
+ display: flex;
780
+ gap: 12px;
781
+ }
782
+
783
+ .color-option {
784
+ width: 24px;
785
+ height: 24px;
786
+ border-radius: 4px;
787
+ cursor: pointer;
788
+ display: flex;
789
+ align-items: center;
790
+ justify-content: center;
791
+ transition: transform 0.2s;
792
+
793
+ &:hover {
794
+ transform: scale(1.1);
795
+ }
796
+
797
+ &.is-active {
798
+ box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 4px var(--color-primary);
799
+ }
800
+ }
801
+
802
+ .settings-switch-list {
803
+ display: flex;
804
+ flex-direction: column;
805
+ gap: 12px;
806
+ }
807
+
808
+ .settings-switch-item {
809
+ display: flex;
810
+ align-items: center;
811
+ justify-content: space-between;
812
+
813
+ span {
814
+ font-size: 14px;
815
+ color: var(--color-text-regular);
816
+ }
817
+ }
818
+
819
+ .switch-wrapper {
820
+ width: 44px;
821
+ height: 22px;
822
+ display: flex;
823
+ align-items: center;
824
+ cursor: pointer;
825
+
826
+ .switch-core {
827
+ width: 100%;
828
+ height: 100%;
829
+ border-radius: 11px;
830
+ background-color: var(--color-border);
831
+ position: relative;
832
+ transition: background-color 0.2s;
833
+
834
+ &::after {
835
+ content: '';
836
+ position: absolute;
837
+ top: 2px;
838
+ left: 2px;
839
+ width: 18px;
840
+ height: 18px;
841
+ background-color: #fff;
842
+ border-radius: 50%;
843
+ transition: left 0.2s;
844
+ }
845
+ }
846
+
847
+ &.is-checked {
848
+ .switch-core {
849
+ background-color: var(--color-primary);
850
+
851
+ &::after {
852
+ left: 24px;
853
+ }
854
+ }
855
+ }
856
+ }
857
+ }
858
+
859
+ // 下拉动画
860
+ .dropdown-enter-active,
861
+ .dropdown-leave-active {
862
+ transition: all 0.2s ease;
863
+ }
864
+
865
+ .dropdown-enter-from,
866
+ .dropdown-leave-to {
867
+ opacity: 0;
868
+ transform: translateY(-10px);
869
+ }
870
+ </style>