Commit 349d1978b154f6e9e74e36de7cc56a2ca261d0b0
1 parent
66acb21e
fix: fix missing page refresh parameters
Showing
11 changed files
with
81 additions
and
39 deletions
src/components/Breadcrumb/Breadcrumb.vue
src/components/Form/src/BasicForm.vue
src/components/Menu/src/index.less
... | ... | @@ -118,7 +118,7 @@ |
118 | 118 | .ant-menu-submenu-open, |
119 | 119 | .ant-menu-item-selected, |
120 | 120 | .ant-menu-submenu-selected { |
121 | - color: @white !important; | |
121 | + color: @primary-color !important; | |
122 | 122 | border-bottom: 3px solid @primary-color; |
123 | 123 | } |
124 | 124 | |
... | ... | @@ -127,7 +127,7 @@ |
127 | 127 | .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open, |
128 | 128 | .ant-menu-submenu-active, |
129 | 129 | .ant-menu-submenu-title:hover { |
130 | - color: @white !important; | |
130 | + color: @primary-color !important; | |
131 | 131 | border-bottom: 3px solid @primary-color; |
132 | 132 | } |
133 | 133 | ... | ... |
src/design/var/index.less
src/hooks/web/useTabs.ts
... | ... | @@ -90,15 +90,25 @@ export function useTabs() { |
90 | 90 | closeOther: () => canIUseFn() && closeOther(tabStore.getCurrentTab), |
91 | 91 | closeCurrent: () => canIUseFn() && closeCurrent(tabStore.getCurrentTab), |
92 | 92 | resetCache: () => canIUseFn() && resetCache(), |
93 | - addTab: (path: PageEnum, goTo = false, replace = false) => { | |
93 | + addTab: ( | |
94 | + path: PageEnum | string, | |
95 | + goTo = false, | |
96 | + opt?: { replace?: boolean; query?: any; params?: any } | |
97 | + ) => { | |
94 | 98 | const to = getTo(path); |
95 | 99 | |
96 | 100 | if (!to) return; |
97 | 101 | useTimeout(() => { |
98 | 102 | tabStore.addTabByPathAction(); |
99 | 103 | }, 0); |
104 | + const { replace, query = {}, params = {} } = opt || {}; | |
100 | 105 | activeKeyRef.value = path; |
101 | - goTo && replace ? router.replace : router.push(path); | |
106 | + const data = { | |
107 | + path, | |
108 | + query, | |
109 | + params, | |
110 | + }; | |
111 | + goTo && replace ? router.replace(data) : router.push(data); | |
102 | 112 | }, |
103 | 113 | activeKeyRef, |
104 | 114 | }; | ... | ... |
src/layouts/default/LayoutHeader.tsx
... | ... | @@ -20,7 +20,6 @@ import { GITHUB_URL } from '/@/settings/siteSetting'; |
20 | 20 | import LockAction from './actions/LockActionItem'; |
21 | 21 | import { useModal } from '/@/components/Modal/index'; |
22 | 22 | import { errorStore } from '/@/store/modules/error'; |
23 | -import { useGo } from '/@/hooks/web/usePage'; | |
24 | 23 | import { useWindowSizeFn } from '/@/hooks/event/useWindowSize'; |
25 | 24 | import NoticeAction from './actions/notice/NoticeActionItem.vue'; |
26 | 25 | |
... | ... | @@ -28,11 +27,10 @@ export default defineComponent({ |
28 | 27 | name: 'DefaultLayoutHeader', |
29 | 28 | setup() { |
30 | 29 | const widthRef = ref(200); |
31 | - const { refreshPage } = useTabs(); | |
30 | + const { refreshPage, addTab } = useTabs(); | |
32 | 31 | const [register, { openModal }] = useModal(); |
33 | 32 | const { toggleFullscreen, isFullscreenRef } = useFullscreen(); |
34 | 33 | |
35 | - const go = useGo(); | |
36 | 34 | const getProjectConfigRef = computed(() => { |
37 | 35 | return appStore.getProjectConfig; |
38 | 36 | }); |
... | ... | @@ -72,7 +70,7 @@ export default defineComponent({ |
72 | 70 | |
73 | 71 | function handleToErrorList() { |
74 | 72 | errorStore.commitErrorListCountState(0); |
75 | - go('/exception/error-log'); | |
73 | + addTab('/exception/error-log', true); | |
76 | 74 | } |
77 | 75 | |
78 | 76 | /** |
... | ... | @@ -175,12 +173,8 @@ export default defineComponent({ |
175 | 173 | <div> |
176 | 174 | <Tooltip> |
177 | 175 | {{ |
178 | - title: () => '消息中心', | |
179 | - default: () => ( | |
180 | - <div class={`layout-header__action-item`}> | |
181 | - <NoticeAction /> | |
182 | - </div> | |
183 | - ), | |
176 | + title: () => '消息通知', | |
177 | + default: () => <NoticeAction />, | |
184 | 178 | }} |
185 | 179 | </Tooltip> |
186 | 180 | </div> | ... | ... |
src/layouts/default/actions/notice/NoticeActionItem.vue
1 | 1 | <template> |
2 | - <div> | |
2 | + <div class="layout-header__action-item notify-action"> | |
3 | 3 | <Popover title="" trigger="click"> |
4 | 4 | <Badge :count="count" :numberStyle="numberStyle"> |
5 | 5 | <BellOutlined class="layout-header__action-icon" /> |
... | ... | @@ -43,22 +43,25 @@ |
43 | 43 | }, |
44 | 44 | }); |
45 | 45 | </script> |
46 | -<style lang="less" scoped> | |
47 | - /deep/ .ant-tabs-tab { | |
48 | - padding-top: 8px; | |
49 | - margin-right: 12px; | |
50 | - } | |
46 | +<style lang="less"> | |
47 | + .notify-action { | |
48 | + padding-top: 2px; | |
51 | 49 | |
52 | - /deep/ .ant-tabs-content { | |
53 | - width: 300px; | |
54 | - } | |
50 | + .ant-tabs-content { | |
51 | + width: 300px; | |
52 | + } | |
55 | 53 | |
56 | - /deep/ .ant-badge { | |
57 | - font-size: 18px; | |
54 | + .ant-badge { | |
55 | + font-size: 18px; | |
58 | 56 | |
59 | - .ant-badge-multiple-words { | |
60 | - padding: 0 4px; | |
61 | - transform: translate(26%, -48%); | |
57 | + .ant-badge-multiple-words { | |
58 | + padding: 0 4px; | |
59 | + transform: translate(26%, -40%); | |
60 | + } | |
61 | + | |
62 | + svg { | |
63 | + width: 0.9em; | |
64 | + } | |
62 | 65 | } |
63 | 66 | } |
64 | 67 | </style> | ... | ... |
src/layouts/default/index.less
... | ... | @@ -194,6 +194,11 @@ |
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | +.ant-layout-header { | |
198 | + height: @header-height; | |
199 | + line-height: @header-height; | |
200 | +} | |
201 | + | |
197 | 202 | .layout-header { |
198 | 203 | display: flex; |
199 | 204 | height: @header-height; |
... | ... | @@ -336,12 +341,12 @@ |
336 | 341 | display: flex; |
337 | 342 | align-items: center; |
338 | 343 | height: @header-height; |
339 | - font-size: 1.3em; | |
344 | + font-size: 1.1em; | |
340 | 345 | cursor: pointer; |
341 | 346 | } |
342 | 347 | |
343 | 348 | &-icon { |
344 | - padding: 0 12px; | |
349 | + padding: 0 8px; | |
345 | 350 | } |
346 | 351 | } |
347 | 352 | |
... | ... | @@ -362,13 +367,14 @@ |
362 | 367 | .user-dropdown { |
363 | 368 | display: flex; |
364 | 369 | height: 100%; |
370 | + font-size: 12px; | |
365 | 371 | cursor: pointer; |
366 | 372 | align-items: center; |
367 | 373 | |
368 | 374 | img { |
369 | - width: 32px; | |
370 | - height: 32px; | |
371 | - margin-right: 24px; | |
375 | + width: 26px; | |
376 | + height: 26px; | |
377 | + margin-right: 16px; | |
372 | 378 | } |
373 | 379 | |
374 | 380 | &__header { |
... | ... | @@ -404,7 +410,7 @@ |
404 | 410 | } |
405 | 411 | |
406 | 412 | &__name { |
407 | - font-size: 14px; | |
413 | + font-size: 12px; | |
408 | 414 | } |
409 | 415 | |
410 | 416 | &__desc { | ... | ... |
src/layouts/default/multitabs/index.less
... | ... | @@ -7,6 +7,19 @@ |
7 | 7 | height: @multiple-height; |
8 | 8 | } |
9 | 9 | |
10 | + // .ant-tabs:not(.ant-tabs-card) { | |
11 | + // .ant-tabs-nav-container { | |
12 | + // height: @multiple-height; | |
13 | + // background: @white; | |
14 | + // } | |
15 | + | |
16 | + // .ant-tabs-tab { | |
17 | + // font-size: 14px; | |
18 | + // line-height: 1.5515; | |
19 | + // background: @white; | |
20 | + // } | |
21 | + // } | |
22 | + | |
10 | 23 | .ant-tabs.ant-tabs-card { |
11 | 24 | .ant-tabs-card-bar { |
12 | 25 | height: @multiple-height; |
... | ... | @@ -114,6 +127,10 @@ |
114 | 127 | } |
115 | 128 | } |
116 | 129 | |
130 | +.ant-tabs-extra-content { | |
131 | + line-height: @multiple-height; | |
132 | +} | |
133 | + | |
117 | 134 | .multiple-tabs-content { |
118 | 135 | &__extra { |
119 | 136 | display: inline-block; | ... | ... |
src/layouts/default/multitabs/index.tsx
... | ... | @@ -35,7 +35,11 @@ export default defineComponent({ |
35 | 35 | const { currentRoute } = useRouter(); |
36 | 36 | const { addTab, activeKeyRef } = useTabs(); |
37 | 37 | onMounted(() => { |
38 | - addTab(unref(currentRoute).path as PageEnum); | |
38 | + const route = unref(currentRoute); | |
39 | + addTab(unref(currentRoute).path as PageEnum, false, { | |
40 | + query: route.query, | |
41 | + params: route.params, | |
42 | + }); | |
39 | 43 | }); |
40 | 44 | |
41 | 45 | // 当前激活tab |
... | ... | @@ -60,6 +64,14 @@ export default defineComponent({ |
60 | 64 | // 监听路由的话虽然可以,但是路由切换的时间会造成卡顿现象? |
61 | 65 | // 使用useTab的addTab的话,当用户手动调转,需要自行调用addTab |
62 | 66 | // tabStore.commitAddTab((unref(currentRoute) as unknown) as AppRouteRecordRaw); |
67 | + // const { affix } = currentRoute.value.meta || {}; | |
68 | + // if (affix) return; | |
69 | + // const hasInTab = tabStore.getTabsState.some( | |
70 | + // (item) => item.fullPath === currentRoute.value.fullPath | |
71 | + // ); | |
72 | + // if (!hasInTab) { | |
73 | + // tabStore.commitAddTab((unref(currentRoute) as unknown) as AppRouteRecordRaw); | |
74 | + // } | |
63 | 75 | }, |
64 | 76 | { |
65 | 77 | immediate: true, | ... | ... |
src/settings/projectSetting.ts