@utogether/udp-core 1.0.4 → 2.0.0-beta.3
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.
- package/dist/{403-DASI6Pwz.js → 403-CxOqlq0f.js} +3 -3
- package/dist/403-WCboRvzZ-ZAPgYStl.js +65 -0
- package/dist/404-2V0Qi-d7-DkNwQggp.js +65 -0
- package/dist/{404-YhBA92cb.js → 404-xdB6lFeQ.js} +1 -1
- package/dist/500-BYfzvixf-CGpEieyQ.js +67 -0
- package/dist/{500-ywbFF5MX.js → 500-C94bRK2S.js} +2 -2
- package/dist/AuthorityInfo-DBovfUjB-DpQwT9Q5.js +4 -0
- package/dist/{AuthorityInfo-tCSX2Fh7.js → AuthorityInfo-Dy3b_nFN.js} +1 -1
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-Cwd6UT2i.js → AuthorityInfo.vue_vue_type_style_index_0_lang-Bh7IbcdY.js} +2 -2
- package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-D-l_Az3s-Cw7WmFxz.js +100 -0
- package/dist/AuthorityPanel-CRlAwbaI-G7pZXKdE.js +4 -0
- package/dist/{AuthorityPanel-BeBNiwqc.js → AuthorityPanel-CRlAwbaI.js} +1 -1
- package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-DxhZjp1S-CJvk3pW8.js +114 -0
- package/dist/{AuthorityPanel.vue_vue_type_style_index_0_lang-CIYmnP9-.js → AuthorityPanel.vue_vue_type_style_index_0_lang-DxhZjp1S.js} +31 -24
- package/dist/Company-B4vsXy2I-CkNCOqjJ.js +25 -0
- package/dist/{Company-l23MEzdM.js → Company-gKkfnhLt.js} +3 -3
- package/dist/{CompanyPanel-D_s0rh6h.js → CompanyPanel-BF5Pc35s.js} +7 -7
- package/dist/CompanyPanel-Czcx8Gyw-CvndXwB_.js +206 -0
- package/dist/DataSet-DT-rGICv-DaUfgbxk.js +147 -0
- package/dist/{Department-DSEvORLg.js → Department-D0I3QVZe.js} +3 -3
- package/dist/Department-D0dVUrGC-C6HJcYI1.js +25 -0
- package/dist/{DepartmentPanel-WN8nOgCV.js → DepartmentPanel-2LHODgc7.js} +22 -22
- package/dist/DepartmentPanel-e91Lxr1j-BS_A-ILd.js +254 -0
- package/dist/{DesignPanel-DirEGh9M.js → DesignPanel-CtF3cAAQ.js} +1 -1
- package/dist/DesignPanel-DdFl_ohi-uCwFxcl1.js +4 -0
- package/dist/DesignPanel.vue_vue_type_style_index_0_lang-BACPrfUI-cC7yL0uY.js +1013 -0
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-D02hXSrN.js → DesignPanel.vue_vue_type_style_index_0_lang-BCYgwoVt.js} +3 -3
- package/dist/DictView-BzQLOf_P-DDicwdmM.js +111 -0
- package/dist/{DictView-DiIQdiek.js → DictView-H3V5hxg3.js} +17 -16
- package/dist/{InvOrganization-b7v3g9EJ.js → InvOrganization-BiGLnbqe.js} +2 -2
- package/dist/InvOrganization-atbhw0CI-BABbVt9V.js +74 -0
- package/dist/Org-BW1YHG-Q-Cow7JWlD.js +39 -0
- package/dist/{Org-BORfx1PL.js → Org-DQTCQHNY.js} +2 -2
- package/dist/Preview-DJtVsoq1-CCGidQjJ.js +48 -0
- package/dist/{Preview-DkRn_TSc.js → Preview-DXaiis29.js} +1 -1
- package/dist/{ReportDefine-Cd0QeaWA.js → ReportDefine-BLh4CiER.js} +1 -1
- package/dist/ReportDefine-CNx_ob99-6NQAHK-Q.js +10 -0
- package/dist/ReportDesign-FbQ6yTJS-C1pPAUSp.js +165 -0
- package/dist/{ReportDesign-4qNqyeEW.js → ReportDesign-Ni1YxrLC.js} +7 -7
- package/dist/ReportQuery-C5gz8Lgd-Eu2cQmda.js +75 -0
- package/dist/{ReportQuery-BJfTFpec.js → ReportQuery-C8G88_qF.js} +1 -1
- package/dist/ReportQueryFrom-C7scua5v-uHXWq8Gy.js +4 -0
- package/dist/{ReportQueryFrom-CB7sExZx.js → ReportQueryFrom-CuZKPtB4.js} +1 -1
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-CqO_2Ier.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-BAn_siFW.js} +7 -7
- package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-DCbz67Wa-vK6r2uCl.js +178 -0
- package/dist/ReportTemplate-BDANdIWv-D_IGjR1w.js +161 -0
- package/dist/{ReportTemplate-B69muSgT.js → ReportTemplate-DFnDXWmx.js} +8 -8
- package/dist/{Role-Bo4YrNDC.js → Role-BQ7hsfPn.js} +3 -3
- package/dist/Role-ByB0WbxW-5E8Mb148.js +25 -0
- package/dist/RoleAssign-DW6iC_0v-Bis61auk.js +26 -0
- package/dist/{RoleAssign-kOMYJ4s3.js → RoleAssign-UPCg2d4G.js} +3 -3
- package/dist/RolePanel-BM2MaQPU-CgcsbfaX.js +4 -0
- package/dist/{RolePanel-BSJmjyqc.js → RolePanel-C-mQ5XRq.js} +1 -1
- package/dist/RolePanel-ClQy8DBL-DARL4O-o.js +4 -0
- package/dist/{RolePanel-B1d4e6uk.js → RolePanel-CoSXOCZN.js} +1 -1
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-Bc_Ao_PU-DMmxr2iI.js +132 -0
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DgQpfjaU.js → RolePanel.vue_vue_type_script_setup_true_lang-Bg-t2UhF.js} +7 -7
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DCzX-ZP_.js → RolePanel.vue_vue_type_script_setup_true_lang-D-o7HYZ8.js} +8 -8
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-fthF1zkp-JsbQJoDy.js +154 -0
- package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-ByWIwajm-BsBf2Vs3.js +100 -0
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-WNOYFxJ1.js → ScrollPanel.vue_vue_type_style_index_0_lang-CCsoxDfk.js} +1 -1
- package/dist/Staff-CuxzvhD9-D0KTcyRh.js +25 -0
- package/dist/{Staff-BFp3zNNR.js → Staff-D-CmvG1R.js} +3 -3
- package/dist/StaffInfo-CY7gUICu-EZUhUwIp.js +4 -0
- package/dist/{StaffInfo-DcU9_40C.js → StaffInfo-Idhvuc6e.js} +1 -1
- package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-Dd8gtQz8-Dlkt-eCn.js +108 -0
- package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-CtfN2CAr.js → StaffInfo.vue_vue_type_script_setup_true_lang-MUGKjnHU.js} +1 -1
- package/dist/{StaffPanel-7exWkZd9.js → StaffPanel-CDDmAYE5.js} +1 -1
- package/dist/StaffPanel-CwqG0_xr-CrvzLJoc.js +4 -0
- package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-v5xOXKRS.js → StaffPanel.vue_vue_type_script_setup_true_lang-Bdilqbee.js} +42 -42
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-DCdBy8Hu-BXrueqi0.js +143 -0
- package/dist/SysUser-9Q2UJWhi-DprWXFlR.js +15 -0
- package/dist/{SysUser-B3uB_cp2.js → SysUser-a-j5bppr.js} +2 -2
- package/dist/{SysUserPanel-B0CLp5AO.js → SysUserPanel-6V232wwB.js} +1 -1
- package/dist/SysUserPanel-bJy69O7x-BJtBgFEs.js +4 -0
- package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-Cwea_4dY.js → SysUserPanel.vue_vue_type_script_setup_true_lang-BOtHuMVy.js} +126 -111
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-DUPFqgz3-BSqRCMen.js +356 -0
- package/dist/{SystemMenu-a59l4hTk.js → SystemMenu-BnVeOSOQ.js} +50 -47
- package/dist/SystemMenu-DGOAolc1-CJSLHP8i.js +156 -0
- package/dist/UserInfo-CKoOHkAM-DDWp0I_U.js +4 -0
- package/dist/{UserInfo-D1IA2oLt.js → UserInfo-Cax9b2nw.js} +1 -1
- package/dist/UserInfo.vue_vue_type_style_index_0_lang-BaT53SSu-DsNaAomO.js +160 -0
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-DDVgYRD5.js → UserInfo.vue_vue_type_style_index_0_lang-D-cw11i9.js} +2 -2
- package/dist/await-to-js.es5-Bv3Eu4mi-UCggJjes.js +10 -0
- package/dist/await-to-js.es5-Bv3Eu4mi.js +10 -0
- package/dist/childView-0YZQ6GBn-CEqg7k5d.js +4 -0
- package/dist/{childView-6rCeLcsx.js → childView-DKG3eZo8.js} +1 -1
- package/dist/childView-DKkgi3yo-D47ft-vi.js +4 -0
- package/dist/{childView-JdrkroL5.js → childView-siumuBz0.js} +1 -1
- package/dist/childView.vue_vue_type_style_index_0_lang-ABMrGInv-ClOdE_sa.js +143 -0
- package/dist/{childView.vue_vue_type_style_index_0_lang-BfcnWnx9.js → childView.vue_vue_type_style_index_0_lang-CUfXDS1q.js} +28 -25
- package/dist/{childView.vue_vue_type_style_index_0_lang-B8x99f1B.js → childView.vue_vue_type_style_index_0_lang-CW3EbAmW.js} +8 -8
- package/dist/childView.vue_vue_type_style_index_0_lang-CaW106ve-CClTM8PK.js +180 -0
- package/dist/{code-rule-2lkPF547.js → code-rule-Dtoree6F.js} +2 -2
- package/dist/code-rule-wQyfgpNL-C4evD4Co.js +148 -0
- package/dist/core.es.js +10 -10
- package/dist/cron-task-C-kryDtd-C0NuGZCe.js +135 -0
- package/dist/{cron-task-DV1pGO1m.js → cron-task-GSRgA7S5.js} +2 -2
- package/dist/flow-task-B07st2aD-CgQvagSQ.js +10 -0
- package/dist/frameView-BOGA3ezf-QoSxzmSQ.js +44 -0
- package/dist/{frameView-C0bzSB8c.js → frameView-Cy6wxW0K.js} +1 -1
- package/dist/index-Dc7xWMiC.js +7265 -0
- package/dist/layout-home-3Dy4onl4.js +228 -0
- package/dist/layout-home-CYHksXN_-Basy-3IH.js +228 -0
- package/dist/layoutView-BaRvAbIa-xVgfqspc.js +3302 -0
- package/dist/{layoutView-CTV-E4Cj.js → layoutView-DMjNscJ-.js} +148 -149
- package/dist/log-in-Cx1dGik8-BVeEHeZ8.js +117 -0
- package/dist/{log-in-CoBP2x6u.js → log-in-VAG6Cvcx.js} +8 -8
- package/dist/log-out-COYdxrNC-ftopGZdE.js +130 -0
- package/dist/{log-out-KX8FiRVf.js → log-out-DZGaMCjC.js} +4 -4
- package/dist/{login-CtCoGWzD.js → login-CqVMdNHs.js} +126 -136
- package/dist/login-Dg9ofNS8-Bocp1XMA.js +241 -0
- package/dist/login-log-DJBGJVV0-AoOyj0jD.js +70 -0
- package/dist/lov-view-C0T5prk8-B2DBmn55.js +97 -0
- package/dist/{lov-view-Bm0JEzzg.js → lov-view-Cc68_28B.js} +7 -7
- package/dist/{menuInfo-D2qPoRwz.js → menuInfo-BIrIaJlH.js} +1 -1
- package/dist/menuInfo-BZJ_q7bz-Drho-_QC.js +4 -0
- package/dist/menuInfo.vue_vue_type_style_index_0_lang-BA8xjUo3-BCZ1wipf.js +363 -0
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-DoQjX9Ly.js → menuInfo.vue_vue_type_style_index_0_lang-DlE4w35X.js} +38 -36
- package/dist/{pda-app-SbcIclbH.js → pda-app-DnjphrRS.js} +9 -9
- package/dist/pda-app-m9hsppHo-B4xyja1o.js +710 -0
- package/dist/redirect-BqegffKC-CBCIuqmz.js +15 -0
- package/dist/resource-C6KEIXu--B_ddyecm.js +97 -0
- package/dist/{resource-Cdq1UKGI.js → resource-DISgPDM7.js} +4 -4
- package/dist/su-welcome-BjbuSrBZ.js +49424 -0
- package/dist/su-welcome-CYYy-dzr-D3RKPoB0.js +42089 -0
- package/dist/sys-config-DCjJGtht-DARDjlrt.js +370 -0
- package/dist/{sys-config-CCOf4xbj.js → sys-config-Yc9vh1t1.js} +13 -13
- package/dist/udp-core.css +1 -1
- package/dist/utogether-MlnyYtNS-CGgjFNPS.js +4 -0
- package/package.json +5 -2
- package/src/App.vue +37 -31
- package/src/components/udp/content/index.vue +88 -88
- package/src/components/udp/form-upload/form-upload.vue +492 -0
- package/src/components/udp/grid/index.vue +524 -524
- package/src/components/udp/index.ts +6 -5
- package/src/components/udp/ut-stamp-badge/index.vue +271 -271
- package/src/components/udp/utils.ts +408 -408
- package/src/layout/components/lay-content/index.vue +4 -11
- package/src/layout/components/lay-search/components/SearchModal.vue +181 -189
- package/src/layout/components/lay-setting/index.vue +503 -503
- package/src/layout/components/lay-sidebar/sidebar-logo.vue +101 -101
- package/src/layout/components/lay-tag/index.vue +598 -598
- package/src/layout/hooks/useNav.ts +176 -176
- package/src/layout/hooks/useTag.ts +227 -227
- package/src/layout/layoutView.vue +216 -215
- package/src/layout/types.ts +93 -93
- package/src/main.ts +111 -115
- package/src/plugins/i18n/zh.ts +17 -3
- package/src/plugins/vxe-table/index.ts +116 -116
- package/src/plugins/vxe-table/render.tsx +968 -950
- package/src/router/index.ts +187 -187
- package/src/router/modules/home.ts +32 -32
- package/src/router/utils.ts +420 -420
- package/src/store/modules/epTheme.ts +48 -48
- package/src/style/vxetable.scss +18 -2
- package/src/utils/dataFormat/index.ts +222 -222
- package/src/utils/lifecycle.ts +39 -39
- package/src/views/organization/department/DepartmentPanel.vue +303 -303
- package/src/views/organization/staff/StaffInfo.vue +127 -127
- package/src/views/organization/staff/StaffPanel.vue +3 -3
- package/src/views/system/layout/layout-home.vue +237 -0
- package/src/views/system/menu/AuthorityPanel.vue +10 -9
- package/src/views/system/menu/SystemMenu.vue +194 -185
- package/src/views/system/menu/menuInfo.vue +384 -384
- package/src/views/system/sysUser/SysUserPanel.vue +363 -347
- package/src/views/udev/coderule/code-rule.vue +132 -132
- package/src/views/udev/dict/DictView.vue +118 -118
- package/src/views/udev/dict/childView.vue +184 -183
- package/src/views/udev/lov/childView.vue +174 -174
- package/src/views/uhome/components/common-menu.vue +118 -0
- package/src/views/uhome/components/dynamic-component.vue +66 -0
- package/src/views/uhome/components/home-todo.vue +170 -0
- package/src/views/uhome/components/menu-favorite.vue +315 -315
- package/src/views/uhome/dynamic-card.vue +31 -0
- package/src/views/uhome/su-welcome.vue +48 -113
- package/src/views/ulogin/login.vue +336 -325
- package/src/views/upms/interface/log-in.vue +100 -100
- package/src/views/upms/interface/log-out.vue +104 -104
- package/src/views/upms/user/login-log.vue +54 -54
- package/types/global.d.ts +232 -231
- package/dist/await-to-js.es5-BtRbN2QH.js +0 -10
- package/dist/index-BbtbEMCH.js +0 -4649
- package/dist/su-welcome-BHDsjqqV.js +0 -524
|
@@ -1,503 +1,503 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { reactive, ref, unref, watch, computed, nextTick, onUnmounted, onBeforeMount } from 'vue';
|
|
3
|
-
import { templateRef } from '@vueuse/core';
|
|
4
|
-
import { useI18n } from 'vue-i18n';
|
|
5
|
-
import { useDark, useGlobal, useDebounce } from '@utogether/utils';
|
|
6
|
-
import panel from '../lay-panel/index.vue';
|
|
7
|
-
import { emitter } from '../../../utils/mitt';
|
|
8
|
-
import { useAppStoreHook } from '../../../store/modules/app';
|
|
9
|
-
import { useMultiTagsStoreHook } from '../../../store/modules/multiTags';
|
|
10
|
-
import { useDataThemeChange } from '../../hooks/useDataThemeChange';
|
|
11
|
-
import { useNav } from '../../hooks/useNav';
|
|
12
|
-
import { useRenderIcon } from '../../../components/ReIcon/src/hooks';
|
|
13
|
-
import dayIcon from '../../../assets/svg/day.svg?component';
|
|
14
|
-
import darkIcon from '../../../assets/svg/dark.svg?component';
|
|
15
|
-
import systemIcon from '../../../assets/svg/system.svg?component';
|
|
16
|
-
|
|
17
|
-
interface IThemeOption {
|
|
18
|
-
label: string;
|
|
19
|
-
icon: any;
|
|
20
|
-
theme: string;
|
|
21
|
-
value: number;
|
|
22
|
-
iconAttrs: { fill: string };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const { device } = useNav();
|
|
26
|
-
const { t } = useI18n();
|
|
27
|
-
const { isDark } = useDark();
|
|
28
|
-
const { $storage } = useGlobal();
|
|
29
|
-
|
|
30
|
-
const mixRef = templateRef<HTMLElement | null>('mixRef', null);
|
|
31
|
-
const verticalRef = templateRef<HTMLElement | null>('verticalRef', null);
|
|
32
|
-
const horizontalRef = templateRef<HTMLElement | null>('horizontalRef', null);
|
|
33
|
-
|
|
34
|
-
const { dataTheme, overallStyle, layoutTheme, themeColors, toggleClass, dataThemeChange, setLayoutThemeColor } =
|
|
35
|
-
useDataThemeChange();
|
|
36
|
-
|
|
37
|
-
/* body添加layout属性,作用于src/style/sidebar.scss */
|
|
38
|
-
if (unref(layoutTheme)) {
|
|
39
|
-
const layout = unref(layoutTheme).layout;
|
|
40
|
-
const theme = unref(layoutTheme).theme;
|
|
41
|
-
document.documentElement.setAttribute('data-theme', theme);
|
|
42
|
-
setLayoutModel(layout);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** 默认灵动模式 */
|
|
46
|
-
const markValue = ref($storage.configure?.showModel ?? 'smart');
|
|
47
|
-
|
|
48
|
-
const logoVal = ref($storage.configure?.showLogo ?? true);
|
|
49
|
-
|
|
50
|
-
const settings = reactive({
|
|
51
|
-
greyVal: $storage.configure.grey,
|
|
52
|
-
weakVal: $storage.configure.weak,
|
|
53
|
-
tabsVal: $storage.configure.hideTabs,
|
|
54
|
-
showLogo: $storage.configure.showLogo,
|
|
55
|
-
showModel: $storage.configure.showModel,
|
|
56
|
-
multiTagsCache: $storage.configure.multiTagsCache
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const getThemeColorStyle = computed(() => {
|
|
60
|
-
return color => {
|
|
61
|
-
return { background: color };
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
/** 当网页整体为暗色风格时不显示亮白色主题配色切换选项 */
|
|
66
|
-
const showThemeColors = computed(() => {
|
|
67
|
-
return themeColor => {
|
|
68
|
-
return themeColor === 'light' && isDark.value ? false : true;
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
function storageConfigureChange<T>(key: string, val: T): void {
|
|
73
|
-
const storageConfigure = $storage.configure;
|
|
74
|
-
storageConfigure[key] = val;
|
|
75
|
-
$storage.configure = storageConfigure;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** 灰色模式设置 */
|
|
79
|
-
const greyChange = (value): void => {
|
|
80
|
-
const htmlEl = document.querySelector('html');
|
|
81
|
-
toggleClass(settings.greyVal, 'html-grey', htmlEl);
|
|
82
|
-
storageConfigureChange('grey', value);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/** 色弱模式设置 */
|
|
86
|
-
const weekChange = (value): void => {
|
|
87
|
-
const htmlEl = document.querySelector('html');
|
|
88
|
-
toggleClass(settings.weakVal, 'html-weakness', htmlEl);
|
|
89
|
-
storageConfigureChange('weak', value);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/** 隐藏标签页设置 */
|
|
93
|
-
const tagsChange = () => {
|
|
94
|
-
const showVal = settings.tabsVal;
|
|
95
|
-
storageConfigureChange('hideTabs', showVal);
|
|
96
|
-
emitter.emit('tagViewsChange', showVal as unknown as string);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/** 标签页持久化设置 */
|
|
100
|
-
const multiTagsCacheChange = () => {
|
|
101
|
-
const multiTagsCache = settings.multiTagsCache;
|
|
102
|
-
storageConfigureChange('multiTagsCache', multiTagsCache);
|
|
103
|
-
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
function onChange(value) {
|
|
107
|
-
markValue.value = value;
|
|
108
|
-
storageConfigureChange('showModel', value);
|
|
109
|
-
emitter.emit('tagViewsShowModel', value);
|
|
110
|
-
}
|
|
111
|
-
/** 主题切换 */
|
|
112
|
-
function onThemeChange(theme) {
|
|
113
|
-
// dataTheme.value = !dataTheme.value;
|
|
114
|
-
// dataThemeChange();
|
|
115
|
-
theme === 1 && theme !== 2 ? (dataTheme.value = true) : (dataTheme.value = false);
|
|
116
|
-
overallStyle.value = themeOptions.value[theme].theme;
|
|
117
|
-
dataThemeChange(overallStyle.value);
|
|
118
|
-
theme === 2 && watchSystemThemeChange();
|
|
119
|
-
}
|
|
120
|
-
/** 侧边栏Logo */
|
|
121
|
-
function logoChange() {
|
|
122
|
-
unref(logoVal) ? storageConfigureChange('showLogo', true) : storageConfigureChange('showLogo', false);
|
|
123
|
-
emitter.emit('logoChange', unref(logoVal));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function setFalse(Doms): any {
|
|
127
|
-
Doms.forEach(v => {
|
|
128
|
-
toggleClass(false, 'is-select', unref(v));
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** 主题色 激活选择项 */
|
|
133
|
-
const getThemeColor = computed(() => {
|
|
134
|
-
return current => {
|
|
135
|
-
if (current === layoutTheme.value.theme && layoutTheme.value.theme !== 'light') {
|
|
136
|
-
return '#fff';
|
|
137
|
-
} else if (current === layoutTheme.value.theme && layoutTheme.value.theme === 'light') {
|
|
138
|
-
return '#1d2b45';
|
|
139
|
-
} else {
|
|
140
|
-
return 'transparent';
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
const themeOptions = computed<IThemeOption[]>(() => {
|
|
146
|
-
return [
|
|
147
|
-
{
|
|
148
|
-
label: t('message.udp.light'),
|
|
149
|
-
icon: dayIcon,
|
|
150
|
-
theme: 'light',
|
|
151
|
-
value: 0,
|
|
152
|
-
iconAttrs: { fill: isDark.value ? '#fff' : '#000' }
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
label: t('message.udp.dark'),
|
|
156
|
-
icon: darkIcon,
|
|
157
|
-
theme: 'dark',
|
|
158
|
-
value: 1,
|
|
159
|
-
iconAttrs: { fill: isDark.value ? '#fff' : '#000' }
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
label: '自动',
|
|
163
|
-
icon: systemIcon,
|
|
164
|
-
theme: 'system',
|
|
165
|
-
value: 2,
|
|
166
|
-
iconAttrs: { fill: isDark.value ? '#fff' : '#000' }
|
|
167
|
-
}
|
|
168
|
-
];
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
const markOptions = [
|
|
172
|
-
{ label: t('message.udp.smart'), value: 'smart' },
|
|
173
|
-
{ label: t('message.udp.card'), value: 'card' },
|
|
174
|
-
{ label: '丝滑', value: 'chrome' }
|
|
175
|
-
];
|
|
176
|
-
|
|
177
|
-
/** 设置菜单布局 */
|
|
178
|
-
function setLayoutModel(layout: string) {
|
|
179
|
-
layoutTheme.value.layout = layout;
|
|
180
|
-
window.document.body.setAttribute('layout', layout);
|
|
181
|
-
window.document.body.setAttribute('layoutType', window.top === window.self ? 'normal' : 'iframe');
|
|
182
|
-
$storage.layout = {
|
|
183
|
-
layout,
|
|
184
|
-
theme: layoutTheme.value.theme,
|
|
185
|
-
darkMode: $storage.layout?.darkMode,
|
|
186
|
-
sidebarStatus: $storage.layout?.sidebarStatus,
|
|
187
|
-
epThemeColor: $storage.layout?.epThemeColor,
|
|
188
|
-
themeColor: layoutTheme.value.theme,
|
|
189
|
-
overallStyle: $storage.layout?.overallStyle
|
|
190
|
-
};
|
|
191
|
-
useAppStoreHook().setLayout(layout);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
watch($storage, ({ layout }) => {
|
|
195
|
-
switch (layout['layout']) {
|
|
196
|
-
case 'vertical':
|
|
197
|
-
toggleClass(true, 'is-select', unref(verticalRef));
|
|
198
|
-
useDebounce(setFalse([horizontalRef]), 50);
|
|
199
|
-
useDebounce(setFalse([mixRef]), 50);
|
|
200
|
-
break;
|
|
201
|
-
case 'horizontal':
|
|
202
|
-
toggleClass(true, 'is-select', unref(horizontalRef));
|
|
203
|
-
useDebounce(setFalse([verticalRef]), 50);
|
|
204
|
-
useDebounce(setFalse([mixRef]), 50);
|
|
205
|
-
break;
|
|
206
|
-
case 'mix':
|
|
207
|
-
toggleClass(true, 'is-select', unref(mixRef));
|
|
208
|
-
useDebounce(setFalse([verticalRef]), 50);
|
|
209
|
-
useDebounce(setFalse([horizontalRef]), 50);
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
const mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');
|
|
215
|
-
|
|
216
|
-
/** 根据操作系统主题设置平台主题模式 */
|
|
217
|
-
function updateTheme() {
|
|
218
|
-
if (overallStyle.value !== 'system') return;
|
|
219
|
-
if (mediaQueryList.matches) {
|
|
220
|
-
dataTheme.value = true;
|
|
221
|
-
} else {
|
|
222
|
-
dataTheme.value = false;
|
|
223
|
-
}
|
|
224
|
-
dataThemeChange(overallStyle.value);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function removeMatchMedia() {
|
|
228
|
-
mediaQueryList.removeEventListener('change', updateTheme);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/** 监听操作系统主题改变 */
|
|
232
|
-
function watchSystemThemeChange() {
|
|
233
|
-
updateTheme();
|
|
234
|
-
removeMatchMedia();
|
|
235
|
-
mediaQueryList.addEventListener('change', updateTheme);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
onBeforeMount(() => {
|
|
239
|
-
/* 初始化项目配置 */
|
|
240
|
-
nextTick(() => {
|
|
241
|
-
watchSystemThemeChange();
|
|
242
|
-
settings.greyVal && document.querySelector('html')?.classList.add('html-grey');
|
|
243
|
-
settings.weakVal && document.querySelector('html')?.classList.add('html-weakness');
|
|
244
|
-
settings.tabsVal && tagsChange();
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
onUnmounted(() => removeMatchMedia);
|
|
249
|
-
</script>
|
|
250
|
-
<script lang="ts">
|
|
251
|
-
export default { name: 'SettingPanel' };
|
|
252
|
-
</script>
|
|
253
|
-
<template>
|
|
254
|
-
<panel>
|
|
255
|
-
<div class="p-6">
|
|
256
|
-
<p class="mb-3 text-sm font-medium dark:text-white">{{ $t('message.udp.pageStyle') }}</p>
|
|
257
|
-
<el-segmented
|
|
258
|
-
:model-value="overallStyle === 'system' ? 2 : dataTheme ? 1 : 0"
|
|
259
|
-
:options="themeOptions"
|
|
260
|
-
@change="onThemeChange"
|
|
261
|
-
>
|
|
262
|
-
<template #default="{ item }">
|
|
263
|
-
<div class="flex items-center gap-2 p-2">
|
|
264
|
-
<component :is="useRenderIcon(item.icon)" />
|
|
265
|
-
<span class="pl-1">{{ item.label }}</span>
|
|
266
|
-
</div>
|
|
267
|
-
</template>
|
|
268
|
-
</el-segmented>
|
|
269
|
-
|
|
270
|
-
<p class="mt-5 mb-3 text-sm font-medium dark:text-white">{{ $t('message.udp.theme') }}</p>
|
|
271
|
-
<ul class="theme-color">
|
|
272
|
-
<li
|
|
273
|
-
v-for="(item, index) in themeColors"
|
|
274
|
-
v-show="showThemeColors(item.themeColor)"
|
|
275
|
-
:key="index"
|
|
276
|
-
:style="getThemeColorStyle(item.color)"
|
|
277
|
-
@click="setLayoutThemeColor(item.themeColor)"
|
|
278
|
-
>
|
|
279
|
-
<el-icon style="margin: 0.1em 0.1em 0 0" :size="17" :color="getThemeColor(item.themeColor)">
|
|
280
|
-
<IconifyIconOffline icon="ri:check-line" />
|
|
281
|
-
</el-icon>
|
|
282
|
-
</li>
|
|
283
|
-
</ul>
|
|
284
|
-
|
|
285
|
-
<p class="mt-5 mb-3 text-sm font-medium dark:text-white">{{ $t('message.udp.navigationMode') }}</p>
|
|
286
|
-
<ul class="udp-theme">
|
|
287
|
-
<li
|
|
288
|
-
ref="verticalRef"
|
|
289
|
-
v-tippy="{
|
|
290
|
-
content: '左侧菜单',
|
|
291
|
-
zIndex: 41000
|
|
292
|
-
}"
|
|
293
|
-
:class="layoutTheme.layout === 'vertical' ? 'is-select' : ''"
|
|
294
|
-
@click="setLayoutModel('vertical')"
|
|
295
|
-
>
|
|
296
|
-
<div />
|
|
297
|
-
<div />
|
|
298
|
-
</li>
|
|
299
|
-
<li
|
|
300
|
-
v-if="device !== 'mobile'"
|
|
301
|
-
ref="horizontalRef"
|
|
302
|
-
v-tippy="{
|
|
303
|
-
content: '顶部菜单',
|
|
304
|
-
zIndex: 41000
|
|
305
|
-
}"
|
|
306
|
-
:class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''"
|
|
307
|
-
@click="setLayoutModel('horizontal')"
|
|
308
|
-
>
|
|
309
|
-
<div />
|
|
310
|
-
<div />
|
|
311
|
-
</li>
|
|
312
|
-
<li
|
|
313
|
-
v-if="device !== 'mobile'"
|
|
314
|
-
ref="mixRef"
|
|
315
|
-
v-tippy="{
|
|
316
|
-
content: '混合菜单',
|
|
317
|
-
zIndex: 41000
|
|
318
|
-
}"
|
|
319
|
-
:class="layoutTheme.layout === 'mix' ? 'is-select' : ''"
|
|
320
|
-
@click="setLayoutModel('mix')"
|
|
321
|
-
>
|
|
322
|
-
<div />
|
|
323
|
-
<div />
|
|
324
|
-
</li>
|
|
325
|
-
</ul>
|
|
326
|
-
|
|
327
|
-
<p class="mt-5 mb-3 text-base font-medium dark:text-white">{{ $t('message.udp.tagStyle') }}</p>
|
|
328
|
-
<el-segmented :model-value="markValue" :options="markOptions" @change="onChange" />
|
|
329
|
-
|
|
330
|
-
<p class="mt-5 mb-1 text-base font-medium dark:text-white">界面显示</p>
|
|
331
|
-
<ul class="setting">
|
|
332
|
-
<li>
|
|
333
|
-
<span class="dark:text-white">灰色模式</span>
|
|
334
|
-
<el-switch
|
|
335
|
-
v-model="settings.greyVal"
|
|
336
|
-
inline-prompt
|
|
337
|
-
active-text="开"
|
|
338
|
-
inactive-text="关"
|
|
339
|
-
@change="greyChange"
|
|
340
|
-
/>
|
|
341
|
-
</li>
|
|
342
|
-
<li>
|
|
343
|
-
<span class="dark:text-white">色弱模式</span>
|
|
344
|
-
<el-switch
|
|
345
|
-
v-model="settings.weakVal"
|
|
346
|
-
inline-prompt
|
|
347
|
-
active-text="开"
|
|
348
|
-
inactive-text="关"
|
|
349
|
-
@change="weekChange"
|
|
350
|
-
/>
|
|
351
|
-
</li>
|
|
352
|
-
<li>
|
|
353
|
-
<span class="dark:text-white">隐藏标签页</span>
|
|
354
|
-
<el-switch
|
|
355
|
-
v-model="settings.tabsVal"
|
|
356
|
-
inline-prompt
|
|
357
|
-
active-text="开"
|
|
358
|
-
inactive-text="关"
|
|
359
|
-
@change="tagsChange"
|
|
360
|
-
/>
|
|
361
|
-
</li>
|
|
362
|
-
<li>
|
|
363
|
-
<span class="dark:text-white">Logo</span>
|
|
364
|
-
<el-switch
|
|
365
|
-
v-model="logoVal"
|
|
366
|
-
inline-prompt
|
|
367
|
-
:active-value="true"
|
|
368
|
-
:inactive-value="false"
|
|
369
|
-
active-text="开"
|
|
370
|
-
inactive-text="关"
|
|
371
|
-
@change="logoChange"
|
|
372
|
-
/>
|
|
373
|
-
</li>
|
|
374
|
-
<li>
|
|
375
|
-
<span class="dark:text-white">页签持久化</span>
|
|
376
|
-
<el-switch
|
|
377
|
-
v-model="settings.multiTagsCache"
|
|
378
|
-
inline-prompt
|
|
379
|
-
active-text="开"
|
|
380
|
-
inactive-text="关"
|
|
381
|
-
@change="multiTagsCacheChange"
|
|
382
|
-
/>
|
|
383
|
-
</li>
|
|
384
|
-
</ul>
|
|
385
|
-
</div>
|
|
386
|
-
</panel>
|
|
387
|
-
</template>
|
|
388
|
-
|
|
389
|
-
<style lang="scss" scoped>
|
|
390
|
-
::v-deep(.el-divider__text) {
|
|
391
|
-
font-size: 16px;
|
|
392
|
-
font-weight: 700;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
::v-deep(.el-switch__core) {
|
|
396
|
-
--el-switch-off-color: var(--udp-switch-off-color);
|
|
397
|
-
|
|
398
|
-
min-width: 36px;
|
|
399
|
-
height: 18px;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
::v-deep(.el-switch__core .el-switch__action) {
|
|
403
|
-
height: 14px;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
.theme-color {
|
|
407
|
-
height: 20px;
|
|
408
|
-
|
|
409
|
-
li {
|
|
410
|
-
float: left;
|
|
411
|
-
height: 20px;
|
|
412
|
-
margin-right: 8px;
|
|
413
|
-
cursor: pointer;
|
|
414
|
-
border-radius: 4px;
|
|
415
|
-
|
|
416
|
-
&:nth-child(2) {
|
|
417
|
-
border: 1px solid #ddd;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
.udp-theme {
|
|
423
|
-
display: flex;
|
|
424
|
-
gap: 12px;
|
|
425
|
-
|
|
426
|
-
li {
|
|
427
|
-
position: relative;
|
|
428
|
-
width: 46px;
|
|
429
|
-
height: 36px;
|
|
430
|
-
overflow: hidden;
|
|
431
|
-
cursor: pointer;
|
|
432
|
-
background: #f0f2f5;
|
|
433
|
-
border-radius: 4px;
|
|
434
|
-
box-shadow: 0 1px 2.5px 0 rgb(0 0 0 / 18%);
|
|
435
|
-
|
|
436
|
-
&:nth-child(1) {
|
|
437
|
-
div {
|
|
438
|
-
&:nth-child(1) {
|
|
439
|
-
width: 30%;
|
|
440
|
-
height: 100%;
|
|
441
|
-
background: #1b2a47;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
&:nth-child(2) {
|
|
445
|
-
position: absolute;
|
|
446
|
-
top: 0;
|
|
447
|
-
right: 0;
|
|
448
|
-
width: 70%;
|
|
449
|
-
height: 30%;
|
|
450
|
-
background: #fff;
|
|
451
|
-
box-shadow: 0 0 1px #888;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
&:nth-child(2) {
|
|
457
|
-
div {
|
|
458
|
-
&:nth-child(1) {
|
|
459
|
-
width: 100%;
|
|
460
|
-
height: 30%;
|
|
461
|
-
background: #1b2a47;
|
|
462
|
-
box-shadow: 0 0 1px #888;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
&:nth-child(3) {
|
|
468
|
-
div {
|
|
469
|
-
&:nth-child(1) {
|
|
470
|
-
width: 100%;
|
|
471
|
-
height: 30%;
|
|
472
|
-
background: #1b2a47;
|
|
473
|
-
box-shadow: 0 0 1px #888;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
&:nth-child(2) {
|
|
477
|
-
position: absolute;
|
|
478
|
-
bottom: 0;
|
|
479
|
-
left: 0;
|
|
480
|
-
width: 30%;
|
|
481
|
-
height: 70%;
|
|
482
|
-
background: #fff;
|
|
483
|
-
box-shadow: 0 0 1px #888;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
.is-select {
|
|
491
|
-
border: 2px solid var(--el-color-primary);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
.setting {
|
|
495
|
-
li {
|
|
496
|
-
display: flex;
|
|
497
|
-
align-items: center;
|
|
498
|
-
justify-content: space-between;
|
|
499
|
-
padding: 4px 0;
|
|
500
|
-
font-size: 14px;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { reactive, ref, unref, watch, computed, nextTick, onUnmounted, onBeforeMount } from 'vue';
|
|
3
|
+
import { templateRef } from '@vueuse/core';
|
|
4
|
+
import { useI18n } from 'vue-i18n';
|
|
5
|
+
import { useDark, useGlobal, useDebounce } from '@utogether/utils';
|
|
6
|
+
import panel from '../lay-panel/index.vue';
|
|
7
|
+
import { emitter } from '../../../utils/mitt';
|
|
8
|
+
import { useAppStoreHook } from '../../../store/modules/app';
|
|
9
|
+
import { useMultiTagsStoreHook } from '../../../store/modules/multiTags';
|
|
10
|
+
import { useDataThemeChange } from '../../hooks/useDataThemeChange';
|
|
11
|
+
import { useNav } from '../../hooks/useNav';
|
|
12
|
+
import { useRenderIcon } from '../../../components/ReIcon/src/hooks';
|
|
13
|
+
import dayIcon from '../../../assets/svg/day.svg?component';
|
|
14
|
+
import darkIcon from '../../../assets/svg/dark.svg?component';
|
|
15
|
+
import systemIcon from '../../../assets/svg/system.svg?component';
|
|
16
|
+
|
|
17
|
+
interface IThemeOption {
|
|
18
|
+
label: string;
|
|
19
|
+
icon: any;
|
|
20
|
+
theme: string;
|
|
21
|
+
value: number;
|
|
22
|
+
iconAttrs: { fill: string };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { device } = useNav();
|
|
26
|
+
const { t } = useI18n();
|
|
27
|
+
const { isDark } = useDark();
|
|
28
|
+
const { $storage } = useGlobal();
|
|
29
|
+
|
|
30
|
+
const mixRef = templateRef<HTMLElement | null>('mixRef', null);
|
|
31
|
+
const verticalRef = templateRef<HTMLElement | null>('verticalRef', null);
|
|
32
|
+
const horizontalRef = templateRef<HTMLElement | null>('horizontalRef', null);
|
|
33
|
+
|
|
34
|
+
const { dataTheme, overallStyle, layoutTheme, themeColors, toggleClass, dataThemeChange, setLayoutThemeColor } =
|
|
35
|
+
useDataThemeChange();
|
|
36
|
+
|
|
37
|
+
/* body添加layout属性,作用于src/style/sidebar.scss */
|
|
38
|
+
if (unref(layoutTheme)) {
|
|
39
|
+
const layout = unref(layoutTheme).layout;
|
|
40
|
+
const theme = unref(layoutTheme).theme;
|
|
41
|
+
document.documentElement.setAttribute('data-theme', theme);
|
|
42
|
+
setLayoutModel(layout);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 默认灵动模式 */
|
|
46
|
+
const markValue = ref($storage.configure?.showModel ?? 'smart');
|
|
47
|
+
|
|
48
|
+
const logoVal = ref($storage.configure?.showLogo ?? true);
|
|
49
|
+
|
|
50
|
+
const settings = reactive({
|
|
51
|
+
greyVal: $storage.configure.grey,
|
|
52
|
+
weakVal: $storage.configure.weak,
|
|
53
|
+
tabsVal: $storage.configure.hideTabs,
|
|
54
|
+
showLogo: $storage.configure.showLogo,
|
|
55
|
+
showModel: $storage.configure.showModel,
|
|
56
|
+
multiTagsCache: $storage.configure.multiTagsCache
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const getThemeColorStyle = computed(() => {
|
|
60
|
+
return color => {
|
|
61
|
+
return { background: color };
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/** 当网页整体为暗色风格时不显示亮白色主题配色切换选项 */
|
|
66
|
+
const showThemeColors = computed(() => {
|
|
67
|
+
return themeColor => {
|
|
68
|
+
return themeColor === 'light' && isDark.value ? false : true;
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
function storageConfigureChange<T>(key: string, val: T): void {
|
|
73
|
+
const storageConfigure = $storage.configure;
|
|
74
|
+
storageConfigure[key] = val;
|
|
75
|
+
$storage.configure = storageConfigure;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 灰色模式设置 */
|
|
79
|
+
const greyChange = (value): void => {
|
|
80
|
+
const htmlEl = document.querySelector('html');
|
|
81
|
+
toggleClass(settings.greyVal, 'html-grey', htmlEl);
|
|
82
|
+
storageConfigureChange('grey', value);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/** 色弱模式设置 */
|
|
86
|
+
const weekChange = (value): void => {
|
|
87
|
+
const htmlEl = document.querySelector('html');
|
|
88
|
+
toggleClass(settings.weakVal, 'html-weakness', htmlEl);
|
|
89
|
+
storageConfigureChange('weak', value);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/** 隐藏标签页设置 */
|
|
93
|
+
const tagsChange = () => {
|
|
94
|
+
const showVal = settings.tabsVal;
|
|
95
|
+
storageConfigureChange('hideTabs', showVal);
|
|
96
|
+
emitter.emit('tagViewsChange', showVal as unknown as string);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** 标签页持久化设置 */
|
|
100
|
+
const multiTagsCacheChange = () => {
|
|
101
|
+
const multiTagsCache = settings.multiTagsCache;
|
|
102
|
+
storageConfigureChange('multiTagsCache', multiTagsCache);
|
|
103
|
+
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
function onChange(value) {
|
|
107
|
+
markValue.value = value;
|
|
108
|
+
storageConfigureChange('showModel', value);
|
|
109
|
+
emitter.emit('tagViewsShowModel', value);
|
|
110
|
+
}
|
|
111
|
+
/** 主题切换 */
|
|
112
|
+
function onThemeChange(theme) {
|
|
113
|
+
// dataTheme.value = !dataTheme.value;
|
|
114
|
+
// dataThemeChange();
|
|
115
|
+
theme === 1 && theme !== 2 ? (dataTheme.value = true) : (dataTheme.value = false);
|
|
116
|
+
overallStyle.value = themeOptions.value[theme].theme;
|
|
117
|
+
dataThemeChange(overallStyle.value);
|
|
118
|
+
theme === 2 && watchSystemThemeChange();
|
|
119
|
+
}
|
|
120
|
+
/** 侧边栏Logo */
|
|
121
|
+
function logoChange() {
|
|
122
|
+
unref(logoVal) ? storageConfigureChange('showLogo', true) : storageConfigureChange('showLogo', false);
|
|
123
|
+
emitter.emit('logoChange', unref(logoVal));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function setFalse(Doms): any {
|
|
127
|
+
Doms.forEach(v => {
|
|
128
|
+
toggleClass(false, 'is-select', unref(v));
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** 主题色 激活选择项 */
|
|
133
|
+
const getThemeColor = computed(() => {
|
|
134
|
+
return current => {
|
|
135
|
+
if (current === layoutTheme.value.theme && layoutTheme.value.theme !== 'light') {
|
|
136
|
+
return '#fff';
|
|
137
|
+
} else if (current === layoutTheme.value.theme && layoutTheme.value.theme === 'light') {
|
|
138
|
+
return '#1d2b45';
|
|
139
|
+
} else {
|
|
140
|
+
return 'transparent';
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const themeOptions = computed<IThemeOption[]>(() => {
|
|
146
|
+
return [
|
|
147
|
+
{
|
|
148
|
+
label: t('message.udp.light'),
|
|
149
|
+
icon: dayIcon,
|
|
150
|
+
theme: 'light',
|
|
151
|
+
value: 0,
|
|
152
|
+
iconAttrs: { fill: isDark.value ? '#fff' : '#000' }
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: t('message.udp.dark'),
|
|
156
|
+
icon: darkIcon,
|
|
157
|
+
theme: 'dark',
|
|
158
|
+
value: 1,
|
|
159
|
+
iconAttrs: { fill: isDark.value ? '#fff' : '#000' }
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
label: '自动',
|
|
163
|
+
icon: systemIcon,
|
|
164
|
+
theme: 'system',
|
|
165
|
+
value: 2,
|
|
166
|
+
iconAttrs: { fill: isDark.value ? '#fff' : '#000' }
|
|
167
|
+
}
|
|
168
|
+
];
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const markOptions = [
|
|
172
|
+
{ label: t('message.udp.smart'), value: 'smart' },
|
|
173
|
+
{ label: t('message.udp.card'), value: 'card' },
|
|
174
|
+
{ label: '丝滑', value: 'chrome' }
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
/** 设置菜单布局 */
|
|
178
|
+
function setLayoutModel(layout: string) {
|
|
179
|
+
layoutTheme.value.layout = layout;
|
|
180
|
+
window.document.body.setAttribute('layout', layout);
|
|
181
|
+
window.document.body.setAttribute('layoutType', window.top === window.self ? 'normal' : 'iframe');
|
|
182
|
+
$storage.layout = {
|
|
183
|
+
layout,
|
|
184
|
+
theme: layoutTheme.value.theme,
|
|
185
|
+
darkMode: $storage.layout?.darkMode,
|
|
186
|
+
sidebarStatus: $storage.layout?.sidebarStatus,
|
|
187
|
+
epThemeColor: $storage.layout?.epThemeColor,
|
|
188
|
+
themeColor: layoutTheme.value.theme,
|
|
189
|
+
overallStyle: $storage.layout?.overallStyle
|
|
190
|
+
};
|
|
191
|
+
useAppStoreHook().setLayout(layout);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
watch($storage, ({ layout }) => {
|
|
195
|
+
switch (layout['layout']) {
|
|
196
|
+
case 'vertical':
|
|
197
|
+
toggleClass(true, 'is-select', unref(verticalRef));
|
|
198
|
+
useDebounce(setFalse([horizontalRef]), 50);
|
|
199
|
+
useDebounce(setFalse([mixRef]), 50);
|
|
200
|
+
break;
|
|
201
|
+
case 'horizontal':
|
|
202
|
+
toggleClass(true, 'is-select', unref(horizontalRef));
|
|
203
|
+
useDebounce(setFalse([verticalRef]), 50);
|
|
204
|
+
useDebounce(setFalse([mixRef]), 50);
|
|
205
|
+
break;
|
|
206
|
+
case 'mix':
|
|
207
|
+
toggleClass(true, 'is-select', unref(mixRef));
|
|
208
|
+
useDebounce(setFalse([verticalRef]), 50);
|
|
209
|
+
useDebounce(setFalse([horizontalRef]), 50);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
const mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');
|
|
215
|
+
|
|
216
|
+
/** 根据操作系统主题设置平台主题模式 */
|
|
217
|
+
function updateTheme() {
|
|
218
|
+
if (overallStyle.value !== 'system') return;
|
|
219
|
+
if (mediaQueryList.matches) {
|
|
220
|
+
dataTheme.value = true;
|
|
221
|
+
} else {
|
|
222
|
+
dataTheme.value = false;
|
|
223
|
+
}
|
|
224
|
+
dataThemeChange(overallStyle.value);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function removeMatchMedia() {
|
|
228
|
+
mediaQueryList.removeEventListener('change', updateTheme);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** 监听操作系统主题改变 */
|
|
232
|
+
function watchSystemThemeChange() {
|
|
233
|
+
updateTheme();
|
|
234
|
+
removeMatchMedia();
|
|
235
|
+
mediaQueryList.addEventListener('change', updateTheme);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
onBeforeMount(() => {
|
|
239
|
+
/* 初始化项目配置 */
|
|
240
|
+
nextTick(() => {
|
|
241
|
+
watchSystemThemeChange();
|
|
242
|
+
settings.greyVal && document.querySelector('html')?.classList.add('html-grey');
|
|
243
|
+
settings.weakVal && document.querySelector('html')?.classList.add('html-weakness');
|
|
244
|
+
settings.tabsVal && tagsChange();
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
onUnmounted(() => removeMatchMedia);
|
|
249
|
+
</script>
|
|
250
|
+
<script lang="ts">
|
|
251
|
+
export default { name: 'SettingPanel' };
|
|
252
|
+
</script>
|
|
253
|
+
<template>
|
|
254
|
+
<panel>
|
|
255
|
+
<div class="p-6">
|
|
256
|
+
<p class="mb-3 text-sm font-medium dark:text-white">{{ $t('message.udp.pageStyle') }}</p>
|
|
257
|
+
<el-segmented
|
|
258
|
+
:model-value="overallStyle === 'system' ? 2 : dataTheme ? 1 : 0"
|
|
259
|
+
:options="themeOptions"
|
|
260
|
+
@change="onThemeChange"
|
|
261
|
+
>
|
|
262
|
+
<template #default="{ item }">
|
|
263
|
+
<div class="flex items-center gap-2 p-2">
|
|
264
|
+
<component :is="useRenderIcon(item.icon)" />
|
|
265
|
+
<span class="pl-1">{{ item.label }}</span>
|
|
266
|
+
</div>
|
|
267
|
+
</template>
|
|
268
|
+
</el-segmented>
|
|
269
|
+
|
|
270
|
+
<p class="mt-5 mb-3 text-sm font-medium dark:text-white">{{ $t('message.udp.theme') }}</p>
|
|
271
|
+
<ul class="theme-color">
|
|
272
|
+
<li
|
|
273
|
+
v-for="(item, index) in themeColors"
|
|
274
|
+
v-show="showThemeColors(item.themeColor)"
|
|
275
|
+
:key="index"
|
|
276
|
+
:style="getThemeColorStyle(item.color)"
|
|
277
|
+
@click="setLayoutThemeColor(item.themeColor)"
|
|
278
|
+
>
|
|
279
|
+
<el-icon style="margin: 0.1em 0.1em 0 0" :size="17" :color="getThemeColor(item.themeColor)">
|
|
280
|
+
<IconifyIconOffline icon="ri:check-line" />
|
|
281
|
+
</el-icon>
|
|
282
|
+
</li>
|
|
283
|
+
</ul>
|
|
284
|
+
|
|
285
|
+
<p class="mt-5 mb-3 text-sm font-medium dark:text-white">{{ $t('message.udp.navigationMode') }}</p>
|
|
286
|
+
<ul class="udp-theme">
|
|
287
|
+
<li
|
|
288
|
+
ref="verticalRef"
|
|
289
|
+
v-tippy="{
|
|
290
|
+
content: '左侧菜单',
|
|
291
|
+
zIndex: 41000
|
|
292
|
+
}"
|
|
293
|
+
:class="layoutTheme.layout === 'vertical' ? 'is-select' : ''"
|
|
294
|
+
@click="setLayoutModel('vertical')"
|
|
295
|
+
>
|
|
296
|
+
<div />
|
|
297
|
+
<div />
|
|
298
|
+
</li>
|
|
299
|
+
<li
|
|
300
|
+
v-if="device !== 'mobile'"
|
|
301
|
+
ref="horizontalRef"
|
|
302
|
+
v-tippy="{
|
|
303
|
+
content: '顶部菜单',
|
|
304
|
+
zIndex: 41000
|
|
305
|
+
}"
|
|
306
|
+
:class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''"
|
|
307
|
+
@click="setLayoutModel('horizontal')"
|
|
308
|
+
>
|
|
309
|
+
<div />
|
|
310
|
+
<div />
|
|
311
|
+
</li>
|
|
312
|
+
<li
|
|
313
|
+
v-if="device !== 'mobile'"
|
|
314
|
+
ref="mixRef"
|
|
315
|
+
v-tippy="{
|
|
316
|
+
content: '混合菜单',
|
|
317
|
+
zIndex: 41000
|
|
318
|
+
}"
|
|
319
|
+
:class="layoutTheme.layout === 'mix' ? 'is-select' : ''"
|
|
320
|
+
@click="setLayoutModel('mix')"
|
|
321
|
+
>
|
|
322
|
+
<div />
|
|
323
|
+
<div />
|
|
324
|
+
</li>
|
|
325
|
+
</ul>
|
|
326
|
+
|
|
327
|
+
<p class="mt-5 mb-3 text-base font-medium dark:text-white">{{ $t('message.udp.tagStyle') }}</p>
|
|
328
|
+
<el-segmented :model-value="markValue" :options="markOptions" @change="onChange" />
|
|
329
|
+
|
|
330
|
+
<p class="mt-5 mb-1 text-base font-medium dark:text-white">界面显示</p>
|
|
331
|
+
<ul class="setting">
|
|
332
|
+
<li>
|
|
333
|
+
<span class="dark:text-white">灰色模式</span>
|
|
334
|
+
<el-switch
|
|
335
|
+
v-model="settings.greyVal"
|
|
336
|
+
inline-prompt
|
|
337
|
+
active-text="开"
|
|
338
|
+
inactive-text="关"
|
|
339
|
+
@change="greyChange"
|
|
340
|
+
/>
|
|
341
|
+
</li>
|
|
342
|
+
<li>
|
|
343
|
+
<span class="dark:text-white">色弱模式</span>
|
|
344
|
+
<el-switch
|
|
345
|
+
v-model="settings.weakVal"
|
|
346
|
+
inline-prompt
|
|
347
|
+
active-text="开"
|
|
348
|
+
inactive-text="关"
|
|
349
|
+
@change="weekChange"
|
|
350
|
+
/>
|
|
351
|
+
</li>
|
|
352
|
+
<li>
|
|
353
|
+
<span class="dark:text-white">隐藏标签页</span>
|
|
354
|
+
<el-switch
|
|
355
|
+
v-model="settings.tabsVal"
|
|
356
|
+
inline-prompt
|
|
357
|
+
active-text="开"
|
|
358
|
+
inactive-text="关"
|
|
359
|
+
@change="tagsChange"
|
|
360
|
+
/>
|
|
361
|
+
</li>
|
|
362
|
+
<li>
|
|
363
|
+
<span class="dark:text-white">Logo</span>
|
|
364
|
+
<el-switch
|
|
365
|
+
v-model="logoVal"
|
|
366
|
+
inline-prompt
|
|
367
|
+
:active-value="true"
|
|
368
|
+
:inactive-value="false"
|
|
369
|
+
active-text="开"
|
|
370
|
+
inactive-text="关"
|
|
371
|
+
@change="logoChange"
|
|
372
|
+
/>
|
|
373
|
+
</li>
|
|
374
|
+
<li>
|
|
375
|
+
<span class="dark:text-white">页签持久化</span>
|
|
376
|
+
<el-switch
|
|
377
|
+
v-model="settings.multiTagsCache"
|
|
378
|
+
inline-prompt
|
|
379
|
+
active-text="开"
|
|
380
|
+
inactive-text="关"
|
|
381
|
+
@change="multiTagsCacheChange"
|
|
382
|
+
/>
|
|
383
|
+
</li>
|
|
384
|
+
</ul>
|
|
385
|
+
</div>
|
|
386
|
+
</panel>
|
|
387
|
+
</template>
|
|
388
|
+
|
|
389
|
+
<style lang="scss" scoped>
|
|
390
|
+
::v-deep(.el-divider__text) {
|
|
391
|
+
font-size: 16px;
|
|
392
|
+
font-weight: 700;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
::v-deep(.el-switch__core) {
|
|
396
|
+
--el-switch-off-color: var(--udp-switch-off-color);
|
|
397
|
+
|
|
398
|
+
min-width: 36px;
|
|
399
|
+
height: 18px;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
::v-deep(.el-switch__core .el-switch__action) {
|
|
403
|
+
height: 14px;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.theme-color {
|
|
407
|
+
height: 20px;
|
|
408
|
+
|
|
409
|
+
li {
|
|
410
|
+
float: left;
|
|
411
|
+
height: 20px;
|
|
412
|
+
margin-right: 8px;
|
|
413
|
+
cursor: pointer;
|
|
414
|
+
border-radius: 4px;
|
|
415
|
+
|
|
416
|
+
&:nth-child(2) {
|
|
417
|
+
border: 1px solid #ddd;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.udp-theme {
|
|
423
|
+
display: flex;
|
|
424
|
+
gap: 12px;
|
|
425
|
+
|
|
426
|
+
li {
|
|
427
|
+
position: relative;
|
|
428
|
+
width: 46px;
|
|
429
|
+
height: 36px;
|
|
430
|
+
overflow: hidden;
|
|
431
|
+
cursor: pointer;
|
|
432
|
+
background: #f0f2f5;
|
|
433
|
+
border-radius: 4px;
|
|
434
|
+
box-shadow: 0 1px 2.5px 0 rgb(0 0 0 / 18%);
|
|
435
|
+
|
|
436
|
+
&:nth-child(1) {
|
|
437
|
+
div {
|
|
438
|
+
&:nth-child(1) {
|
|
439
|
+
width: 30%;
|
|
440
|
+
height: 100%;
|
|
441
|
+
background: #1b2a47;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
&:nth-child(2) {
|
|
445
|
+
position: absolute;
|
|
446
|
+
top: 0;
|
|
447
|
+
right: 0;
|
|
448
|
+
width: 70%;
|
|
449
|
+
height: 30%;
|
|
450
|
+
background: #fff;
|
|
451
|
+
box-shadow: 0 0 1px #888;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
&:nth-child(2) {
|
|
457
|
+
div {
|
|
458
|
+
&:nth-child(1) {
|
|
459
|
+
width: 100%;
|
|
460
|
+
height: 30%;
|
|
461
|
+
background: #1b2a47;
|
|
462
|
+
box-shadow: 0 0 1px #888;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
&:nth-child(3) {
|
|
468
|
+
div {
|
|
469
|
+
&:nth-child(1) {
|
|
470
|
+
width: 100%;
|
|
471
|
+
height: 30%;
|
|
472
|
+
background: #1b2a47;
|
|
473
|
+
box-shadow: 0 0 1px #888;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
&:nth-child(2) {
|
|
477
|
+
position: absolute;
|
|
478
|
+
bottom: 0;
|
|
479
|
+
left: 0;
|
|
480
|
+
width: 30%;
|
|
481
|
+
height: 70%;
|
|
482
|
+
background: #fff;
|
|
483
|
+
box-shadow: 0 0 1px #888;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.is-select {
|
|
491
|
+
border: 2px solid var(--el-color-primary);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.setting {
|
|
495
|
+
li {
|
|
496
|
+
display: flex;
|
|
497
|
+
align-items: center;
|
|
498
|
+
justify-content: space-between;
|
|
499
|
+
padding: 4px 0;
|
|
500
|
+
font-size: 14px;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
</style>
|