v-header.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <!--头部-->
  3. <div class="header">
  4. <Clock></Clock>
  5. <!--中间LOGO -->
  6. <div class="title">
  7. <!-- <img src="@/assets/images/integrated/bigdata-header-nav-left2.png" /> -->
  8. <h3><img class="logo" src="@/assets/images/integrated/logo-small.png" />{{systemTitle.title}} {{titlename}}
  9. </h3>
  10. <!-- <img src="@/assets/images/integrated/bigdata-header-nav-right2.png" /> -->
  11. </div>
  12. <!--中间导航-->
  13. <div class="bignav">
  14. <img src="@/assets/images/integrated/bigdata-header-nav-left2.png" />
  15. <router-link v-for="(navbar,index) in navbar" :key="index+'1'" :to="navbar.path" class="bignav-list"
  16. exact>
  17. <a>{{navbar.meta.title}}</a>
  18. </router-link>
  19. <img src="@/assets/images/integrated/bigdata-header-nav-right2.png" />
  20. </div>
  21. <!-- 右侧5个中心 -->
  22. <VfastMenu></VfastMenu>
  23. </div>
  24. </template>
  25. <script>
  26. import {constantRoutes} from '@/router/index'//navbar导航引用了router路由的数组
  27. import Clock from '@/components/clock.vue' // 时钟+天气
  28. import VfastMenu from '@/components/v-fastmenu.vue' // 头部右侧菜单
  29. import {
  30. fontConfig
  31. } from '@/api/login'
  32. export default{
  33. components:{
  34. VfastMenu,
  35. Clock
  36. },
  37. created(){
  38. this.fontConfig()
  39. this.navbar
  40. },
  41. data(){
  42. return{
  43. systemTitle: {
  44. title: '', //标题
  45. },
  46. }
  47. },
  48. methods:{
  49. fontConfig(){
  50. fontConfig().then(res => {
  51. this.systemTitle.title = res.data.fontTitle;
  52. })
  53. },
  54. },
  55. computed:{
  56. titlename(){
  57. return this.$route.meta.title
  58. },
  59. //导航菜单
  60. navbar(){
  61. return constantRoutes.slice(1)
  62. },
  63. },
  64. }
  65. </script>
  66. <style rel="stylesheet/scss" lang="scss" scoped>
  67. @import '@/assets/styles/base.scss';
  68. .header {
  69. width: 100%;
  70. background: #a7ec12;
  71. background: url(../assets/images/visual/header.png) no-repeat center center;
  72. background-size: cover;
  73. height: 4rem;
  74. display: flex;
  75. align-items: center;
  76. z-index: 1000;
  77. position: fixed;
  78. top: 0;
  79. .title {
  80. display: flex;
  81. position: fixed;
  82. left: 50%;
  83. transform: translateX(-50%);
  84. h3 {
  85. display: flex;
  86. align-items: center;
  87. text-align: center;
  88. color: $white;
  89. font-size: 1.8rem;
  90. font-family: $fontFk;
  91. img {
  92. margin-right: .5rem;
  93. }
  94. }
  95. }
  96. .bignav {
  97. height: 40px;
  98. position: fixed;
  99. left: 50%;
  100. transform: translateX(-50%);
  101. top: 3.9rem;
  102. z-index: 1000;
  103. border-radius: 5px;
  104. display: flex;
  105. justify-content: cetner;
  106. align-items: center;
  107. .bignav-list {
  108. background: url(../assets/images/integrated/bigdata-header-nav-re2.png) repeat-x center;
  109. float: left;
  110. display: flex;
  111. justify-content: cetner;
  112. align-items: center;
  113. color: $fListTitle;
  114. height: 40px;
  115. font-size: 12px;
  116. padding: 0 23px;
  117. cursor: pointer;
  118. -webkit-transform: translateY(0);
  119. transform: translateY(0);
  120. transition: all 0.3s ease-in-out;
  121. }
  122. .router-link-active,
  123. .bignav-list:hover {
  124. filter: brightness(2.3);
  125. -webkit-transform: translateY(-1px);
  126. transform: translateY(-1px);
  127. color: $inBlueHover;
  128. border-bottom: 1px solid $inBlueHover;
  129. transition: all 0.3s ease-in-out;
  130. }
  131. }
  132. }
  133. </style>