feat(index): 首页随机姿势提示 + 移除冗余文案
- homeTip 从 config.postureTips 随机取一条,每次进首页换一条 - 移除圆环下方"平板支撑"单位文字,调整 ring 间距
This commit is contained in:
@@ -15,6 +15,7 @@ Page({
|
|||||||
todayDone: false,
|
todayDone: false,
|
||||||
todayDuration: 0,
|
todayDuration: 0,
|
||||||
todayTargetText: '',
|
todayTargetText: '',
|
||||||
|
homeTip: '',
|
||||||
// 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
|
||||||
@@ -147,6 +148,10 @@ 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) : []
|
||||||
|
// 首页姿势要领:从 config.postureTips 随机取一条,每次刷新都换,
|
||||||
|
// 让用户反复进首页能看到不同要领。配置为空时回退到默认文案,避免空白。
|
||||||
|
const tips = config.postureTips || []
|
||||||
|
const homeTip = tips.length ? tips[Math.floor(Math.random() * tips.length)] : '保持身体成一条直线,核心收紧,均匀呼吸'
|
||||||
this.setData({
|
this.setData({
|
||||||
theme,
|
theme,
|
||||||
icons: iconsMod.build(theme),
|
icons: iconsMod.build(theme),
|
||||||
@@ -160,7 +165,8 @@ Page({
|
|||||||
planTotal: plan.totalDays,
|
planTotal: plan.totalDays,
|
||||||
planProgress,
|
planProgress,
|
||||||
useSegments,
|
useSegments,
|
||||||
planDays
|
planDays,
|
||||||
|
homeTip
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,6 @@
|
|||||||
<view class="target-ring">
|
<view class="target-ring">
|
||||||
<text class="target-time" style="font-size: {{targetTimeFontSize}}rpx;">{{todayTargetText}}</text>
|
<text class="target-time" style="font-size: {{targetTimeFontSize}}rpx;">{{todayTargetText}}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="target-unit">平板支撑</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="today-status">
|
<view class="today-status">
|
||||||
<block wx:if="{{todayDone}}">
|
<block wx:if="{{todayDone}}">
|
||||||
@@ -106,7 +105,7 @@
|
|||||||
<ui-card variant="soft" padded="{{false}}">
|
<ui-card variant="soft" padded="{{false}}">
|
||||||
<view class="tip-card">
|
<view class="tip-card">
|
||||||
<image class="tip-icon" src="{{icons.lightFill}}" mode="aspectFit"></image>
|
<image class="tip-icon" src="{{icons.lightFill}}" mode="aspectFit"></image>
|
||||||
<text class="tip-text">保持身体成一条直线,核心收紧,均匀呼吸</text>
|
<text class="tip-text">{{homeTip}}</text>
|
||||||
</view>
|
</view>
|
||||||
</ui-card>
|
</ui-card>
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,6 @@
|
|||||||
background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.10), rgba(var(--primary-rgb), 0.03));
|
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);
|
border: 6rpx solid rgba(var(--primary-rgb), 0.18);
|
||||||
box-shadow: 0 0 0 14rpx rgba(var(--primary-rgb), 0.05);
|
box-shadow: 0 0 0 14rpx rgba(var(--primary-rgb), 0.05);
|
||||||
margin-bottom: 20rpx;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,14 +265,6 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.target-unit {
|
|
||||||
display: block;
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
margin-top: 4rpx;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.today-status {
|
.today-status {
|
||||||
margin-top: 16rpx;
|
margin-top: 16rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user