Header.vue 14 KB

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