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