update:优化节奏训练
This commit is contained in:
@@ -124,20 +124,21 @@ const formatValue = (value, digits = 1) => {
|
||||
return String(Number(numberValue.toFixed(digits)));
|
||||
};
|
||||
|
||||
const formatCompactCount = (value) => {
|
||||
const numberValue = Number(value);
|
||||
if (!Number.isFinite(numberValue)) return "--";
|
||||
if (numberValue >= 10000) return `${formatValue(numberValue / 1000)}K`;
|
||||
return formatValue(numberValue, 0);
|
||||
};
|
||||
|
||||
const getLevelText = (item) => {
|
||||
if (!item) return "";
|
||||
const level = Number(item.current_level) || 0;
|
||||
return `当前进度 LV${level} >`;
|
||||
};
|
||||
|
||||
// 卡路里字段按需求做 K / W 缩写展示。
|
||||
const getCaloriesValue = (value) => {
|
||||
const numberValue = Number(value);
|
||||
if (!Number.isFinite(numberValue)) return "--";
|
||||
if (numberValue >= 10000) return `${formatValue(numberValue / 10000)}W`;
|
||||
if (numberValue >= 1000) return `${formatValue(numberValue / 1000)}K`;
|
||||
return formatValue(numberValue, 0);
|
||||
};
|
||||
// 接口字段暂时沿用 total_calories,页面按平均环数展示。
|
||||
const getAverageRingValue = (value) => formatValue(value);
|
||||
|
||||
const getTrainingIcon = (item = {}) =>
|
||||
trainingModeIconMap[item.icon] || trainingModeIconMap.bow;
|
||||
@@ -418,7 +419,7 @@ onShow(async () => {
|
||||
<view class="stats-value-row">
|
||||
<view class="stats-value-group">
|
||||
<text class="stats-value">
|
||||
{{ formatValue(trainingData.stats.total_arrows, 0) }}
|
||||
{{ formatCompactCount(trainingData.stats.total_arrows) }}
|
||||
</text>
|
||||
<text class="stats-unit">支</text>
|
||||
<view class="stats-value-decoration"></view>
|
||||
@@ -444,7 +445,7 @@ onShow(async () => {
|
||||
<view class="stats-value-row">
|
||||
<view class="stats-value-group">
|
||||
<text class="stats-value">
|
||||
{{ formatValue(trainingData.stats.ten_ring_count, 0) }}
|
||||
{{ formatCompactCount(trainingData.stats.ten_ring_count) }}
|
||||
</text>
|
||||
<text class="stats-unit">支</text>
|
||||
<view class="stats-value-decoration"></view>
|
||||
@@ -457,13 +458,13 @@ onShow(async () => {
|
||||
<view class="stats-value-row">
|
||||
<view class="stats-value-group">
|
||||
<text class="stats-value">
|
||||
{{ getCaloriesValue(trainingData.stats.total_calories) }}
|
||||
{{ getAverageRingValue(trainingData.stats.total_calories) }}
|
||||
</text>
|
||||
<text class="stats-unit">卡路里</text>
|
||||
<text class="stats-unit">环</text>
|
||||
<view class="stats-value-decoration"></view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="stats-label">共消耗</text>
|
||||
<text class="stats-label">平均环数</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user