|
|
|
@ -16,33 +16,128 @@ page { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
box-sizing: border-box; |
|
|
|
background-color: #f8f8f8; |
|
|
|
/* 移除背景色,让page的背景渐变显示出来 */ |
|
|
|
} |
|
|
|
|
|
|
|
/* 顶部搜索区域容器 */ |
|
|
|
.top-section { |
|
|
|
flex-shrink: 0; |
|
|
|
padding: 10rpx 0; |
|
|
|
margin-bottom: 20rpx; |
|
|
|
overflow: hidden; |
|
|
|
transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, transform 0.4s ease-in-out, margin-bottom 0.4s ease-in-out, padding 0.4s ease-in-out; |
|
|
|
-webkit-transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, -webkit-transform 0.4s ease-in-out, margin-bottom 0.4s ease-in-out, padding 0.4s ease-in-out; |
|
|
|
will-change: opacity, transform, max-height, margin; |
|
|
|
max-height: 200rpx; |
|
|
|
opacity: 1; |
|
|
|
/* 顶部搜索区域容器 - 保持紫色渐变背景 */ |
|
|
|
.top-section-container { |
|
|
|
position: fixed; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
right: 0; |
|
|
|
z-index: 1000; |
|
|
|
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); |
|
|
|
transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); |
|
|
|
transform: translateY(0); |
|
|
|
-webkit-transform: translateY(0); |
|
|
|
will-change: transform; |
|
|
|
-webkit-transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); |
|
|
|
} |
|
|
|
|
|
|
|
/* 隐藏时的状态 */ |
|
|
|
.top-section-container.top-hidden { |
|
|
|
transform: translateY(-100%); |
|
|
|
opacity: 0; |
|
|
|
} |
|
|
|
|
|
|
|
/* 标题样式调整 */ |
|
|
|
.top-section-container .title { |
|
|
|
padding: 30rpx 0 20rpx 0; |
|
|
|
font-size: 36rpx; |
|
|
|
font-weight: bold; |
|
|
|
text-align: center; |
|
|
|
color: white; |
|
|
|
transition: all 0.3s ease; |
|
|
|
} |
|
|
|
|
|
|
|
/* 顶部搜索区域完全隐藏状态 - 用于平滑收缩高度 */ |
|
|
|
.top-hidden { |
|
|
|
max-height: 0; |
|
|
|
.top-section-container.top-hidden .title { |
|
|
|
padding: 0; |
|
|
|
margin-bottom: 0; |
|
|
|
pointer-events: none; |
|
|
|
font-size: 0; |
|
|
|
opacity: 0; |
|
|
|
} |
|
|
|
|
|
|
|
/* 搜索区域样式调整 */ |
|
|
|
.top-section-container .search-section { |
|
|
|
padding: 0 30rpx 30rpx; |
|
|
|
transition: all 0.3s ease; |
|
|
|
} |
|
|
|
|
|
|
|
.top-section-container.top-hidden .search-section { |
|
|
|
padding: 0 30rpx; |
|
|
|
opacity: 0; |
|
|
|
} |
|
|
|
|
|
|
|
/* 搜索框样式 */ |
|
|
|
.top-section-container .search-bar { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
background: white; |
|
|
|
border-radius: 50rpx; |
|
|
|
padding: 10rpx 20rpx; |
|
|
|
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1); |
|
|
|
transition: all 0.3s ease; |
|
|
|
} |
|
|
|
|
|
|
|
.top-section-container.top-hidden .search-bar { |
|
|
|
transform: scale(0.9); |
|
|
|
opacity: 0; |
|
|
|
transform: translateY(-20rpx); |
|
|
|
-webkit-transform: translateY(-20rpx); |
|
|
|
} |
|
|
|
|
|
|
|
/* 商品列表区域 - 调整位置 */ |
|
|
|
.goods-section { |
|
|
|
margin-top: 240rpx; /* 给搜索区域留出空间 */ |
|
|
|
height: calc(100vh - 240rpx); |
|
|
|
background: transparent; /* 透明背景,显示page的渐变 */ |
|
|
|
} |
|
|
|
|
|
|
|
/* 当搜索框隐藏时调整内边距 */ |
|
|
|
.top-section-container.top-hidden ~ .goods-section { |
|
|
|
margin-top: 100rpx; |
|
|
|
height: calc(100vh - 100rpx); |
|
|
|
} |
|
|
|
|
|
|
|
/* 品种筛选区域调整 */ |
|
|
|
.category-section { |
|
|
|
position: fixed; |
|
|
|
top: 200rpx; /* 根据搜索区域高度调整 */ |
|
|
|
left: 0; |
|
|
|
right: 0; |
|
|
|
z-index: 999; |
|
|
|
background: white; |
|
|
|
transition: top 0.3s ease; |
|
|
|
padding: 20rpx 0; |
|
|
|
border-bottom: 2rpx solid #f0f0f0; |
|
|
|
} |
|
|
|
|
|
|
|
.top-section-container.top-hidden ~ .category-section { |
|
|
|
top: 60rpx; /* 搜索区域隐藏后上移 */ |
|
|
|
} |
|
|
|
|
|
|
|
/* iOS专用修复 */ |
|
|
|
@media screen and (-webkit-min-device-pixel-ratio:0) { |
|
|
|
.top-section-container { |
|
|
|
-webkit-transform: translateZ(0); |
|
|
|
transform: translateZ(0); |
|
|
|
} |
|
|
|
|
|
|
|
.top-section-container.top-hidden { |
|
|
|
-webkit-transform: translate3d(0, -100%, 0); |
|
|
|
transform: translate3d(0, -100%, 0); |
|
|
|
} |
|
|
|
|
|
|
|
/* 防止iOS弹性滚动导致的视觉问题 */ |
|
|
|
.goods-list { |
|
|
|
-webkit-overflow-scrolling: touch; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* 确保滚动视图有正确的容器高度 */ |
|
|
|
.goods-section { |
|
|
|
position: relative; |
|
|
|
} |
|
|
|
|
|
|
|
.goods-list { |
|
|
|
height: 100%; |
|
|
|
box-sizing: border-box; |
|
|
|
} |
|
|
|
|
|
|
|
/* 标题样式 */ |
|
|
|
|