diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/company-overview/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/company-overview/index.vue index 962d85ff..39310263 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/company-overview/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/company-overview/index.vue @@ -345,7 +345,7 @@ const renderShopBarChart = () => { axisTick: { show: false }, axisLabel: { fontWeight: 'bold', - color: '#1e293b', + color: 'hsl(240deg 5% 64.9%)', fontSize: 13, }, }, @@ -374,7 +374,10 @@ const renderShopBarChart = () => { formatter: (params: any) => `¥${params.value.toLocaleString('zh-CN')}`, fontWeight: 900, - color: '#0f172a', + color: + document.documentElement.classList.contains('dark') + ? 'hsl(0deg 0% 95%)' + : '#334155', }, }, ], @@ -465,7 +468,10 @@ const renderShopScatterChart = () => { label: { show: true, position: 'top', - color: '#334155', + color: + document.documentElement.classList.contains('dark') + ? 'hsl(0deg 0% 95%)' + : '#334155', fontWeight: 700, formatter: (params: any) => params.data?.[2] ?? '', }, @@ -526,6 +532,19 @@ watch( onMounted(async () => { await loadShopCount(); await refreshOverviewByCurrentParams(true); + + // 监听深色模式切换,重新渲染图表 + const darkObserver = new MutationObserver(() => { + if (overviewData.value) { + renderShopBarChart(); + renderShopScatterChart(); + } + }); + darkObserver.observe(document.documentElement, { + attributes: true, + attributeFilter: ['class'], + }); + onUnmounted(() => darkObserver.disconnect()); }); onActivated(async () => { @@ -598,9 +617,9 @@ const handleExportSelectedShops = async () => {