index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div :class="classObj" class="app-wrapper zap-home" :style="{'--current-color': theme}">
  3. <!-- 一级导航水平 start -->
  4. <!-- <el-header style="width:100%"> -->
  5. <div class="zap-header" :style="{backgroundColor: variables.menuBg}">
  6. <div style="display:flex;align-items:center;">
  7. <img class="zap-home-logo" src="../assets/images/home_logo.png" alt="">
  8. <div class="zap-home-name">融信宝</div>
  9. </div>
  10. <div style="display: flex; align-items: center;">
  11. <div class="zap-home-search">
  12. <img class="zap-home-search__icon" src="../assets/images/home_search.png" alt="">
  13. <el-input class="zap-home-search__input" placeholder="输入搜索关键词"></el-input>
  14. </div>
  15. <img class="zap-home-header__icon" src="../assets/images/nav_icon1.png" alt="">
  16. <img class="zap-home-header__icon" src="../assets/images/nav_icon2.png" alt="">
  17. <!-- <user /> -->
  18. <img class="zap-avatar" :src="avatar" alt="">
  19. <P class="zap-username">{{name}}</P>
  20. </div>
  21. </div>
  22. <!-- </el-header> -->
  23. <!-- 一级导航水平 end -->
  24. <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
  25. <sidebar class="sidebar-container" />
  26. <div :class="{hasTagsView:needTagsView}" class="main-container">
  27. <div :class="{'fixed-header':fixedHeader}">
  28. <navbar />
  29. <tags-view v-if="needTagsView" />
  30. </div>
  31. <app-main />
  32. <right-panel v-if="showSettings">
  33. <settings />
  34. </right-panel>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import RightPanel from '@/components/RightPanel'
  40. import { AppMain, Navbar, Settings, Sidebar, TagsView, Horizontalbar, User } from './components'
  41. import ResizeMixin from './mixin/ResizeHandler'
  42. import { mapGetters, mapState } from "vuex"
  43. import variables from '@/assets/styles/variables.scss'
  44. export default {
  45. name: 'Layout',
  46. components: {
  47. AppMain,
  48. Navbar,
  49. RightPanel,
  50. Settings,
  51. Sidebar,
  52. Horizontalbar,
  53. TagsView,
  54. User
  55. },
  56. mixins: [ResizeMixin],
  57. computed: {
  58. ...mapState({
  59. settings: state => state.settings,
  60. theme: state => state.settings.theme,
  61. sideTheme: state => state.settings.sideTheme,
  62. sidebar: state => state.app.sidebar,
  63. device: state => state.app.device,
  64. showSettings: state => state.settings.showSettings,
  65. needTagsView: state => state.settings.tagsView,
  66. fixedHeader: state => state.settings.fixedHeader
  67. }),
  68. ...mapGetters(["permission_routes", "sidebar", "avatar", "name"]),
  69. classObj() {
  70. return {
  71. hideSidebar: !this.sidebar.opened,
  72. openSidebar: this.sidebar.opened,
  73. withoutAnimation: this.sidebar.withoutAnimation,
  74. mobile: this.device === 'mobile'
  75. }
  76. },
  77. variables() {
  78. return variables;
  79. },
  80. activeMenu() {
  81. const route = this.$route;
  82. const { matched } = route;
  83. // if set path, the sidebar will highlight the path you set
  84. if (matched[0]) {
  85. return matched[0].path;
  86. }
  87. return '';
  88. },
  89. },
  90. methods: {
  91. handleClickOutside() {
  92. this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. .zap-home{
  99. .el-input--medium .el-input__inner{
  100. font-size: 16px;
  101. border-color: transparent;
  102. }
  103. }
  104. </style>
  105. <style lang="scss" scoped>
  106. @import "~@/assets/styles/mixin.scss";
  107. @import "~@/assets/styles/variables.scss";
  108. .horizontalbar-container{
  109. // display: flex;
  110. justify-content: space-between;
  111. padding-left: 270px;
  112. z-index:5;
  113. .el-menu-item{
  114. padding: 0 2%;
  115. }
  116. }
  117. .app-wrapper {
  118. @include clearfix;
  119. position: relative;
  120. height: 100%;
  121. width: 100%;
  122. &.mobile.openSidebar {
  123. // position: fixed;
  124. top: 0;
  125. }
  126. }
  127. .drawer-bg {
  128. background: #000;
  129. opacity: 0.3;
  130. width: 100%;
  131. top: 0;
  132. height: 100%;
  133. position: absolute;
  134. z-index: 999;
  135. }
  136. .fixed-header {
  137. // position: fixed;
  138. top: 0;
  139. right: 0;
  140. z-index: 9;
  141. width: calc(100% - #{$sideBarWidth});
  142. transition: width 0.28s;
  143. }
  144. .hideSidebar .fixed-header {
  145. width: calc(100% - 54px)
  146. }
  147. .mobile .fixed-header {
  148. width: 100%;
  149. }
  150. .zap-header{
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. position: fixed;
  155. top: 0;
  156. left: 0;
  157. width: 100%;
  158. height: 60px;
  159. z-index: 99;
  160. }
  161. .zap-home-logo{
  162. width: 215px;
  163. height: 60px;
  164. }
  165. .zap-home-name{
  166. display: inline-block;
  167. height: 60px;
  168. line-height: 60px;
  169. text-align: center;
  170. padding: 0 16px;
  171. font-size: 16px;
  172. color: #ffffff;
  173. background-image: linear-gradient(
  174. #3b72d8,
  175. #3b72d8),
  176. linear-gradient(
  177. #588dff,
  178. #588dff);
  179. background-blend-mode: normal,
  180. normal;
  181. }
  182. .zap-home-search{
  183. display: flex;
  184. align-items: center;
  185. width: 395px;
  186. height: 40px;
  187. padding: 0 22px;
  188. background-image: linear-gradient(
  189. #ffffff,
  190. #ffffff),
  191. linear-gradient(
  192. #f7f7f7,
  193. #f7f7f7);
  194. background-blend-mode: normal,
  195. normal;
  196. border-radius: 19px;
  197. border: solid 1px #ebebeb;
  198. }
  199. .zap-home-search__icon{
  200. width: 21px;
  201. height: 22px;
  202. }
  203. .zap-home-search__input{
  204. }
  205. .zap-home-header__icon{
  206. width: 26px;
  207. height: 26px ;
  208. &:nth-of-type(1){
  209. margin-left: 40px;
  210. }
  211. &:nth-of-type(2){
  212. margin-left: 30px;
  213. }
  214. }
  215. .zap-avatar{
  216. width: 40px;
  217. height: 40px;
  218. margin-left: 40px;
  219. border-radius: 50%;
  220. }
  221. .zap-username{
  222. margin-left: 10px;
  223. margin-right: 24px;
  224. font-size: 14px;
  225. color: #ffffff;
  226. }
  227. </style>