diff --git a/src/views/Jyh/Community/components/HMStatsBar.vue b/src/views/Jyh/Community/components/HMStatsBar.vue index 4a4783c..18ab38d 100644 --- a/src/views/Jyh/Community/components/HMStatsBar.vue +++ b/src/views/Jyh/Community/components/HMStatsBar.vue @@ -58,9 +58,10 @@ const fetchStats = async () => { try { loading.value = true; const response = await hmStatsBarPage3(); + const businessData = response.data; - if (response.code === 200 && response.data) { - const { developer, certificationDeveloper, wuhanCertificationDeveloper, project, company } = response.data; + if (businessData.code === 200 && businessData) { + const { developer, certificationDeveloper, wuhanCertificationDeveloper, project, company } = businessData.data; // 格式化数据显示 hmDevelopers.value = `${formatNumber(developer)}+`; @@ -69,7 +70,7 @@ const fetchStats = async () => { hmProjects.value = `${formatNumber(project)}`; hmCompanies.value = `${formatNumber(company)}+`; } else { - console.error('获取鸿蒙统计数据失败:', response.msg || '未知错误'); + console.error('获取鸿蒙统计数据失败:', businessData.msg || '未知错误'); // 设置默认值 hmDevelopers.value = '1000万+'; hmCertificationDevelopers.value = '60万+'; diff --git a/src/views/Jyh/Community/components/HarmonyEcoCharts.vue b/src/views/Jyh/Community/components/HarmonyEcoCharts.vue index 5855349..5a7a375 100644 --- a/src/views/Jyh/Community/components/HarmonyEcoCharts.vue +++ b/src/views/Jyh/Community/components/HarmonyEcoCharts.vue @@ -455,10 +455,11 @@ const hmProjects = ref([ const fetchHmProjects = async () => { try { const response = await hmProjectsPage3(); - if (response.code === 200 && response.data) { - hmProjects.value = response.data; + const businessData = response.data; + if (businessData.code === 200 && businessData.data) { + hmProjects.value = businessData.data; } else { - console.error('获取鸿蒙开源项目数据失败:', response.msg || '未知错误'); + console.error('获取鸿蒙开源项目数据失败:', businessData.msg || '未知错误'); // 使用默认数据 hmProjects.value = [ { @@ -607,10 +608,11 @@ const whProjects = ref([ const fetchWhProjects = async() => { try { const response = await whProjectsPage3(); - if (response.code === 200 && response.data) { - whProjects.value = response.data; + const businessData = response.data; + if (businessData.code === 200 && businessData.data) { + whProjects.value = businessData.data; } else { - console.error('获取武汉鸿蒙开源项目数据失败:', response.msg || '未知错误'); + console.error('获取武汉鸿蒙开源项目数据失败:', businessData.msg || '未知错误'); // 使用默认数据 whProjects.value = [ { name: 'docs', desc: 'OpenHarmony官方文档与指南', stars: '498', company: '中科创达' }, // 总热度: 4152 (498 Star + 3654 Fork) @@ -974,12 +976,13 @@ const initHmCityChart = () => { const fetchHmCityData = async () => { try { const response = await hmCityDataPage3(); - if (response.code === 200 && response.data) { - hmCityData.value = response.data; + const businessData = response.data; + if (businessData.code === 200 && businessData.data) { + hmCityData.value = businessData.data; // 重新初始化图表以显示新数据 initHmCityChart(); } else { - console.error('获取鸿蒙项目城市分布数据失败:', response.msg || '未知错误'); + console.error('获取鸿蒙项目城市分布数据失败:', businessData.msg || '未知错误'); // 使用默认数据 hmCityData.value = [ { name: '广东', value: 185 }, diff --git a/src/views/Jyh/Community/components/StatsBar.vue b/src/views/Jyh/Community/components/StatsBar.vue index 9050f73..d96e42a 100644 --- a/src/views/Jyh/Community/components/StatsBar.vue +++ b/src/views/Jyh/Community/components/StatsBar.vue @@ -52,9 +52,10 @@ const fetchStats = async() => { try { loading.value = true; const response = await statsBarPage3(); + const businessData = response.data; - if (response.code === 200 && response.data) { - const { developer, community, company, project } = response.data; + if (businessData.code === 200 && businessData) { + const { developer, community, company, project } = businessData.data; // 格式化数据显示 whDeveloper.value = `${formatNumber(developer)}+`; @@ -62,7 +63,7 @@ const fetchStats = async() => { whCompany.value = `${formatNumber(company)}+`; whProject.value = `${formatNumber(project)}+`; } else { - console.error('获取统计数据失败:', response.msg || '未知错误'); + console.error('获取统计数据失败:', businessData.msg || '未知错误'); // 设置默认值 whDeveloper.value = '70万+'; whCommunity.value = '12';