diff --git a/.idea/real-time-fund.iml b/.idea/real-time-fund.iml index c956989..0e89486 100644 --- a/.idea/real-time-fund.iml +++ b/.idea/real-time-fund.iml @@ -1,7 +1,10 @@ - + + + + diff --git a/app/page.jsx b/app/page.jsx index 22380d9..623007b 100644 --- a/app/page.jsx +++ b/app/page.jsx @@ -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), diff --git a/package-lock.json b/package-lock.json index 1e52ab8..392fca0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,8 @@ "react": "18.3.1", "react-chartjs-2": "^5.3.1", "react-dom": "18.3.1", - "tesseract.js": "^5.1.1" + "tesseract.js": "^5.1.1", + "uuid": "^13.0.0" }, "devDependencies": { "babel-plugin-react-compiler": "^1.0.0", @@ -6959,6 +6960,19 @@ "punycode": "^2.1.0" } }, + "node_modules/uuid": { + "version": "13.0.0", + "resolved": "https://registry.npmmirror.com/uuid/-/uuid-13.0.0.tgz", + "integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist-node/bin/uuid" + } + }, "node_modules/wasm-feature-detect": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/wasm-feature-detect/-/wasm-feature-detect-1.8.0.tgz", diff --git a/package.json b/package.json index 6969228..48e21a2 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "react": "18.3.1", "react-chartjs-2": "^5.3.1", "react-dom": "18.3.1", - "tesseract.js": "^5.1.1" + "tesseract.js": "^5.1.1", + "uuid": "^13.0.0" }, "engines": { "node": ">=20.9.0"