From efd9493cb0449ba273aebeec501ca6e47f9f85ff Mon Sep 17 00:00:00 2001 From: d266377 Date: Wed, 4 Feb 2026 14:16:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=81=E5=8A=BF=E6=84=9F=E7=9F=A5=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0-=E6=AD=A6=E6=B1=89=E5=B8=82=E5=BC=80=E6=BA=90?= =?UTF-8?q?=E7=94=9F=E6=80=81=E5=BB=BA=E8=AE=BE-=E9=87=8D=E7=82=B9?= =?UTF-8?q?=E5=9F=8E=E5=B8=82=E9=AB=98=E6=A0=A1=E5=BC=80=E6=BA=90=E7=A4=BE?= =?UTF-8?q?=E5=9B=A2=E6=95=B0=E9=87=8F=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Jyh/Community/index.vue | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/views/Jyh/Community/index.vue b/src/views/Jyh/Community/index.vue index e59bcf5..6b4d84d 100644 --- a/src/views/Jyh/Community/index.vue +++ b/src/views/Jyh/Community/index.vue @@ -312,7 +312,7 @@ import { usePageResize } from '@/utils/hooks/usePageResize'; import StatsBar from './components/StatsBar.vue'; import HarmonyEcoCharts from './components/HarmonyEcoCharts.vue'; import { wuhanGithubProjectsPage3, cityProjectPage3, chinaExcellentProjectsPage3, excellentProjectsPage3, - talentPage3, developerNamesPage3, communityRankChartPage3, wuhanCommunitiesPage3 } from '@/api/jyh/situation'; + talentPage3, developerNamesPage3, communityRankChartPage3, wuhanCommunitiesPage3, ClubPage3 } from '@/api/jyh/situation'; const { widthType } = usePageResize(); @@ -657,6 +657,29 @@ const fetchwuhanCommunities = async() => { } }; +const setClubdata = () => { + chartData.value.club.xAxis = ['成都', '北京', '上海', '武汉', '重庆', '深圳', '苏州', '杭州', '合肥', '青岛']; + chartData.value.club.data = [10, 7, 5, 4, 3, 2, 2, 2, 2, 2]; + isEmpty.value.club = false; +}; + +const fetchclubData = async() => { + try { + const response = await ClubPage3(); + const clubdata = response.data; + if (clubdata?.code === 200 && clubdata?.data) { + chartData.value.club.xAxis = clubdata.data.map(item => item.name); + chartData.value.club.data = clubdata.data.map(item => item.number); + isEmpty.value.club = false; + } else { + console.error('获取重点城市高校开源社团数量数据失败:', clubdata?.msg || '未知错误'); + setClubdata(); + } + } catch (error) { + console.error('请求重点城市高校开源社团数量数据时发生错误:', error); + setClubdata(); + } +}; // 图表数据 const chartData = ref({ @@ -872,8 +895,8 @@ const initClubChart = () => { myChart.setOption({ tooltip: { trigger: 'axis', valueFormatter: (value: any) => value + ' 个' }, grid: commonGrid, - xAxis: { type: 'category', data: chartData.value.club.xAxis, axisLabel: { color: '#666' } }, - yAxis: { type: 'value', name: '单位:个', splitLine: { lineStyle: { type: 'dashed', color: '#eee' } } }, + xAxis: { type: 'category', data: chartData.value.club.xAxis, axisLabel: { color: '#666' }}, + yAxis: { type: 'value', name: '单位:个', splitLine: { lineStyle: { type: 'dashed', color: '#eee' }}}, series: [{ type: 'line', data: chartData.value.club.data, smooth: true, symbolSize: 8, lineStyle: { width: 3, color: '#F59E0B' }, @@ -982,6 +1005,7 @@ onMounted(async() => { await fetchexcellentProjects(); // 获取2025武汉优秀开源项目数据 await fetchCommunityRankData(); // 获取城市社区数量排行数据 await fetchwuhanCommunities(); // 获取武汉知名开源社区数据 + await fetchclubData(); // 获取重点城市高校开源社团数量数据 init(); // 再初始化图表 });