bw-mini-app/src/components/TemplateCard/index.css

213 lines
4.1 KiB
CSS
Raw 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.

.template-card {
background: #fff;
border-radius: 32rpx;
padding: 0;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.08);
/* 优化移除transition减少重绘 */
cursor: pointer;
display: flex;
flex-direction: column;
position: relative;
overflow: hidden;
break-inside: avoid;
width: 100%;
box-sizing: border-box;
/* 性能优化:启用硬件加速 */
transform: translateZ(0);
will-change: transform;
}
/* 优化简化active状态减少重绘 */
.template-card:active {
opacity: 0.9;
}
/* 合成对比图片区域 */
.image-comparison {
position: relative;
padding: 0;
flex: 1;
min-height: 480rpx;
}
.merged-image-container {
position: relative;
border-radius: 0;
overflow: hidden;
width: 100%;
height: 100%;
min-height: 480rpx;
display: block;
}
.image-layer {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
min-height: 480rpx;
}
/* 优化减少clip-path动画频率提升性能 */
.overlay-layer {
transition: clip-path 0.2s ease-out;
/* 启用硬件加速 */
transform: translateZ(0);
will-change: clip-path;
}
.full-image {
width: 100%;
height: 100%;
min-height: 480rpx;
object-fit: cover;
display: block;
/* 性能优化:启用硬件加速和图片优化 */
transform: translateZ(0);
image-rendering: optimizeSpeed;
/* 防止图片闪烁 */
backface-visibility: hidden;
}
/* 可拖拽分割线 */
.split-line {
position: absolute;
top: 0;
bottom: 0;
width: 8rpx; /* 增加宽度便于拖拽 */
background: linear-gradient(to bottom,
rgba(255, 255, 255, 0.8) 0%,
rgba(255, 255, 255, 0.9) 50%,
rgba(255, 255, 255, 0.8) 100%);
transform: translateX(-50%);
z-index: 3;
cursor: col-resize;
touch-action: none; /* 防止页面滚动 */
transition: left 0.1s ease-out;
}
.split-handle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 64rpx;
height: 64rpx;
background: rgba(255, 255, 255, 0.95);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.25);
border: 4rpx solid rgba(0, 122, 255, 0.4);
cursor: col-resize;
touch-action: none;
transition: all 0.2s ease;
}
.split-handle:active {
transform: translate(-50%, -50%) scale(1.1);
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.3);
}
.split-icon {
font-size: 24rpx;
color: #007AFF;
font-weight: bold;
}
/* ==================== 新布局样式 ==================== */
/* 标题区域 - 图片上方 */
.template-header {
padding: 24rpx 32rpx 16rpx;
background: #fff;
}
.template-name {
font-size: 32rpx;
font-weight: 700;
color: #1a1a1a;
line-height: 1.3;
margin: 0;
display: block;
}
/* 积分悬浮徽章 - 图片右上角 */
.credit-badge {
position: absolute;
top: 24rpx;
right: 24rpx;
z-index: 4;
background: rgba(255, 107, 53, 0.95);
backdrop-filter: blur(20rpx);
-webkit-backdrop-filter: blur(20rpx);
border-radius: 20rpx;
padding: 6rpx 12rpx;
box-shadow: 0 4rpx 16rpx rgba(255, 107, 53, 0.3);
display: flex;
align-items: center;
justify-content: center;
min-height: 36rpx;
line-height: 1;
}
.credit-text {
color: #fff;
font-size: 22rpx;
font-weight: 600;
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
margin: 0;
padding: 0;
line-height: 1;
display: block;
}
/* 标签悬浮 - 图片底部 */
.tags-overlay {
position: absolute;
bottom: 24rpx;
left: 24rpx;
right: 24rpx;
z-index: 4;
display: flex;
flex-wrap: wrap;
gap: 12rpx;
}
.tag-badge {
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(20rpx);
-webkit-backdrop-filter: blur(20rpx);
color: #fff;
font-size: 20rpx;
font-weight: 500;
padding: 6rpx 16rpx;
border-radius: 20rpx;
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3);
}
/* 简介区域 - 图片下方 */
.template-footer {
padding: 24rpx 32rpx 32rpx;
background: #fff;
}
.template-desc {
font-size: 26rpx;
color: #666;
line-height: 1.4;
margin: 0;
display: block;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}