2 Commits

Author SHA1 Message Date
hzm
7c332cb89d feat: 发布 0.2.5 2026-03-13 11:01:11 +08:00
hzm
631336097f fix: 设置持仓输入回滚问题 2026-03-13 10:14:33 +08:00
5 changed files with 30 additions and 20 deletions

View File

@@ -712,7 +712,7 @@ export const fetchFundHistory = async (code, range = '1m') => {
}; };
export const parseFundTextWithLLM = async (text) => { export const parseFundTextWithLLM = async (text) => {
const apiKey = 'sk-a72c4e279bc62a03cc105be6263d464c'; const apiKey = 'sk-5b03d4e02ec22dd2ba233fb6d2dd549b';
if (!apiKey || !text) return null; if (!apiKey || !text) return null;
try { try {

View File

@@ -3,7 +3,7 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { motion, AnimatePresence } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
const ANNOUNCEMENT_KEY = 'hasClosedAnnouncement_v15'; const ANNOUNCEMENT_KEY = 'hasClosedAnnouncement_v16';
export default function Announcement() { export default function Announcement() {
const [isVisible, setIsVisible] = useState(false); const [isVisible, setIsVisible] = useState(false);
@@ -75,15 +75,13 @@ export default function Announcement() {
<span>公告</span> <span>公告</span>
</div> </div>
<div style={{ color: 'var(--text)', lineHeight: '1.6', fontSize: '15px', overflowY: 'auto', minHeight: 0, flex: 1, paddingRight: '4px' }}> <div style={{ color: 'var(--text)', lineHeight: '1.6', fontSize: '15px', overflowY: 'auto', minHeight: 0, flex: 1, paddingRight: '4px' }}>
<p>v0.2.4 版本更新内容如下</p> <p>v0.2.5 紧急更新</p>
<p>1. 调整设置持仓相关弹框样式</p> <p>1. 修复拍照失败 key 过期问题</p>
<p>2. 基金详情弹框支持设置持仓相关参数</p> <p>2. 设置持仓输入回滚问题</p>
<p>3. 添加基金到分组弹框展示持仓金额数据</p>
<p>4. 已登录用户新增手动同步按钮</p>
<br/> <br/>
<p>答疑</p> <p>下周更新内容:</p>
<p>1. 因估值数据源问题大部分海外基金估值数据不准或没有暂时没有解决方案</p> <p>1. 大盘数据</p>
<p>2. 因交易日用户人数过多为控制服务器免费额度上限暂时减少数据自动同步频率新增手动同步按钮</p> <p>2. 关联板块</p>
<p>如有建议欢迎进用户支持群反馈</p> <p>如有建议欢迎进用户支持群反馈</p>
</div> </div>

View File

@@ -1,6 +1,6 @@
'use client'; 'use client';
import { useEffect, useState } from 'react'; import { useEffect, useMemo, useRef, useState } from 'react';
import { CloseIcon, SettingsIcon } from './Icons'; import { CloseIcon, SettingsIcon } from './Icons';
import { import {
Dialog, Dialog,
@@ -12,12 +12,21 @@ export default function HoldingEditModal({ fund, holding, onClose, onSave }) {
const [mode, setMode] = useState('amount'); // 'amount' | 'share' const [mode, setMode] = useState('amount'); // 'amount' | 'share'
const dwjz = fund?.dwjz || fund?.gsz || 0; const dwjz = fund?.dwjz || fund?.gsz || 0;
const dwjzRef = useRef(dwjz);
useEffect(() => {
dwjzRef.current = dwjz;
}, [dwjz]);
const [share, setShare] = useState(''); const [share, setShare] = useState('');
const [cost, setCost] = useState(''); const [cost, setCost] = useState('');
const [amount, setAmount] = useState(''); const [amount, setAmount] = useState('');
const [profit, setProfit] = useState(''); const [profit, setProfit] = useState('');
const holdingSig = useMemo(() => {
if (!holding) return '';
return `${holding.id ?? ''}|${holding.share ?? ''}|${holding.cost ?? ''}`;
}, [holding]);
useEffect(() => { useEffect(() => {
if (holding) { if (holding) {
const s = holding.share || 0; const s = holding.share || 0;
@@ -25,14 +34,17 @@ export default function HoldingEditModal({ fund, holding, onClose, onSave }) {
setShare(String(s)); setShare(String(s));
setCost(String(c)); setCost(String(c));
if (dwjz > 0) { const price = dwjzRef.current;
const a = s * dwjz; if (price > 0) {
const p = (dwjz - c) * s; const a = s * price;
const p = (price - c) * s;
setAmount(a.toFixed(2)); setAmount(a.toFixed(2));
setProfit(p.toFixed(2)); setProfit(p.toFixed(2));
} }
} }
}, [holding, fund, dwjz]); // 只在“切换持仓/初次打开”时初始化,避免净值刷新覆盖用户输入
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [holdingSig]);
const handleModeChange = (newMode) => { const handleModeChange = (newMode) => {
if (newMode === mode) return; if (newMode === mode) return;

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "real-time-fund", "name": "real-time-fund",
"version": "0.2.4", "version": "0.2.5",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "real-time-fund", "name": "real-time-fund",
"version": "0.2.4", "version": "0.2.5",
"dependencies": { "dependencies": {
"@dicebear/collection": "^9.3.1", "@dicebear/collection": "^9.3.1",
"@dicebear/core": "^9.3.1", "@dicebear/core": "^9.3.1",

View File

@@ -1,6 +1,6 @@
{ {
"name": "real-time-fund", "name": "real-time-fund",
"version": "0.2.4", "version": "0.2.5",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",