Header.vue 14 KB

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