header.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <header class="v-header clearfix">
  3. <div id="index-header" :class="headFixed == true ? 'fixedTop' : ''">
  4. <div class="index-header-box">
  5. <div class="h-nav-logo">
  6. <nuxt-link to="/">
  7. <img src="~/assets/images/index/logo_icon.png" alt="" srcset="">
  8. </nuxt-link>
  9. <div class="name">中德智慧教育</div>
  10. </div>
  11. <div class="i-h-nav">
  12. <ul class="h-nav-list">
  13. <li>
  14. <nuxt-link to="/">首页</nuxt-link>
  15. </li>
  16. <li>
  17. <nuxt-link to="/product">产品与服务</nuxt-link>
  18. <ul class="h-nav-list-child">
  19. <li>
  20. <nuxt-link target="_blank" to="/product/list">教具玩具</nuxt-link>
  21. </li>
  22. <li>
  23. <nuxt-link target="_blank" to="/product/course">多端课堂</nuxt-link>
  24. </li>
  25. </ul>
  26. <div class="expand"></div>
  27. </li>
  28. <li>
  29. <nuxt-link to="/leader">新闻资讯</nuxt-link>
  30. </li>
  31. <li>
  32. <nuxt-link to="/experice">网校中心</nuxt-link>
  33. </li>
  34. <li>
  35. <nuxt-link target="_blank" to="/campus">全国校区</nuxt-link>
  36. </li>
  37. <li>
  38. <nuxt-link target="_blank" to="/news">加盟合作</nuxt-link>
  39. </li>
  40. <li>
  41. <nuxt-link to="/about">关于我们</nuxt-link>
  42. <ul class="h-nav-list-child">
  43. <li>
  44. <nuxt-link target="_blank" to="/about/brand">品牌故事</nuxt-link>
  45. </li>
  46. <li>
  47. <nuxt-link target="_blank" to="/about/team">专家团队</nuxt-link>
  48. </li>
  49. <li>
  50. <nuxt-link target="_blank" to="/about/contact">联系我们</nuxt-link>
  51. </li>
  52. </ul>
  53. <div class="expand"></div>
  54. </li>
  55. </ul>
  56. </div>
  57. <!-- <div class="h-right">
  58. <div class="h-login btn">登录</div>
  59. <div class="h-regist btn">注册</div>
  60. </div> -->
  61. </div>
  62. </div>
  63. </header>
  64. </template>
  65. <script>
  66. import { mapState } from "vuex";
  67. export default {
  68. name: "VHeader",
  69. data() {
  70. return {
  71. headFixed: true,
  72. maxClientWidth: 980,
  73. isShowCode: false,
  74. };
  75. },
  76. computed: {
  77. ...mapState(["headProdNav", "headNewsNav", "headJobNav"]),
  78. },
  79. mounted() {
  80. //监听滚动条
  81. window.addEventListener("scroll", this.handleScroll);
  82. },
  83. methods: {
  84. handleScroll() {
  85. // var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  86. // var offsetTop = document.querySelector('.h-nav-list').offsetTop;
  87. // if (scrollTop > offsetTop) {
  88. // this.headFixed = true;
  89. // } else {
  90. // this.headFixed = false;
  91. // }
  92. },
  93. showCode() {
  94. this.isShowCode = !this.isShowCode;
  95. },
  96. },
  97. destroyed() {
  98. window.removeEventListener("scroll", this.handleScroll);
  99. },
  100. };
  101. </script>
  102. <style lang="scss" scoped>
  103. @import '~static/common/style.sass';
  104. #index-header {
  105. width: 1200px;
  106. top: 36px;
  107. left: 50%;
  108. transform: translateX(-50%);
  109. /* width: 100%; */
  110. /* height: 158px; */
  111. background: #fff;
  112. z-index: 666;
  113. box-shadow: 0px 2px 35px 0px rgba(6,8,71,0.17);
  114. border-radius: 8px;
  115. }
  116. .fixedTop {
  117. position: fixed;
  118. /* top: -100px; */
  119. left: 0;
  120. }
  121. .index-header-box {
  122. height: 82px;
  123. display: flex;
  124. align-items: center;
  125. /* background: #fff; */
  126. box-sizing: border-box;
  127. }
  128. .i-h-nav {
  129. display: flex;
  130. align-items: center;
  131. // width: 1200px;
  132. height: 82px;
  133. // margin: 0 auto;
  134. font-size: 15px;
  135. // text-align: center;
  136. margin-right: 34px;
  137. }
  138. .h-nav-logo {
  139. font-size: 0;
  140. display: flex;
  141. align-items: center;
  142. padding-right: 22px;
  143. border-right: 1px solid #F0F1F2;
  144. }
  145. .h-nav-logo img {
  146. height: 38px;
  147. margin: 0 16px 0 22px;
  148. }
  149. .h-nav-logo .name {
  150. width: 108px;
  151. height: 25px;
  152. line-height: 25px;
  153. font-size: 18px;
  154. font-family: PingFangSC-Semibold,PingFang SC;
  155. font-weight: 600;
  156. color: $theme_color;
  157. }
  158. ul.h-nav-list {
  159. display: block;
  160. width: 100%;
  161. height: 100%;
  162. font-size: 0;
  163. }
  164. .h-nav-list > li {
  165. position: relative;
  166. display: inline-block;
  167. padding: 0 35px;
  168. line-height: 82px;
  169. box-sizing: border-box;
  170. font-size: 15px;
  171. }
  172. .h-nav-list > li:first-child {
  173. padding-left: 40px;
  174. }
  175. .h-nav-list > li > a {
  176. width: 100%;
  177. padding: 22px 0;
  178. color: $theme_fu_bule;
  179. -webkit-box-sizing: border-box;
  180. -moz-box-sizing: border-box;
  181. box-sizing: border-box;
  182. -webkit-transition: all 0.5s ease;
  183. -o-transition: all 0.5s ease;
  184. transition: all 0.5s ease;
  185. font-family: PingFangSC-Medium,PingFang SC;
  186. font-weight: 500;
  187. }
  188. .h-nav-list > li .expand {
  189. position: absolute;
  190. top: 50%;
  191. transform: translateY(-50%);
  192. right: 4px;
  193. font-size: 0;
  194. width: 16px;
  195. height: 10px;
  196. background-image: url('~assets/images/index/arrow_down.png');
  197. background-size: 16px 10px;
  198. background-repeat: no-repeat;
  199. }
  200. .h-nav-list > li:hover .expand {
  201. background-size: 16px 10px;
  202. background-image: url('~assets/images/index/arrow_down_bg_blue.png');
  203. }
  204. .h-nav-list > li:hover > a,
  205. .h-nav-list li .nuxt-link-exact-active,
  206. .h-nav-list li .nuxt-link-active {
  207. color: $theme_color_fu;
  208. // border-bottom: 2px solid $theme_color_fu;
  209. }
  210. .h-nav-list > li:first-child .nuxt-link-active {
  211. color: $theme_fu_bule;
  212. border-bottom: 2px solid transparent;
  213. }
  214. .h-nav-list > li:first-child .nuxt-link-active.nuxt-link-exact-active {
  215. // border-bottom: 2px solid $theme_color_fu;
  216. color: $theme_color_fu;
  217. }
  218. // .h-nav-list-child li a.nuxt-link-exact-active {
  219. // // border: none;
  220. // }
  221. .h-nav-list > li .h-nav-list-child {
  222. visibility: hidden;
  223. position: absolute;
  224. // left: 50%;
  225. // transform: translateX(-50%);
  226. width: 100px;
  227. border-radius: 0px 0px 3px 3px;
  228. overflow: hidden;
  229. height: 0;
  230. // margin-left: -50px;
  231. /* background: #f2f3f4; */
  232. background: #ffffff;
  233. opacity: 0;
  234. filter: alpha(opacity=0);
  235. z-index: 999;
  236. padding: 10px 0;
  237. transition: all .5s ease;
  238. }
  239. .h-nav-list > li:hover .h-nav-list-child {
  240. visibility: visible;
  241. height: auto;
  242. -webkit-transition: all .5s ease;
  243. -o-transition: all .5s ease;
  244. transition: all .5s ease;
  245. opacity: 100;
  246. filter: alpha(opacity=1);
  247. }
  248. ul.h-nav-list-child > li {
  249. width: 100%;
  250. height: 30px;
  251. font-size: 14px;
  252. text-align: center;
  253. line-height: 30px;
  254. }
  255. ul.h-nav-list-child li a {
  256. display: block;
  257. overflow: hidden;
  258. width: 100%;
  259. height: 100%;
  260. color: $theme_fu_bule;
  261. // border: none;
  262. }
  263. ul.h-nav-list-child li a:hover {
  264. color: $theme_color_fu;
  265. }
  266. .h-right {
  267. display: flex;
  268. .btn {
  269. width: 70px;
  270. height: 30px;
  271. line-height: 30px;
  272. text-align: center;
  273. }
  274. .h-regist {
  275. background: $theme_color_fu;
  276. box-shadow:0px 2px 12px 0px rgba(57,109,209,0.58);
  277. border-radius: 50px;
  278. color: #F8FFF7;
  279. }
  280. .h-login {
  281. border-radius: 50px;
  282. border:1px solid $theme_color_fu;
  283. color: $theme_color_fu;
  284. margin-right: 40px;
  285. }
  286. }
  287. </style>