header.vue 7.1 KB

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