diff --git a/app/components/layouts/ArcticNewOneHeader.vue b/app/components/layouts/ArcticNewOneHeader.vue index c18f59b..92c1686 100755 --- a/app/components/layouts/ArcticNewOneHeader.vue +++ b/app/components/layouts/ArcticNewOneHeader.vue @@ -31,15 +31,42 @@ const navItems = computed>(() => [ ]) const topHeaderRef = ref(null) +const bottomHeaderRef = ref(null) const mobileMenuRef = ref(null) const isMobileMenuOpen = ref(false) const isUserMenuOpen = ref(false) // 滚动后为顶部导航加毛玻璃背景(内容不再与页面文字叠压) const isScrolled = ref(false) +let lastScrollY = 0 +let isBottomHeaderVisible = false + +const setBottomHeaderVisible = (visible: boolean) => { + if (!bottomHeaderRef.value || isBottomHeaderVisible === visible) return + isBottomHeaderVisible = visible + + gsap.to(bottomHeaderRef.value, { + yPercent: visible ? 0 : 150, + autoAlpha: visible ? 1 : 0, + duration: 0.45, + ease: 'power2.out', + overwrite: 'auto', + force3D: true, + }) +} + const onPageScroll = () => { const y = window.scrollY || window.pageYOffset || 0 isScrolled.value = y > 20 + + // 深入页面后向上滚动时,从底部弹出快捷导航;继续向下滚动/回到顶部则收回。 + if (y > 1000 && y < lastScrollY) { + setBottomHeaderVisible(true) + } else if (y <= 1000 || y > lastScrollY) { + setBottomHeaderVisible(false) + } + + lastScrollY = y } let scrollPending = false const scheduleScrollCheck = () => { @@ -172,6 +199,16 @@ onMounted(() => { window.addEventListener('scroll', scheduleScrollCheck, { passive: true }) window.addEventListener('resize', scheduleScrollCheck, { passive: true }) + // 底部快捷导航默认藏在视口下方 + if (bottomHeaderRef.value) { + gsap.set(bottomHeaderRef.value, { + xPercent: -50, + yPercent: 150, + autoAlpha: 0, + force3D: true, + }) + } + if (!appStore.isAppLoading && route.path !== '/') { showTopHeaderInstant() } @@ -202,6 +239,10 @@ onBeforeUnmount(() => { if (topHeaderRef.value) { gsap.killTweensOf(topHeaderRef.value) } + if (bottomHeaderRef.value) { + gsap.killTweensOf(bottomHeaderRef.value) + } + isBottomHeaderVisible = false if (isMobileMenuOpen.value) { document.body.style.overflow = '' } @@ -234,7 +275,7 @@ if (typeof window !== 'undefined') { @@ -409,11 +481,39 @@ if (typeof window !== 'undefined') { background: rgba(255, 255, 255, 0.72); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px); - border-radius: 0 0 18px 18px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06); border-bottom: 1px solid rgba(0, 0, 0, 0.06); } +.site-header-bottom { + border: 1px solid #ffffff47; + border-radius: 12px; + grid-template-rows: auto; + grid-template-columns: 1fr auto 1fr; + grid-auto-columns: 1fr; + place-items: center; + width: calc(100% - 1rem); + max-width: 570px; + padding: 10px 10px; + display: grid; + position: fixed; + left: 50%; + bottom: 15px; + overflow: hidden; + visibility: hidden; + opacity: 0; + box-shadow: 0 -1px #0000001f, 0 12px 30px #0000001a, inset 0 1px #ffffff96; +} + +@media (min-width: 768px) { + .site-header-bottom { + grid-template-columns: auto minmax(50px, auto) auto; + gap: 0; + width: fit-content; + padding: 15px 20px; + } +} + /* 用户下拉菜单动画 */ .dropdown-enter-active, .dropdown-leave-active {