Layout.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div class="app-wrapper" :class="classObj">
  3. <div class="main-container">
  4. <navbar></navbar>
  5. <div class="main-content">
  6. <div class="app-content">
  7. <sidebar class="sidebar-container" v-if="show_sidebar" :classObj="classObj"></sidebar>
  8. <app-main></app-main>
  9. </div>
  10. <div class="footer_copyright" :class="show_sidebar?'footer_copyright_margin':''">Copyright © {{$moment().format("YYYY")}} 广东功道云数字科技有限公司 All Rights Reserved</div>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import {
  17. Navbar,
  18. Sidebar,
  19. AppMain
  20. } from './components'
  21. import ResizeMixin from './mixin/ResizeHandler'
  22. export default {
  23. name: 'layout',
  24. data() {
  25. return {
  26. video_show_box: true,
  27. video_show: true,
  28. show_sidebar: false,
  29. route_detail: this.$route.path
  30. }
  31. },
  32. components: {
  33. Navbar,
  34. Sidebar,
  35. AppMain,
  36. },
  37. mixins: [ResizeMixin],
  38. computed: {
  39. sidebar() {
  40. return this.$store.state.app.sidebar
  41. },
  42. device() {
  43. return this.$store.state.app.device
  44. },
  45. classObj() {
  46. return {
  47. // hideSidebar: !this.sidebar.opened,
  48. openSidebar: this.sidebar.opened,
  49. withoutAnimation: this.sidebar.withoutAnimation,
  50. mobile: this.device === 'mobile'
  51. }
  52. }
  53. },
  54. methods: {
  55. // handleClickOutside() {
  56. // this.$store.dispatch('closeSideBar', {
  57. // withoutAnimation: false
  58. // })
  59. // }
  60. },
  61. watch:{
  62. $route(to,from){//当点击首页或刚进入时,左边导航栏不显示
  63. if(to.path === '/index' || to.path === '/workbench_blank'){
  64. this.show_sidebar = false
  65. }else{
  66. this.show_sidebar = true
  67. }
  68. }
  69. },
  70. created(){//当点击首页或刚进入时,左边导航栏不显示
  71. if(this.$route.path === '/index' || this.$route.path === '/workbench_blank'){
  72. this.show_sidebar = false
  73. }else{
  74. this.show_sidebar = true
  75. }
  76. }
  77. }
  78. </script>
  79. <style rel="stylesheet/scss" lang="scss" scoped>
  80. @import "src/styles/mixin.scss";
  81. .app-content{
  82. width: 1200px;
  83. margin: 0 auto;
  84. // height: calc(100% - 60px);
  85. position: relative;
  86. }
  87. .app-wrapper {
  88. @include clearfix;
  89. position: relative;
  90. height: 100%;
  91. width: 100%;
  92. &.mobile.openSidebar {
  93. position: fixed;
  94. top: 0;
  95. }
  96. }
  97. .main-content{
  98. background-color:rgba(244, 246, 249, 1);
  99. padding-top: 60px;
  100. height: 100%;
  101. overflow-y: scroll;
  102. }
  103. /*滚动条的宽度*/
  104. .main-content::-webkit-scrollbar {
  105. width:9px;
  106. height:9px;
  107. }
  108. /*外层轨道。可以用display:none让其不显示,也可以添加背景图片,颜色改变显示效果*/
  109. .main-content::-webkit-scrollbar-track {
  110. width: 3px;
  111. background-color:#fff0;
  112. -webkit-border-radius: 2em;
  113. -moz-border-radius: 2em;
  114. border-radius:2em;
  115. }
  116. /*滚动条的设置*/
  117. .main-content::-webkit-scrollbar-thumb {
  118. background-color:#fff0;
  119. background-clip:padding-box;
  120. min-height:28px;
  121. -webkit-border-radius: 2em;
  122. -moz-border-radius: 2em;
  123. border-radius:2em;
  124. }
  125. /*滚动条移上去的背景*/
  126. .main-content:hover::-webkit-scrollbar-thumb{
  127. background-color:rgba(144,147,153,.3);
  128. }
  129. .drawer-bg {
  130. background: #000;
  131. opacity: 0.3;
  132. width: 100%;
  133. top: 0;
  134. height: 100%;
  135. position: absolute;
  136. z-index: 999;
  137. }
  138. .el-submenu__icon-arrow {
  139. margin-top: 0 !important;
  140. }
  141. .footer_copyright{
  142. padding-bottom: 10px;
  143. display: block;
  144. text-align: center;
  145. font-size: 14px;
  146. line-height: 20px;
  147. color: #606266;
  148. width: 1200px;
  149. margin: 0 auto;
  150. }
  151. .footer_copyright_margin{
  152. padding-left: 200px;
  153. }
  154. </style>