MenuSingleLayer.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <el-container >
  3. <el-aside width="140px" style="margin-bottom: 20px">
  4. <sidebarA class="sidebar-container" />
  5. </el-aside>
  6. <el-container>
  7. <el-header class="header">
  8. <!-- 头部 导航 -->
  9. <navbar :nameshow="nameshow" @helpcenterEvent="showhelp" />
  10. </el-header>
  11. <el-main>
  12. <div :class="{hasTagsView:needTagsView}" class="main-container">
  13. <div :class="{'fixed-header':fixedHeader}">
  14. <div style="margin: 10px 0 0 10px">
  15. <tags-view v-if="needTagsView" />
  16. <app-main />
  17. <CozeChat></CozeChat>
  18. </div>
  19. </div>
  20. </div>
  21. </el-main>
  22. <right-panel v-if="showSettings">
  23. <settings />
  24. </right-panel>
  25. </el-container>
  26. </el-container>
  27. </template>
  28. <script>
  29. import RightPanel from '@/components/RightPanel'
  30. import { AppMain, Navbar, Settings, Sidebar, TagsView, HelpWord,CozeChat } from './components'
  31. import SubSidebar from './components/subSidebar'
  32. import ResizeMixin from './mixin/ResizeHandler'
  33. import sidebarA from './components/SidebarA'
  34. import { mapState } from 'vuex'
  35. export default {
  36. name: 'Layout',
  37. components: {
  38. AppMain,
  39. Navbar,
  40. RightPanel,
  41. Settings,
  42. Sidebar,
  43. SubSidebar,
  44. TagsView,
  45. HelpWord,
  46. sidebarA,
  47. CozeChat
  48. },
  49. mixins: [ResizeMixin],
  50. computed: {
  51. ...mapState({
  52. sidebar: state => state.app.sidebar,
  53. device: state => state.app.device,
  54. showSettings: state => state.settings.showSettings,
  55. needTagsView: state => state.settings.tagsView,
  56. fixedHeader: state => state.settings.fixedHeader
  57. }),
  58. classObj() {
  59. return {
  60. hideSidebar: !this.sidebar.opened,
  61. openSidebar: this.sidebar.opened,
  62. withoutAnimation: this.sidebar.withoutAnimation,
  63. mobile: this.device === 'mobile'
  64. }
  65. }
  66. },
  67. data() {
  68. return {
  69. sidebarType:1,
  70. currRouter: null,
  71. nameshow: false,
  72. showhelped: false
  73. }
  74. },
  75. methods: {
  76. handleClickOutside() {
  77. this.$store.dispatch('app/closeSideBar', {
  78. withoutAnimation: false
  79. })
  80. },
  81. byChildByParent(currRouter) {
  82. this.currRouter = currRouter;
  83. if(currRouter === null) {
  84. this.nameshow = false
  85. } else {
  86. this.nameshow = true
  87. }
  88. },
  89. showhelp(data) {
  90. this.showhelped = data
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. @import "../styles/mixin.scss";
  97. @import "../styles/variablesSingleLayer.scss";
  98. ::v-deep .el-main {
  99. padding: 0;
  100. }
  101. .el-header {
  102. padding: 0;
  103. position: fixed;
  104. width: -webkit-calc(100% - #{$sideBarWidth});
  105. width: -moz-calc(100% - #{$sideBarWidth});
  106. width: calc(100% - #{$sideBarWidth});
  107. top: 0;
  108. z-index: 1000;
  109. }
  110. .el-main {
  111. margin-top: 50px;
  112. }
  113. .app-wrapper {
  114. @include clearfix;
  115. position: relative;
  116. height: 100%;
  117. width: 100%;
  118. &.mobile.openSidebar {
  119. position: fixed;
  120. top: 0;
  121. }
  122. }
  123. .drawer-bg {
  124. background: #000;
  125. opacity: 0.3;
  126. width: 100%;
  127. top: 0;
  128. height: 100%;
  129. position: absolute;
  130. z-index: 999;
  131. }
  132. .fixed-header {
  133. position: fixed;
  134. top: 0;
  135. right: 0;
  136. z-index: 9;
  137. width: calc(100% - #{$sideBarWidth});
  138. transition: width 0.28s;
  139. }
  140. .hideSidebar .fixed-header {
  141. width: calc(100% - 54px)
  142. }
  143. .mobile .fixed-header {
  144. width: 100%;
  145. }
  146. .helpcenter {
  147. flex: 1.5;
  148. margin-left: 10px;
  149. margin-right: -20px;
  150. margin-top: 10px;
  151. border-radius: 5px;
  152. box-shadow: 0 0 5px rgba(100, 100, 100, .2);
  153. }
  154. .min_width{
  155. width: calc(100vw - 250px);
  156. }
  157. .max_width{
  158. width: calc(100vw - 130px);
  159. }
  160. .left_main{
  161. display: flex;
  162. padding: 0px 20px;
  163. background-color: #f8f8f8;
  164. height: calc(100vh - 50px);
  165. overflow: hidden;
  166. padding-right: 10px;
  167. }
  168. #main_work{
  169. margin-top: 10px;
  170. /*overflow-y: scroll;*/
  171. height: calc(100vh - 100px);
  172. }
  173. </style>