classicalMenu.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <a-layout>
  3. <a-layout-sider
  4. v-if="!isMobile"
  5. :collapsed="menuIsCollapse"
  6. :trigger="null"
  7. collapsible
  8. :theme="sideTheme"
  9. width="250"
  10. :style="{ backgroundColor: sideTheme && sideTheme == 'dark' ? '#1b1c1e' : '' }"
  11. >
  12. <header id="snowyHeaderLogo" class="snowy-header-logo">
  13. <div class="snowy-header-left">
  14. <div class="logo-bar">
  15. <img class="logo" :src="sysBaseConfig.SNOWY_SYS_LOGO" />
  16. <span>{{ sysBaseConfig.SNOWY_SYS_NAME }}</span>
  17. </div>
  18. </div>
  19. </header>
  20. <div :class="menuIsCollapse ? 'admin-ui-side isCollapse' : 'admin-ui-side'">
  21. <div class="admin-ui-side-scroll">
  22. <a-menu
  23. v-bind:openKeys="openKeys"
  24. v-bind:selectedKeys="selectedKeys"
  25. mode="inline"
  26. :theme="sideTheme"
  27. @select="onSelect"
  28. @openChange="onOpenChange"
  29. >
  30. <NavMenu :nav-menus="menu" />
  31. </a-menu>
  32. </div>
  33. </div>
  34. </a-layout-sider>
  35. <!-- 手机端情况下的左侧菜单 -->
  36. <Side-m v-if="isMobile" />
  37. <!-- 右侧布局 -->
  38. <a-layout>
  39. <div id="snowyHeader" class="snowy-header">
  40. <div class="snowy-header-left xn-pl0">
  41. <div v-if="!isMobile" class="panel-item hidden-sm-and-down" @click="menuIsCollapseClick">
  42. <MenuUnfoldOutlined v-if="menuIsCollapse" />
  43. <MenuFoldOutlined v-else />
  44. </div>
  45. <moduleMenu v-if="moduleMenuShow" @switchModule="switchModule" />
  46. </div>
  47. <div class="snowy-header-right">
  48. <user-bar />
  49. </div>
  50. </div>
  51. <Breadcrumb v-if="!isMobile && breadcrumbOpen" />
  52. <!-- 多标签 -->
  53. <Tags v-if="!isMobile && layoutTagsOpen" />
  54. <a-layout-content class="main-content-wrapper">
  55. <div id="admin-ui-main" class="admin-ui-main">
  56. <router-view v-slot="{ Component }">
  57. <keep-alive :include="kStore.keepLiveRoute">
  58. <component :is="Component" v-if="kStore.routeShow" :key="route.name" />
  59. </keep-alive>
  60. </router-view>
  61. <iframe-view />
  62. <div v-if="footerCopyrightOpen" class="main-bottom-wrapper">
  63. <a class="xn-color-a0a0a0" :href="sysBaseConfig.SNOWY_SYS_COPYRIGHT_URL" target="_blank">{{
  64. sysBaseConfig.SNOWY_SYS_COPYRIGHT
  65. }}</a>
  66. </div>
  67. </div>
  68. </a-layout-content>
  69. </a-layout>
  70. </a-layout>
  71. </template>
  72. <script setup>
  73. import { useRoute } from 'vue-router'
  74. const route = useRoute()
  75. import UserBar from '@/layout/components/userbar.vue'
  76. import Tags from '@/layout/components/tags.vue'
  77. import SideM from '@/layout/components/sideM.vue'
  78. import NavMenu from '@/layout/components/NavMenu.vue'
  79. import ModuleMenu from '@/layout/components/moduleMenu.vue'
  80. import IframeView from '@/layout/components/iframeView.vue'
  81. import Breadcrumb from '@/layout/components/breadcrumb.vue'
  82. const props = defineProps({
  83. layout: { type: String }, // 布局信息
  84. isMobile: { type: Boolean }, // 是否移动端
  85. menuIsCollapse: { type: Boolean }, // 菜单是否折叠
  86. sideTheme: { type: String },
  87. sysBaseConfig: { type: Object },
  88. openKeys: { type: Array },
  89. selectedKeys: { type: Array },
  90. menu: { type: Array }, // 菜单
  91. breadcrumbOpen: { type: Boolean }, //面包屑
  92. layoutTagsOpen: { type: Boolean },
  93. kStore: { type: Object }, // 获取的仓库数据
  94. footerCopyrightOpen: { type: Boolean }, //页脚版权信息
  95. moduleMenuShow: { type: Boolean }
  96. })
  97. const emit = defineEmits(['onSelect', 'onOpenChange', 'switchModule', 'menuIsCollapseClick'])
  98. const onSelect = (obj) => {
  99. emit('onSelect', obj)
  100. }
  101. const onOpenChange = (keys) => {
  102. emit('onOpenChange', keys)
  103. }
  104. const switchModule = (id) => {
  105. emit('switchModule', id)
  106. }
  107. const menuIsCollapseClick = () => {
  108. emit('menuIsCollapseClick')
  109. }
  110. </script>
  111. <style lang="less" scoped>
  112. // 经典模式
  113. .ant-layout-sider-dark {
  114. // 菜单栏logo 标题 部分
  115. .snowy-header-logo {
  116. background-color: #1b1c1e;
  117. }
  118. .ant-menu {
  119. background-color: #1b1c1e;
  120. }
  121. }
  122. .xn-color-fff {
  123. color: #fff;
  124. }
  125. .xn-pdl25 {
  126. padding-left: 11px;
  127. }
  128. .xn-menu-line {
  129. text-align: center;
  130. height: auto;
  131. line-height: 20px;
  132. flex: none;
  133. display: block;
  134. padding: 12px 0 !important;
  135. }
  136. .xn-navmenu-line {
  137. min-width: 0;
  138. flex: 1 1 0%;
  139. overflow: hidden;
  140. }
  141. .xn-bb0 {
  142. border-bottom: none;
  143. position: relative;
  144. }
  145. .ant-layout-content {
  146. display: flex;
  147. flex-direction: column;
  148. }
  149. .xn-pd1180 {
  150. padding: 10px 150px 0 150px;
  151. }
  152. .xn-pd050 {
  153. padding: 0 50px;
  154. }
  155. .xn-pl10 {
  156. padding-left: 10px;
  157. }
  158. .xn-mg050 {
  159. margin: 0px 150px;
  160. }
  161. </style>