v-header.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="header">
  3. <div class="header-left">
  4. <!-- 时间-->
  5. <div class="date">
  6. <div class="day m-r-10">
  7. <span>{{today}}</span>
  8. <span>{{weekE}}</span>
  9. </div>
  10. <div class="week m-r-10">{{weekC}}</div>
  11. <div class="line m-r-10"></div>
  12. <div class="time">{{time}}</div>
  13. </div>
  14. </div>
  15. <!--中间LOGO -->
  16. <router-link class="title" to="/integrated/index" exact><img
  17. src="@/assets/images/integrated/bigdata-header-nav-left2.png" />
  18. <h3><img class="logo" src="@/assets/images/integrated/logo-small.png" />态势感知平台 监控中心
  19. </h3><img src="@/assets/images/integrated/bigdata-header-nav-right2.png" />
  20. </router-link>
  21. <!--中间导航-->
  22. <div class="bignav">
  23. <img src="@/assets/images/integrated/bigdata-header-nav-left2.png" />
  24. <router-link v-for="(navbar,index) in navbar " :key="index" :to="navbar.path" class="bignav-list" exact>
  25. {{navbar.name}}
  26. </router-link>
  27. <img src="@/assets/images/integrated/bigdata-header-nav-right2.png" />
  28. </div>
  29. <!-- 右侧5个中心 -->
  30. <VfastMenu></VfastMenu>
  31. </div>
  32. </template>
  33. <script>
  34. let aDate = new Date();
  35. let month = aDate.getMonth() < 9 ? "0" + (aDate.getMonth() + 1) : aDate.getMonth() + 1;
  36. let date = aDate.getDate() <= 9 ? "0" + aDate.getDate() : aDate.getDate();
  37. let day = aDate.getDay();
  38. let weekCh = new Array("周日", "周一", "周二", "周三", "周四", "周五", "周六");
  39. let weekEn = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
  40. "Saturday");
  41. import VfastMenu from './v-fastmenu.vue' //头部右侧菜单
  42. export default {
  43. components: {
  44. VfastMenu,
  45. },
  46. data() {
  47. return {
  48. navbar: [{
  49. name: '监控中心',
  50. path: '/integrated/monitor',
  51. },
  52. {
  53. name: '数字林业',
  54. path: '/integrated/forest',
  55. },
  56. {
  57. name: '数字农业',
  58. path: '/',
  59. },
  60. {
  61. name: '数字水利',
  62. path: '/',
  63. },
  64. {
  65. name: '数字环保',
  66. path: '/',
  67. },
  68. {
  69. name: '数字应急',
  70. path: '/',
  71. },
  72. {
  73. name: '数字交通',
  74. path: '/',
  75. },
  76. {
  77. name: '数字资源',
  78. path: '/',
  79. },
  80. {
  81. name: '数字消防',
  82. path: '/',
  83. },
  84. ],
  85. // 右上时钟
  86. today: aDate.getFullYear() + "." + month + "." + date,
  87. weekE: weekEn[day].toUpperCase(),
  88. weekC: weekCh[day],
  89. time: aDate.toTimeString().substring(0, 8),
  90. interval: '',
  91. websocketURL: '',
  92. yjCount: 0,
  93. }
  94. },
  95. mounted() {
  96. this.init()
  97. },
  98. methods: {
  99. init() {
  100. // 右上时钟
  101. this.interval = setInterval(() => {
  102. let aDate = new Date();
  103. let month = aDate.getMonth() < 9 ? "0" + (aDate.getMonth() + 1) : aDate.getMonth() + 1;
  104. let date = aDate.getDate() <= 9 ? "0" + aDate.getDate() : aDate.getDate();
  105. let day = aDate.getDay();
  106. let weekCh = new Array("周日", "周一", "周二", "周三", "周四", "周五", "周六");
  107. let weekEn = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
  108. "Saturday");
  109. this.today = aDate.getFullYear() + "." + month + "." + date;
  110. this.weekC = weekCh[day];
  111. this.weekE = weekEn[day].toUpperCase();
  112. this.time = aDate.toTimeString().substring(0, 8);
  113. // console.log(this.today, this.weekC, this.weekE ,this.time);
  114. }, 1000)
  115. }
  116. },
  117. beforeDestroy() {
  118. // 右上时钟
  119. clearInterval(this.interval);
  120. },
  121. }
  122. </script>
  123. <style rel="stylesheet/scss" lang="scss" scoped>
  124. @import '@/assets/styles/base.scss';
  125. .header {
  126. width: 100%;
  127. background: #a7ec12;
  128. background: url(../../../assets/images/visual/v-header.png) repeat-x;
  129. height: 2.5rem;
  130. display: flex;
  131. align-items: center;
  132. z-index: 10000000;
  133. position: absolute;
  134. top: 0;
  135. .title {
  136. display: flex;
  137. position: fixed;
  138. left: 50%;
  139. transform: translateX(-50%);
  140. h3 {
  141. display: flex;
  142. align-items: center;
  143. text-align: center;
  144. color: $white;
  145. font-size: 1.8rem;
  146. font-family: $fontFk;
  147. background: url(../../../assets/images/integrated/bigdata-header-nav-re2.png) repeat-x center;
  148. img {
  149. margin-right: .5rem;
  150. }
  151. }
  152. }
  153. .bignav {
  154. height: 40px;
  155. position: fixed;
  156. left: 50%;
  157. transform: translateX(-50%);
  158. top: 2.4rem;
  159. z-index: 1000;
  160. border-radius: 5px;
  161. display: flex;
  162. justify-content: cetner;
  163. align-items: center;
  164. .bignav-list {
  165. background: url(../../../assets/images/integrated/bigdata-header-nav-re2.png) repeat-x center;
  166. float: left;
  167. display: flex;
  168. justify-content: cetner;
  169. align-items: center;
  170. color: $white;
  171. height: 40px;
  172. font-size: 12px;
  173. padding: 0 23px;
  174. cursor: pointer;
  175. -webkit-transform: translateY(0);
  176. transform: translateY(0);
  177. transition: all 0.3s ease-in-out;
  178. }
  179. .router-link-active,
  180. .bignav-list:hover {
  181. filter: brightness(2.3);
  182. -webkit-transform: translateY(-1px);
  183. transform: translateY(-1px);
  184. color: $inBlueHover;
  185. border-bottom: 1px solid $inBlueHover;
  186. transition: all 0.3s ease-in-out;
  187. }
  188. }
  189. .header-left {
  190. height: 5vh;
  191. position: absolute;
  192. left: 10px;
  193. display: flex;
  194. font-size: 1rem;
  195. align-items: center;
  196. color: $inBlue;
  197. .date {
  198. flex: 1;
  199. display: flex;
  200. align-items: center;
  201. .day {
  202. display: flex;
  203. flex-direction: column;
  204. font-size: 14px;
  205. }
  206. .day span:nth-child(2) {
  207. font-size: 10px;
  208. text-align: right;
  209. }
  210. .week {
  211. font-size: 13px;
  212. writing-mode: tb-rl;
  213. }
  214. .time {
  215. font-size: 2rem;
  216. }
  217. .line {
  218. width: 1px;
  219. height: 1.5rem;
  220. background: $inBlue;
  221. margin: 0 .4rem;
  222. }
  223. }
  224. }
  225. }
  226. </style>