态势感知平台-武汉市开源生态建设-城市社区数量排行接口对接

This commit is contained in:
d266377
2026-02-04 11:37:29 +08:00
parent 0901ddd469
commit 9ce6bbe07f

View File

@@ -311,12 +311,20 @@ 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 } from '@/api/jyh/situation';
import { wuhanGithubProjectsPage3, cityProjectPage3, chinaExcellentProjectsPage3, excellentProjectsPage3, talentPage3, developerNamesPage3, communityRankChartPage3 } from '@/api/jyh/situation';
const { widthType } = usePageResize();
const githubProjects = ref([]);
const activeTab = ref(0);
const excellentProjects = ref([]);
const chinaExcellentProjects = ref([]);
const developerNames = ref([]);
// 武汉优质开源项目备用数据
const setgithubProjectsdata = () => {
githubProjects.value = [
@@ -451,15 +459,33 @@ const fetchTalentData = async() => {
}
};
// 城市社区数量排行备用数据
const setCommunityRankDefaultData = () => {
chartData.value.communityRank.xAxis = ['北京', '深圳', '上海', '杭州', '广州', '成都', '南京', '武汉'];
chartData.value.communityRank.data = [69, 35, 31, 25, 18, 15, 12, 12];
isEmpty.value.communityRank = false;
};
const activeTab = ref(0);
const excellentProjects = ref([]);
const chinaExcellentProjects = ref([]);
// 开发者名单
const developerNames = ref([]);
// 获取武汉社区数量排行数据
const fetchCommunityRankData = async() => {
try {
const response = await communityRankChartPage3();
const communitydata = response.data;
if (communitydata?.code === 200 && communitydata?.data) {
// 更新图表数据
chartData.value.communityRank.xAxis = communitydata.data.map(item => item.name);
chartData.value.communityRank.data = communitydata.data.map(item => item.value);
// 设置非空状态
isEmpty.value.communityRank = false;
} else {
console.error('获取城市社区数量排行数据失败:', communitydata?.msg || '未知错误');
setCommunityRankDefaultData();
}
} catch (error) {
console.error('请求城市社区数量排行数据时发生错误:', error);
setCommunityRankDefaultData();
}
};
// 2024武汉优秀开源项目备用数据
const chinaExcellentProjectsdata = () => {
@@ -802,12 +828,14 @@ const initCommunityRankChart = () => {
grid: { left: '3%', right: '4%', bottom: '15px', top: '22%', containLabel: true },
xAxis: {
type: 'category',
data: ['北京', '深圳', '上海', '杭州', '广州', '成都', '南京', '武汉'],
data: chartData.value.communityRank.xAxis,
axisLabel: { color: '#666' }
},
yAxis: { type: 'value', name: '单位:个', nameTextStyle: { color: '#999' } },
yAxis: { type: 'value', name: '单位:个', nameTextStyle: { color: '#999' }},
series: [{
type: 'bar', data: [69, 35, 31, 25, 18, 15, 12, 12], barWidth: '40%',
type: 'bar',
data: chartData.value.communityRank.data,
barWidth: '40%',
itemStyle: { borderRadius: [4, 4, 0, 0], color: '#3b82f6' }
}]
});
@@ -929,6 +957,7 @@ onMounted(async() => {
await fetchDeveloperNamesData(); // 获取武汉明星开发者贡献榜数据
await fetchchinaExcellentProjects(); // 获取2024中国优秀开源项目数据
await fetchexcellentProjects(); // 获取2025武汉优秀开源项目数据
await fetchCommunityRankData(); // 获取城市社区数量排行数据
init(); // 再初始化图表
});