feat(cp排行榜): 金币计算方法调整
This commit is contained in:
parent
6871fce39e
commit
ccc4ef24f4
@ -590,11 +590,17 @@ const formatLargeNumber = (num) => {
|
|||||||
const absNum = Math.abs(num)
|
const absNum = Math.abs(num)
|
||||||
|
|
||||||
if (absNum >= 1000000) {
|
if (absNum >= 1000000) {
|
||||||
return (num / 1000000).toFixed(2) + 'M'
|
// 截断到两位小数,不进行四舍五入
|
||||||
|
const millionValue = num / 1000000
|
||||||
|
const truncatedValue = Math.trunc(millionValue * 100) / 100
|
||||||
|
return truncatedValue.toFixed(2) + 'M'
|
||||||
} else if (absNum >= 1000) {
|
} else if (absNum >= 1000) {
|
||||||
return (num / 1000).toFixed(2) + 'K'
|
// 截断到两位小数,不进行四舍五入
|
||||||
|
const thousandValue = num / 1000
|
||||||
|
const truncatedValue = Math.trunc(thousandValue * 100) / 100
|
||||||
|
return truncatedValue.toFixed(2) + 'K'
|
||||||
} else {
|
} else {
|
||||||
return num.toString()
|
return Math.floor(num).toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user