header.vue 11 KB

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