MultipleHeader.vue
5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<template>
<div :style="getPlaceholderDomStyle" v-if="getIsShowPlaceholderDom"></div>
<div :style="getWrapStyle" :class="getClass">
<LayoutHeader v-if="getShowHeader" />
<MultipleTabs v-if="getShowTabs" />
</div>
</template>
<script lang="ts">
import { defineComponent, unref, computed, CSSProperties } from 'vue';
import LayoutHeader from './index.vue';
import MultipleTabs from '../tabs/index.vue';
import { useAppStore } from "@/store/modules/app";
import { useGlobSetting } from "/@/hooks/setting";
import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
import { useFullContent } from '/@/hooks/web/useFullContent';
import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting';
import { useAppInject } from '/@/hooks/web/useAppInject';
import { useDesign } from '/@/hooks/web/useDesign';
import { useLayoutHeight } from '../content/useContentViewHeight';
import { TabsThemeEnum } from '/@/enums/appEnum';
import { MenuTypeEnum } from '/@/enums/menuEnum';
// update-begin--author:liaozhiyang---date:20240407---for:【QQYUN-8774】网站header区域加高
const HEADER_HEIGHT = 60;
// update-begin--author:liaozhiyang---date:20240407---for:【【QQYUN-8774】网站header区域加高
// updateBy:sunjianlei---updateDate:2021-09-03---修改tab切换栏样式:更改高度
const TABS_HEIGHT = 32;
const TABS_HEIGHT_CARD = 50;
const TABS_HEIGHT_SMOOTH = 50;
export default defineComponent({
name: 'LayoutMultipleHeader',
components: { LayoutHeader, MultipleTabs },
setup() {
const { setHeaderHeight } = useLayoutHeight();
const { prefixCls } = useDesign('layout-multiple-header');
const appStore = useAppStore()
const glob = useGlobSetting()
const { getCalcContentWidth, getSplit, getMenuType } = useMenuSetting();
const { getIsMobile } = useAppInject();
const { getFixed, getShowInsetHeaderRef, getShowFullHeaderRef, getHeaderTheme } = useHeaderSetting();
const { getFullContent } = useFullContent();
const { getShowMultipleTab, getTabsTheme } = useMultipleTabSetting();
const getShowHeader = computed(() => {
// 控制是否显示顶部
if (appStore.getLayoutHideHeader) {
return false;
}
return unref(getShowInsetHeaderRef);
})
const getShowTabs = computed(() => {
// 控制是否显示多Tabs切换
if (appStore.getLayoutHideMultiTabs) {
return false;
}
return unref(getShowMultipleTab) && !unref(getFullContent);
});
const getIsShowPlaceholderDom = computed(() => {
return unref(getFixed) || unref(getShowFullHeaderRef);
});
const getWrapStyle = computed((): CSSProperties => {
const style: CSSProperties = {};
if (unref(getFixed) && !glob.isQiankunMicro) {
style.width = unref(getIsMobile) ? '100%' : unref(getCalcContentWidth);
}
if (unref(getShowFullHeaderRef)) {
style.top = `${HEADER_HEIGHT}px`;
}
return style;
});
const getIsFixed = computed(() => {
return unref(getFixed) || unref(getShowFullHeaderRef);
});
// updateBy:sunjianlei---updateDate:2021-09-08---根据主题的不同,动态计算tabs高度
const getTabsThemeHeight = computed(() => {
let tabsTheme = unref(getTabsTheme);
if (tabsTheme === TabsThemeEnum.CARD) {
return TABS_HEIGHT_CARD;
} else if (tabsTheme === TabsThemeEnum.SMOOTH) {
return TABS_HEIGHT_SMOOTH;
} else {
return TABS_HEIGHT;
}
});
const getPlaceholderDomStyle = computed((): CSSProperties => {
let height = 0;
// update-begin--author:liaozhiyang---date:20241216---for:【issues/7561】主题切换为顶部混合模式时,页面顶部内容显示不出来,被遮盖
if ((unref(getShowFullHeaderRef) || !unref(getSplit)) && unref(getShowHeader) && !unref(getFullContent) || unref(getMenuType) == MenuTypeEnum.MIX) {
height += HEADER_HEIGHT;
}
// update-end--author:liaozhiyang---date:20241216---for:【issues/7561】主题切换为顶部混合模式时,页面顶部内容显示不出来,被遮盖
if (unref(getShowTabs) && !unref(getFullContent)) {
height += unref(getTabsThemeHeight);
}
setHeaderHeight(height);
return {
height: `${height}px`,
};
});
const getClass = computed(() => {
return [prefixCls, `${prefixCls}--${unref(getHeaderTheme)}`, {
[`${prefixCls}--fixed`]: unref(getIsFixed),
// 【JEECG作为乾坤子应用】
[`${prefixCls}--qiankun-micro`]: glob.isQiankunMicro,
}];
});
return {
glob,
getClass,
prefixCls,
getPlaceholderDomStyle,
getIsFixed,
getWrapStyle,
getIsShowPlaceholderDom,
getShowTabs,
getShowHeader,
};
},
});
</script>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-layout-multiple-header';
.@{prefix-cls} {
transition: width 0.2s;
flex: 0 0 auto;
&--dark {
margin-left: -1px;
}
&--fixed {
position: fixed;
top: 0;
z-index: @multiple-tab-fixed-z-index;
width: 100%;
}
// 【JEECG作为乾坤子应用】
&--qiankun-micro {
position: absolute;
}
}
</style>