diff --git a/web/src/components/dashboard/ChartsPanel.jsx b/web/src/components/dashboard/ChartsPanel.jsx index 86726e53..9eaab07e 100644 --- a/web/src/components/dashboard/ChartsPanel.jsx +++ b/web/src/components/dashboard/ChartsPanel.jsx @@ -17,7 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import React from 'react'; +import React, { Suspense } from 'react'; import { Card, Tabs, TabPane } from '@douyinfe/semi-ui'; import { PieChart } from 'lucide-react'; import { @@ -25,7 +25,9 @@ import { IconPulse, IconPieChart2Stroked } from '@douyinfe/semi-icons'; -import { VChart } from '@visactor/react-vchart'; +const LazyVChart = React.lazy(() => + import('@visactor/react-vchart').then(m => ({ default: m.VChart })) +); const ChartsPanel = ({ activeChartTab, @@ -86,28 +88,36 @@ const ChartsPanel = ({ >
{activeChartTab === '1' && ( - + + + )} {activeChartTab === '2' && ( - + + + )} {activeChartTab === '3' && ( - + + + )} {activeChartTab === '4' && ( - + + + )}
diff --git a/web/src/components/dashboard/StatsCards.jsx b/web/src/components/dashboard/StatsCards.jsx index ae614eb5..cfbcdea3 100644 --- a/web/src/components/dashboard/StatsCards.jsx +++ b/web/src/components/dashboard/StatsCards.jsx @@ -17,9 +17,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import React from 'react'; +import React, { Suspense } from 'react'; import { Card, Avatar, Skeleton } from '@douyinfe/semi-ui'; -import { VChart } from '@visactor/react-vchart'; + +const LazyVChart = React.lazy(() => + import('@visactor/react-vchart').then(m => ({ default: m.VChart })) +); const StatsCards = ({ groupedStatsData, @@ -74,10 +77,12 @@ const StatsCards = ({ {(loading || (item.trendData && item.trendData.length > 0)) && (
- + + +
)} diff --git a/web/src/components/settings/personal/cards/AccountManagement.js b/web/src/components/settings/personal/cards/AccountManagement.js index b2c9017e..59f53cb8 100644 --- a/web/src/components/settings/personal/cards/AccountManagement.js +++ b/web/src/components/settings/personal/cards/AccountManagement.js @@ -71,7 +71,7 @@ const AccountManagement = ({ - + {/* 账户绑定 Tab */} {() => ( - + {/* 通知配置 Tab */} { - const theme = useTheme(); const getUsername = () => { if (userState.user) { @@ -44,16 +42,7 @@ const UserInfoHeader = ({ t, userState }) => { }; return ( - + {/* 装饰性背景元素 */}
@@ -61,12 +50,13 @@ const UserInfoHeader = ({ t, userState }) => {
-
+
{getAvatarText()} @@ -113,7 +103,7 @@ const UserInfoHeader = ({ t, userState }) => { {/* 右上角统计信息(Semi UI 卡片) */}
- +
diff --git a/web/src/hooks/dashboard/useDashboardCharts.js b/web/src/hooks/dashboard/useDashboardCharts.js index a5ce0b19..ec99f3aa 100644 --- a/web/src/hooks/dashboard/useDashboardCharts.js +++ b/web/src/hooks/dashboard/useDashboardCharts.js @@ -18,7 +18,6 @@ For commercial licensing, please contact support@quantumnous.com */ import { useState, useCallback, useEffect } from 'react'; -import { initVChartSemiTheme } from '@visactor/vchart-semi-theme'; import { modelColorMap, renderNumber, @@ -418,9 +417,19 @@ export const useDashboardCharts = ( // ========== 初始化图表主题 ========== useEffect(() => { - initVChartSemiTheme({ - isWatchingThemeSwitch: true, - }); + // 动态加载 visactor 主题,避免首页首屏加载 + let canceled = false; + (async () => { + try { + const mod = await import('@visactor/vchart-semi-theme'); + if (!canceled && mod?.initVChartSemiTheme) { + mod.initVChartSemiTheme({ isWatchingThemeSwitch: true }); + } + } catch (e) { + // 忽略加载失败,图表页再尝试 + } + })(); + return () => { canceled = true; }; }, []); return {