top.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <a-layout class="layout-top">
  3. <a-layout-header class="m-layout-header">
  4. <Header />
  5. </a-layout-header>
  6. <a-layout class="middleLayout">
  7. <a-layout-sider
  8. class="m-layout-left"
  9. width="180"
  10. v-model:collapsed="collapsed"
  11. @collapse="collapse"
  12. collapsible
  13. >
  14. <Menu @chooseMenu="chooseMenu" :collapsed="collapsed" />
  15. </a-layout-sider>
  16. <a-layout-content :style="{ background: '#0E0E0F', flex: 1 }">
  17. <Drawer :title="'挂牌'" :visible="visible"></Drawer>
  18. <!-- <Main /> -->
  19. <router-view />
  20. </a-layout-content>
  21. </a-layout>
  22. </a-layout>
  23. </template>
  24. <script lang="ts">
  25. import { defineComponent, ref, provide } from 'vue';
  26. import CapitalInfo from '@/common/components/capitalInfo/index.vue';
  27. import SecondMenu from '@/common/components/secondeMenu/index.vue';
  28. import { useRouter } from 'vue-router';
  29. import Drawer from '@/common/components/drawer/index.vue';
  30. import Header from './header.vue';
  31. import Menu from './menu.vue';
  32. import Main from './main.vue';
  33. import { OperationTabMenu } from '@/services/go/commonService/interface';
  34. export default defineComponent({
  35. name: 'layout-top',
  36. components: {
  37. CapitalInfo,
  38. SecondMenu,
  39. Drawer,
  40. Main,
  41. Menu,
  42. Header,
  43. },
  44. setup(props, context) {
  45. const router = useRouter();
  46. const list = ref<OperationTabMenu[]>([]); // 右边tab栏 需要的列表数据
  47. const index = ref<string[]>(['0']); // 右边tab栏 具体选中的哪一个数据 默认第一个
  48. // 配置是否显示下半部分
  49. function setShowBottomPart(code: string) {
  50. // 显示下半部分 这里保存的是市场对应的 code
  51. const show: string[] = [''];
  52. context.emit('chooseMenu', show.includes(code));
  53. }
  54. // 选中菜单
  55. function chooseMenu(value: OperationTabMenu) {
  56. const temp = router.currentRoute.value.name;
  57. let name = temp;
  58. if (temp === 'home') {
  59. // 第一次进入项目
  60. if (value?.children.length) {
  61. // 默认第一个tab页
  62. name = value.children[0].code;
  63. index.value = ['0'];
  64. } else {
  65. router.push({ name: '404' });
  66. return;
  67. }
  68. } else {
  69. // 这里处理页面刷新,还原 导航栏数据
  70. const i = value.children.findIndex((e) => e.code === temp);
  71. if (i === -1) {
  72. // 切换左边菜单栏
  73. if (value?.children.length) {
  74. // 默认第一个tab页
  75. name = value.children[0].code;
  76. index.value = ['0'];
  77. } else {
  78. router.push({ name: '404' });
  79. return;
  80. }
  81. } else {
  82. // 切换右边上面tab 栏
  83. index.value = [`${i}`];
  84. }
  85. }
  86. list.value = value.children;
  87. setShowBottomPart(value.code);
  88. router.push({ name: name as string });
  89. }
  90. // 选中菜单的数据
  91. provide('thirdMenuList', list);
  92. provide('index', index);
  93. // 控制菜单是否隐藏
  94. const collapsed = ref<boolean>(false);
  95. function collapse(show: boolean) {
  96. collapsed.value = show;
  97. }
  98. return {
  99. collapsed,
  100. collapse,
  101. chooseMenu,
  102. };
  103. },
  104. });
  105. </script>
  106. <style lang="less">
  107. .layout-top {
  108. .flex;
  109. width: 100%;
  110. height: calc(100% - 336px);
  111. flex-direction: column;
  112. .m-layout-header {
  113. width: 100%;
  114. height: 40px;
  115. line-height: 40px;
  116. background: @m-grey0;
  117. color: @m-grey1;
  118. padding: 0 20px;
  119. .flex();
  120. justify-content: space-between;
  121. img {
  122. margin-right: 16px;
  123. width: 20px;
  124. height: 20px;
  125. }
  126. .searchInput.ant-input-affix-wrapper {
  127. width: 240px;
  128. height: 30px;
  129. line-height: 30px;
  130. font-size: 14px;
  131. background: @m-grey9;
  132. border: 0;
  133. vertical-align: middle;
  134. padding-left: 40px;
  135. position: relative;
  136. .rounded-corners(15px);
  137. .ant-input {
  138. background: @m-grey9;
  139. color: @m-white0;
  140. }
  141. .ant-input-suffix {
  142. margin-left: -215px;
  143. .ant-input-search-icon {
  144. color: @m-grey10;
  145. }
  146. }
  147. }
  148. .m-layout-header-right {
  149. .flex();
  150. .news-container {
  151. padding-left: 10px;
  152. padding-right: 16px;
  153. .ant-badge {
  154. margin-top: 7px;
  155. cursor: pointer;
  156. > svg {
  157. font-size: 24px;
  158. }
  159. .ant-badge-dot {
  160. box-shadow: 0 0 0 1px @m-red0;
  161. }
  162. }
  163. }
  164. .ant-avatar-icon {
  165. margin-top: -3px;
  166. }
  167. }
  168. }
  169. .middleLayout {
  170. flex: 1;
  171. width: 100%;
  172. height: calc(100% - 40px);
  173. max-height: calc(100% - 40px);
  174. background: @m-grey18;
  175. .inlineflex;
  176. border-bottom: 1px solid @m-black2;
  177. .ant-layout-sider-has-trigger {
  178. background: @m-black4;
  179. .ant-layout-sider-children {
  180. background: @m-grey18;
  181. }
  182. }
  183. .m-layout-left {
  184. min-height: calc(100vh - 376px);
  185. background: @m-black4;
  186. overflow: hidden;
  187. .ant-layout-sider-children {
  188. ul.ant-menu.ant-menu-inline.left-menu {
  189. height: calc(100vh - 376px);
  190. overflow-y: auto;
  191. li.ant-menu-submenu {
  192. padding-bottom: 0;
  193. .ant-menu-submenu-title {
  194. color: @m-grey2;
  195. font-size: 16px;
  196. height: 60px;
  197. line-height: 60px;
  198. margin-top: 0;
  199. margin-bottom: 0;
  200. padding: 5px 0;
  201. .icon {
  202. font-size: 20px;
  203. }
  204. .menu-item_title {
  205. display: inline-block;
  206. font-size: 16px;
  207. margin-left: 15px;
  208. }
  209. }
  210. .ant-menu-sub {
  211. .ant-menu-item {
  212. padding-left: 60px !important;
  213. margin-top: 5px;
  214. margin-bottom: 5px;
  215. }
  216. }
  217. }
  218. li.ant-menu-submenu-open {
  219. .ant-menu-submenu-title {
  220. color: @m-white0;
  221. .icon {
  222. color: @m-white0;
  223. }
  224. }
  225. .ant-menu-sub {
  226. .ant-menu-item.ant-menu-item-selected {
  227. background-color: @m-blue0;
  228. }
  229. }
  230. }
  231. }
  232. }
  233. .ant-layout-sider-trigger {
  234. width: 100%;
  235. height: 40px;
  236. line-height: 40px;
  237. background: @m-black0;
  238. position: absolute;
  239. }
  240. }
  241. .ant-menu-vertical {
  242. .ant-menu-submenu-vertical {
  243. height: 60px;
  244. line-height: 60px;
  245. padding: 5px 0;
  246. .ant-menu-submenu-title {
  247. height: 50px;
  248. line-height: 50px;
  249. .icon {
  250. font-size: 20px;
  251. }
  252. }
  253. }
  254. .ant-menu-submenu {
  255. .ant-menu-submenu-title {
  256. .menu-item_title {
  257. display: none;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. .bottomLayout {
  264. width: 100%;
  265. flex: none;
  266. height: @bottomHeight;
  267. .inlineflex;
  268. }
  269. }
  270. </style>