header.vue 7.2 KB

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