header.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  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-btn', headWhite && 'blue']" @click="jumpTeach">教师登录</div>
  92. <!-- <div class="h-right">
  93. <div class="h-login btn">登录</div>
  94. <div class="h-regist btn">注册</div>
  95. </div> -->
  96. </div>
  97. </div>
  98. </header>
  99. </template>
  100. <script>
  101. import { mapState } from "vuex";
  102. export default {
  103. name: "VHeader",
  104. data() {
  105. return {
  106. headFixed: true,
  107. headWhite: false,
  108. isHome: true,
  109. maxClientWidth: 980,
  110. productActive: false,
  111. aboutActive: false,
  112. };
  113. },
  114. watch: {
  115. $route() {
  116. this.handleRouterActive();
  117. },
  118. },
  119. computed: {
  120. ...mapState(["headProdNav", "headNewsNav", "headJobNav"]),
  121. },
  122. mounted() {
  123. //监听滚动条
  124. window.addEventListener("scroll", this.handleScroll);
  125. this.handleRouterActive();
  126. },
  127. methods: {
  128. jumpTeach() {
  129. // window.location.href = "https://luojigou.vip/teacher_lib/#/";
  130. window.open("https://luojigou.vip/teacher_lib/#/");
  131. },
  132. handleScroll() {
  133. let scrollTop =
  134. window.pageYOffset ||
  135. document.documentElement.scrollTop ||
  136. document.body.scrollTop;
  137. if (this.isHome && scrollTop <= 10) {
  138. this.headWhite = false;
  139. } else {
  140. this.headWhite = true;
  141. }
  142. this.$emit("returnScrollTop", scrollTop);
  143. },
  144. navEnter() {
  145. if (this.isHome && !this.headWhite) {
  146. this.headWhite = true;
  147. }
  148. },
  149. navLeave() {
  150. let scrollTop =
  151. window.pageYOffset ||
  152. document.documentElement.scrollTop ||
  153. document.body.scrollTop;
  154. if (this.isHome && scrollTop <= 0) {
  155. this.headWhite = false;
  156. }
  157. },
  158. handleRouterActive() {
  159. if (this.$route.fullPath == "/") {
  160. this.isHome = true;
  161. } else {
  162. this.isHome = false;
  163. this.headWhite = true;
  164. }
  165. if (this.$route.fullPath && this.$route.fullPath.includes("/about")) {
  166. this.aboutActive = true;
  167. } else {
  168. this.aboutActive = false;
  169. }
  170. if (this.$route.fullPath && this.$route.fullPath.includes("/product")) {
  171. this.productActive = true;
  172. } else {
  173. this.productActive = false;
  174. }
  175. },
  176. },
  177. destroyed() {
  178. window.removeEventListener("scroll", this.handleScroll);
  179. },
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. @import "~static/common/style.sass";
  184. .nav-space {
  185. height: 72px;
  186. }
  187. .fixedTop {
  188. position: fixed;
  189. left: 0;
  190. top: 0;
  191. }
  192. #index-header {
  193. width: 100%;
  194. z-index: 666;
  195. background: transparent;
  196. &.head-white {
  197. background: #fff;
  198. transition: background 0.3s ease-in-out;
  199. .h-nav-list {
  200. li {
  201. &:first-child {
  202. // padding-left: 40px;
  203. .nuxt-link-active {
  204. color: $theme_gray333;
  205. // border-bottom: 2px solid transparent;
  206. &.nuxt-link-exact-active {
  207. color: $theme_color;
  208. &::after {
  209. // background: #ffffff;
  210. // background: $theme_color;
  211. }
  212. }
  213. }
  214. }
  215. a {
  216. color: $theme_gray333;
  217. transition: color 0.3s ease-in-out;
  218. &.nuxt-link-exact-active {
  219. color: $theme_color;
  220. }
  221. }
  222. .expand {
  223. color: $theme_gray333;
  224. }
  225. }
  226. .h-nav-list-child {
  227. transition: max-height 0.3s ease-in-out;
  228. li {
  229. .nuxt-link-exact-active {
  230. color: $theme_color;
  231. }
  232. }
  233. }
  234. .h-nav-li-more {
  235. .h-nav-list-parent {
  236. color: $theme_color;
  237. }
  238. .expand {
  239. color: $theme_color;
  240. }
  241. }
  242. .h-nav-li {
  243. .nuxt-link-exact-active {
  244. &:after {
  245. background: #236afa;
  246. }
  247. }
  248. }
  249. }
  250. .h-nav-logo {
  251. h1 {
  252. background: url("~assets/images/home/logo@2x.png") no-repeat 0 0;
  253. background-size: 100% 100%;
  254. }
  255. }
  256. }
  257. .index-header-box {
  258. position: relative;
  259. height: 72px;
  260. display: flex;
  261. align-items: center;
  262. box-sizing: border-box;
  263. }
  264. .h-nav-logo {
  265. h1 {
  266. display: block;
  267. height: 31px;
  268. width: 114px;
  269. background: url("~assets/images/home/logo_white@2x.png") no-repeat 0 0;
  270. text-indent: -9999px;
  271. overflow: hidden;
  272. background-size: 100% 100%;
  273. }
  274. }
  275. .i-h-nav {
  276. display: flex;
  277. align-items: center;
  278. position: absolute;
  279. left: 50%;
  280. top: 50%;
  281. transform: translate(-50%, -50%);
  282. height: 72px;
  283. font-size: 15px;
  284. white-space: nowrap;
  285. //margin-left: 70px;
  286. }
  287. .h-nav-list {
  288. display: block;
  289. width: 100%;
  290. height: 100%;
  291. font-size: 0;
  292. li {
  293. position: relative;
  294. display: inline-block;
  295. padding: 0 40px;
  296. line-height: 72px;
  297. box-sizing: border-box;
  298. font-size: 15px;
  299. &:first-child {
  300. // padding-left: 40px;
  301. .nuxt-link-active {
  302. color: #333;
  303. // border-bottom: 2px solid transparent;
  304. &.nuxt-link-exact-active {
  305. color: #ffffff;
  306. }
  307. }
  308. }
  309. &:hover {
  310. .h-nav-list-child {
  311. max-height: 500px;
  312. }
  313. .expand {
  314. color: $theme_color;
  315. }
  316. a {
  317. position: relative;
  318. color: $theme_color;
  319. transition: all 0.3s;
  320. font-family: PingFangSC-Medium, sans-serif;
  321. font-weight: 500;
  322. }
  323. }
  324. .nuxt-link-exact-active,
  325. .nuxt-link-active {
  326. position: relative;
  327. color: $theme_color;
  328. transition: all 0.3s;
  329. font-family: PingFangSC-Medium, sans-serif;
  330. font-weight: 500;
  331. }
  332. .expand {
  333. position: absolute;
  334. top: 0;
  335. right: 11px;
  336. font-size: 16px;
  337. color: #ffffff;
  338. transition: color 0.3s ease-in-out;
  339. }
  340. a {
  341. width: 100%;
  342. padding: 22px 0;
  343. color: #ffffff;
  344. -webkit-box-sizing: border-box;
  345. -moz-box-sizing: border-box;
  346. box-sizing: border-box;
  347. -webkit-transition: all 0.5s ease;
  348. -o-transition: all 0.5s ease;
  349. transition: all 0.5s ease;
  350. font-family: PingFangSC-Medium, sans-serif;
  351. font-weight: 400;
  352. }
  353. .h-nav-list-child {
  354. // position: absolute;
  355. // width: 100px;
  356. // border-radius: 0px 0px 4px 4px;
  357. // overflow: hidden;
  358. // max-height: 0;
  359. // background: #ffffff;
  360. // z-index: 999;
  361. // transition: max-height .3s ease-in-out;
  362. }
  363. }
  364. .h-nav-li {
  365. .nuxt-link-exact-active {
  366. &:after {
  367. content: "";
  368. position: absolute;
  369. bottom: 0;
  370. background: #ffffff;
  371. width: 40px;
  372. height: 2px;
  373. box-shadow: 0px 2px 4px 0px rgba(85, 141, 253, 0.4);
  374. left: 50%;
  375. transform: translateX(-50%);
  376. }
  377. }
  378. }
  379. .h-nav-list-child {
  380. position: absolute;
  381. width: 100px;
  382. border-radius: 0px 0px 4px 4px;
  383. overflow: hidden;
  384. max-height: 0;
  385. background: #ffffff;
  386. z-index: 999;
  387. line-height: 20px;
  388. li {
  389. width: 100%;
  390. height: 20px;
  391. font-size: 14px;
  392. text-align: center;
  393. line-height: 20px;
  394. margin: 10px 0 0;
  395. padding: 0;
  396. &:last-child {
  397. margin-bottom: 18px;
  398. }
  399. a {
  400. display: block;
  401. overflow: hidden;
  402. width: 100%;
  403. height: 100%;
  404. color: $theme_fu_bule;
  405. padding: 0;
  406. &:hover {
  407. color: $theme_color;
  408. }
  409. }
  410. }
  411. }
  412. .h-right {
  413. display: flex;
  414. .btn {
  415. width: 70px;
  416. height: 30px;
  417. line-height: 30px;
  418. text-align: center;
  419. }
  420. .h-regist {
  421. background: $theme_color_fu;
  422. box-shadow: 0px 2px 12px 0px rgba(57, 109, 209, 0.58);
  423. border-radius: 50px;
  424. color: #f8fff7;
  425. }
  426. .h-login {
  427. border-radius: 50px;
  428. border: 1px solid $theme_color_fu;
  429. color: $theme_color_fu;
  430. margin-right: 40px;
  431. }
  432. }
  433. }
  434. .h-btn {
  435. display: flex;
  436. justify-content: center;
  437. align-items: center;
  438. position: absolute;
  439. right: 0;
  440. top: 50%;
  441. transform: translateY(-50%);
  442. width: 108px;
  443. height: 40px;
  444. background: #FFFFFF;
  445. border-radius: 26px;
  446. font-size: 15px;
  447. font-family: PingFangSC-Regular, PingFang SC;
  448. font-weight: 400;
  449. color: #0D0827;
  450. cursor: pointer;
  451. }
  452. .blue {
  453. background-color: #236CFA;
  454. color: #fff;
  455. }
  456. }
  457. </style>