fix: 修复价格显示错误
This commit is contained in:
@@ -3,6 +3,7 @@ import {useParams} from 'react-router'
|
|||||||
import {amisRender, commonInfo, readOnlyDialogOptions, remoteMappings} from '../../util/amis.tsx'
|
import {amisRender, commonInfo, readOnlyDialogOptions, remoteMappings} from '../../util/amis.tsx'
|
||||||
import type {Schema} from 'amis'
|
import type {Schema} from 'amis'
|
||||||
import {isNil} from 'es-toolkit'
|
import {isNil} from 'es-toolkit'
|
||||||
|
import {toNumber} from 'es-toolkit/compat'
|
||||||
|
|
||||||
const formatFinanceNumber = (value: number): string => {
|
const formatFinanceNumber = (value: number): string => {
|
||||||
if (isNil(value)) {
|
if (isNil(value)) {
|
||||||
@@ -433,30 +434,28 @@ function StockDetail() {
|
|||||||
padding: 12,
|
padding: 12,
|
||||||
formatter: function (params: any) {
|
formatter: function (params: any) {
|
||||||
const param = params[0]
|
const param = params[0]
|
||||||
const open = param.data[0]
|
const open = toNumber(param.data[1]).toFixed(2)
|
||||||
const close = param.data[1]
|
const close = toNumber(param.data[2]).toFixed(2)
|
||||||
const lowest = param.data[2]
|
const lowest = toNumber(param.data[3]).toFixed(2)
|
||||||
const highest = param.data[3]
|
const highest = toNumber(param.data[4]).toFixed(2)
|
||||||
|
|
||||||
return [
|
return `<div class="text-center font-bold mb-2">${param.name}</div>
|
||||||
`<div style="font-weight: bold; margin-bottom: 4px;">${param.name}</div>`,
|
<div class="text-center">
|
||||||
`<div style="display: flex; justify-content: space-between; margin: 2px 0;">`,
|
<span>开盘:</span>
|
||||||
`<span>开盘:</span>`,
|
<span class="font-bold ml-4">${open}</span>
|
||||||
`<span style="margin-left: 12px; font-weight: bold;">${open}</span>`,
|
</div>
|
||||||
`</div>`,
|
<div class="text-center">
|
||||||
`<div style="display: flex; justify-content: space-between; margin: 2px 0;">`,
|
<span>收盘:</span>
|
||||||
`<span>收盘:</span>`,
|
<span class="font-bold ml-4">${close}</span>
|
||||||
`<span style="margin-left: 12px; font-weight: bold;">${close}</span>`,
|
</div>
|
||||||
`</div>`,
|
<div class="text-center">
|
||||||
`<div style="display: flex; justify-content: space-between; margin: 2px 0;">`,
|
<span>最低:</span>
|
||||||
`<span>最低:</span>`,
|
<span class="font-bold ml-4">${lowest}</span>
|
||||||
`<span style="margin-left: 12px; font-weight: bold;">${lowest}</span>`,
|
</div>
|
||||||
`</div>`,
|
<div class="text-center">
|
||||||
`<div style="display: flex; justify-content: space-between; margin: 2px 0;">`,
|
<span>最高:</span>
|
||||||
`<span>最高:</span>`,
|
<span class="font-bold ml-4">${highest}</span>
|
||||||
`<span style="margin-left: 12px; font-weight: bold;">${highest}</span>`,
|
</div>`
|
||||||
`</div>`,
|
|
||||||
].join('')
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
@@ -495,7 +494,7 @@ function StockDetail() {
|
|||||||
color: '#666',
|
color: '#666',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
formatter: function (value: number) {
|
formatter: function (value: number) {
|
||||||
return value.toFixed(0)
|
return value.toFixed(2)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
splitLine: {
|
splitLine: {
|
||||||
@@ -538,7 +537,7 @@ function StockDetail() {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"12月线数据"
|
"12月线数据",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user