fix(mobile): 修正火柴人进度计算,使用固定目标值
- 省公司: 目标固定5万,达到或超过5万停在红旗 - 市公司: 目标固定1万,达到或超过1万停在红旗 - 进度 = completedCount / targetCount,clamp到0-1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7d1a392d9e
commit
0623169d19
|
|
@ -8,11 +8,10 @@ class StickmanRankingData {
|
|||
final String nickname;
|
||||
final String? avatarUrl;
|
||||
final int completedCount; // 完成数量
|
||||
final int targetCount; // 目标数量 (从后端获取)
|
||||
final int targetCount; // 目标数量 (省5万/市1万)
|
||||
final double monthlyEarnings; // 本月可结算收益
|
||||
final bool isCurrentUser; // 是否是当前用户
|
||||
final String? accountSequence; // 账户序列号(用于查看详情)
|
||||
final double progressPercentage; // 进度百分比 (0-100, 从后端获取)
|
||||
|
||||
StickmanRankingData({
|
||||
required this.id,
|
||||
|
|
@ -23,11 +22,13 @@ class StickmanRankingData {
|
|||
required this.monthlyEarnings,
|
||||
this.isCurrentUser = false,
|
||||
this.accountSequence,
|
||||
required this.progressPercentage,
|
||||
});
|
||||
|
||||
/// 完成进度 (0.0 - 1.0),使用后端计算的进度百分比
|
||||
double get progress => (progressPercentage / 100).clamp(0.0, 1.0);
|
||||
/// 完成进度 (0.0 - 1.0)
|
||||
/// 直接用 completedCount / targetCount 计算,达到或超过目标就是100%
|
||||
double get progress => targetCount > 0
|
||||
? (completedCount / targetCount).clamp(0.0, 1.0)
|
||||
: 0.0;
|
||||
}
|
||||
|
||||
/// 授权类型
|
||||
|
|
|
|||
|
|
@ -609,11 +609,10 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
|||
nickname: r.nickname,
|
||||
avatarUrl: r.avatarUrl,
|
||||
completedCount: r.completedCount,
|
||||
targetCount: r.finalTarget,
|
||||
targetCount: 50000, // 省公司目标固定5万
|
||||
monthlyEarnings: r.monthlyEarnings,
|
||||
isCurrentUser: r.isCurrentUser,
|
||||
accountSequence: r.accountSequence,
|
||||
progressPercentage: r.progressPercentage,
|
||||
)).toList();
|
||||
});
|
||||
}
|
||||
|
|
@ -644,11 +643,10 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
|||
nickname: r.nickname,
|
||||
avatarUrl: r.avatarUrl,
|
||||
completedCount: r.completedCount,
|
||||
targetCount: r.finalTarget,
|
||||
targetCount: 10000, // 市公司目标固定1万
|
||||
monthlyEarnings: r.monthlyEarnings,
|
||||
isCurrentUser: r.isCurrentUser,
|
||||
accountSequence: r.accountSequence,
|
||||
progressPercentage: r.progressPercentage,
|
||||
)).toList();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue