header.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. console.log(this.$route.parmas);
  90. console.log(this.$route.fullPath);
  91. },
  92. methods: {
  93. handleScroll() {
  94. // var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  95. // var offsetTop = document.querySelector('.h-nav-list').offsetTop;
  96. // if (scrollTop > offsetTop) {
  97. // this.headFixed = true;
  98. // } else {
  99. // this.headFixed = false;
  100. // }
  101. },
  102. showCode() {
  103. this.isShowCode = !this.isShowCode;
  104. },
  105. },
  106. destroyed() {
  107. window.removeEventListener("scroll", this.handleScroll);
  108. },
  109. };
  110. </script>
  111. <style lang="scss" scoped>
  112. @import '~static/common/style.sass';
  113. #index-header {
  114. width: 1200px;
  115. top: 36px;
  116. left: 50%;
  117. transform: translateX(-50%);
  118. /* width: 100%; */
  119. /* height: 158px; */
  120. background: #fff;
  121. z-index: 666;
  122. box-shadow: 0px 2px 35px 0px rgba(6,8,71,0.17);
  123. border-radius: 8px;
  124. }
  125. .fixedTop {
  126. position: fixed;
  127. /* top: -100px; */
  128. left: 0;
  129. }
  130. .index-header-box {
  131. height: 82px;
  132. display: flex;
  133. align-items: center;
  134. /* background: #fff; */
  135. box-sizing: border-box;
  136. }
  137. .i-h-nav {
  138. display: flex;
  139. align-items: center;
  140. // width: 1200px;
  141. height: 82px;
  142. // margin: 0 auto;
  143. font-size: 15px;
  144. // text-align: center;
  145. margin-right: 34px;
  146. }
  147. .h-nav-logo {
  148. font-size: 0;
  149. display: flex;
  150. align-items: center;
  151. padding-right: 22px;
  152. border-right: 1px solid #F0F1F2;
  153. }
  154. .h-nav-logo img {
  155. height: 38px;
  156. margin: 0 16px 0 22px;
  157. }
  158. .h-nav-logo .name {
  159. width: 108px;
  160. height: 25px;
  161. line-height: 25px;
  162. font-size: 18px;
  163. font-family: PingFangSC-Semibold,PingFang SC;
  164. font-weight: 600;
  165. color: $theme_color;
  166. }
  167. ul.h-nav-list {
  168. display: block;
  169. width: 100%;
  170. height: 100%;
  171. font-size: 0;
  172. }
  173. .h-nav-list > li {
  174. position: relative;
  175. display: inline-block;
  176. padding: 0 35px;
  177. line-height: 82px;
  178. box-sizing: border-box;
  179. font-size: 15px;
  180. }
  181. .h-nav-list > li:first-child {
  182. padding-left: 40px;
  183. }
  184. .h-nav-list > li > a {
  185. width: 100%;
  186. padding: 22px 0;
  187. color: $theme_fu_bule;
  188. -webkit-box-sizing: border-box;
  189. -moz-box-sizing: border-box;
  190. box-sizing: border-box;
  191. -webkit-transition: all 0.5s ease;
  192. -o-transition: all 0.5s ease;
  193. transition: all 0.5s ease;
  194. font-family: PingFangSC-Medium,PingFang SC;
  195. font-weight: 500;
  196. }
  197. .h-nav-list > li .expand {
  198. position: absolute;
  199. top: 0;
  200. right: 11px;
  201. font-size: 16px;
  202. // width: 16px;
  203. // height: 10px;
  204. color: #DBDBDB;
  205. // background-image: url('~assets/images/index/arrow_down.png');
  206. // background-size: 16px 10px;
  207. // background-repeat: no-repeat;
  208. }
  209. .h-nav-list > li:hover .expand {
  210. color: $theme_color_fu;
  211. // background-image: url('~assets/images/index/arrow_down_bg_blue.png');
  212. }
  213. .h-nav-list > li:hover > a,
  214. .h-nav-list li .nuxt-link-exact-active,
  215. .h-nav-list li .nuxt-link-active {
  216. color: $theme_color_fu;
  217. transition: all 0.3s;
  218. // border-bottom: 2px solid $theme_color_fu;
  219. }
  220. .h-nav-list > li:first-child .nuxt-link-active {
  221. color: $theme_fu_bule;
  222. border-bottom: 2px solid transparent;
  223. }
  224. .h-nav-list > li:first-child .nuxt-link-active.nuxt-link-exact-active {
  225. // border-bottom: 2px solid $theme_color_fu;
  226. color: $theme_color_fu;
  227. }
  228. // .h-nav-list-child li a.nuxt-link-exact-active {
  229. // // border: none;
  230. // }
  231. .h-nav-list > li .h-nav-list-child {
  232. position: absolute;
  233. // left: 50%;
  234. // transform: translateX(-50%);
  235. width: 100px;
  236. border-radius: 0px 0px 4px 4px;
  237. overflow: hidden;
  238. max-height: 0;
  239. // margin-left: -50px;
  240. /* background: #f2f3f4; */
  241. background: #ffffff;
  242. z-index: 999;
  243. // padding: 10px 0;
  244. // transition: all .5s ease;
  245. transition: max-height .3s ease-in-out;
  246. }
  247. .h-nav-list > li:hover .h-nav-list-child {
  248. max-height: 500px;
  249. }
  250. ul.h-nav-list-child > li {
  251. width: 100%;
  252. height: 20px;
  253. font-size: 14px;
  254. text-align: center;
  255. line-height: 20px;
  256. margin: 10px 0 0;
  257. &:last-child {
  258. margin-bottom: 18px;
  259. }
  260. }
  261. ul.h-nav-list-child li a {
  262. display: block;
  263. overflow: hidden;
  264. width: 100%;
  265. height: 100%;
  266. color: $theme_fu_bule;
  267. // border: none;
  268. }
  269. ul.h-nav-list-child li a:hover {
  270. color: $theme_color_fu;
  271. }
  272. .h-right {
  273. display: flex;
  274. .btn {
  275. width: 70px;
  276. height: 30px;
  277. line-height: 30px;
  278. text-align: center;
  279. }
  280. .h-regist {
  281. background: $theme_color_fu;
  282. box-shadow:0px 2px 12px 0px rgba(57,109,209,0.58);
  283. border-radius: 50px;
  284. color: #F8FFF7;
  285. }
  286. .h-login {
  287. border-radius: 50px;
  288. border:1px solid $theme_color_fu;
  289. color: $theme_color_fu;
  290. margin-right: 40px;
  291. }
  292. }
  293. </style>