| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <template>
- <a-layout class="layout-top">
- <a-layout-header class="m-layout-header">
- <Header />
- </a-layout-header>
- <a-layout class="middleLayout">
- <a-layout-sider
- class="m-layout-left"
- width="180"
- v-model:collapsed="collapsed"
- @collapse="collapse"
- collapsible
- >
- <Menu @chooseMenu="chooseMenu" :collapsed="collapsed" />
- </a-layout-sider>
- <a-layout-content :style="{ background: '#0E0E0F', flex: 1 }">
- <Drawer :title="'挂牌'" :visible="visible"></Drawer>
- <!-- <Main /> -->
- <router-view />
- </a-layout-content>
- </a-layout>
- </a-layout>
- </template>
- <script lang="ts">
- import { defineComponent, ref, provide } from 'vue';
- import CapitalInfo from '@/common/components/capitalInfo/index.vue';
- import SecondMenu from '@/common/components/secondeMenu/index.vue';
- import { useRouter } from 'vue-router';
- import Drawer from '@/common/components/drawer/index.vue';
- import Header from './header.vue';
- import Menu from './menu.vue';
- import Main from './main.vue';
- import { OperationTabMenu } from '@/services/go/commonService/interface';
- export default defineComponent({
- name: 'layout-top',
- components: {
- CapitalInfo,
- SecondMenu,
- Drawer,
- Main,
- Menu,
- Header,
- },
- setup(props, context) {
- const router = useRouter();
- const list = ref<OperationTabMenu[]>([]); // 右边tab栏 需要的列表数据
- const index = ref<string[]>(['0']); // 右边tab栏 具体选中的哪一个数据 默认第一个
- // 配置是否显示下半部分
- function setShowBottomPart(code: string) {
- // 显示下半部分 这里保存的是市场对应的 code
- const show: string[] = [''];
- context.emit('chooseMenu', show.includes(code));
- }
- // 选中菜单
- function chooseMenu(value: OperationTabMenu) {
- const temp = router.currentRoute.value.name;
- let name = temp;
- if (temp === 'home') {
- // 第一次进入项目
- if (value?.children.length) {
- // 默认第一个tab页
- name = value.children[0].code;
- index.value = ['0'];
- } else {
- router.push({ name: '404' });
- return;
- }
- } else {
- // 这里处理页面刷新,还原 导航栏数据
- const i = value.children.findIndex((e) => e.code === temp);
- if (i === -1) {
- // 切换左边菜单栏
- if (value?.children.length) {
- // 默认第一个tab页
- name = value.children[0].code;
- index.value = ['0'];
- } else {
- router.push({ name: '404' });
- return;
- }
- } else {
- // 切换右边上面tab 栏
- index.value = [`${i}`];
- }
- }
- list.value = value.children;
- setShowBottomPart(value.code);
- router.push({ name: name as string });
- }
- // 选中菜单的数据
- provide('thirdMenuList', list);
- provide('index', index);
- // 控制菜单是否隐藏
- const collapsed = ref<boolean>(false);
- function collapse(show: boolean) {
- collapsed.value = show;
- }
- return {
- collapsed,
- collapse,
- chooseMenu,
- };
- },
- });
- </script>
- <style lang="less">
- .layout-top {
- .flex;
- width: 100%;
- height: calc(100% - 336px);
- flex-direction: column;
- .m-layout-header {
- width: 100%;
- height: 40px;
- line-height: 40px;
- background: @m-grey0;
- color: @m-grey1;
- padding: 0 20px;
- .flex();
- justify-content: space-between;
- img {
- margin-right: 16px;
- width: 20px;
- height: 20px;
- }
- .searchInput.ant-input-affix-wrapper {
- width: 240px;
- height: 30px;
- line-height: 30px;
- font-size: 14px;
- background: @m-grey9;
- border: 0;
- vertical-align: middle;
- padding-left: 40px;
- position: relative;
- .rounded-corners(15px);
- .ant-input {
- background: @m-grey9;
- color: @m-white0;
- }
- .ant-input-suffix {
- margin-left: -215px;
- .ant-input-search-icon {
- color: @m-grey10;
- }
- }
- }
- .m-layout-header-right {
- .flex();
- .news-container {
- padding-left: 10px;
- padding-right: 16px;
- .ant-badge {
- margin-top: 7px;
- cursor: pointer;
- > svg {
- font-size: 24px;
- }
- .ant-badge-dot {
- box-shadow: 0 0 0 1px @m-red0;
- }
- }
- }
- .ant-avatar-icon {
- margin-top: -3px;
- }
- }
- }
- .middleLayout {
- flex: 1;
- width: 100%;
- height: calc(100% - 40px);
- max-height: calc(100% - 40px);
- background: @m-grey18;
- .inlineflex;
- border-bottom: 1px solid @m-black2;
- .ant-layout-sider-has-trigger {
- background: @m-black4;
- .ant-layout-sider-children {
- background: @m-grey18;
- }
- }
- .m-layout-left {
- min-height: calc(100vh - 376px);
- background: @m-black4;
- overflow: hidden;
- .ant-layout-sider-children {
- ul.ant-menu.ant-menu-inline.left-menu {
- height: calc(100vh - 376px);
- overflow-y: auto;
- li.ant-menu-submenu {
- padding-bottom: 0;
- .ant-menu-submenu-title {
- color: @m-grey2;
- font-size: 16px;
- height: 60px;
- line-height: 60px;
- margin-top: 0;
- margin-bottom: 0;
- padding: 5px 0;
- .icon {
- font-size: 20px;
- }
- .menu-item_title {
- display: inline-block;
- font-size: 16px;
- margin-left: 15px;
- }
- }
- .ant-menu-sub {
- .ant-menu-item {
- padding-left: 60px !important;
- margin-top: 5px;
- margin-bottom: 5px;
- }
- }
- }
- li.ant-menu-submenu-open {
- .ant-menu-submenu-title {
- color: @m-white0;
- .icon {
- color: @m-white0;
- }
- }
- .ant-menu-sub {
- .ant-menu-item.ant-menu-item-selected {
- background-color: @m-blue0;
- }
- }
- }
- }
- }
- .ant-layout-sider-trigger {
- width: 100%;
- height: 40px;
- line-height: 40px;
- background: @m-black0;
- position: absolute;
- }
- }
- .ant-menu-vertical {
- .ant-menu-submenu-vertical {
- height: 60px;
- line-height: 60px;
- padding: 5px 0;
- .ant-menu-submenu-title {
- height: 50px;
- line-height: 50px;
- .icon {
- font-size: 20px;
- }
- }
- }
- .ant-menu-submenu {
- .ant-menu-submenu-title {
- .menu-item_title {
- display: none;
- }
- }
- }
- }
- }
- .bottomLayout {
- width: 100%;
- flex: none;
- height: @bottomHeight;
- .inlineflex;
- }
- }
- </style>
|