diff --git a/src/views/Jyh/Community/index.vue b/src/views/Jyh/Community/index.vue index 531f3a3..715cbaa 100644 --- a/src/views/Jyh/Community/index.vue +++ b/src/views/Jyh/Community/index.vue @@ -311,7 +311,7 @@ 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 } from '@/api/jyh/situation'; +import { wuhanGithubProjectsPage3, cityProjectPage3, chinaExcellentProjectsPage3, excellentProjectsPage3, talentPage3, developerNamesPage3 } from '@/api/jyh/situation'; const { widthType } = usePageResize(); @@ -451,12 +451,16 @@ const fetchTalentData = async() => { } }; + const activeTab = ref(0); const excellentProjects = ref([]); const chinaExcellentProjects = ref([]); +// 开发者名单 +const developerNames = ref([]); + // 2024武汉优秀开源项目备用数据 const chinaExcellentProjectsdata = () => { chinaExcellentProjects.value = [ @@ -561,6 +565,31 @@ const fetchexcellentProjects = async() => { } }; +// 武汉明星开发者贡献榜备用数据 +const setDeveloperNamesDefaultData = () => { + developerNames.value = ['白纯骢', '陆红旭', '慕冬亮', '张继德', '蒋周奇', '张天雄', '阮文俊', '李奇', '陈鹏轩', '杨帆']; +}; + +// 获取武汉明星开发者贡献榜数据 +const fetchDeveloperNamesData = async() => { + try { + const response = await developerNamesPage3(); + const developerdata = response.data; + if (developerdata?.code === 200 && developerdata?.data) { + // 更新开发者名单 - 后端返回字段为 name + developerNames.value = developerdata.data.map(item => item.name); + // 设置非空状态 + isEmpty.value.developer = false; + } else { + console.error('获取武汉明星开发者贡献榜数据失败:', developerdata?.msg || '未知错误'); + setDeveloperNamesDefaultData(); + } + } catch (error) { + console.error('请求武汉明星开发者贡献榜数据时发生错误:', error); + setDeveloperNamesDefaultData(); + } +}; + const wuhanCommunities = ref([ { name: '黄鹤开源社区', type: '核心生态', slogan: '国家级、城市级开源社区平台,武汉开源生态的核心枢纽' }, { name: '深度社区 (Deepin)', type: '操作系统', slogan: '全球最大桌面操作系统社区之一,全球用户超过 750 万' }, @@ -580,9 +609,6 @@ const wuhanCommunities = ref([ { name: '湖北大学', type: '兴趣小组', slogan: '开源技术兴趣小组' } ]); -// 开发者名单 -const developerNames = ['白纯骢', '陆红旭', '慕冬亮', '张继德', '蒋周奇', '张天雄', '阮文俊', '李奇', '陈鹏轩', '杨帆']; - // 图表数据 const chartData = ref({ cityProject: { @@ -900,6 +926,7 @@ onMounted(async() => { await fetchGithubProjects(); await fetchCityProjectData(); // 获取城市项目数据 await fetchTalentData(); // 获取城市人才数据 + await fetchDeveloperNamesData(); // 获取武汉明星开发者贡献榜数据 await fetchchinaExcellentProjects(); // 获取2024中国优秀开源项目数据 await fetchexcellentProjects(); // 获取2025武汉优秀开源项目数据 init(); // 再初始化图表