diff --git a/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart b/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart index 62f102d4..33853b9e 100644 --- a/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart +++ b/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart @@ -33,7 +33,6 @@ class _AssetPageState extends ConsumerState { // 实时刷新相关状态 Timer? _refreshTimer; int _elapsedSeconds = 0; - double _initialDisplayValue = 0; double _initialShareBalance = 0; double _growthPerSecond = 0; String? _lastAccountSequence; @@ -54,7 +53,6 @@ class _AssetPageState extends ConsumerState { _refreshTimer?.cancel(); _elapsedSeconds = 0; - _initialDisplayValue = double.tryParse(asset.displayAssetValue) ?? 0; _initialShareBalance = double.tryParse(asset.shareBalance) ?? 0; // 使用传入的每秒增长值(来自 mining-service) _growthPerSecond = double.tryParse(perSecondEarning) ?? 0; @@ -78,13 +76,10 @@ class _AssetPageState extends ConsumerState { } /// 计算当前实时资产显示值 - /// 资产显示值 = 积分股余额 × (1 + burnMultiplier) × price - /// 每秒资产增长 = 每秒积分股增长 × (1 + burnMultiplier) × price + /// 资产显示值 = 积分股余额 × price(不含倍数,使用实际价格) double get _currentDisplayValue { final price = double.tryParse(_lastAsset?.currentPrice ?? '0') ?? 0; - final burnMultiplier = double.tryParse(_lastAsset?.burnMultiplier ?? '0') ?? 0; - final multiplierFactor = 1 + burnMultiplier; - return _initialDisplayValue + (_elapsedSeconds * _growthPerSecond * multiplierFactor * price); + return _currentShareBalance * price; } /// 计算当前实时积分股余额 @@ -163,7 +158,7 @@ class _AssetPageState extends ConsumerState { children: [ const SizedBox(height: 8), // 总资产卡片 - 始终显示,数字部分闪烁,实时刷新 - _buildTotalAssetCard(asset, isLoading, _currentDisplayValue, perSecondEarning), + _buildTotalAssetCard(asset, isLoading, _currentDisplayValue, _currentShareBalance, perSecondEarning), const SizedBox(height: 24), // 快捷操作按钮 _buildQuickActions(context), @@ -208,14 +203,19 @@ class _AssetPageState extends ConsumerState { ); } - Widget _buildTotalAssetCard(AssetDisplay? asset, bool isLoading, double currentDisplayValue, String perSecondEarning) { + Widget _buildTotalAssetCard(AssetDisplay? asset, bool isLoading, double currentDisplayValue, double currentShareBalance, String perSecondEarning) { // 使用传入的每秒增长值(来自 mining-service) final growthPerSecond = double.tryParse(perSecondEarning) ?? 0.0; - // 使用实时计算的资产值(如果有) + // 使用实时计算的资产值(如果有)- 不含倍数 final displayValue = asset != null && currentDisplayValue > 0 ? currentDisplayValue.toString() - : asset?.displayAssetValue; + : null; + + // 使用实时计算的积分股余额(如果有)- 实际数量,不含倍数 + final shareBalance = asset != null && currentShareBalance > 0 + ? currentShareBalance.toString() + : asset?.shareBalance; return Container( decoration: BoxDecoration( @@ -300,9 +300,9 @@ class _AssetPageState extends ConsumerState { ), ), const SizedBox(height: 4), - // 有效积分股 + // 积分股余额 - 实际数量 DataText( - data: asset != null ? '≈ ${formatCompact(asset.effectiveShares)} 积分股 (含倍数)' : null, + data: shareBalance != null ? '≈ ${formatCompact(shareBalance)} 积分股' : null, isLoading: isLoading, placeholder: '≈ -- 积分股', style: const TextStyle(