header.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <header class="v-header clearfix">
  3. <div id="index-header" :class="headFixed == true ? 'fixedTop' : ''">
  4. <div class="index-header-box">
  5. <div class="i-h-nav">
  6. <div class="h-nav-logo">
  7. <nuxt-link to="/">
  8. <img src="~/assets/images/index/logo.png" alt="" srcset="">
  9. </nuxt-link>
  10. </div>
  11. <ul class="h-nav-list">
  12. <li>
  13. <nuxt-link to="/">首页</nuxt-link>
  14. </li>
  15. <li>
  16. <nuxt-link to="/product">产品与服务</nuxt-link>
  17. <ul class="h-nav-list-child">
  18. <li>
  19. <nuxt-link target="_blank" to="/product/list">教具玩具</nuxt-link>
  20. </li>
  21. <li>
  22. <nuxt-link target="_blank" to="/product/course">多端课堂</nuxt-link>
  23. </li>
  24. <!-- <li><a href="/brand#brand-story">教具玩具</a></li> -->
  25. <!-- <li><a href="/brand#brand-background">多端课堂</a></li> -->
  26. </ul>
  27. </li>
  28. <li>
  29. <nuxt-link to="/leader">新闻资讯</nuxt-link>
  30. </li>
  31. <li>
  32. <nuxt-link to="/experice">网校中心</nuxt-link>
  33. <ul class="h-nav-list-child">
  34. <li>
  35. <nuxt-link to="/experice/bt">包头</nuxt-link>
  36. </li>
  37. <li>
  38. <nuxt-link to="/experice/cd">成都</nuxt-link>
  39. </li>
  40. <li>
  41. <nuxt-link to="/experice/nj">南京</nuxt-link>
  42. </li>
  43. <li>
  44. <nuxt-link to="/experice/dg">东莞</nuxt-link>
  45. </li>
  46. </ul>
  47. </li>
  48. <li>
  49. <nuxt-link target="_blank" to="/prod">全国校区</nuxt-link>
  50. <ul class="h-nav-list-child h-nav-list-childProd">
  51. <li>
  52. <nuxt-link target="_blank" to="/prod/newPro">最新产品</nuxt-link>
  53. <nuxt-link target="_blank" to="/prod/newPro">全部</nuxt-link>
  54. </li>
  55. <template v-for="(item,index) in headProdNav">
  56. <li
  57. :key="index"
  58. v-if="item.proCategoryId != 96 && item.proCategoryId != 97"
  59. >
  60. <nuxt-link
  61. target="_blank"
  62. :to="{name: 'prod-typeId',params: {typeId: item.proCategoryId}}"
  63. >{{item.proCategoryName}}</nuxt-link>
  64. <nuxt-link
  65. target="_blank"
  66. :to="{name: 'prod-typeId',params: {typeId: item.proCategoryId}}"
  67. >全部</nuxt-link>
  68. <ul class="nav-childProd">
  69. <li v-for="(list,index) in headProdNav[index].children" :key="index">
  70. <nuxt-link
  71. target="_blank"
  72. :to="{name: 'prod-typeId',params: {typeId: item.proCategoryId},query: {classId: list.proCategoryId}}"
  73. >{{list.proCategoryName}}</nuxt-link>
  74. </li>
  75. </ul>
  76. </li>
  77. </template>
  78. </ul>
  79. </li>
  80. <li>
  81. <nuxt-link target="_blank" to="/news">加盟合作</nuxt-link>
  82. <ul class="h-nav-list-child h-nav-list-childNews">
  83. <li v-for="item in headNewsNav" :key="item.articleCategoryId">
  84. <nuxt-link
  85. target="_blank"
  86. :to="{name: 'news-category',params: {category: item.articleCategoryId}}"
  87. >{{item.articleCategoryName}}</nuxt-link>
  88. </li>
  89. </ul>
  90. </li>
  91. <li>
  92. <nuxt-link to="/join">招商加盟</nuxt-link>
  93. </li>
  94. <li>
  95. <nuxt-link to="/service/contact">关于我们</nuxt-link>
  96. <ul class="h-nav-list-child">
  97. <li>
  98. <nuxt-link to="/service/presales">品牌故事</nuxt-link>
  99. </li>
  100. <li>
  101. <nuxt-link to="/service/aftersales">专家团队</nuxt-link>
  102. </li>
  103. <li>
  104. <nuxt-link to="/service/contact">联系我们</nuxt-link>
  105. </li>
  106. </ul>
  107. </li>
  108. </ul>
  109. </div>
  110. </div>
  111. </div>
  112. </header>
  113. </template>
  114. <script>
  115. import { mapState } from "vuex";
  116. export default {
  117. name: "VHeader",
  118. data() {
  119. return {
  120. headFixed: true,
  121. maxClientWidth: 980,
  122. isShowCode: false,
  123. };
  124. },
  125. computed: {
  126. ...mapState(["headProdNav", "headNewsNav", "headJobNav"]),
  127. },
  128. mounted() {
  129. //监听滚动条
  130. window.addEventListener("scroll", this.handleScroll);
  131. },
  132. methods: {
  133. handleScroll() {
  134. // var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  135. // var offsetTop = document.querySelector('.h-nav-list').offsetTop;
  136. // if (scrollTop > offsetTop) {
  137. // this.headFixed = true;
  138. // } else {
  139. // this.headFixed = false;
  140. // }
  141. },
  142. showCode() {
  143. this.isShowCode = !this.isShowCode;
  144. },
  145. },
  146. destroyed() {
  147. window.removeEventListener("scroll", this.handleScroll);
  148. },
  149. };
  150. </script>
  151. <style scoped>
  152. #index-header {
  153. width: 100%;
  154. /* height: 158px; */
  155. background: #fff;
  156. z-index: 666;
  157. }
  158. .fixedTop {
  159. position: fixed;
  160. /* top: -100px; */
  161. left: 0;
  162. }
  163. .index-header-box {
  164. position: relative;
  165. width: 100%;
  166. height: 100%;
  167. background: #fff;
  168. border-bottom: 1px solid #d5d5d8;
  169. box-sizing: border-box;
  170. }
  171. .i-h-top {
  172. position: relative;
  173. width: 100%;
  174. min-width: 1200px;
  175. height: 81px;
  176. margin-top: 15px;
  177. }
  178. .h-t-contact {
  179. float: left;
  180. height: 45px;
  181. margin-left: 66px;
  182. color: #a2a1a2;
  183. font-size: 12px;
  184. text-align: center;
  185. line-height: 45px;
  186. }
  187. .h-t-contact h1 {
  188. display: inline-block;
  189. font-weight: normal;
  190. }
  191. .h-t-logo {
  192. position: absolute;
  193. left: 50%;
  194. top: 0;
  195. width: 80px;
  196. height: 81px;
  197. margin-left: -40px;
  198. }
  199. .h-t-mobile {
  200. position: relative;
  201. float: right;
  202. height: 45px;
  203. margin-right: 66px;
  204. font-size: 12px;
  205. text-align: center;
  206. line-height: 45px;
  207. }
  208. .h-t-contact > span {
  209. padding: 0 10px;
  210. }
  211. .h-t-contact > a {
  212. padding: 0 10px;
  213. color: #a2a1a2;
  214. }
  215. .t-m-mobile-code {
  216. position: absolute;
  217. top: 45px;
  218. right: 0;
  219. width: 100px;
  220. height: 100px;
  221. }
  222. .t-m-mobile-code img {
  223. width: 100%;
  224. }
  225. .h-t-mobile > div {
  226. float: left;
  227. padding: 0 12px;
  228. }
  229. .h-t-mobile > div > a {
  230. color: #a2a1a2;
  231. }
  232. .i-h-nav {
  233. display: flex;
  234. width: 1200px;
  235. height: 60px;
  236. line-height: 60px;
  237. margin: 0 auto;
  238. /* padding-top: 15px; */
  239. font-size: 14px;
  240. /* line-height: 54px; */
  241. text-align: center;
  242. }
  243. .h-nav-logo {
  244. font-size: 0;
  245. }
  246. .h-nav-logo img {
  247. height: 60px;
  248. }
  249. ul.h-nav-list {
  250. display: block;
  251. width: 100%;
  252. height: 100%;
  253. }
  254. .h-nav-list > li {
  255. position: relative;
  256. display: inline-block;
  257. padding: 0 23px;
  258. box-sizing: border-box;
  259. }
  260. .h-nav-list > li > a {
  261. display: block;
  262. width: 100%;
  263. height: 60px;
  264. /* padding-bottom: 6px; */
  265. color: #6d6d6d;
  266. -webkit-box-sizing: border-box;
  267. -moz-box-sizing: border-box;
  268. box-sizing: border-box;
  269. -webkit-transition: all 0.5s ease;
  270. -o-transition: all 0.5s ease;
  271. transition: all 0.5s ease;
  272. }
  273. .h-nav-list > li:hover > a,
  274. .h-nav-list .nuxt-link-exact-active,
  275. .h-nav-list .nuxt-link-active {
  276. color: #22202b;
  277. border-bottom: 2px solid #2f2d37;
  278. }
  279. .h-nav-list > li:first-child .nuxt-link-active {
  280. border-bottom: 2px solid transparent;
  281. }
  282. .h-nav-list > li:first-child .nuxt-link-active.nuxt-link-exact-active {
  283. border-bottom: 2px solid #2f2d37;
  284. }
  285. .h-nav-list-child li a.nuxt-link-exact-active {
  286. border: none;
  287. }
  288. .h-nav-list > li .h-nav-list-child {
  289. visibility: hidden;
  290. position: absolute;
  291. top: 60px;
  292. left: 50%;
  293. overflow: hidden;
  294. width: 100px;
  295. height: 0;
  296. margin-left: -50px;
  297. /* background: #f2f3f4; */
  298. background: #ffffff;
  299. box-shadow: 0 13px 42px 11px rgba(0,0,0,.05);
  300. border: 1px solid #EEE;
  301. opacity: 0;
  302. filter: alpha(opacity=0);
  303. z-index: 999;
  304. transition: all .5s ease;
  305. }
  306. .h-nav-list > li:hover .h-nav-list-child {
  307. visibility: visible;
  308. height: auto;
  309. -webkit-transition: all .5s ease;
  310. -o-transition: all .5s ease;
  311. transition: all .5s ease;
  312. opacity: 100;
  313. filter: alpha(opacity=1);
  314. }
  315. ul.h-nav-list-child > li {
  316. width: 100%;
  317. height: 30px;
  318. font-size: 14px;
  319. text-align: center;
  320. line-height: 30px;
  321. }
  322. ul.h-nav-list-child li a {
  323. display: block;
  324. overflow: hidden;
  325. width: 100%;
  326. height: 100%;
  327. color: #6d6d6d;
  328. border: none;
  329. }
  330. ul.h-nav-list-child li a:hover {
  331. color: #22202b;
  332. }
  333. ul.h-nav-list-child.h-nav-list-childProd {
  334. left: 0;
  335. margin-left: 0;
  336. width: 600px;
  337. padding: 15px;
  338. }
  339. ul.h-nav-list-child.h-nav-list-childProd > li {
  340. overflow: hidden;
  341. height: auto;
  342. line-height: 40px;
  343. }
  344. ul.h-nav-list-child.h-nav-list-childProd > li > a:first-child {
  345. float: left;
  346. width: 100px;
  347. }
  348. ul.h-nav-list-child.h-nav-list-childProd > li > a:nth-child(2) {
  349. float: left;
  350. width: 50px;
  351. font-weight: bold;
  352. }
  353. ul.nav-childProd {
  354. float: left;
  355. width: 450px;
  356. min-height: 30px;
  357. border-bottom: 1px dotted #ccc;
  358. }
  359. ul.h-nav-list-child.h-nav-list-childProd > li:last-child .nav-childProd {
  360. border-bottom: none;
  361. }
  362. ul.nav-childProd > li {
  363. float: left;
  364. width: auto;
  365. }
  366. ul.nav-childProd > li > a {
  367. padding: 0 10px;
  368. }
  369. ul.h-nav-list-child.h-nav-list-childProd .nuxt-link-active {
  370. color: #6d6d6d;
  371. border-bottom: transparent;
  372. }
  373. ul.h-nav-list-child.h-nav-list-childProd li a:hover {
  374. color: #22202b;
  375. }
  376. .h-nav-list-childNews li a.nuxt-link-active {
  377. color: #6d6d6d;
  378. border: none;
  379. }
  380. </style>