header.vue 9.4 KB

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