feat: 排行榜虚拟领奖台 + 勋章对齐与尺寸统一

- 领奖台数据不足 3 名时显示虚拟空位(虚线轮廓+虚位以待)
- 领奖台勋章与昵称对齐改为等高盒结构性修复(移除 margin 盲推)
- 全 app 成就勋章图标尺寸统一为 30rpx(前三名/列表/设置页/记录页一致)
- 勋章 SVG 按包围盒精确居中(utils/icons.js)
- 设置页/记录页勋章展示配套调整
This commit is contained in:
2026-08-04 11:23:48 +08:00
parent bce796d893
commit b52db87ddf
17 changed files with 690 additions and 67 deletions
+19 -1
View File
@@ -67,6 +67,7 @@ Page({
icons: iconsMod.build(),
nickName: '',
avatarUrl: '',
unlockedBadges: [],
// Dark mode
darkModePref: 'system',
darkModeOptions: [
@@ -125,10 +126,27 @@ Page({
plans: buildPlansList(storage.getCustomPlans()),
nickName: profile.nickname || '',
avatarUrl: profile.avatarUrl || '',
darkModePref: darkMod.getPref()
darkModePref: darkMod.getPref(),
// 已解锁勋章:个人资料昵称旁展示(主题色版,浅底可见)
unlockedBadges: this._getUnlockedBadges()
})
},
/**
* 已解锁勋章列表 = 累计去重训练日达到阈值的 badge。
* iconFill 是 icons.build 生成的主题色变体 keyicons.js PATHS.*Fill)。
*/
_getUnlockedBadges() {
try {
const totalDays = storage.getTotalStats().totalDays
return config.trainingDayBadges
.filter(b => totalDays >= b.days)
.map(b => ({ ...b, iconFill: b.icon + 'Fill' }))
} catch (e) {
return []
}
},
applyThemeToPage() {
themeMod.applyThemeToPage(this)
},
+7 -1
View File
@@ -13,7 +13,13 @@
</view>
</button>
<view class="profile-info">
<text class="profile-name">{{nickName || '未设置'}}</text>
<view class="profile-name-row">
<text class="profile-name">{{nickName || '未设置'}}</text>
<!-- 已解锁勋章(主题色版,浅底可见)。无解锁时不占位 -->
<view class="profile-badges" wx:if="{{unlockedBadges.length > 0}}">
<image class="profile-badge" wx:for="{{unlockedBadges}}" wx:key="days" src="{{icons[item.iconFill]}}" mode="aspectFit"></image>
</view>
</view>
<text class="profile-sub">排行榜将显示此昵称</text>
</view>
</view>
+25
View File
@@ -380,6 +380,31 @@
text-overflow: ellipsis;
}
/* 昵称 + 已解锁勋章横排。昵称可收缩省略,勋章组固定宽度不挤压 */
.profile-name-row {
display: flex;
align-items: center;
gap: 10rpx;
min-width: 0;
}
.profile-name-row .profile-name {
flex: 0 1 auto;
min-width: 0;
}
.profile-badges {
display: flex;
align-items: center;
gap: 4rpx;
flex-shrink: 0;
}
.profile-badge {
width: 30rpx;
height: 30rpx;
}
.profile-sub {
font-size: 22rpx;
color: var(--text-secondary);