Files
a_long/pages/index/index.wxss
2026-06-14 02:38:05 +08:00

585 lines
11 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* ===== 1. 全局样式 ===== */
.shangpin-page {
min-height: 100vh;
background: linear-gradient(180deg, #f5faff 0%, #f0f8ff 100%);
}
/* ===== 2. 公告栏样式 - 物理上移方案 ===== */
.gonggao-box {
margin: 20rpx 30rpx;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(135deg,
rgba(220, 255, 220, 0.85) 0%,
rgba(255, 255, 200, 0.85) 100%);
backdrop-filter: blur(10px);
display: flex;
align-items: center;
padding: 0 25rpx;
box-shadow: 0 4rpx 15rpx rgba(0, 100, 0, 0.08);
border: 1rpx solid rgba(255, 255, 255, 0.3);
position: relative;
overflow: hidden;
}
.gonggao-icon {
width: 40rpx;
height: 40rpx;
margin-right: 20rpx;
flex-shrink: 0;
display: flex;
align-items: center;
}
.gonggao-icon image {
width: 100%;
height: 100%;
}
.gonggao-content {
flex: 1;
overflow: hidden;
height: 100%;
position: relative;
}
/* 关键修改:使用物理上移 */
.gonggao-text {
font-size: 26rpx;
color: #333;
white-space: nowrap;
padding-right: 50rpx;
/* 物理上移方法1直接调整位置 */
position: absolute;
top: -5rpx; /* 从顶部开始计算位置 */
left: 0;
/* 或者使用方法2负margin上移 */
/* position: relative;
top: -10rpx; */
/* 或者使用方法3translate上移 */
/* transform: translateY(-5rpx); */
}
/* 尝试不同的上移值,直到居中为止 */
/* 可以尝试的值5rpx, 8rpx, 10rpx, 12rpx, 15rpx, 18rpx, 20rpx */
.gonggao-anim {
animation: marquee 10s linear infinite; /* 加快速度到10秒 */
animation-delay: 0.5s;
}
@keyframes marquee {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
}
/* ===== 3. 轮播图样式 ===== */
.lunbo-container {
margin: 0 30rpx 30rpx;
height: 350rpx;
border-radius: 25rpx;
overflow: hidden;
position: relative;
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.1);
}
.lunbo-swiper {
width: 100%;
height: 100%;
}
.lunbo-image {
width: 100%;
height: 100%;
}
.lunbo-placeholder {
width: 100%;
height: 100%;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
justify-content: center;
align-items: center;
}
.lunbo-placeholder image {
width: 100%;
height: 100%;
opacity: 0.8;
}
/* 刷新按钮 */
.refresh-btn {
position: absolute;
top: 20rpx;
right: 20rpx;
width: 80rpx;
height: 80rpx;
z-index: 10;
display: flex;
justify-content: center;
align-items: center;
}
.refresh-icon {
width: 60rpx;
height: 60rpx;
transition: transform 0.3s;
filter: drop-shadow(0 4rpx 8rpx rgba(0, 0, 0, 0.2));
}
.refreshing {
animation: rotate360 1s linear infinite;
}
@keyframes rotate360 {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.refresh-dot {
position: absolute;
width: 12rpx;
height: 12rpx;
background: #ffcc00;
border-radius: 50%;
top: 15rpx;
right: 15rpx;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% {
opacity: 0.8;
transform: scale(1);
}
50% {
opacity: 1;
transform: scale(1.2);
}
}
/* ===== 4. 商品展示区域 ===== */
.shangpin-container {
background: rgba(255, 255, 255, 0.95);
border-radius: 40rpx 40rpx 0 0;
margin-top: -20rpx;
padding: 40rpx 30rpx 100rpx;
min-height: 800rpx;
box-shadow: 0 -10rpx 30rpx rgba(0, 0, 0, 0.05);
}
/* 商品类型选择 - 完全重新设计,确保左对齐且间距协调 */
.leixing-scroll {
width: 100%;
white-space: nowrap;
margin-bottom: 50rpx;
}
.leixing-list {
display: inline-flex;
padding-left: 0; /* 完全去掉左内边距100%左对齐 */
padding-right: 30rpx; /* 只保留右内边距给最后一个元素一点空间 */
padding-top: 10rpx;
padding-bottom: 10rpx;
}
/* 关键:完全协调的间距 */
.leixing-item {
display: inline-flex;
flex-direction: column;
align-items: center;
margin-right: 30rpx; /* 合适的间距,不会太大也不会太小 */
transition: all 0.3s;
position: relative;
flex-shrink: 0;
width: 130rpx; /* 固定宽度,确保四个看起来协调 */
}
.leixing-item:last-child {
margin-right: 0;
}
.leixing-image-box {
width: 110rpx; /* 稍微减小,让整体更紧凑 */
height: 110rpx;
border-radius: 25rpx;
overflow: hidden;
position: relative;
margin-bottom: 12rpx;
transition: all 0.3s;
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.1);
}
.leixing-image {
width: 100%;
height: 100%;
}
.leixing-glow {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 25rpx;
border: 4rpx solid transparent;
transition: all 0.3s;
}
.leixing-active .leixing-glow {
border-color: #ffcc00;
box-shadow: 0 0 20rpx rgba(255, 204, 0, 0.5);
}
.leixing-active .leixing-image-box {
transform: translateY(-8rpx);
}
.leixing-text {
font-size: 24rpx;
color: #666;
white-space: nowrap;
transition: all 0.3s;
text-align: center;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
.leixing-active .leixing-text {
color: #333;
font-weight: bold;
transform: scale(1.05);
}
/* 专区标题 */
.zhuanqu-title {
display: flex;
align-items: center;
margin: 40rpx 0 15rpx;
padding-left: 0;
position: relative;
}
.zhuanqu-icon {
width: 40rpx;
height: 40rpx;
margin-right: 20rpx;
position: relative;
}
.zhuanqu-icon-image {
width: 100%;
height: 100%;
filter: drop-shadow(0 2rpx 4rpx rgba(255, 204, 0, 0.3));
}
.zhuanqu-sparkle {
animation: sparkle 2s infinite;
}
@keyframes sparkle {
0%, 100% {
transform: scale(1) rotate(0deg);
filter: drop-shadow(0 2rpx 4rpx rgba(255, 204, 0, 0.3));
}
50% {
transform: scale(1.1) rotate(10deg);
filter: drop-shadow(0 4rpx 8rpx rgba(255, 204, 0, 0.6));
}
}
.zhuanqu-text {
font-size: 32rpx;
font-weight: bold;
color: #333;
position: relative;
}
.zhuanqu-text::after {
content: '';
position: absolute;
left: 0;
bottom: -8rpx;
width: 60rpx;
height: 4rpx;
background: linear-gradient(90deg, #ffcc00, transparent);
border-radius: 2rpx;
}
/* 商品网格 */
.shangpin-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 25rpx;
margin-bottom: 40rpx;
}
.shangpin-card {
background: #ffffff;
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 8rpx 25rpx rgba(0, 0, 0, 0.06);
transition: all 0.3s;
position: relative;
}
.shangpin-card:active {
transform: scale(0.98);
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.1);
}
.shangpin-image-box {
width: 100%;
height: 220rpx;
position: relative;
overflow: hidden;
}
.shangpin-image {
width: 100%;
height: 100%;
transition: transform 0.5s;
}
/* 商品标题区域 - 协调紧凑 */
.shangpin-title {
height: 75rpx;
padding: 6rpx 12rpx 2rpx 12rpx;
display: flex;
align-items: flex-start;
overflow: hidden;
}
.title-text {
font-size: 26rpx;
color: #000;
line-height: 34rpx;
font-weight: 450; /* 微调粗细,更加协调 */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}
/* 价格和购买按钮 - 协调紧凑 */
.shangpin-footer {
height: 50rpx;
padding: 0 12rpx 8rpx 12rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.price-box {
display: flex;
align-items: baseline;
}
.price-icon {
font-size: 24rpx;
color: #ff4444;
font-weight: bold;
margin-right: 2rpx;
}
.price-integer {
font-size: 32rpx;
color: #ff4444;
font-weight: bold;
}
.price-decimal {
font-size: 24rpx;
color: #ff4444;
font-weight: bold;
}
.buy-btn {
width: 48rpx;
height: 48rpx;
border-radius: 50%;
background: linear-gradient(135deg, #ff4444, #ff6666);
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 4rpx 12rpx rgba(255, 68, 68, 0.3);
transition: all 0.3s;
}
.buy-btn:active {
transform: scale(0.9);
}
.buy-icon {
width: 26rpx;
height: 26rpx;
filter: brightness(0) invert(1);
}
/* ===== 5. 空状态 ===== */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
}
.empty-image {
width: 200rpx;
height: 200rpx;
margin-bottom: 40rpx;
opacity: 0.7;
}
.empty-text {
font-size: 30rpx;
color: #999;
margin-bottom: 40rpx;
}
.empty-btn {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
font-size: 28rpx;
padding: 20rpx 60rpx;
border-radius: 50rpx;
box-shadow: 0 8rpx 25rpx rgba(102, 126, 234, 0.3);
}
/* ===== 6. 弹窗样式 ===== */
.gonggao-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1000;
display: flex;
justify-content: center;
align-items: center;
}
.modal-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(5px);
}
.modal-content {
width: 600rpx;
background: white;
border-radius: 30rpx;
overflow: hidden;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.2);
z-index: 1001;
animation: modalShow 0.3s;
}
@keyframes modalShow {
from {
opacity: 0;
transform: scale(0.9);
}
to {
opacity: 1;
transform: scale(1);
}
}
.modal-header {
padding: 40rpx;
border-bottom: 2rpx solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.modal-close {
font-size: 40rpx;
color: #999;
width: 60rpx;
height: 60rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
.modal-close:active {
background: #f5f5f5;
}
.modal-body {
max-height: 600rpx;
padding: 40rpx;
}
.modal-text {
font-size: 28rpx;
color: #333;
line-height: 1.6;
white-space: normal;
word-break: break-word;
}
/* ===== 7. 加载提示 ===== */
.loading-toast {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(10px);
padding: 30rpx 50rpx;
border-radius: 25rpx;
display: flex;
flex-direction: column;
align-items: center;
z-index: 999;
}
.loading-spinner {
width: 60rpx;
height: 60rpx;
border: 6rpx solid rgba(255, 255, 255, 0.3);
border-top-color: white;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 20rpx;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.loading-text {
font-size: 26rpx;
color: white;
}