diff --git a/src/views/Jyh/Community/index.vue b/src/views/Jyh/Community/index.vue index 671362e..e59bcf5 100644 --- a/src/views/Jyh/Community/index.vue +++ b/src/views/Jyh/Community/index.vue @@ -311,7 +311,8 @@ import * as echarts from 'echarts'; 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 } from '@/api/jyh/situation'; +import { wuhanGithubProjectsPage3, cityProjectPage3, chinaExcellentProjectsPage3, excellentProjectsPage3, + talentPage3, developerNamesPage3, communityRankChartPage3, wuhanCommunitiesPage3 } from '@/api/jyh/situation'; const { widthType } = usePageResize(); @@ -325,6 +326,8 @@ const chinaExcellentProjects = ref([]); const developerNames = ref([]); +const wuhanCommunities = ref([]); + // 武汉优质开源项目备用数据 const setgithubProjectsdata = () => { githubProjects.value = [ @@ -616,24 +619,44 @@ const fetchDeveloperNamesData = async() => { } }; -const wuhanCommunities = ref([ - { name: '黄鹤开源社区', type: '核心生态', slogan: '国家级、城市级开源社区平台,武汉开源生态的核心枢纽' }, - { name: '深度社区 (Deepin)', type: '操作系统', slogan: '全球最大桌面操作系统社区之一,全球用户超过 750 万' }, - { - name: '极狐社区 (GitLab China)', - type: 'DevOps', - slogan: '全球第二大开源托管平台 GitLab 在汉设立的中国发行版及开发者社区' - }, - { name: '开源鸿蒙社区 (OpenHarmony)', type: '万物互联', slogan: '国家级生态创新中心,设有全国首个分委会' }, - { name: 'PostgreSQL 中文社区', type: '数据库', slogan: '全球四大开源数据库之一的运营中心设在武汉' }, - { name: '武汉大学开源社区', type: '学术社团', slogan: '老牌社团,涉及 Linux、嵌入式、深度学习等方向' }, - { name: '武汉大学 OpenHarmony 俱乐部', type: '万物互联', slogan: '专注于华为开源鸿蒙生态' }, - { name: '华中科技大学开源社团', type: '学术社团', slogan: '常年组织 LUG (Linux User Group) 及黑客松活动' }, - { name: '武汉理工大学开源联盟', type: '学术社团', slogan: '聚焦计算机科学与软件工程方向' }, - { name: '华中师范大学', type: '兴趣小组', slogan: '开源技术兴趣小组' }, - { name: '中南民族大学', type: '兴趣小组', slogan: '开源技术兴趣小组' }, - { name: '湖北大学', type: '兴趣小组', slogan: '开源技术兴趣小组' } -]); +// 武汉知名开源社区备用数据 +const setwuhanCommunitiesdata = () => { + wuhanCommunities.value = [ + { name: '黄鹤开源社区', type: '核心生态', slogan: '国家级、城市级开源社区平台,武汉开源生态的核心枢纽' }, + { name: '深度社区 (Deepin)', type: '操作系统', slogan: '全球最大桌面操作系统社区之一,全球用户超过 750 万' }, + { + name: '极狐社区 (GitLab China)', + type: 'DevOps', + slogan: '全球第二大开源托管平台 GitLab 在汉设立的中国发行版及开发者社区' + }, + { name: '开源鸿蒙社区 (OpenHarmony)', type: '万物互联', slogan: '国家级生态创新中心,设有全国首个分委会' }, + { name: 'PostgreSQL 中文社区', type: '数据库', slogan: '全球四大开源数据库之一的运营中心设在武汉' }, + { name: '武汉大学开源社区', type: '学术社团', slogan: '老牌社团,涉及 Linux、嵌入式、深度学习等方向' }, + { name: '武汉大学 OpenHarmony 俱乐部', type: '万物互联', slogan: '专注于华为开源鸿蒙生态' }, + { name: '华中科技大学开源社团', type: '学术社团', slogan: '常年组织 LUG (Linux User Group) 及黑客松活动' }, + { name: '武汉理工大学开源联盟', type: '学术社团', slogan: '聚焦计算机科学与软件工程方向' }, + { name: '华中师范大学', type: '兴趣小组', slogan: '开源技术兴趣小组' }, + { name: '中南民族大学', type: '兴趣小组', slogan: '开源技术兴趣小组' }, + { name: '湖北大学', type: '兴趣小组', slogan: '开源技术兴趣小组' } + ]; +}; + +const fetchwuhanCommunities = async() => { + try { + const response = await wuhanCommunitiesPage3(); + const communitydata = response.data; + if (communitydata?.code === 200 && communitydata?.data) { + wuhanCommunities.value = communitydata.data; + } else { + console.error('获取武汉知名开源社区数据失败:', communitydata?.msg || '未知错误'); + setwuhanCommunitiesdata(); + } + } catch (error) { + console.error('请求武汉知名开源社区数据时发生错误:', error); + setwuhanCommunitiesdata(); + } +}; + // 图表数据 const chartData = ref({ @@ -958,6 +981,7 @@ onMounted(async() => { await fetchchinaExcellentProjects(); // 获取2024中国优秀开源项目数据 await fetchexcellentProjects(); // 获取2025武汉优秀开源项目数据 await fetchCommunityRankData(); // 获取城市社区数量排行数据 + await fetchwuhanCommunities(); // 获取武汉知名开源社区数据 init(); // 再初始化图表 });