peng
2026-03-18 b89df58e3b783f3d718bd85a3e4c6a3bd9ee353c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
  <a-layout class="layout desktop">
    <a-layout :class="['top-menu', `content-width-${contentWidth}`]" :style="{ paddingLeft: fixSidebar && `80px` }">
      <!-- layout header -->
      <top-menu-header :menus="menus" />
 
      <!-- layout content -->
      <a-layout-content :style="{ height: '100%', paddingTop: fixedHeader ? '56px' : '0' }">
        <slot></slot>
      </a-layout-content>
 
      <!-- layout footer -->
      <a-layout-footer style="padding: 0px">
        <global-footer />
      </a-layout-footer>
    </a-layout>
  </a-layout>
</template>
 
<script>
import TopMenuHeader from './TopMenuHeader'
import GlobalFooter from '@/components/page/GlobalFooter'
import SideMenu from '@/components/menu/SideMenu'
import { mapState } from 'vuex'
import { mixin, mixinDevice } from '@tievd/cube-block/lib/utils/mixin.js'
import skinLayoutMixin from '@/mixins/skin-layout-mixin'
 
export default {
  name: 'TopMenuLayout',
 
  components: {
    TopMenuHeader,
    GlobalFooter,
    SideMenu
  },
 
  mixins: [mixin, mixinDevice, skinLayoutMixin],
 
  data() {
    return {
      activeMenu: {},
      menus: []
    }
  },
 
  computed: {
    ...mapState({
      // 主路由
      mainRouters: state => state.permission.addRouters,
      // 后台菜单
      permissionMenuList: state => state.user.permissionList
    })
  },
 
  created() {
    this.menus = this.permissionMenuList
  }
}
</script>
 
<style scoped lang="less">
body {
  // 打开滚动条固定显示
  overflow-y: scroll;
 
  &.colorWeak {
    filter: invert(80%);
  }
}
 
.layout {
  min-height: 100vh !important;
  overflow-x: hidden;
 
  // 内容区
  .layout-content {
    margin: 24px 24px 0px;
    height: 64px;
    padding: 0 12px 0 0;
  }
}
 
// 顶部菜单模式
.top-menu {
  .page-header-index-wide {
    margin: 0 auto;
    width: 100%;
  }
 
  .ant-header-fixed-header {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9;
    width: 100%;
    transition: width 0.2s;
 
    &.ant-header-side-opened {
      width: 100%;
    }
 
    &.ant-header-side-closed {
      width: 100%;
    }
  }
  /* 必须为 top-menu  才能启用流式布局 */
  &.content-width-fluid {
    .header-index-wide {
      max-width: unset;
      margin-left: 24px;
    }
 
    .page-header-index-wide {
      max-width: unset;
    }
  }
}
 
.layout .top-nav-header-index .user-wrapper .action .anticon {
  color: inherit !important;
}
</style>