feat: 首页顶部加头像昵称问候 + 循环训练秒数步进改为±10
This commit is contained in:
@@ -7,7 +7,7 @@ module.exports = {
|
|||||||
version: 'v3.2',
|
version: 'v3.2',
|
||||||
|
|
||||||
/** 最后更新日期,外显在设置页「关于」 */
|
/** 最后更新日期,外显在设置页「关于」 */
|
||||||
updatedAt: '2026-08-04',
|
updatedAt: '2026-08-11',
|
||||||
|
|
||||||
/** 开发者名称 / 微信号,设置页点击可复制 */
|
/** 开发者名称 / 微信号,设置页点击可复制 */
|
||||||
developer: '三口一瓶',
|
developer: '三口一瓶',
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ Page({
|
|||||||
todayDone: false,
|
todayDone: false,
|
||||||
todayDuration: 0,
|
todayDuration: 0,
|
||||||
todayTargetText: '',
|
todayTargetText: '',
|
||||||
|
// 顶部问候区的用户资料(头像 + 昵称),来自 storage.getProfile()。
|
||||||
|
// 空则回退占位(人形图标 + "运动达人"),settings 改完回首页即刷新。
|
||||||
|
nickName: '',
|
||||||
|
avatarUrl: '',
|
||||||
// Ring number font size in rpx. WeChat auto-scales text by the user's
|
// Ring number font size in rpx. WeChat auto-scales text by the user's
|
||||||
// font-size setting (fontSizeScaleFactor) but does NOT scale rpx box
|
// font-size setting (fontSizeScaleFactor) but does NOT scale rpx box
|
||||||
// dimensions — so on a real device with enlarged system font the 84rpx
|
// dimensions — so on a real device with enlarged system font the 84rpx
|
||||||
@@ -153,6 +157,7 @@ Page({
|
|||||||
// 分段格子(每天一格)只在计划天数 <= 10 时用;更长则退化为里程碑连续条,避免格子过密
|
// 分段格子(每天一格)只在计划天数 <= 10 时用;更长则退化为里程碑连续条,避免格子过密
|
||||||
const useSegments = plan.totalDays > 0 && plan.totalDays <= 10
|
const useSegments = plan.totalDays > 0 && plan.totalDays <= 10
|
||||||
const planDays = useSegments ? Array.from({ length: plan.totalDays }, (_, i) => i) : []
|
const planDays = useSegments ? Array.from({ length: plan.totalDays }, (_, i) => i) : []
|
||||||
|
const profile = storage.getProfile()
|
||||||
this.setData({
|
this.setData({
|
||||||
theme,
|
theme,
|
||||||
icons: iconsMod.build(theme),
|
icons: iconsMod.build(theme),
|
||||||
@@ -166,7 +171,9 @@ Page({
|
|||||||
planTotal: plan.totalDays,
|
planTotal: plan.totalDays,
|
||||||
planProgress,
|
planProgress,
|
||||||
useSegments,
|
useSegments,
|
||||||
planDays
|
planDays,
|
||||||
|
nickName: profile.nickname || '',
|
||||||
|
avatarUrl: profile.avatarUrl || ''
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
+16
-9
@@ -1,12 +1,19 @@
|
|||||||
<view class="container page-enter" style="{{themeStyle}}">
|
<view class="container page-enter" style="{{themeStyle}}">
|
||||||
|
|
||||||
<!-- 顶部问候 -->
|
<!-- 顶部问候:头像 + "昵称,准备好了吗?" -->
|
||||||
<view class="greeting-row">
|
<view class="greeting-row">
|
||||||
<view class="greeting-text">
|
<!-- 圆形头像:无头像时回退人形图标占位 -->
|
||||||
<image class="greeting-icon" src="{{todayDone ? icons.successFill : icons.emojiFill}}" mode="aspectFit"></image>
|
<view class="greeting-avatar {{avatarUrl ? 'has-avatar' : ''}}">
|
||||||
<text class="greeting-title">{{todayDone ? '太棒了!' : '准备好了吗?'}}</text>
|
<image
|
||||||
|
class="greeting-avatar-img"
|
||||||
|
src="{{avatarUrl || icons.peopleFill}}"
|
||||||
|
mode="{{avatarUrl ? 'aspectFill' : 'aspectFit'}}"
|
||||||
|
></image>
|
||||||
|
</view>
|
||||||
|
<view class="greeting-main">
|
||||||
|
<text class="greeting-title">{{nickName || '运动达人'}},{{todayDone ? '太棒了!' : '准备好了吗?'}}</text>
|
||||||
|
<text class="greeting-sub">{{todayDone ? '继续保持这个势头' : '今天的平板支撑等着你'}}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="greeting-sub">{{todayDone ? '继续保持这个势头' : '今天的平板支撑等着你'}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 连续打卡卡片:火焰连胜 + 分段进度 -->
|
<!-- 连续打卡卡片:火焰连胜 + 分段进度 -->
|
||||||
@@ -172,9 +179,9 @@
|
|||||||
<view class="circuit-row">
|
<view class="circuit-row">
|
||||||
<text class="circuit-row-label">每组时长</text>
|
<text class="circuit-row-label">每组时长</text>
|
||||||
<view class="stepper">
|
<view class="stepper">
|
||||||
<view class="stepper-btn" data-field="hold" data-delta="-5" bindtap="onCircuitStep">−</view>
|
<view class="stepper-btn" data-field="hold" data-delta="-10" bindtap="onCircuitStep">−</view>
|
||||||
<text class="stepper-val">{{cHold}}秒</text>
|
<text class="stepper-val">{{cHold}}秒</text>
|
||||||
<view class="stepper-btn" data-field="hold" data-delta="5" bindtap="onCircuitStep">+</view>
|
<view class="stepper-btn" data-field="hold" data-delta="10" bindtap="onCircuitStep">+</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -190,9 +197,9 @@
|
|||||||
<view class="circuit-row">
|
<view class="circuit-row">
|
||||||
<text class="circuit-row-label">组间休息</text>
|
<text class="circuit-row-label">组间休息</text>
|
||||||
<view class="stepper">
|
<view class="stepper">
|
||||||
<view class="stepper-btn" data-field="rest" data-delta="-5" bindtap="onCircuitStep">−</view>
|
<view class="stepper-btn" data-field="rest" data-delta="-10" bindtap="onCircuitStep">−</view>
|
||||||
<text class="stepper-val">{{cRest}}秒</text>
|
<text class="stepper-val">{{cRest}}秒</text>
|
||||||
<view class="stepper-btn" data-field="rest" data-delta="5" bindtap="onCircuitStep">+</view>
|
<view class="stepper-btn" data-field="rest" data-delta="10" bindtap="onCircuitStep">+</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
+33
-9
@@ -1,33 +1,57 @@
|
|||||||
/* ---- greeting ---- */
|
/* ---- greeting ---- */
|
||||||
.greeting-row {
|
.greeting-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
padding: 16rpx 8rpx 24rpx;
|
padding: 16rpx 8rpx 24rpx;
|
||||||
animation: cardIn 0.4s ease both;
|
animation: cardIn 0.4s ease both;
|
||||||
}
|
}
|
||||||
|
|
||||||
.greeting-text {
|
/* 圆形头像:外层 overflow:hidden + 内层 image border-radius:50% 双保险,
|
||||||
|
避免远程(cloud://)头像裁不出圆角而露直角。无头像时显示人形图标占位,
|
||||||
|
加浅色底让占位更有质感;有头像时去掉底,避免深色头像边缘露白缝。 */
|
||||||
|
.greeting-avatar {
|
||||||
|
width: 88rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--bg-soft);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 8rpx;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.greeting-icon {
|
.greeting-avatar-img {
|
||||||
width: 44rpx;
|
width: 100%;
|
||||||
height: 44rpx;
|
height: 100%;
|
||||||
margin-right: 12rpx;
|
border-radius: 50%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.greeting-avatar.has-avatar {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.greeting-main {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.greeting-title {
|
.greeting-title {
|
||||||
|
display: block;
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
line-height: 1.2;
|
line-height: 1.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.greeting-sub {
|
.greeting-sub {
|
||||||
|
display: block;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
margin-left: 60rpx;
|
margin-top: 4rpx;
|
||||||
line-height: 1;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---- header card ---- */
|
/* ---- header card ---- */
|
||||||
|
|||||||
Reference in New Issue
Block a user