leftMenu.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <a-layout>
  3. <template v-if="isMobile">
  4. <!-- 手机端情况下的左侧菜单 -->
  5. <Side-m/>
  6. <!-- 右侧布局 -->
  7. <a-layout>
  8. <div id="snowyHeader" class="snowy-header">
  9. <div class="snowy-header-left xn-pl0">
  10. <div class="logo-bar is-mobile __hover" @click="toPortal">
  11. <img class="logo" :src="sysBaseConfig.SNOWY_SYS_LOGO"/>
  12. <span>{{ sysBaseConfig.SNOWY_SYS_NAME }}</span>
  13. </div>
  14. </div>
  15. <div class="snowy-header-right">
  16. <user-bar/>
  17. </div>
  18. </div>
  19. <a-layout-content class="main-content-wrapper">
  20. <div id="admin-ui-main" class="admin-ui-main">
  21. <router-view v-slot="{ Component }">
  22. <keep-alive :include="kStore.keepLiveRoute">
  23. <component :is="Component" v-if="kStore.routeShow" :key="route.name"/>
  24. </keep-alive>
  25. </router-view>
  26. <iframe-view/>
  27. <div v-if="footerCopyrightOpen" class="main-bottom-wrapper">
  28. <a class="xn-color-a0a0a0" :href="sysBaseConfig.SNOWY_SYS_COPYRIGHT_URL" target="_blank">{{
  29. sysBaseConfig.SNOWY_SYS_COPYRIGHT
  30. }}</a>
  31. </div>
  32. </div>
  33. </a-layout-content>
  34. </a-layout>
  35. </template>
  36. <template v-else>
  37. <a-layout-header class="left-menu-header">
  38. <div id="snowyHeader" class="snowy-header">
  39. <div class="snowy-header-left xn-pl0">
  40. <div class="logo-bar __hover" @click="toPortal">
  41. <img class="logo" :src="sysBaseConfig.SNOWY_SYS_LOGO"/>
  42. <span>{{ sysBaseConfig.SNOWY_SYS_NAME }}</span>
  43. </div>
  44. </div>
  45. <div class="snowy-header-right">
  46. <user-bar/>
  47. </div>
  48. </div>
  49. </a-layout-header>
  50. <a-layout>
  51. <a-layout-sider
  52. :collapsed="menuIsCollapse"
  53. :trigger="null"
  54. collapsible
  55. :theme="sideTheme"
  56. width="190"
  57. >
  58. <div :class="menuIsCollapse ? 'admin-ui-side isCollapse' : 'admin-ui-side'">
  59. <div class="admin-ui-side-scroll">
  60. <a-menu
  61. v-bind:openKeys="openKeys"
  62. v-bind:selectedKeys="selectedKeys"
  63. :theme="sideTheme"
  64. mode="inline"
  65. @select="onSelect"
  66. @openChange="onOpenChange"
  67. :inlineIndent="18"
  68. >
  69. <NavMenu :nav-menus="menu"/>
  70. </a-menu>
  71. </div>
  72. </div>
  73. </a-layout-sider>
  74. <!-- 右侧布局 -->
  75. <a-layout>
  76. <Breadcrumb v-if="!isMobile && breadcrumbOpen"/>
  77. <!-- 多标签 -->
  78. <Tags v-if="!isMobile && layoutTagsOpen"/>
  79. <a-layout-content class="main-content-wrapper">
  80. <div id="admin-ui-main" class="admin-ui-main">
  81. <router-view v-slot="{ Component }">
  82. <keep-alive :include="kStore.keepLiveRoute">
  83. <component :is="Component" v-if="kStore.routeShow" :key="route.name"/>
  84. </keep-alive>
  85. </router-view>
  86. <iframe-view/>
  87. <div v-if="footerCopyrightOpen" class="main-bottom-wrapper">
  88. <a class="xn-color-a0a0a0" :href="sysBaseConfig.SNOWY_SYS_COPYRIGHT_URL" target="_blank">{{
  89. sysBaseConfig.SNOWY_SYS_COPYRIGHT
  90. }}</a>
  91. </div>
  92. </div>
  93. </a-layout-content>
  94. </a-layout>
  95. </a-layout>
  96. </template>
  97. </a-layout>
  98. </template>
  99. <script setup>
  100. import {useRoute} from 'vue-router'
  101. const route = useRoute()
  102. import UserBar from '@/layout/components/userbar.vue'
  103. import Tags from '@/layout/components/tags.vue'
  104. import SideM from '@/layout/components/sideM.vue'
  105. import NavMenu from '@/layout/components/NavMenu.vue'
  106. import ModuleMenu from '@/layout/components/moduleMenu.vue'
  107. import IframeView from '@/layout/components/iframeView.vue'
  108. import Breadcrumb from '@/layout/components/breadcrumb.vue'
  109. import {toPortal} from "@/views/auth/login/util";
  110. const props = defineProps({
  111. layout: {type: String}, // 布局信息
  112. isMobile: {type: Boolean}, // 是否移动端
  113. menuIsCollapse: {type: Boolean}, // 菜单是否折叠
  114. sideTheme: {type: String},
  115. sysBaseConfig: {type: Object},
  116. openKeys: {type: Array},
  117. selectedKeys: {type: Array},
  118. menu: {type: Array}, // 菜单
  119. breadcrumbOpen: {type: Boolean}, //面包屑
  120. layoutTagsOpen: {type: Boolean},
  121. kStore: {type: Object}, // 获取的仓库数据
  122. footerCopyrightOpen: {type: Boolean}, //页脚版权信息
  123. moduleMenuShow: {type: Boolean}
  124. })
  125. const emit = defineEmits(['onSelect', 'onOpenChange', 'switchModule', 'menuIsCollapseClick'])
  126. const onSelect = (obj) => {
  127. emit('onSelect', obj)
  128. }
  129. const onOpenChange = (keys) => {
  130. emit('onOpenChange', keys)
  131. }
  132. const switchModule = (id) => {
  133. emit('switchModule', id)
  134. }
  135. const menuIsCollapseClick = () => {
  136. emit('menuIsCollapseClick')
  137. }
  138. </script>
  139. <style lang="less" scoped>
  140. .xn-color-fff {
  141. color: #fff;
  142. }
  143. .xn-pdl25 {
  144. padding-left: 11px;
  145. }
  146. .xn-menu-line {
  147. text-align: center;
  148. height: auto;
  149. line-height: 20px;
  150. flex: none;
  151. display: block;
  152. padding: 12px 0 !important;
  153. }
  154. .xn-navmenu-line {
  155. min-width: 0;
  156. flex: 1 1 0%;
  157. overflow: hidden;
  158. }
  159. .xn-bb0 {
  160. border-bottom: none;
  161. position: relative;
  162. }
  163. .ant-layout-content {
  164. display: flex;
  165. flex-direction: column;
  166. background-color: #08112A;
  167. }
  168. .xn-pd1180 {
  169. padding: 10px 150px 0 150px;
  170. }
  171. .xn-pd050 {
  172. padding: 0 50px;
  173. }
  174. .xn-pl10 {
  175. padding-left: 10px;
  176. }
  177. .xn-mg050 {
  178. margin: 0px 150px;
  179. }
  180. .left-menu-header {
  181. padding: 0;
  182. height: 40px;
  183. .snowy-header {
  184. height: 100%;
  185. background-color: #266EFF;
  186. border: none;
  187. .snowy-header-left {
  188. }
  189. .snowy-header-right {
  190. color: #ffffff;
  191. :deep(.user-bar) {
  192. >* {
  193. font-size: 18px;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. :deep(.ant-layout-sider) {
  200. background-image: url("./left-menu.png");
  201. background-repeat: no-repeat;
  202. background-position: left bottom;
  203. background-size: 190px auto;
  204. .ant-menu {
  205. background-color: transparent !important;
  206. .ant-menu-submenu-title {
  207. padding-right: 12px;
  208. padding-left: 10px !important;
  209. .ant-menu-submenu-arrow {
  210. inset-inline-end: 4px;
  211. }
  212. }
  213. }
  214. }
  215. </style>