fix:实时估值分时显示条件判断bug

This commit is contained in:
hzm
2026-02-27 21:42:13 +08:00
parent dae7576c7a
commit 7236684178
2 changed files with 10 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ export default function SettingsModal({
<div className="form-group" style={{ marginBottom: 16 }}>
<div className="muted" style={{ marginBottom: 8, fontSize: '0.8rem' }}>刷新频率</div>
<div className="chips" style={{ marginBottom: 12 }}>
{[10, 30, 60, 120, 300].map((s) => (
{[30, 60, 120, 300].map((s) => (
<button
key={s}
type="button"
@@ -40,15 +40,15 @@ export default function SettingsModal({
className="input"
type="number"
inputMode="numeric"
min="10"
min="30"
step="5"
value={tempSeconds}
onChange={(e) => setTempSeconds(Number(e.target.value))}
placeholder="自定义秒数"
/>
{tempSeconds < 10 && (
{tempSeconds < 30 && (
<div className="error-text" style={{ marginTop: 8 }}>
最小 10
最小 30
</div>
)}
</div>
@@ -77,7 +77,7 @@ export default function SettingsModal({
</div>
<div className="row" style={{ justifyContent: 'flex-end', marginTop: 24 }}>
<button className="button" onClick={saveSettings} disabled={tempSeconds < 10}>保存并关闭</button>
<button className="button" onClick={saveSettings} disabled={tempSeconds < 30}>保存并关闭</button>
</div>
</div>
</div>

View File

@@ -9,6 +9,7 @@ import { glass } from '@dicebear/collection';
import dayjs from 'dayjs';
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 Announcement from "./components/Announcement";
import { Stat } from "./components/Common";
@@ -48,6 +49,7 @@ import PcFundTable from './components/PcFundTable';
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(isSameOrAfter);
const DEFAULT_TZ = 'Asia/Shanghai';
const getBrowserTimeZone = () => {
@@ -306,9 +308,9 @@ export default function HomePage() {
const isExplicitLoginRef = useRef(false);
// 刷新频率状态
const [refreshMs, setRefreshMs] = useState(30000);
const [refreshMs, setRefreshMs] = useState(60000);
const [settingsOpen, setSettingsOpen] = useState(false);
const [tempSeconds, setTempSeconds] = useState(30);
const [tempSeconds, setTempSeconds] = useState(60);
// 全局刷新状态
const [refreshing, setRefreshing] = useState(false);
@@ -2483,7 +2485,7 @@ export default function HomePage() {
const saveSettings = (e) => {
e?.preventDefault?.();
const ms = Math.max(10, Number(tempSeconds)) * 1000;
const ms = Math.max(30, Number(tempSeconds)) * 1000;
setRefreshMs(ms);
storageHelper.setItem('refreshMs', String(ms));
setSettingsOpen(false);