feat: crypto.randomUUID 替换为 uuid

This commit is contained in:
hzm
2026-03-04 10:21:33 +08:00
parent c9038757dd
commit c65f2b8ab1
4 changed files with 25 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
import { isNumber, isString, isPlainObject } from 'lodash';
import { v4 as uuidv4 } from 'uuid';
import Announcement from "./components/Announcement";
import { Stat } from "./components/Common";
import FundTrendChart from "./components/FundTrendChart";
@@ -987,7 +988,7 @@ export default function HomePage() {
setTransactions(prev => {
const current = prev[fundCode] || [];
const record = {
id: crypto.randomUUID(),
id: uuidv4(),
type: data.type,
share: data.share,
amount: data.amount,
@@ -1012,7 +1013,7 @@ export default function HomePage() {
// 如果没有价格API失败加入待处理队列
if (!data.price || data.price === 0) {
const pending = {
id: crypto.randomUUID(),
id: uuidv4(),
fundCode: fund.code,
fundName: fund.name,
type: tradeModal.type,
@@ -1063,7 +1064,7 @@ export default function HomePage() {
setTransactions(prev => {
const current = prev[fund.code] || [];
const record = {
id: crypto.randomUUID(),
id: uuidv4(),
type: tradeModal.type,
share: data.share,
amount: isBuy ? data.totalCost : (data.share * data.price),