@opendesign-plus/components 0.0.1-rc.16
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/chunk-OElCookieNotice.cjs.js +1 -0
- package/dist/chunk-OElCookieNotice.es.js +281 -0
- package/dist/components/OBanner.vue.d.ts +2 -0
- package/dist/components/OCookieNotice.vue.d.ts +16 -0
- package/dist/components/OFooter.vue.d.ts +25 -0
- package/dist/components/OHeader.vue.d.ts +23 -0
- package/dist/components/OHeaderMoblie.vue.d.ts +33 -0
- package/dist/components/OHeaderSearch.vue.d.ts +692 -0
- package/dist/components/OHeaderUser.vue.d.ts +40 -0
- package/dist/components/OPlusConfigProvider.vue.d.ts +23 -0
- package/dist/components/OSection.vue.d.ts +37 -0
- package/dist/components/OSourceCode.vue.d.ts +20 -0
- package/dist/components/OThemeSwitcher.vue.d.ts +28 -0
- package/dist/components/element-plus/OElCookieNotice.vue.d.ts +31 -0
- package/dist/components/element-plus/index.d.ts +2 -0
- package/dist/components/events/OEventsApply.vue.d.ts +16 -0
- package/dist/components/events/OEventsCalendar.vue.d.ts +5 -0
- package/dist/components/events/OEventsList.vue.d.ts +26 -0
- package/dist/components/events/config.d.ts +26 -0
- package/dist/components/events/index.d.ts +78 -0
- package/dist/components/events/types.d.ts +66 -0
- package/dist/components/events/utils.d.ts +7 -0
- package/dist/components.cjs.js +3 -0
- package/dist/components.css +1 -0
- package/dist/components.element.cjs.js +1 -0
- package/dist/components.element.es.js +4 -0
- package/dist/components.es.js +3509 -0
- package/dist/index.d.ts +18 -0
- package/docs/design.md +27 -0
- package/docs/design_banner.md +41 -0
- package/docs/design_section.md +27 -0
- package/npmcachae/_cacache/content-v2/sha512/bd/56/25079ffb18446953f88fc063c3d6eaf7191772851b8477c118f113b920a7f357b67b9006181af58c9f68b0059b899ad0f2c86fe0a6490958d138cb063afd +1 -0
- package/npmcachae/_cacache/index-v5/d8/49/af4c6bb8f580edbd7b6e18db381844403e5f689a9849c5ffcdd2dd95d735 +3 -0
- package/npmcachae/_logs/2026-03-17T09_38_12_009Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_14_370Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_16_516Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_18_616Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_20_859Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_23_182Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_25_452Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_27_865Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_30_082Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_32_219Z-debug-0.log +157 -0
- package/npmcachae/_logs/2026-03-17T09_38_34_308Z-debug-0.log +157 -0
- package/npmcachae/_update-notifier-last-checked +0 -0
- package/package.json +53 -0
- package/scripts/generate-components-index.js +100 -0
- package/src/assets/events/city/default-cover.png +0 -0
- package/src/assets/events/city//344/270/212/346/265/267.png +0 -0
- package/src/assets/events/city//345/214/227/344/272/254.png +0 -0
- package/src/assets/events/city//345/215/227/344/272/254.png +0 -0
- package/src/assets/events/city//345/244/251/346/264/245.png +0 -0
- package/src/assets/events/city//345/271/277/345/267/236.png +0 -0
- package/src/assets/events/city//346/210/220/351/203/275.png +0 -0
- package/src/assets/events/city//346/227/240/351/224/241.png +0 -0
- package/src/assets/events/city//346/235/255/345/267/236.png +0 -0
- package/src/assets/events/city//346/255/246/346/261/211.png +0 -0
- package/src/assets/events/city//346/267/261/345/234/2631.png +0 -0
- package/src/assets/events/city//346/267/261/345/234/2632.png +0 -0
- package/src/assets/events/city//350/213/217/345/267/236.png +0 -0
- package/src/assets/events/city//350/245/277/345/256/211.png +0 -0
- package/src/assets/events/city//351/203/221/345/267/236.png +0 -0
- package/src/assets/events/svg-icons/icon-checked.svg +3 -0
- package/src/assets/events/svg-icons/icon-competition.svg +7 -0
- package/src/assets/events/svg-icons/icon-events.svg +4 -0
- package/src/assets/events/svg-icons/icon-release.svg +4 -0
- package/src/assets/events/svg-icons/icon-summit.svg +4 -0
- package/src/assets/svg-icons/icon-arrow-left.svg +3 -0
- package/src/assets/svg-icons/icon-avatar-line.svg +3 -0
- package/src/assets/svg-icons/icon-caret-left.svg +3 -0
- package/src/assets/svg-icons/icon-caret-right.svg +3 -0
- package/src/assets/svg-icons/icon-chevron-down.svg +3 -0
- package/src/assets/svg-icons/icon-chevron-right.svg +3 -0
- package/src/assets/svg-icons/icon-close.svg +3 -0
- package/src/assets/svg-icons/icon-delete.svg +3 -0
- package/src/assets/svg-icons/icon-header-back.svg +3 -0
- package/src/assets/svg-icons/icon-header-delete.svg +3 -0
- package/src/assets/svg-icons/icon-header-menu.svg +3 -0
- package/src/assets/svg-icons/icon-header-person.svg +3 -0
- package/src/assets/svg-icons/icon-header-search.svg +4 -0
- package/src/assets/svg-icons/icon-locale.svg +3 -0
- package/src/assets/svg-icons/icon-log-off.svg +3 -0
- package/src/assets/svg-icons/icon-message.svg +3 -0
- package/src/assets/svg-icons/icon-moon.svg +3 -0
- package/src/assets/svg-icons/icon-outlink.svg +3 -0
- package/src/assets/svg-icons/icon-overview.svg +3 -0
- package/src/assets/svg-icons/icon-setting.svg +3 -0
- package/src/assets/svg-icons/icon-sun.svg +3 -0
- package/src/components/OBanner.vue +390 -0
- package/src/components/OCookieNotice.vue +423 -0
- package/src/components/OFooter.vue +566 -0
- package/src/components/OHeader.vue +97 -0
- package/src/components/OHeaderMoblie.vue +149 -0
- package/src/components/OHeaderSearch.vue +601 -0
- package/src/components/OHeaderUser.vue +304 -0
- package/src/components/OPlusConfigProvider.vue +32 -0
- package/src/components/OSection.vue +178 -0
- package/src/components/OSourceCode.vue +153 -0
- package/src/components/OThemeSwitcher.vue +108 -0
- package/src/components/common/AppAvatar.vue +83 -0
- package/src/components/common/ClientOnlyWrapper.ts +21 -0
- package/src/components/common/ContentWrapper.vue +85 -0
- package/src/components/common/HeaderEulerNav.vue +1118 -0
- package/src/components/common/HeaderNavMoblie.vue +344 -0
- package/src/components/common/HeaderUbmcNav.vue +597 -0
- package/src/components/element-plus/OElCookieNotice.vue +412 -0
- package/src/components/element-plus/index.ts +3 -0
- package/src/components/events/OEventsApply.vue +487 -0
- package/src/components/events/OEventsCalendar.vue +611 -0
- package/src/components/events/OEventsList.vue +402 -0
- package/src/components/events/config.ts +47 -0
- package/src/components/events/index.ts +23 -0
- package/src/components/events/npmcachae/_cacache/content-v2/sha512/2c/4f/a4140bfbf374a43f7dfe71880c051f79149cd259fb1a154fb692802c7489ef2317b737e7e690a627714ba19317971f29051b3798c246297b425a626a5b7a +1 -0
- package/src/components/events/npmcachae/_cacache/index-v5/8e/86/70dc69f1b1592fe14da10d2516ddfaa609af0cd9054a6ebde664acc6ab12 +2 -0
- package/src/components/events/npmcachae/_logs/2026-03-25T09_58_33_134Z-debug-0.log +105 -0
- package/src/components/events/npmcachae/_update-notifier-last-checked +0 -0
- package/src/components/events/types.ts +80 -0
- package/src/components/events/utils.ts +9 -0
- package/src/components/meeting/npmcachae/_cacache/content-v2/sha512/3e/17/1865217b9acb9f4921c53a09b5c76587cd2ab748beb2699ff6cfb1341d73b1aa56ed91ffc5ab2c9c9b3fbe626103b35d9a79ff29ff6b8cbb8d89755fe1a2 +1 -0
- package/src/components/meeting/npmcachae/_cacache/content-v2/sha512/a6/15/47bb7552ec9248079e839a5feecc1742d4de19524fdf041cf581701cf4760a5025106036145e279ba193b07c8fa5b07ae3d75f1b6032f0cb2219115b6167 +1 -0
- package/src/components/meeting/npmcachae/_cacache/content-v2/sha512/d1/4c/133b32e09c97101a27a07cc4432f94e470cff02d120d21babcea77c3f5cd436793516dc1a8e282ee1a568f923c148b1a48f4a43233462a530d35e8b41c67 +1 -0
- package/src/components/meeting/npmcachae/_cacache/index-v5/54/0d/a4909047714a0a7198bb9bd37020992464e47c79a791889919b84d90aab0 +3 -0
- package/src/components/meeting/npmcachae/_cacache/index-v5/8e/2b/21a79778e2ac08cf5663baf83cb35f951995a496007eb2e2f7fba54021a4 +3 -0
- package/src/components/meeting/npmcachae/_cacache/index-v5/eb/a0/b70c8132e5b57a0f1e129b8cc941796420a9c147c0baa680710083740898 +2 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_03_54_955Z-debug-0.log +277 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_03_57_842Z-debug-0.log +277 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_04_00_016Z-debug-0.log +277 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_04_02_191Z-debug-0.log +277 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_04_04_425Z-debug-0.log +277 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_04_06_642Z-debug-0.log +277 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_04_08_826Z-debug-0.log +277 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_25_36_140Z-debug-0.log +433 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_25_39_573Z-debug-0.log +433 -0
- package/src/components/meeting/npmcachae/_logs/2026-03-20T07_25_42_134Z-debug-0.log +212 -0
- package/src/components/meeting/npmcachae/_update-notifier-last-checked +0 -0
- package/src/draft/Banner.vue +265 -0
- package/src/draft/ButtonCards.vue +106 -0
- package/src/draft/Feature.vue +134 -0
- package/src/draft/Footer.vue +512 -0
- package/src/draft/HorizontalAnchor.vue +165 -0
- package/src/draft/ItemSwiper.vue +133 -0
- package/src/draft/Logo.vue +141 -0
- package/src/draft/LogoCard.vue +75 -0
- package/src/draft/LogoV2.vue +19 -0
- package/src/draft/MainCard.vue +38 -0
- package/src/draft/MultiCard.vue +95 -0
- package/src/draft/MultiIconCard.vue +74 -0
- package/src/draft/OInfoCard.vue +176 -0
- package/src/draft/Process.vue +81 -0
- package/src/draft/Section.vue +167 -0
- package/src/draft/SingleTabCard.vue +85 -0
- package/src/draft/SliderCard.vue +110 -0
- package/src/env.d.ts +1 -0
- package/src/i18n/en.ts +20 -0
- package/src/i18n/index.ts +42 -0
- package/src/i18n/zh.ts +14 -0
- package/src/index.ts +46 -0
- package/src/npmcachae/_cacache/content-v2/sha512/bd/56/25079ffb18446953f88fc063c3d6eaf7191772851b8477c118f113b920a7f357b67b9006181af58c9f68b0059b899ad0f2c86fe0a6490958d138cb063afd +1 -0
- package/src/npmcachae/_cacache/index-v5/d8/49/af4c6bb8f580edbd7b6e18db381844403e5f689a9849c5ffcdd2dd95d735 +3 -0
- package/src/npmcachae/_logs/2026-03-17T10_53_33_398Z-debug-0.log +156 -0
- package/src/npmcachae/_logs/2026-03-17T10_53_35_464Z-debug-0.log +156 -0
- package/src/npmcachae/_logs/2026-03-17T10_53_37_852Z-debug-0.log +156 -0
- package/src/npmcachae/_update-notifier-last-checked +0 -0
- package/src/shared/provide.ts +6 -0
- package/src/shims-vue-dompurify-html.d.ts +17 -0
- package/src/vue.d.ts +10 -0
- package/tsconfig.json +33 -0
- package/vite.config.ts +102 -0
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, onMounted, watch, computed, nextTick, onUnmounted } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { OIcon, OIconChevronRight, OTag } from '@opensig/opendesign';
|
|
5
|
+
|
|
6
|
+
import { ElCascaderPanel } from 'element-plus';
|
|
7
|
+
|
|
8
|
+
import { useLocale, useScreen } from '@opendesign-plus/composables';
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
navData: undefined,
|
|
12
|
+
hasPerm: undefined,
|
|
13
|
+
tagMap: undefined,
|
|
14
|
+
currentPath: undefined,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const { locale } = useLocale();
|
|
18
|
+
const { lePadV } = useScreen();
|
|
19
|
+
const route = {};
|
|
20
|
+
|
|
21
|
+
const MORE_ID = 'more';
|
|
22
|
+
// -------------------- hover事件 --------------------
|
|
23
|
+
const cascaderRef = ref({});
|
|
24
|
+
const activeIndex = ref(-1);
|
|
25
|
+
const onMouseEnter = (idx: number) => {
|
|
26
|
+
activeIndex.value = idx;
|
|
27
|
+
};
|
|
28
|
+
const onMouseLeave = (idx) => {
|
|
29
|
+
activeIndex.value = -1;
|
|
30
|
+
cascaderRef.value[idx]?.clearCheckedNodes();
|
|
31
|
+
};
|
|
32
|
+
// -------------------- 选中事件 --------------------
|
|
33
|
+
const selectedIndex = ref(-1);
|
|
34
|
+
|
|
35
|
+
const getSelectedIndex = () => {
|
|
36
|
+
const path = route?.fullPath?.split('/').slice(0, 3).join('/');
|
|
37
|
+
selectedIndex.value = [...navs.value, moreItem.value].findIndex((nav) => {
|
|
38
|
+
const sharpIdx = path?.indexOf('#');
|
|
39
|
+
if (visibleIds.value.length && !visibleIds.value.includes(nav.id) && nav.id !== MORE_ID) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return (
|
|
43
|
+
handelHref(nav.href) === path ||
|
|
44
|
+
nav.children?.some((item) => {
|
|
45
|
+
if (item.children?.length) {
|
|
46
|
+
return item.children.some((v) => {
|
|
47
|
+
return handelHref(v.href) === path;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return handelHref(item.href) === path;
|
|
51
|
+
}) ||
|
|
52
|
+
nav.keys?.includes(path?.slice(1, sharpIdx !== -1 ? sharpIdx : path?.length))
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
getSelectedIndex();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
watch(
|
|
62
|
+
() => route.path,
|
|
63
|
+
() => {
|
|
64
|
+
getSelectedIndex();
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const checkVisible = (date: string, lang: 'zh' | 'en'): boolean => {
|
|
69
|
+
let flag = true;
|
|
70
|
+
if (date) {
|
|
71
|
+
flag = flag && new Date(date).getTime() >= Date.now();
|
|
72
|
+
}
|
|
73
|
+
if (lang) {
|
|
74
|
+
flag = flag && locale.value === lang;
|
|
75
|
+
}
|
|
76
|
+
return flag;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const filterPerm = (navItem: any, permMap: any) => {
|
|
80
|
+
if (navItem.checkPermKey) {
|
|
81
|
+
return permMap[navItem.checkPermKey];
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const moreItem = computed(() => {
|
|
87
|
+
return {
|
|
88
|
+
id: MORE_ID,
|
|
89
|
+
label: '更多',
|
|
90
|
+
children: navs.value.filter((v) => !visibleIds.value.includes(v.id)) || [],
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
const navs = computed(() => {
|
|
94
|
+
const path = [] as string[];
|
|
95
|
+
let currentNavs = [] as any[];
|
|
96
|
+
const permMap = {
|
|
97
|
+
meeting: props.hasPerm,
|
|
98
|
+
};
|
|
99
|
+
try {
|
|
100
|
+
currentNavs = props.navData
|
|
101
|
+
.filter((navItem) => filterPerm(navItem, permMap))
|
|
102
|
+
.map(function fn(navItem: any) {
|
|
103
|
+
path.push(navItem.label);
|
|
104
|
+
const res = {
|
|
105
|
+
...navItem,
|
|
106
|
+
_path: [...path],
|
|
107
|
+
};
|
|
108
|
+
if (navItem.children) {
|
|
109
|
+
res.children = navItem.children.filter((navItem) => filterPerm(navItem, permMap)).map(fn);
|
|
110
|
+
}
|
|
111
|
+
path.pop();
|
|
112
|
+
return res;
|
|
113
|
+
});
|
|
114
|
+
} catch {
|
|
115
|
+
currentNavs = props.navData;
|
|
116
|
+
}
|
|
117
|
+
return currentNavs;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// ----------------埋点----------------
|
|
121
|
+
// 导航埋点
|
|
122
|
+
let lastHoverTime = 0;
|
|
123
|
+
let steps = 0; // 触发初始导航到最终完成跳转所用步数
|
|
124
|
+
|
|
125
|
+
const onRedirect = (navItem: any) => {
|
|
126
|
+
const timeUsed = Date.now() - lastHoverTime;
|
|
127
|
+
const _steps = steps + 1;
|
|
128
|
+
lastHoverTime = 0;
|
|
129
|
+
steps = 0;
|
|
130
|
+
if (navItem._path) {
|
|
131
|
+
const levels = {} as Record<string, string>;
|
|
132
|
+
navItem._path.forEach((name: string, idx: number) => {
|
|
133
|
+
levels[`level${idx + 1}`] = name;
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
properties: {
|
|
137
|
+
module: 'navigation',
|
|
138
|
+
timeUsed,
|
|
139
|
+
steps: _steps,
|
|
140
|
+
...levels,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const onNavHover = (navItem: any) => {
|
|
147
|
+
steps++;
|
|
148
|
+
if (lastHoverTime) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
lastHoverTime = Date.now();
|
|
152
|
+
return {
|
|
153
|
+
event: 'hover',
|
|
154
|
+
properties: {
|
|
155
|
+
module: 'navigation',
|
|
156
|
+
target: navItem.label,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const onCancelNav = () => {
|
|
162
|
+
lastHoverTime = 0;
|
|
163
|
+
steps = 0;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const isHttpUrl = (url: string) => {
|
|
167
|
+
return url ? url.startsWith('http') : false;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const wrapperRef = ref(null);
|
|
171
|
+
const listRef = ref(null);
|
|
172
|
+
const visibleIds = ref([]);
|
|
173
|
+
const resizeTimer = ref(null);
|
|
174
|
+
const leftWidth = ref(0);
|
|
175
|
+
|
|
176
|
+
const calculateLayout = () => {
|
|
177
|
+
if (!wrapperRef.value) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
visibleIds.value = [];
|
|
181
|
+
leftWidth.value = wrapperRef.value.clientWidth;
|
|
182
|
+
if (lePadV.value) {
|
|
183
|
+
visibleIds.value = navs.value.map((v) => v.id);
|
|
184
|
+
}
|
|
185
|
+
// 计算可用宽度
|
|
186
|
+
if (wrapperRef.value.clientWidth >= listRef.value.clientWidth) {
|
|
187
|
+
// 重置
|
|
188
|
+
visibleIds.value = navs.value.map((v) => v.id);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
leftWidth.value = 0;
|
|
192
|
+
const moreEle = listRef.value.querySelector(`li.nav-item#${MORE_ID}`);
|
|
193
|
+
let availableWidth = wrapperRef.value.clientWidth - moreEle.clientWidth;
|
|
194
|
+
const allItems = listRef.value.querySelectorAll('li.nav-item');
|
|
195
|
+
let done = false;
|
|
196
|
+
[...allItems].forEach((item, idx) => {
|
|
197
|
+
if (item.id !== MORE_ID && availableWidth > item.clientWidth && !done) {
|
|
198
|
+
availableWidth -= item.clientWidth;
|
|
199
|
+
visibleIds.value.push(navs.value[idx].id);
|
|
200
|
+
leftWidth.value += item.clientWidth;
|
|
201
|
+
} else {
|
|
202
|
+
done = true;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
onMounted(() => {
|
|
208
|
+
window.addEventListener('resize', calculateLayout);
|
|
209
|
+
// 确保 DOM 完全渲染后再计算
|
|
210
|
+
nextTick(() => {
|
|
211
|
+
calculateLayout();
|
|
212
|
+
resizeTimer.value = setTimeout(() => {
|
|
213
|
+
calculateLayout();
|
|
214
|
+
}, 1000);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// 清理
|
|
219
|
+
onUnmounted(() => {
|
|
220
|
+
window.removeEventListener('resize', calculateLayout);
|
|
221
|
+
clearTimeout(resizeTimer.value);
|
|
222
|
+
});
|
|
223
|
+
// 监听 items 变化
|
|
224
|
+
watch(
|
|
225
|
+
() => navs.value,
|
|
226
|
+
() => {
|
|
227
|
+
nextTick(() => {
|
|
228
|
+
calculateLayout();
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
{ deep: true }
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const handelHref = (href: string) => {
|
|
235
|
+
if (href === '/') {
|
|
236
|
+
href = '';
|
|
237
|
+
}
|
|
238
|
+
if (isHttpUrl(href)) {
|
|
239
|
+
return href;
|
|
240
|
+
}
|
|
241
|
+
return `/${locale.value}${href}`;
|
|
242
|
+
};
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<template>
|
|
246
|
+
<nav class="header-nav-ubmc" ref="wrapperRef">
|
|
247
|
+
<ul
|
|
248
|
+
class="nav-list"
|
|
249
|
+
@mouseleave="onCancelNav"
|
|
250
|
+
ref="listRef"
|
|
251
|
+
:style="{
|
|
252
|
+
'--more-left': leftWidth,
|
|
253
|
+
}"
|
|
254
|
+
>
|
|
255
|
+
<li
|
|
256
|
+
v-for="(item, idx) in [...navs, moreItem]"
|
|
257
|
+
:key="item.id"
|
|
258
|
+
:id="item.id"
|
|
259
|
+
class="nav-item"
|
|
260
|
+
:class="{
|
|
261
|
+
'is-selected': selectedIndex === idx,
|
|
262
|
+
'is-active': activeIndex === idx,
|
|
263
|
+
hidden: (!visibleIds.includes(item.id) && item.id !== MORE_ID) || (item.id === MORE_ID && item.children.length === 0),
|
|
264
|
+
}"
|
|
265
|
+
@mouseenter="onMouseEnter(idx)"
|
|
266
|
+
@mouseleave="onMouseLeave(idx)"
|
|
267
|
+
v-analytics:mouseenter="() => onNavHover(item)"
|
|
268
|
+
>
|
|
269
|
+
<a class="info-wrap clickable" v-if="!item.children?.length && item.href" :href="handelHref(item.href)">
|
|
270
|
+
<span>
|
|
271
|
+
<span>{{ item.label }}</span>
|
|
272
|
+
</span>
|
|
273
|
+
</a>
|
|
274
|
+
<div class="info-wrap" v-else>
|
|
275
|
+
<span>
|
|
276
|
+
<span>{{ item.label }}</span>
|
|
277
|
+
</span>
|
|
278
|
+
<div class="dropdown-wrapper">
|
|
279
|
+
<el-cascader-panel :options="item.children" value="id" expandTrigger="hover" :ref="(ref) => (cascaderRef[idx] = ref)">
|
|
280
|
+
<template #default="{ data: childTab }">
|
|
281
|
+
<template v-if="childTab.disabled">
|
|
282
|
+
<div class="tab-disabled">
|
|
283
|
+
<span>{{ childTab.label }}</span>
|
|
284
|
+
<span class="disabled-tag">待上线</span>
|
|
285
|
+
</div>
|
|
286
|
+
</template>
|
|
287
|
+
<template v-else-if="childTab?.children">
|
|
288
|
+
<div class="tab-expand">
|
|
289
|
+
<span>{{ childTab.label }}</span>
|
|
290
|
+
<OIcon>
|
|
291
|
+
<OIconChevronRight />
|
|
292
|
+
</OIcon>
|
|
293
|
+
</div>
|
|
294
|
+
</template>
|
|
295
|
+
<template v-else>
|
|
296
|
+
<a
|
|
297
|
+
:href="handelHref(childTab.href)"
|
|
298
|
+
class="dropdown-link"
|
|
299
|
+
:target="isHttpUrl(childTab.href) ? '_blank' : '_self'"
|
|
300
|
+
:rel="isHttpUrl(childTab.href) ? 'noopener noreferrer' : ''"
|
|
301
|
+
>
|
|
302
|
+
<span>{{ childTab.label }}</span>
|
|
303
|
+
<OTag
|
|
304
|
+
v-if="(tagMap[childTab?.href?.slice(1)] || childTab.tag) && checkVisible(childTab.tagExpire, childTab.tagLang)"
|
|
305
|
+
color="danger"
|
|
306
|
+
size="small"
|
|
307
|
+
round="pill"
|
|
308
|
+
>
|
|
309
|
+
{{ tagMap[childTab?.href?.slice(1)] || childTab.tag }}
|
|
310
|
+
</OTag>
|
|
311
|
+
<OIcon v-if="childTab.icon" class="jump-out-icon">
|
|
312
|
+
<component :is="childTab.icon" class="icon" />
|
|
313
|
+
</OIcon>
|
|
314
|
+
</a>
|
|
315
|
+
</template>
|
|
316
|
+
</template>
|
|
317
|
+
</el-cascader-panel>
|
|
318
|
+
<div class="dropdown-body-wrapper" style="display: none !important">
|
|
319
|
+
<div class="dropdown-body" v-for="(childTab, index) in item.children" :key="index" @mouseenter="onMouseEnter(idx)" @mouseleave="onMouseLeave">
|
|
320
|
+
<div class="dropdown-item" v-if="childTab.disabled">
|
|
321
|
+
<div class="tab-disabled">
|
|
322
|
+
<span>{{ childTab.label }}</span>
|
|
323
|
+
<span class="disabled-tag">待上线</span>
|
|
324
|
+
</div>
|
|
325
|
+
</div>
|
|
326
|
+
<div class="dropdown-item" v-else v-analytics="() => onRedirect(childTab)">
|
|
327
|
+
<a
|
|
328
|
+
:href="handelHref(childTab.href)"
|
|
329
|
+
class="dropdown-link"
|
|
330
|
+
:target="isHttpUrl(childTab.href) ? '_blank' : '_self'"
|
|
331
|
+
:rel="isHttpUrl(childTab.href) ? 'noopener noreferrer' : ''"
|
|
332
|
+
>
|
|
333
|
+
<span>{{ childTab.label }}</span>
|
|
334
|
+
<OTag
|
|
335
|
+
v-if="(tagMap[childTab?.href?.slice(1)] || childTab.tag) && checkVisible(childTab.tagExpire, childTab.tagLang)"
|
|
336
|
+
color="danger"
|
|
337
|
+
size="small"
|
|
338
|
+
round="pill"
|
|
339
|
+
>
|
|
340
|
+
{{ tagMap[childTab?.href?.slice(1)] || childTab.tag }}
|
|
341
|
+
</OTag>
|
|
342
|
+
<OIcon v-if="childTab.icon" class="jump-out-icon">
|
|
343
|
+
<component :is="childTab.icon" class="icon" />
|
|
344
|
+
</OIcon>
|
|
345
|
+
</a>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
</div>
|
|
351
|
+
</li>
|
|
352
|
+
</ul>
|
|
353
|
+
</nav>
|
|
354
|
+
</template>
|
|
355
|
+
|
|
356
|
+
<style lang="scss" scoped>
|
|
357
|
+
.header-nav-ubmc {
|
|
358
|
+
height: 100%;
|
|
359
|
+
min-width: 0;
|
|
360
|
+
flex: 1;
|
|
361
|
+
position: relative;
|
|
362
|
+
}
|
|
363
|
+
.nav-list {
|
|
364
|
+
display: flex;
|
|
365
|
+
height: 100%;
|
|
366
|
+
width: fit-content;
|
|
367
|
+
flex-wrap: nowrap;
|
|
368
|
+
}
|
|
369
|
+
.nav-item {
|
|
370
|
+
position: relative;
|
|
371
|
+
height: 100%;
|
|
372
|
+
color: var(--o-color-info1);
|
|
373
|
+
pointer-events: auto;
|
|
374
|
+
transition: color var(--o-duration-s) var(--o-easing-standard);
|
|
375
|
+
@include text1;
|
|
376
|
+
&.hidden {
|
|
377
|
+
opacity: 0;
|
|
378
|
+
}
|
|
379
|
+
&#more {
|
|
380
|
+
position: absolute;
|
|
381
|
+
left: calc(var(--more-left) * 1px);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
a {
|
|
385
|
+
color: var(--o-color-info2);
|
|
386
|
+
display: flex;
|
|
387
|
+
align-items: center;
|
|
388
|
+
transition: color var(--o-duration-s) var(--o-easing-standard);
|
|
389
|
+
}
|
|
390
|
+
&::after {
|
|
391
|
+
content: '';
|
|
392
|
+
position: absolute;
|
|
393
|
+
bottom: 0;
|
|
394
|
+
left: var(--o-gap-4);
|
|
395
|
+
width: calc(100% - var(--o-gap-4) * 2);
|
|
396
|
+
height: 2px;
|
|
397
|
+
border-radius: 2px;
|
|
398
|
+
background-color: var(--o-color-primary1);
|
|
399
|
+
transition: opacity var(--o-duration-m2) var(--o-easing-standard);
|
|
400
|
+
opacity: 0;
|
|
401
|
+
@include respond-to('pad_h') {
|
|
402
|
+
left: var(--o-gap-3);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
&.is-active,
|
|
406
|
+
&.is-selected {
|
|
407
|
+
.info-wrap {
|
|
408
|
+
color: var(--o-color-primary1);
|
|
409
|
+
font-weight: 500;
|
|
410
|
+
}
|
|
411
|
+
&::after {
|
|
412
|
+
opacity: 1;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.info-wrap {
|
|
418
|
+
display: flex;
|
|
419
|
+
align-items: center;
|
|
420
|
+
height: 100%;
|
|
421
|
+
padding: 0 var(--o-gap-4);
|
|
422
|
+
color: var(--o-color-info1);
|
|
423
|
+
word-break: keep-all;
|
|
424
|
+
position: relative;
|
|
425
|
+
font-weight: normal;
|
|
426
|
+
&:hover {
|
|
427
|
+
color: var(--o-color-primary1);
|
|
428
|
+
}
|
|
429
|
+
& > span {
|
|
430
|
+
display: flex;
|
|
431
|
+
align-items: flex-end;
|
|
432
|
+
white-space: nowrap;
|
|
433
|
+
@include respond-to('pad_h') {
|
|
434
|
+
height: 28px;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
&.clickable {
|
|
438
|
+
cursor: pointer;
|
|
439
|
+
}
|
|
440
|
+
@include respond-to('pad_h') {
|
|
441
|
+
padding: 0 var(--o-gap-3);
|
|
442
|
+
}
|
|
443
|
+
.dropdown-wrapper {
|
|
444
|
+
font-weight: 400;
|
|
445
|
+
position: absolute;
|
|
446
|
+
top: calc(100% - 4px);
|
|
447
|
+
left: 0;
|
|
448
|
+
display: none;
|
|
449
|
+
padding-top: 8px;
|
|
450
|
+
transition: opacity var(--o-duration-s) var(--o-easing-standard);
|
|
451
|
+
:deep(.el-cascader-panel) {
|
|
452
|
+
box-shadow: var(--o-shadow-2);
|
|
453
|
+
border: none;
|
|
454
|
+
background-color: var(--o-color-fill2);
|
|
455
|
+
display: flex;
|
|
456
|
+
.el-cascader-menu {
|
|
457
|
+
min-width: 100px;
|
|
458
|
+
border-right: none;
|
|
459
|
+
}
|
|
460
|
+
.el-cascader-menu + .el-cascader-menu {
|
|
461
|
+
border-left: 1px solid var(--o-color-control4);
|
|
462
|
+
height: auto;
|
|
463
|
+
}
|
|
464
|
+
.el-cascader-node {
|
|
465
|
+
.el-icon {
|
|
466
|
+
display: none;
|
|
467
|
+
}
|
|
468
|
+
&.is-active {
|
|
469
|
+
color: inherit;
|
|
470
|
+
font-weight: normal;
|
|
471
|
+
}
|
|
472
|
+
&.in-active-path {
|
|
473
|
+
font-weight: normal;
|
|
474
|
+
color: var(--o-color-primary1);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.tab-expand {
|
|
479
|
+
display: flex;
|
|
480
|
+
align-items: center;
|
|
481
|
+
justify-content: space-between;
|
|
482
|
+
gap: 12px;
|
|
483
|
+
.o-icon {
|
|
484
|
+
font-size: 16px;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
.el-cascader-menu__wrap {
|
|
488
|
+
height: fit-content;
|
|
489
|
+
}
|
|
490
|
+
.el-cascader-menu__list {
|
|
491
|
+
padding: 6px;
|
|
492
|
+
li {
|
|
493
|
+
padding: 6px 12px;
|
|
494
|
+
border-radius: 4px;
|
|
495
|
+
cursor: pointer;
|
|
496
|
+
&:hover {
|
|
497
|
+
background-color: var(--o-color-control2-light);
|
|
498
|
+
color: var(--o-color-primary1);
|
|
499
|
+
}
|
|
500
|
+
& > span {
|
|
501
|
+
padding: 0;
|
|
502
|
+
&:not(.o-tag) {
|
|
503
|
+
color: var(--o-color-info1);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
.dropdown-body-wrapper {
|
|
510
|
+
background-color: var(--o-color-control-light);
|
|
511
|
+
border-radius: var(--o-radius-s);
|
|
512
|
+
box-shadow: var(--o-shadow-2);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.dropdown-item {
|
|
516
|
+
font-weight: 400;
|
|
517
|
+
white-space: nowrap;
|
|
518
|
+
display: flex;
|
|
519
|
+
align-items: center;
|
|
520
|
+
padding: 6px 12px;
|
|
521
|
+
min-width: 100px;
|
|
522
|
+
border-radius: var(--o-radius-s);
|
|
523
|
+
color: var(--o-color-info2);
|
|
524
|
+
background-color: transparent;
|
|
525
|
+
transition: background-color var(--o-duration-s) var(--o-easing-standard);
|
|
526
|
+
cursor: pointer;
|
|
527
|
+
@include text1;
|
|
528
|
+
@include hover {
|
|
529
|
+
background-color: var(--o-color-control2-light);
|
|
530
|
+
color: var(--o-color-primary1);
|
|
531
|
+
}
|
|
532
|
+
&.dropdown-item {
|
|
533
|
+
display: flex;
|
|
534
|
+
justify-content: space-between;
|
|
535
|
+
.o-icon {
|
|
536
|
+
font-size: 16px;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
.dropdown-link {
|
|
541
|
+
color: inherit;
|
|
542
|
+
display: flex;
|
|
543
|
+
align-items: center;
|
|
544
|
+
width: 100%;
|
|
545
|
+
.o-tag {
|
|
546
|
+
margin-left: var(--o-gap-2);
|
|
547
|
+
transform: scale(0.75);
|
|
548
|
+
transform-origin: left center;
|
|
549
|
+
--layout-pkg-radius: 100vh;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
:deep(.jump-out-icon) {
|
|
553
|
+
font-size: 16px;
|
|
554
|
+
margin-left: 4px;
|
|
555
|
+
path {
|
|
556
|
+
fill: currentColor;
|
|
557
|
+
stroke: transparent;
|
|
558
|
+
}
|
|
559
|
+
path[fill='none'] {
|
|
560
|
+
display: none;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
.nav-item {
|
|
566
|
+
@include hover {
|
|
567
|
+
.dropdown-wrapper {
|
|
568
|
+
display: block;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
.tab-disabled {
|
|
573
|
+
color: var(--o-color-info4);
|
|
574
|
+
display: flex;
|
|
575
|
+
align-items: center;
|
|
576
|
+
cursor: not-allowed;
|
|
577
|
+
|
|
578
|
+
.disabled-tag {
|
|
579
|
+
margin-left: var(--o-gap-1);
|
|
580
|
+
border: 1px solid rgba(224, 226, 230, 1);
|
|
581
|
+
border-radius: var(--o-radius-xs);
|
|
582
|
+
font-size: 10px;
|
|
583
|
+
color: var(--o-color-info3);
|
|
584
|
+
height: 16px;
|
|
585
|
+
width: 38px;
|
|
586
|
+
display: flex;
|
|
587
|
+
align-items: center;
|
|
588
|
+
justify-content: center;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
</style>
|
|
592
|
+
|
|
593
|
+
<style lang="scss">
|
|
594
|
+
.navs-dropdown {
|
|
595
|
+
border-radius: 4px;
|
|
596
|
+
}
|
|
597
|
+
</style>
|