header.vue 8.5 KB

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