m-header.vue 15 KB

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