修改 ota cicd
Docker Build and Push / build-image (push) Successful in 6m37s

This commit is contained in:
cheney
2026-08-07 17:10:07 +08:00
parent 22a36fb213
commit add3ff8831
9 changed files with 141 additions and 15 deletions
+10 -10
View File
@@ -1,9 +1,10 @@
import { useEffect, useState } from 'react'
import { useEffect, useState, useCallback } from 'react'
import { useParams, useNavigate } from 'react-router-dom'
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'
import { Card, List, NavBar } from 'antd-mobile'
import { api } from '../../api/client.js'
import TrendBadge, { calcTrend, lastPoint } from '../../components/TrendBadge.jsx'
import useRefreshOnVisible from '../../hooks/useRefreshOnVisible.js'
// 经济数据
// 列表态 (默认): 列出所有指标, 每行显示最新值 + 趋势徽标, 点击进入详情
@@ -24,19 +25,18 @@ export default function DataView() {
const { name } = useParams()
const navigate = useNavigate()
useEffect(() => {
let cancelled = false
const load = useCallback(() => {
setLoading(true)
api('/indicators')
.then((data) => {
if (cancelled) return
setIndicators(data.indicators || [])
})
.catch((e) => !cancelled && setErr(e.message))
.finally(() => !cancelled && setLoading(false))
return () => { cancelled = true }
.then((data) => { setErr(''); setIndicators(data.indicators || []) })
.catch((e) => setErr(e.message))
.finally(() => setLoading(false))
}, [])
useEffect(() => { load() }, [load])
// 后台回前台时重新拉取
useRefreshOnVisible(load)
if (loading) return <div className="loading">加载中...</div>
if (err) return <div className="error-banner">{err}</div>
if (!indicators.length) return <div className="empty">暂无指标数据, 请先执行 npm run db:seed</div>