Header.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <!--
  2. * @Author: LiZhiWei
  3. * @Date: 2026-01-13 15:41:49
  4. * @LastEditors: LiZhiWei
  5. * @LastEditTime: 2026-01-22 10:21:52
  6. * @Description:
  7. -->
  8. <!--
  9. * @Author: LiZhiWei
  10. * @Description: AppHeader
  11. -->
  12. <template>
  13. <header class="landing-header" :class="{ 'is-scrolled': y > 0 }">
  14. <div class="landing-container header-content">
  15. <i class="header-logo"></i>
  16. <nav class="hidden sm:flex items-center gap-52px text-16px text-#334155 h-full">
  17. <NuxtLink to="/" class="nav-link flex items-center">首页</NuxtLink>
  18. <div class="group h-full flex items-center">
  19. <NuxtLink to="/" class="nav-link flex items-center">产品中心</NuxtLink>
  20. <div
  21. class="fixed left-0 top-80px w-full hidden bg-white shadow-lg border-t border-gray-100 group-hover:block z-50 animate-fade-in-down"
  22. >
  23. <div class="landing-container py-32px flex justify-start">
  24. <div class="grid grid-cols-2 gap-24px">
  25. <NuxtLink
  26. v-for="(item, idx) in productItems"
  27. :key="idx"
  28. :to="item.link"
  29. target="_blank"
  30. rel="noopener noreferrer"
  31. class="product-card group/item"
  32. >
  33. <i :class="[item.icon, 'product-icon']"></i>
  34. <div class="flex flex-col justify-center py-14px">
  35. <div
  36. class="font-s-16px color-#000000 pf-sc-semibold group-hover/item:text-#0F67F8 transition-colors"
  37. >
  38. {{ item.title }}
  39. </div>
  40. <div class="font-s-14px pf-sc-regular text-#64748b lh-22px mb-12px">
  41. {{ item.desc }}
  42. </div>
  43. <div class="flex items-center text-14px text-#0F67F8">
  44. 查看详情
  45. <i
  46. class="i-custom-arrow-right-c ml-4px wh-18px color-#0F67F8 group-hover/item:translate-x-5px transition-all duration-300"
  47. ></i>
  48. </div>
  49. </div>
  50. </NuxtLink>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="group h-full flex items-center">
  56. <NuxtLink to="/" class="nav-link flex items-center">解决方案</NuxtLink>
  57. <!-- Mega Menu -->
  58. <div
  59. class="fixed left-0 top-60px sm:top-80px w-full bg-white shadow-lg border-t border-gray-100 hidden group-hover:block z-50 animate-fade-in-down"
  60. >
  61. <div class="landing-container py-40px flex">
  62. <!-- Left Sidebar -->
  63. <div class="w-240px border-r border-gray-100 pr-40px shrink-0">
  64. <div class="text-18px font-600 mb-20px text-#1e293b">解决方案分类</div>
  65. <div class="flex flex-col gap-4px">
  66. <div
  67. v-for="(tab, index) in abilityTabs"
  68. :key="index"
  69. class="px-16px py-12px rounded-8px cursor-pointer text-14px transition-colors"
  70. :class="
  71. activeCategory === index
  72. ? 'bg-#ECEFF6 text-#0F67F8 pf-sc-semibold'
  73. : 'text-#091221/70'
  74. "
  75. @mouseenter="activeCategory = index"
  76. >
  77. {{ tab.title }}
  78. </div>
  79. </div>
  80. </div>
  81. <!-- Right Content -->
  82. <div class="flex-1 pl-60px">
  83. <div class="grid grid-cols-2 gap-x-60px gap-y-40px">
  84. <div
  85. v-for="(item, idx) in currentItems"
  86. :key="idx"
  87. class="flex gap-16px group/item cursor-pointer"
  88. >
  89. <!-- Icon -->
  90. <i :class="[item.icon, 'wh-48px']"></i>
  91. <!-- Text -->
  92. <div>
  93. <div
  94. class="text-16px font-600 text-#1e293b mb-8px group-hover/item:text-#2563eb transition-colors"
  95. >
  96. {{ item.title }}
  97. </div>
  98. <div class="text-12px text-#64748b lh-20px line-clamp-2">{{ item.desc }}</div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. <NuxtLink to="/" class="nav-link flex items-center">客户案例</NuxtLink>
  107. <NuxtLink to="/" class="nav-link flex items-center">知产专利</NuxtLink>
  108. <NuxtLink to="/about" class="nav-link flex items-center">关于绘家</NuxtLink>
  109. <!-- <NuxtLink to="/" class="nav-link flex items-center">联系合作</NuxtLink> -->
  110. </nav>
  111. <div class="flex items-center gap-30px lt-sm:hidden">
  112. <i class="i-custom-head-phone h-28px w-199px"></i>
  113. <button class="btn-primary btn-apply" @click="openConsultation">
  114. <span class="lh-20px">免费咨询</span>
  115. </button>
  116. </div>
  117. <button class="menu-toggle-btn" @click="isMobileMenuOpen = !isMobileMenuOpen">
  118. <i v-if="!isMobileMenuOpen" class="i-custom-menu menu-icon"></i>
  119. <i v-else class="i-ep-close menu-icon"></i>
  120. </button>
  121. </div>
  122. </header>
  123. <!-- Mobile Menu Overlay -->
  124. <div
  125. v-if="isMobileMenuOpen"
  126. class="fixed inset-0 top-80px lt-sm:top-128px bg-white z-90 sm:hidden flex flex-col animate-fade-in-down overflow-hidden"
  127. >
  128. <nav class="flex-1 overflow-y-auto py-20px px-24px">
  129. <div class="flex flex-col gap-8px text-16px text-#334155 font-500">
  130. <NuxtLink
  131. to="/"
  132. class="mobile-nav-item flex items-center justify-between group"
  133. @click="isMobileMenuOpen = false"
  134. >
  135. <span>首页</span>
  136. </NuxtLink>
  137. <!-- Product Center Section -->
  138. <div class="border-b border-gray-100">
  139. <div
  140. class="mobile-nav-item mobile-submenu-trigger"
  141. :class="{ 'text-#0F67F8': isMobileProductsOpen }"
  142. @click="toggleMobileSubmenu('products')"
  143. >
  144. <span>产品中心</span>
  145. <i
  146. class="i-ep-arrow-right transition-transform duration-300 text-gray-300"
  147. :class="{
  148. 'rotate-90': isMobileProductsOpen,
  149. 'text-#0F67F8': isMobileProductsOpen,
  150. }"
  151. ></i>
  152. </div>
  153. <div
  154. v-show="isMobileProductsOpen"
  155. class="pl-12px pb-16px flex flex-col gap-12px animate-fade-in"
  156. >
  157. <NuxtLink
  158. v-for="(item, idx) in productItems"
  159. :key="idx"
  160. :to="item.link"
  161. target="_blank"
  162. class="mobile-product-card"
  163. >
  164. <i :class="[item.icon, 'mobile-product-icon']"></i>
  165. <div class="flex flex-col">
  166. <div class="text-15px font-600 text-#1e293b">{{ item.title }}</div>
  167. <div class="text-12px text-#64748b mt-2px">{{ item.desc }}</div>
  168. </div>
  169. </NuxtLink>
  170. </div>
  171. </div>
  172. <!-- Solutions Section -->
  173. <div class="border-b border-gray-100">
  174. <div
  175. class="mobile-nav-item mobile-submenu-trigger"
  176. :class="{ 'text-#0F67F8': isMobileSolutionsOpen }"
  177. @click="toggleMobileSubmenu('solutions')"
  178. >
  179. <span>解决方案</span>
  180. <i
  181. class="i-ep-arrow-right transition-transform duration-300 text-gray-300"
  182. :class="{
  183. 'rotate-90': isMobileSolutionsOpen,
  184. 'text-#0F67F8': isMobileSolutionsOpen,
  185. }"
  186. ></i>
  187. </div>
  188. <div
  189. v-show="isMobileSolutionsOpen"
  190. class="pl-12px pb-16px flex flex-col gap-24px animate-fade-in"
  191. >
  192. <div v-for="(tab, idx) in abilityTabs" :key="idx">
  193. <div
  194. class="font-600 text-15px text-#1e293b mb-12px pl-10px border-l-3 border-#0F67F8 flex items-center h-16px"
  195. >
  196. {{ tab.title }}
  197. </div>
  198. <div class="pl-4px grid grid-cols-2 gap-x-10px gap-y-10px">
  199. <div v-for="(item, i) in abilities[tab.id]" :key="i" class="mobile-solution-card">
  200. <i :class="[item.icon, 'mobile-solution-icon']"></i>
  201. {{ item.title }}
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. <NuxtLink
  208. to="/"
  209. class="mobile-nav-item flex items-center justify-between group"
  210. @click="isMobileMenuOpen = false"
  211. >
  212. <span>客户案例</span>
  213. <i class="i-ep-arrow-right text-gray-300 text-12px group-active:text-#0F67F8"></i>
  214. </NuxtLink>
  215. <NuxtLink
  216. to="/about"
  217. class="mobile-nav-item flex items-center justify-between group"
  218. @click="isMobileMenuOpen = false"
  219. >
  220. <span>关于绘家</span>
  221. </NuxtLink>
  222. <!-- <NuxtLink
  223. to="/"
  224. class="mobile-nav-item flex items-center justify-between group"
  225. @click="isMobileMenuOpen = false"
  226. >
  227. <span>联系合作</span>
  228. </NuxtLink> -->
  229. </div>
  230. </nav>
  231. </div>
  232. </template>
  233. <script setup lang="ts">
  234. import { abilities, abilityTabs } from '~/constants/common'
  235. const { openConsultation } = useConsultation()
  236. const { y } = useWindowScroll()
  237. const isMobileMenuOpen = ref(false)
  238. const isMobileSolutionsOpen = ref(false)
  239. const isMobileProductsOpen = ref(false)
  240. const toggleMobileSubmenu = (menu: 'products' | 'solutions') => {
  241. if (menu === 'products') {
  242. isMobileProductsOpen.value = !isMobileProductsOpen.value
  243. if (isMobileProductsOpen.value) isMobileSolutionsOpen.value = false
  244. } else {
  245. isMobileSolutionsOpen.value = !isMobileSolutionsOpen.value
  246. if (isMobileSolutionsOpen.value) isMobileProductsOpen.value = false
  247. }
  248. }
  249. const activeCategory = ref(0)
  250. const productItems = [
  251. {
  252. title: '绘管家',
  253. desc: '智慧物业综合管理云平台',
  254. icon: 'i-custom-cp-hgj',
  255. link: 'https://www.huiguanjia.cn/',
  256. },
  257. {
  258. title: '绘服务',
  259. desc: '足不出户尽享物业服务',
  260. icon: 'i-custom-cp-hfw',
  261. link: 'https://www.huifuwu.cn/',
  262. },
  263. ]
  264. const currentItems = computed(() => {
  265. const activeTabId = abilityTabs[activeCategory.value]?.id
  266. return activeTabId ? abilities[activeTabId] : []
  267. })
  268. </script>
  269. <style scoped lang="scss">
  270. .landing-header {
  271. @apply fixed top-0 left-0 z-100 w-full bg-transparent transition-all duration-300 ease;
  272. &:hover,
  273. &.is-scrolled {
  274. @apply bg-white/80 backdrop-blur-12px shadow-[0_4px_20px_rgba(0,0,0,0.05)] border-b border-white/10;
  275. }
  276. @media (max-width: 767px) {
  277. @apply bg-white/80 backdrop-blur-12px shadow-[0_4px_20px_rgba(0,0,0,0.05)] border-b border-white/10;
  278. }
  279. }
  280. .nav-link {
  281. @apply relative py-8px text-[var(--hj-text-2)] transition-all duration-200 ease;
  282. &:hover,
  283. .group:hover & {
  284. @apply text-[var(--hj-primary)] font-600;
  285. }
  286. &::after {
  287. @apply content-[''] absolute bottom-0 left-1/2 w-0 h-3px bg-[var(--hj-primary)] transition-all duration-300 ease -translate-x-1/2;
  288. }
  289. &:hover::after,
  290. .group:hover &::after {
  291. @apply w-30px;
  292. }
  293. }
  294. .btn-primary {
  295. @apply bg-gradient-to-r from-[#779EFF] to-[#0A50FF] border-none outline-none hover:opacity-80;
  296. }
  297. @keyframes fadeInDown {
  298. from {
  299. opacity: 0;
  300. transform: translateY(-10px);
  301. }
  302. to {
  303. opacity: 1;
  304. transform: translateY(0);
  305. }
  306. }
  307. @keyframes fadeIn {
  308. from {
  309. opacity: 0;
  310. transform: translateY(-5px);
  311. }
  312. to {
  313. opacity: 1;
  314. transform: translateY(0);
  315. }
  316. }
  317. .animate-fade-in {
  318. animation: fadeIn 0.3s ease-out forwards;
  319. }
  320. .animate-fade-in-down {
  321. animation: fadeInDown 0.2s ease-out forwards;
  322. &::before {
  323. content: '';
  324. @apply absolute -top-10px left-0 w-full h-10px;
  325. }
  326. }
  327. .mobile-nav-item {
  328. @apply py-16px border-b border-gray-100 text-#334155 active:text-#0F67F8 transition-colors;
  329. }
  330. .safe-area-bottom {
  331. padding-bottom: calc(24px + env(safe-area-inset-bottom));
  332. }
  333. /* Extracted Styles */
  334. .header-content {
  335. @apply flex items-center justify-between gap-16px h-80px;
  336. @apply lt-sm:h-128px lt-sm:px-24px;
  337. }
  338. .header-logo {
  339. @apply i-custom-logo w-160px h-32px;
  340. @apply lt-sm:w-213px lt-sm:h-64px;
  341. }
  342. .product-card {
  343. @apply flex gap-16px p-8px w-358px rounded-8px bg-#f6f8fd cursor-pointer transition-all duration-300 border border-transparent;
  344. @apply hover:border-gray-100 hover:shadow-sm;
  345. }
  346. .product-icon {
  347. @apply wh-106px flex-shrink-0;
  348. }
  349. .btn-apply {
  350. @apply text-white font-medium w-134px h-40px pf-sc-medium font-s-16px rounded-8px hidden sm:block;
  351. }
  352. .menu-toggle-btn {
  353. @apply sm:hidden text-#334155;
  354. }
  355. .menu-icon {
  356. @apply lt-sm:wh-48px;
  357. }
  358. .mobile-submenu-trigger {
  359. @apply flex items-center justify-between !border-none cursor-pointer;
  360. }
  361. .mobile-product-card {
  362. @apply flex items-center gap-12px p-12px rounded-8px bg-gray-50/80 border border-gray-100 transition-all duration-200;
  363. @apply active:bg-blue-50 active:border-blue-200;
  364. }
  365. .mobile-product-icon {
  366. @apply wh-40px flex-shrink-0;
  367. }
  368. .mobile-solution-card {
  369. @apply text-13px text-#475569 bg-gray-50/80 border border-gray-100 rounded-8px py-12px px-10px flex items-center justify-start text-left transition-all duration-200 gap-8px;
  370. @apply active:bg-blue-50 active:border-blue-200 active:text-blue-600;
  371. }
  372. .mobile-solution-icon {
  373. @apply wh-20px flex-shrink-0;
  374. }
  375. </style>