fix(market-ranking): 最新价格式化与涨跌色对齐商品期权
- 去掉 formatPrice 的 .toFixed(2),改为直接显示原始数值 - 平盘/无值颜色从 price_even 改为 elements_text_primary_02,与商品期权 getPriceColor 逻辑一致
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
contractsToPlaceholderCardData,
|
||||
} from './MarketRankingDataMapper';
|
||||
import { MarketRankingHqRequestClient } from '../node/clients/MarketRankingHqRequestClient';
|
||||
import { formatGreatNumber, formatPercent, formatPrice, riseFallColor } from '../common/NumberFormat';
|
||||
import { formatGreatNumber, formatPercent, riseFallColor } from '../common/NumberFormat';
|
||||
import { AllCardsCard } from '../node/model/AiDiagnosisNodeModel';
|
||||
import { PERIOD_RANGES, TAB_METRICS } from './MarketRankingConstant';
|
||||
import { enableDarkMode } from '@kernel/theme_manager';
|
||||
@@ -606,8 +606,8 @@ export struct MarketRankingNodeComponent {
|
||||
.width('35%')
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
Text(formatPrice(item.price))
|
||||
.fontColor(riseFallColor(item.price_chg))
|
||||
Text(item.price !== undefined ? item.price.toString() : '--')
|
||||
.fontColor(this.getPriceColor(item.price_chg))
|
||||
.fontSize(16)
|
||||
.fontWeight(500)
|
||||
.maxFontSize(16)
|
||||
@@ -720,4 +720,16 @@ export struct MarketRankingNodeComponent {
|
||||
const raw = (metricId === MetricId.RISE_SPEED || metricId === MetricId.FALL_SPEED) ? item.chg_speed : item.price_chg;
|
||||
return riseFallColor(raw);
|
||||
}
|
||||
|
||||
private getPriceColor(priceChg?: number): ResourceStr {
|
||||
if (priceChg === undefined) {
|
||||
return $r('app.color.elements_text_primary_02')
|
||||
}
|
||||
if (priceChg > 0) {
|
||||
return $r('app.color.price_up_100')
|
||||
} else if (priceChg < 0) {
|
||||
return $r('app.color.price_down_100')
|
||||
}
|
||||
return $r('app.color.elements_text_primary_02')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user