feat(index): 首页改版 hero + 进度点地图 + 计时环 dial + CTA 脉冲

- 全宽橙渐变 hero:头像+昵称+按小时问候+「时长」敢不敢来挑战+连胜(昵称同行)
- 进度点地图 quest-card 上浮叠 hero,圆点+连线 done/now/final 三态,与 CTA 等宽
- 计时环 dial 虚线刻度环+呼吸动画,整体放大(320rpx/数字96rpx)
- CTA「立即挑战+时长」带脉冲,保留自由/循环入口
- 千卡按 4 千卡/分钟估算(激励参考);删除「今天还没开始」整段与连胜前图标
- 循环训练秒数步进 ±10;取消每日语录模块
This commit is contained in:
2026-08-11 14:32:25 +08:00
parent 938a7d1276
commit 6f89494c0b
3 changed files with 326 additions and 366 deletions
+217 -271
View File
@@ -1,335 +1,275 @@
/* ---- greeting ---- */
.greeting-row {
display: flex;
align-items: center;
gap: 20rpx;
padding: 16rpx 8rpx 24rpx;
animation: cardIn 0.4s ease both;
/* ===== 全宽渐变头图 hero ===== */
/* 负 margin 抵消 container 的 24rpx 内边距,让头图左右贯穿并贴到导航栏底边;
底部留大内边距给下方 quest-card 负 margin 上浮叠住。文字统一白色,图标用
*White 变体(若有)。hero 用 opacity-only 动画,避免 transform 把 .container
变成 containing block 而破坏弹窗定位(同 app.wxss pageIn 思路)。 */
.hero {
margin: -24rpx -24rpx 0;
padding: 24rpx 24rpx 72rpx;
background: linear-gradient(160deg, var(--primary) 0%, var(--primary-light) 100%);
color: #fff;
position: relative;
overflow: hidden;
animation: heroFade 0.4s ease both;
}
/* 圆形头像:外层 overflow:hidden + 内层 image border-radius:50% 双保险,
避免远程(cloud://)头像裁不出圆角而露直角。无头像时显示人形图标占位,
加浅色底让占位更有质感;有头像时去掉底,避免深色头像边缘露白缝。 */
.greeting-avatar {
width: 88rpx;
height: 88rpx;
.hero::after {
content: '';
position: absolute;
right: -60rpx;
top: -60rpx;
width: 240rpx;
height: 240rpx;
border-radius: 50%;
background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 70%);
pointer-events: none;
}
@keyframes heroFade {
from { opacity: 0; }
to { opacity: 1; }
}
/* 顶部行:圆形头像 + 时间问候 */
.hero-top {
display: flex;
align-items: center;
gap: 18rpx;
}
.hero-avatar {
width: 84rpx;
height: 84rpx;
flex-shrink: 0;
border-radius: 50%;
overflow: hidden;
background: var(--bg-soft);
background: #fff;
display: flex;
align-items: center;
justify-content: center;
border: 3rpx solid rgba(255, 255, 255, 0.6);
}
.greeting-avatar-img {
.hero-avatar-img {
width: 100%;
height: 100%;
border-radius: 50%;
display: block;
}
.greeting-avatar.has-avatar {
/* 有头像时去掉白底,只留浅描边,避免深色头像边缘露白缝 */
.hero-avatar.has-avatar {
background: transparent;
border-color: rgba(255, 255, 255, 0.85);
}
.greeting-main {
flex: 1;
.hero-user {
display: flex;
flex-direction: row;
align-items: center;
gap: 14rpx;
min-width: 0;
}
.greeting-title {
display: block;
font-size: 40rpx;
font-weight: 700;
color: var(--text);
line-height: 1.3;
.hero-greet {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.92);
font-weight: 500;
}
.greeting-sub {
display: block;
font-size: 26rpx;
color: var(--text-secondary);
margin-top: 4rpx;
line-height: 1.2;
}
/* ---- header card ---- */
.header-card {
/* 挑战主句:时长强调色 + 「敢不敢」白字 */
.hero-challenge {
margin-top: 28rpx;
display: flex;
flex-direction: column;
gap: 28rpx;
padding: 4rpx 0;
align-items: baseline;
flex-wrap: wrap;
}
/* 上区:左连胜视觉重心,右计划徽章 */
.streak-row {
display: flex;
align-items: center;
justify-content: space-between;
}
.streak-section {
display: flex;
align-items: center;
}
/* 火焰图标 + 光晕:光晕脉动让火焰"活"起来 */
.streak-icon-wrap {
position: relative;
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 16rpx;
flex-shrink: 0;
}
.streak-halo {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 50%;
background: radial-gradient(circle at center,
rgba(var(--primary-rgb), 0.45) 0%,
rgba(var(--primary-rgb), 0.18) 50%,
rgba(var(--primary-rgb), 0) 75%);
animation: streakHalo 2s ease-in-out infinite;
}
.streak-icon {
position: relative;
width: 64rpx;
height: 64rpx;
z-index: 1;
animation: float 2.5s ease-in-out infinite;
}
.streak-text {
display: flex;
flex-direction: column;
}
.streak-num {
font-size: 72rpx;
.hero-time {
font-size: 48rpx;
font-weight: 800;
line-height: 1;
/* On the gradient hero card --text cascades to white; on any plain card it
stays dark, so var(--text) reads correctly in both contexts. We must NOT
use var(--primary) here — that would be orange-on-orange and invisible. */
color: var(--text);
text-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.15);
color: #FFE3C2;
letter-spacing: 1rpx;
margin-right: 12rpx;
font-variant-numeric: tabular-nums;
}
.streak-label {
font-size: 22rpx;
color: var(--text-secondary);
margin-top: 4rpx;
line-height: 1;
.hero-cta-text {
font-size: 44rpx;
font-weight: 800;
color: #fff;
text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
line-height: 1.2;
}
@keyframes streakHalo {
0%, 100% { transform: scale(0.85); opacity: 0.7; }
50% { transform: scale(1.1); opacity: 1; }
.hero-social {
margin-top: 0;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
/* 计划徽章:移到上区右侧,半透明白底药丸,与火焰渐变卡片区分 */
.plan-badge {
/* ===== 闯关进度地图(上浮卡片) ===== */
.quest-card {
margin-top: -56rpx;
margin-left: 0;
margin-right: 0;
position: relative;
z-index: 2;
}
.quest-head {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.18);
padding: 8rpx 18rpx;
border-radius: 999rpx;
flex-shrink: 0;
justify-content: space-between;
margin-bottom: 24rpx;
}
.plan-badge-icon {
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.plan-badge-text {
font-size: 26rpx;
font-weight: 600;
.quest-title {
font-size: 32rpx;
font-weight: 700;
color: var(--text);
line-height: 1;
}
/* 下区:分段进度 */
.segment-progress {
.quest-sub {
font-size: 24rpx;
font-weight: 400;
color: var(--text-secondary);
margin-left: 12rpx;
}
.quest-trophy {
font-size: 40rpx;
}
.quest-map {
display: flex;
align-items: center;
padding: 8rpx 4rpx;
}
.q-node {
width: 48rpx;
height: 48rpx;
border-radius: 50%;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
font-weight: 700;
background: var(--bg-soft);
color: var(--text-secondary);
}
.q-node.done {
background: var(--primary);
color: #fff;
}
.q-node.now {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: #fff;
box-shadow: 0 0 0 6rpx rgba(var(--primary-rgb), 0.18);
animation: qPulse 1.6s ease-in-out infinite;
}
.q-node.final {
background: #FFF3E0;
font-size: 30rpx;
}
.q-link {
flex: 1;
height: 4rpx;
background: var(--bg-soft);
margin: 0 2rpx;
}
.q-link.done {
background: var(--primary);
}
.quest-tip {
display: block;
margin-top: 20rpx;
font-size: 24rpx;
font-weight: 600;
color: var(--primary);
}
@keyframes qPulse {
0% { box-shadow: 0 0 0 4rpx rgba(var(--primary-rgb), 0.28); }
70% { box-shadow: 0 0 0 12rpx rgba(var(--primary-rgb), 0); }
100% { box-shadow: 0 0 0 4rpx rgba(var(--primary-rgb), 0); }
}
/* ===== 计时环 dial ===== */
.timer-wrap {
text-align: center;
margin: 32rpx 0 8rpx;
}
.dial {
width: 320rpx;
height: 320rpx;
border-radius: 50%;
margin: 0 auto;
position: relative;
background: radial-gradient(circle at 35% 30%, #ffffff, #f4f6f2 70%);
box-shadow: inset 0 4rpx 14rpx rgba(var(--primary-rgb), 0.12), 0 10rpx 24rpx rgba(var(--primary-rgb), 0.12);
display: flex;
flex-direction: column;
gap: 10rpx;
align-items: center;
justify-content: center;
animation: ringBreathe 3s ease-in-out infinite;
}
/* planTotal <= 10:按天分段格子 */
.segment-track {
display: flex;
gap: 8rpx;
}
.segment-cell {
flex: 1;
height: 12rpx;
border-radius: 6rpx;
background: transparent;
border: 2rpx solid rgba(255, 255, 255, 0.30);
box-sizing: border-box;
transition: background 0.3s ease, border-color 0.3s ease;
}
.segment-cell.done {
background: var(--on-primary, #FFFFFF);
border-color: var(--on-primary, #FFFFFF);
}
.segment-cell.current {
background: var(--on-primary, #FFFFFF);
border-color: var(--on-primary, #FFFFFF);
animation: segmentPulse 1.2s ease-in-out infinite;
}
/* planTotal > 10:连续条 + 里程碑节点,避免格子过密 */
.milestone-track {
width: 100%;
}
.milestone-bar {
position: relative;
width: 100%;
height: 12rpx;
background: rgba(0, 0, 0, 0.12);
border-radius: 6rpx;
overflow: visible;
}
.milestone-fill {
height: 100%;
background: var(--on-primary, linear-gradient(90deg, var(--primary), var(--primary-light)));
border-radius: 6rpx;
transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.milestone-node {
/* 虚线刻度环 */
.dial::before {
content: '';
position: absolute;
top: 50%;
width: 10rpx;
height: 10rpx;
inset: 14rpx;
border-radius: 50%;
background: var(--card-bg);
transform: translate(-50%, -50%);
border: 2rpx solid var(--border);
border: 2rpx dashed rgba(var(--primary-rgb), 0.28);
}
.progress-label {
font-size: 22rpx;
color: var(--text-secondary);
line-height: 1;
}
@keyframes segmentPulse {
0%, 100% { box-shadow: 0 0 4rpx rgba(var(--primary-rgb), 0.4); }
50% { box-shadow: 0 0 14rpx rgba(var(--primary-rgb), 0.9); }
}
/* ---- target card ---- */
.target-section {
text-align: center;
}
.target-header {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 8rpx;
}
.target-header .section-title {
margin-bottom: 0;
}
.section-icon {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
.target-display {
margin: 20rpx 0;
}
.target-ring {
display: inline-flex;
align-items: center;
justify-content: center;
width: 280rpx;
height: 280rpx;
border-radius: 50%;
background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.10), rgba(var(--primary-rgb), 0.03));
border: 6rpx solid rgba(var(--primary-rgb), 0.18);
box-shadow: 0 0 0 14rpx rgba(var(--primary-rgb), 0.05);
overflow: hidden;
}
.target-time {
.dial-time {
font-size: 84rpx;
font-weight: 800;
color: var(--primary);
font-variant-numeric: tabular-nums;
letter-spacing: -1rpx;
line-height: 1;
max-width: 240rpx;
max-width: 280rpx;
text-align: center;
white-space: nowrap;
overflow: hidden;
}
.today-status {
margin-top: 16rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
}
.done-badge {
display: inline-flex;
align-items: center;
background: rgba(var(--success-rgb), 0.08);
padding: 10rpx 24rpx;
border-radius: 24rpx;
}
.done-icon {
width: 28rpx;
height: 28rpx;
margin-right: 6rpx;
}
.done-text {
font-size: 26rpx;
color: var(--success);
line-height: 1;
}
.pending-icon {
width: 28rpx;
height: 28rpx;
margin-right: 6rpx;
}
.pending-text {
font-size: 26rpx;
.dial-label {
font-size: 24rpx;
color: var(--text-secondary);
line-height: 1;
margin-top: 8rpx;
}
/* ---- action buttons ---- */
.benefit {
margin-top: 20rpx;
font-size: 28rpx;
color: var(--text-secondary);
}
.benefit-hl {
color: var(--primary);
font-weight: 700;
font-size: 30rpx;
}
@keyframes ringBreathe {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.02); }
}
/* ===== action buttons ===== */
.action-buttons {
display: flex;
flex-direction: column;
@@ -348,7 +288,13 @@
min-width: 0; /* 防止图标+文字在窄屏撑破 flex 项 */
}
/* ---- picker ---- */
/* 主按钮脉冲发光(加在 ui-btn 宿主上,__usePrivacyCheck__ 不影响) */
@keyframes ctaPulse {
0%, 100% { box-shadow: 0 8rpx 20rpx rgba(var(--primary-rgb), 0.35); }
50% { box-shadow: 0 8rpx 30rpx rgba(var(--primary-rgb), 0.6); }
}
/* ===== picker ===== */
.picker-title {
font-size: 34rpx;
font-weight: 600;
@@ -439,7 +385,7 @@
margin-top: 8rpx;
}
/* ---- circuit (循环训练) config panel ---- */
/* ===== circuit (循环训练) config panel ===== */
.picker-sub {
display: block;
text-align: center;
@@ -497,7 +443,7 @@
font-variant-numeric: tabular-nums;
}
/* ---- 训练完成高亮 (3 秒后淡出) ---- */
/* ===== 训练完成高亮 (3 秒后淡出) ===== */
/* 这个 class 落在 <ui-card> 宿主节点上(ui-card.wxss 已把宿主设为 display:block
否则 border/box-shadow 只会碎成两根竖条、transform 完全不生效)。
描边用 box-shadow 的 spread 而非 borderborder 会撑大宿主 8rpx,高亮出现/消失