MenuSingleLayer.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <el-container>
  3. <el-aside :width="sidebar.opened ? '230px' : '64px'">
  4. <sidebarA class="sidebar-container" />
  5. </el-aside>
  6. <el-container>
  7. <el-header
  8. class="header"
  9. :style="{ width: `calc(100% - ${sidebar.opened ? '230px' : '64px'})` }"
  10. >
  11. <!-- 头部 导航 -->
  12. <navbar :nameshow="nameshow" />
  13. </el-header>
  14. <el-main>
  15. <div :class="{ hasTagsView: needTagsView }" class="main-container">
  16. <div :class="{ 'fixed-header': fixedHeader }">
  17. <div style="margin: 10px 0 0 10px">
  18. <tags-view v-if="needTagsView" />
  19. <app-main />
  20. </div>
  21. </div>
  22. </div>
  23. </el-main>
  24. <right-panel v-if="showSettings">
  25. <settings />
  26. </right-panel>
  27. </el-container>
  28. </el-container>
  29. </template>
  30. <script>
  31. import RightPanel from "@/components/RightPanel";
  32. import { AppMain, Navbar, Settings, Sidebar, TagsView } from "./components";
  33. import SubSidebar from "./components/subSidebar";
  34. import ResizeMixin from "./mixin/ResizeHandler";
  35. import sidebarA from "./components/SidebarA";
  36. import { mapState } from "vuex";
  37. export default {
  38. name: "Layout",
  39. components: {
  40. AppMain,
  41. Navbar,
  42. RightPanel,
  43. Settings,
  44. Sidebar,
  45. SubSidebar,
  46. TagsView,
  47. sidebarA
  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. transition: width 0.3s;
  105. top: 0;
  106. z-index: 1000;
  107. transition: width 0.3s;
  108. &.hideSidebar {
  109. width: calc(100% - 64px);
  110. }
  111. }
  112. .el-main {
  113. margin-top: 50px;
  114. }
  115. .app-wrapper {
  116. @include clearfix;
  117. position: relative;
  118. height: 100%;
  119. width: 100%;
  120. &.mobile.openSidebar {
  121. position: fixed;
  122. top: 0;
  123. }
  124. }
  125. .drawer-bg {
  126. background: #000;
  127. opacity: 0.3;
  128. width: 100%;
  129. top: 0;
  130. height: 100%;
  131. position: absolute;
  132. z-index: 999;
  133. }
  134. .fixed-header {
  135. position: fixed;
  136. top: 0;
  137. right: 0;
  138. z-index: 9;
  139. width: calc(100% - #{$sideBarWidth});
  140. transition: width 0.28s;
  141. }
  142. .hideSidebar .fixed-header {
  143. width: calc(100% - 54px);
  144. }
  145. .mobile .fixed-header {
  146. width: 100%;
  147. }
  148. .helpcenter {
  149. flex: 1.5;
  150. margin-left: 10px;
  151. margin-right: -20px;
  152. margin-top: 10px;
  153. border-radius: 5px;
  154. box-shadow: 0 0 5px rgba(100, 100, 100, 0.2);
  155. }
  156. .min_width {
  157. width: calc(100vw - 250px);
  158. }
  159. .max_width {
  160. width: calc(100vw - 130px);
  161. }
  162. .left_main {
  163. display: flex;
  164. padding: 0px 20px;
  165. background-color: #f8f8f8;
  166. height: calc(100vh - 50px);
  167. overflow: hidden;
  168. padding-right: 10px;
  169. }
  170. #main_work {
  171. margin-top: 10px;
  172. /*overflow-y: scroll;*/
  173. height: calc(100vh - 100px);
  174. }
  175. </style>