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