From 2118adfb66117e95865178a1fbf1e731346a84cc Mon Sep 17 00:00:00 2001 From: WangDL Date: Sun, 24 May 2026 17:41:32 +0800 Subject: [PATCH] fix: add missing userTrend/aiCallTrend fields to dashboard stats response Co-Authored-By: Claude Opus 4.7 --- src/pages/Dashboard.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 5f3e4ab..578da41 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -39,17 +39,17 @@ export default function Dashboard() { const userTrendOption = useMemo(() => ({ grid: { top: 20, right: 20, bottom: 20, left: 40 }, tooltip: { trigger: 'axis' as const }, - xAxis: { type: 'category' as const, data: stats?.userTrend.map(p => dayjs(p.date).format('MM-DD')) || [], axisLabel: { fontSize: 11 } }, + xAxis: { type: 'category' as const, data: stats?.userTrend?.map(p => dayjs(p.date).format('MM-DD')) || [], axisLabel: { fontSize: 11 } }, yAxis: { type: 'value' as const, axisLabel: { fontSize: 11 } }, - series: [{ name: '日活用户', type: 'line', data: stats?.userTrend.map(p => p.value) || [], smooth: true, symbol: 'none', lineStyle: { color: '#1677ff', width: 2 }, areaStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(22,119,255,0.15)' }, { offset: 1, color: 'rgba(22,119,255,0)' }]) } }], + series: [{ name: '日活用户', type: 'line', data: stats?.userTrend?.map(p => p.value) || [], smooth: true, symbol: 'none', lineStyle: { color: '#1677ff', width: 2 }, areaStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(22,119,255,0.15)' }, { offset: 1, color: 'rgba(22,119,255,0)' }]) } }], }), [stats]) const aiCallTrendOption = useMemo(() => ({ grid: { top: 20, right: 20, bottom: 20, left: 40 }, tooltip: { trigger: 'axis' as const }, - xAxis: { type: 'category' as const, data: stats?.aiCallTrend.map(p => dayjs(p.date).format('MM-DD')) || [], axisLabel: { fontSize: 11 } }, + xAxis: { type: 'category' as const, data: stats?.aiCallTrend?.map(p => dayjs(p.date).format('MM-DD')) || [], axisLabel: { fontSize: 11 } }, yAxis: { type: 'value' as const, axisLabel: { fontSize: 11 } }, - series: [{ name: 'AI 调用', type: 'bar', data: stats?.aiCallTrend.map(p => p.value) || [], itemStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#52c41a' }, { offset: 1, color: '#b7eb8f' }]), borderRadius: [4, 4, 0, 0] } }], + series: [{ name: 'AI 调用', type: 'bar', data: stats?.aiCallTrend?.map(p => p.value) || [], itemStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#52c41a' }, { offset: 1, color: '#b7eb8f' }]), borderRadius: [4, 4, 0, 0] } }], }), [stats]) return (