index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <Header v-if="!getShowFullHeader || (currentRoute.path.startsWith('/micro-vent-3dModal/modelchannel/') && !noHeadeLink.includes(currentRoute.path) && !currentRoute.path.endsWith('home')) "
  3. :class="[...getHeaderClass, { 'vent-header': currentRoute.path.startsWith('/monitorChannel/monitor-'), 'normal-header': !currentRoute.path.startsWith('/monitorChannel/monitor-'), 'no-header': currentRoute.path.endsWith('home') }]">
  4. <!-- left start -->
  5. <div :class="`${prefixCls}-left`">
  6. <!-- logo -->
  7. <!-- <AppLogo v-if="getShowHeaderLogo || getIsMobile" :class="`${prefixCls}-logo`" :theme="getHeaderTheme" :style="getLogoWidth" /> -->
  8. <AppLogo :class="`${prefixCls}-logo`" :theme="getHeaderTheme" :style="getLogoWidth" />
  9. <div v-if="!currentRoute.path.startsWith('/monitorChannel/monitor-')" style="margin-top: 5px; color: #aaa; margin-left: 10px; font-weight: 600"
  10. >/{{ currentRoute.meta.title }}</div
  11. >
  12. <!-- <LayoutTrigger
  13. v-if="(getShowContent && getShowHeaderTrigger && !getSplit && !getIsMixSidebar) || getIsMobile"
  14. :theme="getHeaderTheme"
  15. :sider="false"
  16. />
  17. <LayoutBreadcrumb v-if="getShowContent && getShowBread" :theme="getHeaderTheme" />
  18. <span v-if="getShowContent && getShowBreadTitle" :class="[prefixCls, `${prefixCls}--${getHeaderTheme}`, 'headerIntroductionClass']">
  19. 欢迎进入 {{ title }}
  20. </span> -->
  21. </div>
  22. <!-- left end -->
  23. <!-- menu start -->
  24. <div v-if="currentRoute.path.startsWith('/monitorChannel/monitor-')" :class="`${prefixCls}-vent`">
  25. <!-- <div>主通风机监测控制</div> -->
  26. <div class="header-nav-title">{{ currentRoute.meta.title }} </div>
  27. </div>
  28. <div :class="`${prefixCls}-menu`" v-else-if="getShowTopMenu && !getIsMobile">
  29. <LayoutMenu :isHorizontal="true" :theme="getHeaderTheme" :splitType="getSplitType" :menuMode="getMenuMode" />
  30. </div>
  31. <!-- menu-end -->
  32. <!-- action -->
  33. <div :class="`${prefixCls}-action`">
  34. <div class="right-position">
  35. <UserDropDown :theme="getHeaderTheme" />
  36. </div>
  37. </div>
  38. </Header>
  39. <div v-else :class="`${prefixCls}-action`" style="position: fixed; top: 30px; right: 20px; z-index: 999;">
  40. <div class="right-position">
  41. <UserDropDown :theme="getHeaderTheme" />
  42. </div>
  43. </div>
  44. <LoginSelect ref="loginSelectRef" @success="loginSelectOk" />
  45. </template>
  46. <script lang="ts">
  47. import { defineComponent, unref, computed, ref, onMounted, toRaw } from 'vue';
  48. import { useGlobSetting } from '/@/hooks/setting';
  49. import { propTypes } from '/@/utils/propTypes';
  50. import { Layout } from 'ant-design-vue';
  51. import { AppLogo } from '/@/components/Application';
  52. import LayoutMenu from '../menu/index.vue';
  53. import LayoutTrigger from '../trigger/index.vue';
  54. import { AppSearch } from '/@/components/Application';
  55. import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
  56. import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
  57. import { useRootSetting } from '/@/hooks/setting/useRootSetting';
  58. import { MenuModeEnum, MenuSplitTyeEnum } from '/@/enums/menuEnum';
  59. import { SettingButtonPositionEnum } from '/@/enums/appEnum';
  60. import { AppLocalePicker } from '/@/components/Application';
  61. import { UserDropDown, LayoutBreadcrumb, FullScreen, Notify, ErrorAction, LockScreen } from './components';
  62. import { useAppInject } from '/@/hooks/web/useAppInject';
  63. import { useDesign } from '/@/hooks/web/useDesign';
  64. import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  65. import { useLocale } from '/@/locales/useLocale';
  66. import LoginSelect from '/@/views/sys/login/LoginSelect.vue';
  67. import { useUserStore } from '/@/store/modules/user';
  68. import { useRouter } from 'vue-router';
  69. import { noHeadeLink } from '../layout.data'
  70. export default defineComponent({
  71. name: 'LayoutHeader',
  72. components: {
  73. Header: Layout.Header,
  74. AppLogo,
  75. LayoutTrigger,
  76. LayoutBreadcrumb,
  77. LayoutMenu,
  78. UserDropDown,
  79. AppLocalePicker,
  80. FullScreen,
  81. Notify,
  82. AppSearch,
  83. ErrorAction,
  84. LockScreen,
  85. LoginSelect,
  86. SettingDrawer: createAsyncComponent(() => import('/@/layouts/default/setting/index.vue'), {
  87. loading: true,
  88. }),
  89. },
  90. props: {
  91. fixed: propTypes.bool,
  92. },
  93. setup(props) {
  94. const { prefixCls } = useDesign('layout-header');
  95. const userStore = useUserStore();
  96. const { currentRoute } = useRouter();
  97. console.log(currentRoute);
  98. const { getShowTopMenu, getShowHeaderTrigger, getSplit, getIsMixMode, getMenuWidth, getIsMixSidebar } = useMenuSetting();
  99. const { getUseErrorHandle, getShowSettingButton, getSettingButtonPosition } = useRootSetting();
  100. const { title } = useGlobSetting();
  101. const {
  102. getHeaderTheme,
  103. getShowFullScreen,
  104. getShowNotice,
  105. getShowContent,
  106. getShowBread,
  107. getShowHeaderLogo,
  108. getShowHeader,
  109. getShowSearch,
  110. getUseLockPage,
  111. getShowBreadTitle,
  112. getShowFullHeaderRef,
  113. } = useHeaderSetting();
  114. const { getShowLocalePicker } = useLocale();
  115. const { getIsMobile } = useAppInject();
  116. const getHeaderClass = computed(() => {
  117. const theme = unref(getHeaderTheme);
  118. return [
  119. prefixCls,
  120. {
  121. [`${prefixCls}--fixed`]: props.fixed,
  122. [`${prefixCls}--mobile`]: unref(getIsMobile),
  123. [`${prefixCls}--${theme}`]: theme,
  124. },
  125. ];
  126. });
  127. const getShowFullHeader = computed(() => {
  128. const route = unref(currentRoute);
  129. return getShowFullHeaderRef && route.path.startsWith('/micro-');
  130. });
  131. const getShowSetting = computed(() => {
  132. if (!unref(getShowSettingButton)) {
  133. return false;
  134. }
  135. const settingButtonPosition = unref(getSettingButtonPosition);
  136. if (settingButtonPosition === SettingButtonPositionEnum.AUTO) {
  137. return unref(getShowHeader);
  138. }
  139. return settingButtonPosition === SettingButtonPositionEnum.HEADER;
  140. });
  141. const getLogoWidth = computed(() => {
  142. if (!unref(getIsMixMode) || unref(getIsMobile)) {
  143. return {};
  144. }
  145. const width = unref(getMenuWidth) < 180 ? 180 : unref(getMenuWidth);
  146. return { width: `${width}px` };
  147. });
  148. const getSplitType = computed(() => {
  149. return unref(getSplit) ? MenuSplitTyeEnum.TOP : MenuSplitTyeEnum.NONE;
  150. });
  151. const getMenuMode = computed(() => {
  152. return unref(getSplit) ? MenuModeEnum.HORIZONTAL : null;
  153. });
  154. // /**
  155. // * 首页多租户部门弹窗逻辑
  156. // */
  157. const loginSelectRef = ref();
  158. function showLoginSelect() {
  159. //update-begin---author:liusq Date:20220101 for:判断登录进来是否需要弹窗选择租户----
  160. //判断是否是登陆进来
  161. const loginInfo = toRaw(userStore.getLoginInfo) || {};
  162. if (!!loginInfo.isLogin) {
  163. loginSelectRef.value.show(loginInfo);
  164. }
  165. //update-end---author:liusq Date:20220101 for:判断登录进来是否需要弹窗选择租户----
  166. }
  167. function loginSelectOk() {
  168. console.log('成功。。。。。');
  169. }
  170. onMounted(() => {
  171. showLoginSelect();
  172. });
  173. return {
  174. prefixCls,
  175. getHeaderClass,
  176. getShowHeaderLogo,
  177. getHeaderTheme,
  178. getShowHeaderTrigger,
  179. getIsMobile,
  180. getShowBreadTitle,
  181. getShowBread,
  182. getShowContent,
  183. getSplitType,
  184. getSplit,
  185. getMenuMode,
  186. getShowTopMenu,
  187. getShowLocalePicker,
  188. getShowFullScreen,
  189. getShowNotice,
  190. getUseErrorHandle,
  191. getLogoWidth,
  192. getIsMixSidebar,
  193. getShowSettingButton,
  194. getShowSetting,
  195. getShowSearch,
  196. getUseLockPage,
  197. loginSelectOk,
  198. loginSelectRef,
  199. currentRoute,
  200. title,
  201. getShowFullHeader,
  202. noHeadeLink
  203. };
  204. },
  205. });
  206. </script>
  207. <style lang="less">
  208. @import './index.less';
  209. //update-begin---author:scott ---date:2022-09-30 for:默认隐藏顶部菜单面包屑-----------
  210. //顶部欢迎语展示样式
  211. @prefix-cls: ~'@{namespace}-layout-header';
  212. .@{prefix-cls} {
  213. display: flex;
  214. padding: 0 8px;
  215. // align-items: center;
  216. .headerIntroductionClass {
  217. margin-right: 4px;
  218. margin-bottom: 2px;
  219. border-bottom: 0px;
  220. border-left: 0px;
  221. }
  222. &--light {
  223. .headerIntroductionClass {
  224. color: @breadcrumb-item-normal-color;
  225. }
  226. }
  227. &--dark {
  228. .headerIntroductionClass {
  229. color: rgba(255, 255, 255, 0.6);
  230. }
  231. .anticon {
  232. color: rgba(255, 255, 255, 0.8);
  233. }
  234. }
  235. //update-end---author:scott ---date::2022-09-30 for:默认隐藏顶部菜单面包屑--------------
  236. }
  237. // background: linear-gradient(#003f77, #0a134c);
  238. // // background: linear-gradient(#02050c 0%, #03114c 100%);
  239. // // border: none;
  240. // border-bottom: 1px solid #81aabf01;
  241. // padding-bottom: 2px;
  242. // box-shadow: 0 0 20px #44caff55 inset;
  243. .normal-header{
  244. height: 52px !important;
  245. line-height: 52px !important;
  246. background: var(--vent-header-bg-color) !important;
  247. // background: linear-gradient(#005177,#0a344c) !important;
  248. border-bottom: 1px solid #81aabf01 !important;
  249. padding-bottom: 2px !important;
  250. box-shadow: 0 0 20px #44caff55 inset !important;
  251. padding: 0 8px !important;
  252. }
  253. .no-header{
  254. height: 0px !important;
  255. display: none !important;
  256. }
  257. .header-nav-title{
  258. background-image: linear-gradient(#ffffff 50%, #60f4ff);
  259. -webkit-background-clip: text;
  260. color: transparent;
  261. font-weight: 600;
  262. }
  263. </style>