header.vue 7.4 KB

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