Header.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <template>
  2. <header id="header">
  3. <!-- 主导航 (桌面端) -->
  4. <nav class="header-nav container hidden-xs">
  5. <router-link to="/" class="header-logo">
  6. <div class="logo-wrapper">
  7. <div class="logo-glow"></div>
  8. <img src="@/assets/img/logo_black.svg" alt="Logo">
  9. </div>
  10. </router-link>
  11. <router-link to="/" class="header-company-name">
  12. <div class="name-wrapper">
  13. <span>上海展域航空技术有限公司</span>
  14. </div>
  15. </router-link>
  16. <ul class="nav-menu">
  17. <li
  18. v-for="(item, index) in navList"
  19. :key="index"
  20. :class="{ active: index === navIndex, 'nav-item-contact': item.name === '联系我们' }"
  21. @click="navClick(index, item.name)"
  22. >
  23. <router-link :to="item.path">
  24. {{ item.name }}
  25. <i v-if="item.children.length > 0" class="glyphicon glyphicon-menu-down"></i>
  26. <span class="nav-underline"></span>
  27. </router-link>
  28. <!-- 二级菜单 -->
  29. <ul v-if="item.children.length > 0" class="submenu">
  30. <li v-for="(child, n) in item.children" :key="n">
  31. <router-link :to="child.path">{{ child.name }}</router-link>
  32. </li>
  33. </ul>
  34. </li>
  35. </ul>
  36. </nav>
  37. <!-- 手机导航 -->
  38. <div class="header-nav-m container-fuild visible-xs">
  39. <router-link to="/home" class="header-nav-m-logo">
  40. <img class="center-block" src="@/assets/img/logo_black.svg" alt="logo">
  41. </router-link>
  42. <!-- 导航栏 -->
  43. <div class="header-nav-m-menu text-center">
  44. {{ menuName }}
  45. <div
  46. class="header-nav-m-menu-wrapper"
  47. data-toggle="collapse"
  48. data-target="#menu"
  49. @click="menuClick"
  50. >
  51. <span :class="menuClass"></span>
  52. </div>
  53. <!-- 导航内容 -->
  54. <ul id="menu" class="header-nav-m-wrapper collapse">
  55. <li
  56. v-for="(item,index) in navList"
  57. :key="index"
  58. :class="index==navIndex?'active':''"
  59. @click="navClick(index,item.name)"
  60. data-toggle="collapse"
  61. data-target="#menu"
  62. >
  63. <router-link :to="item.path">
  64. {{ item.name }}
  65. <i class="glyphicon glyphicon-chevron-right"></i>
  66. </router-link>
  67. </li>
  68. </ul>
  69. </div>
  70. </div>
  71. </header>
  72. </template>
  73. <script>
  74. import { navConfig } from '@/config/nav-config'
  75. export default {
  76. name: "Header",
  77. data() {
  78. return {
  79. navIndex: sessionStorage.getItem('navIndex') || 0,
  80. menuName: "首页",
  81. menuClass: "glyphicon glyphicon-menu-down",
  82. navList: navConfig
  83. };
  84. },
  85. methods: {
  86. navClick(index, name) {
  87. this.navIndex = index;
  88. sessionStorage.setItem('navIndex', index);
  89. this.menuName = name;
  90. },
  91. menuClick() {
  92. if (this.menuClass === "glyphicon glyphicon-menu-down") {
  93. this.menuClass = "glyphicon glyphicon-menu-up";
  94. } else {
  95. this.menuClass = "glyphicon glyphicon-menu-down";
  96. }
  97. }
  98. }
  99. };
  100. </script>
  101. <style scoped>
  102. /* ===== CSS 变量 ===== */
  103. #header {
  104. --header-bg: rgba(255, 255, 255, 0.95);
  105. --header-glass: rgba(255, 255, 255, 0.8);
  106. --header-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  107. --nav-text: #333;
  108. --nav-hover: #1e73be;
  109. --nav-active: #1e73be;
  110. --submenu-bg: #fff;
  111. --submenu-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  112. --transition: all 0.3s ease;
  113. --glow-blue: 0 0 20px rgba(30, 115, 190, 0.3);
  114. }
  115. /* ===== 基础样式 ===== */
  116. #header {
  117. background: var(--header-glass);
  118. backdrop-filter: blur(10px);
  119. box-shadow: var(--header-shadow);
  120. position: sticky;
  121. top: 0;
  122. z-index: 1000;
  123. border-bottom: 1px solid rgba(30, 115, 190, 0.1);
  124. }
  125. /* ===== 主导航 ===== */
  126. .header-nav {
  127. display: flex;
  128. align-items: center;
  129. height: 80px;
  130. padding: 0;
  131. }
  132. /* Logo */
  133. .header-logo {
  134. flex-shrink: 0;
  135. display: flex;
  136. align-items: center;
  137. text-decoration: none;
  138. }
  139. .header-logo .logo-wrapper {
  140. position: relative;
  141. display: inline-block;
  142. padding: 8px;
  143. border-radius: 12px;
  144. transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  145. overflow: visible;
  146. }
  147. .header-logo .logo-glow {
  148. position: absolute;
  149. top: 50%;
  150. left: 50%;
  151. transform: translate(-50%, -50%) scale(0.6);
  152. width: 70%;
  153. height: 70%;
  154. background: conic-gradient(
  155. from 0deg,
  156. rgba(255, 140, 50, 0),
  157. rgba(255, 140, 50, 0.4),
  158. rgba(255, 160, 80, 0.5),
  159. rgba(255, 120, 40, 0.4),
  160. rgba(255, 140, 50, 0)
  161. );
  162. border-radius: 12px;
  163. filter: blur(12px);
  164. opacity: 0;
  165. transition: opacity 0.4s ease;
  166. z-index: 0;
  167. animation: rotate-glow 3s linear infinite;
  168. }
  169. @keyframes rotate-glow {
  170. 0% { transform: translate(-50%, -50%) scale(0.8) rotate(0deg); }
  171. 100% { transform: translate(-50%, -50%) scale(0.8) rotate(360deg); }
  172. }
  173. .header-logo .logo-wrapper::before {
  174. content: '';
  175. position: absolute;
  176. top: 0;
  177. left: 0;
  178. right: 0;
  179. bottom: 0;
  180. border-radius: 12px;
  181. background: linear-gradient(
  182. 135deg,
  183. rgba(255, 140, 50, 0.08),
  184. rgba(255, 160, 80, 0.12),
  185. rgba(255, 140, 50, 0.08)
  186. );
  187. opacity: 0;
  188. transition: opacity 0.4s ease;
  189. z-index: 1;
  190. }
  191. .header-logo .logo-wrapper img {
  192. position: relative;
  193. z-index: 2;
  194. height: 50px;
  195. width: auto;
  196. object-fit: contain;
  197. filter: drop-shadow(0 2px 6px rgba(255, 140, 50, 0.2));
  198. transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  199. }
  200. .header-logo:hover .logo-wrapper {
  201. transform: scale(1.08);
  202. }
  203. .header-logo:hover .logo-wrapper::before {
  204. opacity: 1;
  205. }
  206. .header-logo:hover .logo-glow {
  207. opacity: 1;
  208. }
  209. .header-logo:hover .logo-wrapper img {
  210. transform: scale(1.05);
  211. filter: drop-shadow(0 4px 12px rgba(255, 140, 50, 0.4));
  212. }
  213. /* 企业名称 */
  214. .header-company-name {
  215. flex-shrink: 0;
  216. display: flex;
  217. align-items: center;
  218. padding-left: 16px;
  219. margin-left: 16px;
  220. border-left: 1px solid rgba(30, 115, 190, 0.2);
  221. text-decoration: none;
  222. cursor: pointer;
  223. transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  224. }
  225. .header-company-name:hover {
  226. opacity: 0.85;
  227. }
  228. .header-company-name .name-wrapper {
  229. position: relative;
  230. display: inline-block;
  231. padding: 8px 16px;
  232. border-radius: 12px;
  233. transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  234. overflow: hidden;
  235. }
  236. .header-company-name .name-wrapper::before {
  237. content: '';
  238. position: absolute;
  239. top: 0;
  240. left: 0;
  241. right: 0;
  242. bottom: 0;
  243. border-radius: 12px;
  244. background: linear-gradient(
  245. 135deg,
  246. rgba(255, 140, 50, 0.08),
  247. rgba(255, 160, 80, 0.12),
  248. rgba(255, 140, 50, 0.08)
  249. );
  250. opacity: 0;
  251. transition: opacity 0.4s ease;
  252. }
  253. .header-company-name span {
  254. position: relative;
  255. z-index: 2;
  256. font-size: 20px; /* 修改这个值调整字体大小 */
  257. font-weight: 600;
  258. color: #806D61;
  259. letter-spacing: 1px;
  260. line-height: 1.4;
  261. white-space: nowrap;
  262. transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  263. }
  264. .header-company-name:hover .name-wrapper {
  265. transform: scale(1.03);
  266. }
  267. .header-company-name:hover .name-wrapper::before {
  268. opacity: 1;
  269. }
  270. .header-company-name:hover span {
  271. color: #2c2c2c;
  272. }
  273. /* 导航菜单 */
  274. .nav-menu {
  275. display: flex;
  276. align-items: center;
  277. gap: 8px;
  278. list-style: none;
  279. margin: 0;
  280. padding: 0;
  281. margin-left: auto;
  282. }
  283. .nav-menu > li {
  284. position: relative;
  285. }
  286. /* 联系我们按钮样式 */
  287. .nav-menu > li.nav-item-contact {
  288. margin-left: 10px;
  289. }
  290. .nav-menu > li.nav-item-contact > a {
  291. background: linear-gradient(135deg, #1e73be 0%, #3b82f6 100%);
  292. color: #fff !important;
  293. padding: 10px 24px;
  294. border-radius: 6px;
  295. font-weight: 600;
  296. box-shadow: 0 2px 8px rgba(30, 115, 190, 0.3);
  297. transition: all 0.3s ease;
  298. }
  299. .nav-menu > li.nav-item-contact > a:hover {
  300. background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  301. transform: translateY(-2px);
  302. box-shadow: 0 4px 12px rgba(30, 115, 190, 0.4);
  303. }
  304. .nav-menu > li.nav-item-contact > a .nav-underline {
  305. display: none;
  306. }
  307. .nav-menu > li.nav-item-contact > a i {
  308. display: none;
  309. }
  310. .nav-menu > li > a {
  311. display: flex;
  312. align-items: center;
  313. gap: 4px;
  314. padding: 12px 18px;
  315. color: var(--nav-text);
  316. font-size: 15px;
  317. font-weight: 500;
  318. text-decoration: none;
  319. transition: var(--transition);
  320. border-radius: 8px;
  321. position: relative;
  322. overflow: hidden;
  323. }
  324. .nav-menu > li > a::before {
  325. content: '';
  326. position: absolute;
  327. bottom: 0;
  328. left: 50%;
  329. width: 0;
  330. height: 3px;
  331. background: var(--primary-gradient, linear-gradient(135deg, #1e73be, #3b82f6));
  332. transition: all 0.3s ease;
  333. transform: translateX(-50%);
  334. border-radius: 3px 3px 0 0;
  335. }
  336. .nav-menu > li > a:hover::before,
  337. .nav-menu > li.active > a::before {
  338. width: 80%;
  339. }
  340. .nav-menu > li > a:hover,
  341. .nav-menu > li.active > a {
  342. color: var(--nav-hover);
  343. background: rgba(30, 115, 190, 0.05);
  344. }
  345. .nav-menu > li > a i {
  346. font-size: 10px;
  347. transition: transform 0.3s ease;
  348. }
  349. .nav-menu > li > a:hover i {
  350. transform: rotate(180deg);
  351. }
  352. /* 二级菜单 */
  353. .submenu {
  354. position: absolute;
  355. top: 100%;
  356. left: 0;
  357. min-width: 180px;
  358. background: rgba(255, 255, 255, 0.98);
  359. backdrop-filter: blur(20px);
  360. border-radius: 12px;
  361. box-shadow: var(--submenu-shadow), var(--glow-blue);
  362. list-style: none;
  363. margin-top: 8px;
  364. padding: 8px 0;
  365. opacity: 0;
  366. visibility: hidden;
  367. transform: translateY(-10px);
  368. transition: var(--transition);
  369. border: 1px solid rgba(30, 115, 190, 0.1);
  370. }
  371. .nav-menu > li:hover .submenu {
  372. opacity: 1;
  373. visibility: visible;
  374. transform: translateY(0);
  375. }
  376. .submenu li a {
  377. display: block;
  378. padding: 12px 20px;
  379. color: var(--nav-text);
  380. font-size: 14px;
  381. text-decoration: none;
  382. transition: var(--transition);
  383. position: relative;
  384. }
  385. .submenu li a::before {
  386. content: '';
  387. position: absolute;
  388. left: 0;
  389. top: 0;
  390. width: 3px;
  391. height: 0;
  392. background: var(--primary-gradient, linear-gradient(135deg, #1e73be, #3b82f6));
  393. transition: height 0.3s ease;
  394. }
  395. .submenu li a:hover::before {
  396. height: 100%;
  397. }
  398. .submenu li a:hover {
  399. background: linear-gradient(90deg, rgba(30, 115, 190, 0.05), transparent);
  400. color: var(--nav-hover);
  401. padding-left: 24px;
  402. }
  403. /* ===== 移动端导航 ===== */
  404. @media screen and (max-width: 997px) {
  405. /* 桌面端元素不在移动端显示 */
  406. .header-company-name {
  407. display: none;
  408. }
  409. /* 移动端 Header 容器 - 移除底部边框 */
  410. #header {
  411. border-bottom: none !important;
  412. }
  413. /* 移动端 Logo 区域 */
  414. #header .header-nav-m .header-nav-m-logo {
  415. height: 70px;
  416. position: relative;
  417. background: rgba(255, 255, 255, 0.98);
  418. backdrop-filter: blur(10px);
  419. border-bottom: 1px solid rgba(30, 115, 190, 0.08);
  420. display: block;
  421. text-decoration: none;
  422. }
  423. #header .header-nav-m .header-nav-m-logo img {
  424. width: 160px;
  425. height: 50px;
  426. position: absolute;
  427. top: 0;
  428. left: 0;
  429. right: 0;
  430. bottom: 0;
  431. margin: auto;
  432. }
  433. /* 移动端导航条 - 蓝色玻璃效果 */
  434. #header .header-nav-m .header-nav-m-menu {
  435. height: 44px;
  436. font-size: 14px;
  437. line-height: 44px;
  438. background: rgba(30, 115, 190, 0.95);
  439. backdrop-filter: blur(10px);
  440. position: relative;
  441. box-shadow: 0 4px 16px rgba(30, 115, 190, 0.35);
  442. color: #fff;
  443. font-weight: 500;
  444. }
  445. #header .header-nav-m .header-nav-m-menu-wrapper {
  446. position: absolute;
  447. top: 50%;
  448. right: 16px;
  449. margin-top: -16px;
  450. width: 32px;
  451. height: 32px;
  452. line-height: 32px;
  453. text-align: center;
  454. background: rgba(255, 255, 255, 0.15);
  455. border-radius: 8px;
  456. transition: all 0.3s ease;
  457. cursor: pointer;
  458. }
  459. #header .header-nav-m .header-nav-m-menu-wrapper:hover {
  460. background: rgba(255, 255, 255, 0.25);
  461. }
  462. #header .header-nav-m .header-nav-m-menu-wrapper span {
  463. font-size: 14px;
  464. color: #fff;
  465. }
  466. /* 下拉导航菜单 */
  467. #header .header-nav-m .header-nav-m-wrapper {
  468. background: rgba(255, 255, 255, 0.98);
  469. backdrop-filter: blur(10px);
  470. box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  471. padding: 8px 0;
  472. margin: 0;
  473. }
  474. #header .header-nav-m .header-nav-m-wrapper > li {
  475. margin: 4px 12px;
  476. border-radius: 10px;
  477. overflow: hidden;
  478. transition: all 0.3s ease;
  479. }
  480. #header .header-nav-m .header-nav-m-wrapper > li > a {
  481. display: flex;
  482. align-items: center;
  483. justify-content: space-between;
  484. padding: 14px 18px;
  485. color: #333;
  486. font-size: 15px;
  487. font-weight: 500;
  488. text-decoration: none;
  489. border-radius: 10px;
  490. transition: all 0.3s ease;
  491. }
  492. #header .header-nav-m .header-nav-m-wrapper > li > a i {
  493. font-size: 12px;
  494. color: #ccc;
  495. transition: transform 0.3s ease;
  496. }
  497. #header .header-nav-m .header-nav-m-wrapper > li > a:hover {
  498. background: rgba(30, 115, 190, 0.08);
  499. color: #1e73be;
  500. }
  501. #header .header-nav-m .header-nav-m-wrapper > li > a:hover i {
  502. transform: translateX(4px);
  503. color: #1e73be;
  504. }
  505. /* 激活状态 */
  506. #header .header-nav-m .header-nav-m-wrapper > li.active {
  507. background: rgba(30, 115, 190, 0.1);
  508. }
  509. #header .header-nav-m .header-nav-m-wrapper > li.active > a {
  510. color: #1e73be;
  511. font-weight: 600;
  512. }
  513. #header .header-nav-m .header-nav-m-wrapper > li.active > a i {
  514. color: #1e73be;
  515. }
  516. /* 联系我们特殊样式 */
  517. #header .header-nav-m .header-nav-m-wrapper > li.nav-item-contact {
  518. margin: 16px 12px 8px;
  519. }
  520. #header .header-nav-m .header-nav-m-wrapper > li.nav-item-contact > a {
  521. background: linear-gradient(135deg, #1e73be 0%, #3b82f6 100%);
  522. color: #fff !important;
  523. justify-content: center;
  524. box-shadow: 0 4px 12px rgba(30, 115, 190, 0.3);
  525. }
  526. #header .header-nav-m .header-nav-m-wrapper > li.nav-item-contact > a i {
  527. display: none;
  528. }
  529. #header .header-nav-m .header-nav-m-wrapper > li.nav-item-contact:hover {
  530. transform: translateY(-2px);
  531. box-shadow: 0 6px 16px rgba(30, 115, 190, 0.4);
  532. }
  533. #header .header-nav .header-nav-wrapper > li > a > span {
  534. font-size: 10px;
  535. }
  536. }
  537. </style>