完善每日签到功能

This commit is contained in:
JACKYMYPERSON
2025-09-28 19:15:37 +08:00
parent ea1ee70781
commit ad3f1d64c2
4 changed files with 411 additions and 548 deletions

View File

@@ -1,271 +1,198 @@
/* 全局样式 */
/* pages/checkin/checkin.wxss */
page {
background-color: #f7f8fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
min-height: 100vh;
}
/* 容器样式 */
.checkin-container {
padding: 20rpx;
box-sizing: border-box;
}
/* 顶部信息区 */
.header {
background-color: #51bdb6;
border-radius: 20rpx;
padding: 30rpx;
color: #fff;
margin-bottom: 30rpx;
box-shadow: 0 8rpx 16rpx rgba(81, 189, 182, 0.2);
}
.month-info {
font-size: 32rpx;
font-weight: 500;
margin-bottom: 20rpx;
text-align: center;
}
.checkin-stats {
display: flex;
justify-content: space-around;
align-items: center;
}
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
}
.stat-value {
font-size: 48rpx;
font-weight: bold;
line-height: 1;
margin-bottom: 10rpx;
}
.stat-label {
font-size: 24rpx;
opacity: 0.9;
}
/* 签到按钮区 */
.checkin-button-area {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 40rpx;
}
.checkin-btn {
width: 240rpx;
height: 240rpx;
border-radius: 50%;
background-color: #51bdb6;
color: #fff;
font-size: 34rpx;
font-weight: 500;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 20rpx;
box-shadow: 0 10rpx 20rpx rgba(81, 189, 182, 0.3);
transition: all 0.3s ease;
border: none;
padding: 0;
}
.checkin-btn.checked {
background-color: #e6f7f6;
color: #51bdb6;
box-shadow: 0 5rpx 15rpx rgba(81, 189, 182, 0.2);
}
.checkin-btn.animating {
animation: pulse 1s ease-in-out;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.btn-content {
display: flex;
flex-direction: column;
align-items: center;
}
/* 签到按钮内部的对勾图标样式控制 */
.checkin-btn .check-icon {
width: 40rpx;
height: auto;
margin-top: 10rpx;
display: none; /* 默认隐藏 */
}
.checkin-btn.checked .check-icon {
display: block; /* 仅在已签到状态下显示 */
}
.checkin-tip {
font-size: 26rpx;
color: #666;
text-align: center;
line-height: 1.5;
}
/* 日历签到区 - 核心修复区域 */
.calendar-section {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 30rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
}
.section-title {
font-size: 30rpx;
font-weight: 500;
color: #333;
margin-bottom: 25rpx;
padding-left: 10rpx;
border-left: 6rpx solid #51bdb6;
}
.weekdays {
display: flex;
margin-bottom: 15rpx;
}
.weekday {
flex: 1;
text-align: center;
font-size: 26rpx;
color: #999;
padding: 10rpx 0;
}
.calendar-grid {
display: flex;
flex-wrap: wrap;
width: 100%;
}
/* 日期格子容器 */
.calendar-day {
width: 14.2857%; /* 7天平均分配宽度 */
aspect-ratio: 1; /* 宽高比1:1 */
display: flex;
justify-content: center;
align-items: center;
position: relative;
padding: 8rpx;
box-sizing: border-box;
}
/* 日期数字和圆圈 - 重点修复 */
.day-number {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
font-weight: 500;
position: relative;
line-height: 1;
color: #333; /* 默认颜色 */
}
/* 已签到状态 - 关键修复,确保数字可见 */
.calendar-day.checked .day-number {
background-color: #51bdb6; /* 绿色背景 */
color: #ffffff; /* **纯白色文字,解决覆盖问题** */
font-weight: 600;
box-shadow: 0 2rpx 8rpx rgba(81, 189, 182, 0.4);
}
/* 今日未签到状态 */
.calendar-day.today .day-number {
border: 2rpx solid #51bdb6;
color: #51bdb6;
font-weight: 600;
}
/* 空日期(上月/下月) */
.calendar-day.empty .day-number {
color: #eee;
background: transparent;
}
/* 签到对勾 - 调整位置 */
.check-mark {
position: absolute;
/* 将对勾放在圆圈的右下角作为修饰 */
right: 15rpx;
bottom: 10rpx;
width: 24rpx !important;
height: 24rpx !important;
opacity: 0.9;
z-index: 10;
}
/* 奖励区 */
.rewards-section {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
}
.rewards-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.reward-item {
display: flex;
align-items: center;
padding: 25rpx;
border-radius: 12rpx;
background-color: #f7f8fa;
transition: all 0.3s ease;
}
.reward-item.achieved {
background-color: #e6f7f6;
border-left: 6rpx solid #51bdb6;
}
.reward-days {
font-size: 28rpx;
color: #333;
width: 160rpx;
}
.reward-separator {
font-size: 24rpx;
color: #ccc;
margin: 0 10rpx;
}
.reward-content {
font-size: 28rpx;
color: #666;
flex: 1;
}
.reward-status {
display: flex;
align-items: center;
font-size: 24rpx;
color: #51bdb6;
gap: 8rpx;
}
background-color: #f4f6f8;
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
/* ⭐️ 移除这里的 padding */
}
/* ⭐️ 将 padding 添加到这里 */
.container {
padding: 32rpx;
display: flex;
flex-direction: column;
gap: 32rpx; /* 间距 */
}
/* 顶部统计卡片 */
.summary-card {
background: linear-gradient(135deg, #74cdb9, #52b19e); /* 渐变绿 */
border-radius: 20rpx;
padding: 40rpx 32rpx;
box-shadow: 0 8rpx 24rpx rgba(82, 177, 158, 0.3);
color: #fff;
display: flex;
flex-direction: column;
align-items: center;
}
.month-display {
font-size: 30rpx;
margin-bottom: 30rpx;
font-weight: 500;
}
.stats-row {
display: flex;
justify-content: space-around;
width: 100%;
margin-bottom: 40rpx;
align-items: center;
}
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
width: 45%; /* 均分空间 */
}
.stat-number {
font-size: 68rpx;
font-weight: bold;
line-height: 1;
margin-bottom: 10rpx;
}
.stat-label {
font-size: 26rpx;
opacity: 0.8;
}
.divider-v {
width: 2rpx;
height: 80rpx;
background-color: rgba(255, 255, 255, 0.4);
align-self: center;
}
.today-checkin-box {
margin-top: 30rpx;
margin-bottom: 20rpx;
}
.checkin-button, .checked-in-status {
width: 180rpx;
height: 180rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 600;
transition: all 0.2s ease-in-out;
}
.checkin-button {
background-color: rgba(255, 255, 255, 0.2);
border: 4rpx solid rgba(255, 255, 255, 0.6);
color: #fff;
}
.checkin-button:active {
background-color: rgba(255, 255, 255, 0.3);
transform: scale(0.98);
}
.checked-in-status {
background-color: rgba(255, 255, 255, 0.3); /* 已签到的淡背景 */
border: 4rpx solid rgba(255, 255, 255, 0.4);
color: #fff;
}
.checkin-tip {
font-size: 26rpx;
opacity: 0.9;
text-align: center;
margin-top: 10rpx;
}
/* 签到日历卡片 */
.calendar-card {
background-color: #ffffff;
border-radius: 20rpx;
padding: 32rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
}
.calendar-header {
padding-bottom: 24rpx;
border-bottom: 1rpx solid #eee;
margin-bottom: 24rpx;
}
.calendar-title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
text-align: center;
margin-bottom: 20rpx;
}
.weekday-item {
font-size: 26rpx;
color: #999999;
padding: 10rpx 0;
}
.calendar-days {
display: grid;
grid-template-columns: repeat(7, 1fr);
text-align: center;
}
.day-item {
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
font-size: 30rpx;
color: #333333;
line-height: 1; /* 确保文字不撑开 */
}
/* 其他月份日期 */
.day-item.other-month {
color: #cccccc;
}
/* 今日高亮 */
.day-item.today .day-content {
background-color: #ffeecc; /* 浅黄色背景 */
border-radius: 50%;
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
/* 已签到日期样式 */
.day-content.checked-in {
background-color: #52b19e; /* 绿色背景 */
border-radius: 50%;
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
color: #fff; /* 确保数字颜色为白色,在绿色背景上清晰可见 */
font-weight: 600;
}
/* 确保数字的样式 */
.day-number {
z-index: 2; /* 确保数字在背景之上 */
position: relative; /* 配合 z-index */
}
/* 卡片整体点击态 */
.card-hover {
transform: scale(0.99);
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.1);
}