|
@@ -10,6 +10,7 @@ import { useTokenStore } from '@/store/token'
|
|
|
import { useUserStore } from '@/store/user'
|
|
import { useUserStore } from '@/store/user'
|
|
|
import { getImageUrl } from '@/utils/imageUtil'
|
|
import { getImageUrl } from '@/utils/imageUtil'
|
|
|
import { toLoginPage } from '@/utils/toLoginPage'
|
|
import { toLoginPage } from '@/utils/toLoginPage'
|
|
|
|
|
+import { menuButtonInfo, rpxToPx, safeAreaInsets, systemInfo } from '@/utils'
|
|
|
import { delayLoadingMiddleware } from '@/http/tools/delayLoadingMiddleware'
|
|
import { delayLoadingMiddleware } from '@/http/tools/delayLoadingMiddleware'
|
|
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
@@ -139,11 +140,23 @@ async function onRefresh() {
|
|
|
}
|
|
}
|
|
|
refreshing.value = false
|
|
refreshing.value = false
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// 新增:滚动距离和透明度
|
|
|
|
|
+const scrollTop = ref(0)
|
|
|
|
|
+const headerOverlayOpacity = computed(() => {
|
|
|
|
|
+ // 当滚动距离超过150px时,完全显示纯色背景
|
|
|
|
|
+ const headerHeightForRPX = 526
|
|
|
|
|
+ const headerHeightForPx = rpxToPx(headerHeightForRPX)
|
|
|
|
|
+ const maxScroll = menuButtonInfo.height + safeAreaInsets.top + 64 + (headerHeightForPx - (menuButtonInfo.height + safeAreaInsets.top + 64)) / 2
|
|
|
|
|
+ return Math.min(scrollTop.value / maxScroll, 1)
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
|
<view class="home-container">
|
|
<view class="home-container">
|
|
|
- <up-pull-refresh :refreshing="refreshing" @refresh="onRefresh">
|
|
|
|
|
|
|
+ <view class="home-header-overlay"
|
|
|
|
|
+ :style="{ opacity: headerOverlayOpacity, height: `calc(${menuButtonInfo.bottom + 4}px + 50rpx)` }" />
|
|
|
|
|
+ <!-- <up-pull-refresh :refreshing="refreshing" @refresh="onRefresh"> -->
|
|
|
<!-- 顶部区域 -->
|
|
<!-- 顶部区域 -->
|
|
|
<view class="home-header">
|
|
<view class="home-header">
|
|
|
<view class="planet-font absolute z-3 text-xl c-black" :style="{ top: `${navigationBarHeight - 39}px` }">
|
|
<view class="planet-font absolute z-3 text-xl c-black" :style="{ top: `${navigationBarHeight - 39}px` }">
|
|
@@ -201,7 +214,9 @@ async function onRefresh() {
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- 邀请新人 -->
|
|
<!-- 邀请新人 -->
|
|
|
- <view class="home-header-invite"
|
|
|
|
|
|
|
+ <up-sticky :offset-top="-120">
|
|
|
|
|
+ <view class="invite-header">
|
|
|
|
|
+ <view class="home-header-invite"
|
|
|
:style="{
|
|
:style="{
|
|
|
backgroundImage: `url(${getImageUrl('@img/index/invite-card-bg.png')})`,
|
|
backgroundImage: `url(${getImageUrl('@img/index/invite-card-bg.png')})`,
|
|
|
backgroundSize: 'cover',
|
|
backgroundSize: 'cover',
|
|
@@ -219,9 +234,9 @@ async function onRefresh() {
|
|
|
@click="toInviteFriend"
|
|
@click="toInviteFriend"
|
|
|
/>
|
|
/>
|
|
|
</view>
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
- <!-- 分享优惠券 -->
|
|
|
|
|
- <view class="home-coupon-share">
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <!-- 分享优惠券 -->
|
|
|
|
|
+ <view class="home-coupon-share">
|
|
|
<view class="share-card-bg"
|
|
<view class="share-card-bg"
|
|
|
:style="{
|
|
:style="{
|
|
|
backgroundImage: `url(${getImageUrl('@img/index/share-card-bg.png')})`,
|
|
backgroundImage: `url(${getImageUrl('@img/index/share-card-bg.png')})`,
|
|
@@ -231,15 +246,15 @@ async function onRefresh() {
|
|
|
<view v-if="!hasLogin" class="share-card-text">分享优惠券, 领现金佣金!</view>
|
|
<view v-if="!hasLogin" class="share-card-text">分享优惠券, 领现金佣金!</view>
|
|
|
<view v-else class="share-card-text">分享优惠券{{couponSituationData?.pushCouponCountThreshold || '*'}}张, 领{{couponSituationData?.pushCouponAmount || '*'}}元现金佣金!</view>
|
|
<view v-else class="share-card-text">分享优惠券{{couponSituationData?.pushCouponCountThreshold || '*'}}张, 领{{couponSituationData?.pushCouponAmount || '*'}}元现金佣金!</view>
|
|
|
</view>
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </up-sticky>
|
|
|
<view class="home-coupon-list">
|
|
<view class="home-coupon-list">
|
|
|
<view class="coupon-list">
|
|
<view class="coupon-list">
|
|
|
- <u-sticky :offset-top="navigationBarHeight" :customNavHeight="44">
|
|
|
|
|
- <CouponList />
|
|
|
|
|
- </u-sticky>
|
|
|
|
|
|
|
+ <CouponList />
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- </up-pull-refresh>
|
|
|
|
|
|
|
+ <!-- </up-pull-refresh> -->
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -251,6 +266,17 @@ async function onRefresh() {
|
|
|
min-height: calc(100vh - 100rpx - var(--safe-area-inset-bottom));
|
|
min-height: calc(100vh - 100rpx - var(--safe-area-inset-bottom));
|
|
|
padding: 0 32rpx;
|
|
padding: 0 32rpx;
|
|
|
|
|
|
|
|
|
|
+ .home-header-overlay {
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ left: 0;
|
|
|
|
|
+ right: 0;
|
|
|
|
|
+ background-color: #ed6b66;
|
|
|
|
|
+ border-radius: 10rpx 10rpx 0rpx 0rpx;
|
|
|
|
|
+ z-index: 99;
|
|
|
|
|
+ pointer-events: none; // 确保不影响点击事件
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.home-header {
|
|
.home-header {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
@@ -377,6 +403,11 @@ async function onRefresh() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 邀请新人
|
|
// 邀请新人
|
|
|
|
|
+ .invite-header {
|
|
|
|
|
+ background: #ffffff;
|
|
|
|
|
+ height: 398rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.home-header-invite {
|
|
.home-header-invite {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 296rpx;
|
|
height: 296rpx;
|
|
@@ -411,6 +442,7 @@ async function onRefresh() {
|
|
|
.home-coupon-share {
|
|
.home-coupon-share {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
top: -52rpx;
|
|
top: -52rpx;
|
|
|
|
|
+ z-index: 9;
|
|
|
|
|
|
|
|
.share-card-bg {
|
|
.share-card-bg {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -431,7 +463,7 @@ async function onRefresh() {
|
|
|
|
|
|
|
|
// 优惠券列表
|
|
// 优惠券列表
|
|
|
.home-coupon-list {
|
|
.home-coupon-list {
|
|
|
- margin-top: -52rpx;
|
|
|
|
|
|
|
+ margin-top: -2rpx;
|
|
|
|
|
|
|
|
.coupon-list {
|
|
.coupon-list {
|
|
|
min-height: 209rpx;
|
|
min-height: 209rpx;
|