Header.vue 14 KB

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