refactor(frontend): 资产页面显示实际积分股和价格,移除倍数

- 资产显示值改为 积分股余额 × price(不含倍数)
- 显示实际积分股数量而非含倍数的有效积分股
- 简化实时计算逻辑

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-18 04:28:30 -08:00
parent 8319fe5e9a
commit 4bb5a2b09d
1 changed files with 13 additions and 13 deletions

View File

@ -33,7 +33,6 @@ class _AssetPageState extends ConsumerState<AssetPage> {
// //
Timer? _refreshTimer; Timer? _refreshTimer;
int _elapsedSeconds = 0; int _elapsedSeconds = 0;
double _initialDisplayValue = 0;
double _initialShareBalance = 0; double _initialShareBalance = 0;
double _growthPerSecond = 0; double _growthPerSecond = 0;
String? _lastAccountSequence; String? _lastAccountSequence;
@ -54,7 +53,6 @@ class _AssetPageState extends ConsumerState<AssetPage> {
_refreshTimer?.cancel(); _refreshTimer?.cancel();
_elapsedSeconds = 0; _elapsedSeconds = 0;
_initialDisplayValue = double.tryParse(asset.displayAssetValue) ?? 0;
_initialShareBalance = double.tryParse(asset.shareBalance) ?? 0; _initialShareBalance = double.tryParse(asset.shareBalance) ?? 0;
// 使 mining-service // 使 mining-service
_growthPerSecond = double.tryParse(perSecondEarning) ?? 0; _growthPerSecond = double.tryParse(perSecondEarning) ?? 0;
@ -78,13 +76,10 @@ class _AssetPageState extends ConsumerState<AssetPage> {
} }
/// ///
/// = × (1 + burnMultiplier) × price /// = × price使
/// = × (1 + burnMultiplier) × price
double get _currentDisplayValue { double get _currentDisplayValue {
final price = double.tryParse(_lastAsset?.currentPrice ?? '0') ?? 0; final price = double.tryParse(_lastAsset?.currentPrice ?? '0') ?? 0;
final burnMultiplier = double.tryParse(_lastAsset?.burnMultiplier ?? '0') ?? 0; return _currentShareBalance * price;
final multiplierFactor = 1 + burnMultiplier;
return _initialDisplayValue + (_elapsedSeconds * _growthPerSecond * multiplierFactor * price);
} }
/// ///
@ -163,7 +158,7 @@ class _AssetPageState extends ConsumerState<AssetPage> {
children: [ children: [
const SizedBox(height: 8), const SizedBox(height: 8),
// - // -
_buildTotalAssetCard(asset, isLoading, _currentDisplayValue, perSecondEarning), _buildTotalAssetCard(asset, isLoading, _currentDisplayValue, _currentShareBalance, perSecondEarning),
const SizedBox(height: 24), const SizedBox(height: 24),
// //
_buildQuickActions(context), _buildQuickActions(context),
@ -208,14 +203,19 @@ class _AssetPageState extends ConsumerState<AssetPage> {
); );
} }
Widget _buildTotalAssetCard(AssetDisplay? asset, bool isLoading, double currentDisplayValue, String perSecondEarning) { Widget _buildTotalAssetCard(AssetDisplay? asset, bool isLoading, double currentDisplayValue, double currentShareBalance, String perSecondEarning) {
// 使 mining-service // 使 mining-service
final growthPerSecond = double.tryParse(perSecondEarning) ?? 0.0; final growthPerSecond = double.tryParse(perSecondEarning) ?? 0.0;
// 使 // 使-
final displayValue = asset != null && currentDisplayValue > 0 final displayValue = asset != null && currentDisplayValue > 0
? currentDisplayValue.toString() ? currentDisplayValue.toString()
: asset?.displayAssetValue; : null;
// 使-
final shareBalance = asset != null && currentShareBalance > 0
? currentShareBalance.toString()
: asset?.shareBalance;
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -300,9 +300,9 @@ class _AssetPageState extends ConsumerState<AssetPage> {
), ),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
// // -
DataText( DataText(
data: asset != null ? '${formatCompact(asset.effectiveShares)} 积分股 (含倍数)' : null, data: shareBalance != null ? '${formatCompact(shareBalance)} 积分股' : null,
isLoading: isLoading, isLoading: isLoading,
placeholder: '≈ -- 积分股', placeholder: '≈ -- 积分股',
style: const TextStyle( style: const TextStyle(