From 97ab1a1e79cc820749a93adaf78fc28dfa736b2c Mon Sep 17 00:00:00 2001 From: d266377 Date: Thu, 29 Jan 2026 17:34:40 +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=B8=BF=E8=92=99?= =?UTF-8?q?=E5=BC=80=E6=BA=90=E9=A1=B9=E7=9B=AE=E6=8E=A5=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Community/components/HarmonyEcoCharts.vue | 150 +++++++++++++++++- 1 file changed, 145 insertions(+), 5 deletions(-) diff --git a/src/views/Jyh/Community/components/HarmonyEcoCharts.vue b/src/views/Jyh/Community/components/HarmonyEcoCharts.vue index 4ca8d3d..bae5dee 100644 --- a/src/views/Jyh/Community/components/HarmonyEcoCharts.vue +++ b/src/views/Jyh/Community/components/HarmonyEcoCharts.vue @@ -338,7 +338,7 @@ import { ref, onMounted, nextTick, onUnmounted } from 'vue'; import * as echarts from 'echarts'; import HMStatsBar from './HMStatsBar.vue'; -import { hmCityDataPage3 } from '@/api/jyh/situation'; +import { hmCityDataPage3, hmProjectsPage3 } from '@/api/jyh/situation'; // ================= 数据定义 ================= const hmCityData = ref([ @@ -388,7 +388,7 @@ const hmEnterpriseCityData = [ // { name: '辽宁', value: 8 } ]; -const hmProjects = [ +const hmProjects = ref([ { name: 'OpenHarmony', link: 'https://github.com/openharmony', @@ -449,7 +449,147 @@ const hmProjects = [ stars: '120+', company: 'openharmony-rs组织' } -]; +]); + +// 获取鸿蒙开源项目数据 +const fetchHmProjects = async () => { + try { + const response = await hmProjectsPage3(); + if (response.code === 200 && response.data) { + hmProjects.value = response.data; + } else { + console.error('获取鸿蒙开源项目数据失败:', response.msg || '未知错误'); + // 使用默认数据 + hmProjects.value = [ + { + name: 'OpenHarmony', + link: 'https://github.com/openharmony', + stars: '14.6k+', + company: '开放原子开源基金会' + }, + { + name: 'awesome-harmony', + link: 'https://github.com/Wscats/awesome-harmony', + stars: '3.1k+', + company: '社区维护' + }, + { + name: 'ohos-rs', + link: 'https://github.com/ohos-rs/ohos-rs', + stars: '1.2k+', + company: 'Rust鸿蒙生态' + }, + { + name: 'OpenHarmony (fenwii)', + link: 'https://github.com/fenwii/OpenHarmony', + stars: '920+', + company: '分微科技' + }, + { + name: 'ohos-rust-demo', + link: 'https://github.com/jschwe/ohos-rust-demo', + stars: '380+', + company: '社区/个人' + }, + { + name: 'kelivo', + link: 'https://github.com/Chevey339/kelivo', + stars: '270+', + company: '社区/个人' + }, + { + name: 'openharmony-rs', + link: 'https://github.com/openharmony-rs', + stars: '220+', + company: 'openharmony-rs组织' + }, + { + name: 'harmonyos-next-samples', + link: 'https://github.com/harmonyos-next-samples', + stars: '190+', + company: 'NEXT生态社区' + }, + { + name: 'ohos-sdk', + link: 'https://github.com/openharmony-rs/ohos-sdk', + stars: '150+', + company: 'openharmony-rs组织' + }, + { + name: 'arkui-rs', + link: 'https://github.com/openharmony-rs/arkui-rs', + stars: '120+', + company: 'openharmony-rs组织' + } + ]; + } + } catch (error) { + console.error('获取鸿蒙开源项目数据异常:', error); + // 使用默认数据 + hmProjects.value = [ + { + name: 'OpenHarmony', + link: 'https://github.com/openharmony', + stars: '14.6k+', + company: '开放原子开源基金会' + }, + { + name: 'awesome-harmony', + link: 'https://github.com/Wscats/awesome-harmony', + stars: '3.1k+', + company: '社区维护' + }, + { + name: 'ohos-rs', + link: 'https://github.com/ohos-rs/ohos-rs', + stars: '1.2k+', + company: 'Rust鸿蒙生态' + }, + { + name: 'OpenHarmony (fenwii)', + link: 'https://github.com/fenwii/OpenHarmony', + stars: '920+', + company: '分微科技' + }, + { + name: 'ohos-rust-demo', + link: 'https://github.com/jschwe/ohos-rust-demo', + stars: '380+', + company: '社区/个人' + }, + { + name: 'kelivo', + link: 'https://github.com/Chevey339/kelivo', + stars: '270+', + company: '社区/个人' + }, + { + name: 'openharmony-rs', + link: 'https://github.com/openharmony-rs', + stars: '220+', + company: 'openharmony-rs组织' + }, + { + name: 'harmonyos-next-samples', + link: 'https://github.com/harmonyos-next-samples', + stars: '190+', + company: 'NEXT生态社区' + }, + { + name: 'ohos-sdk', + link: 'https://github.com/openharmony-rs/ohos-sdk', + stars: '150+', + company: 'openharmony-rs组织' + }, + { + name: 'arkui-rs', + link: 'https://github.com/openharmony-rs/arkui-rs', + stars: '120+', + company: 'openharmony-rs组织' + } + ]; + } +}; const whProjects = [ { name: 'docs', desc: 'OpenHarmony官方文档与指南', stars: '498', company: '中科创达' }, // 总热度: 4152 (498 Star + 3654 Fork) @@ -1051,8 +1191,8 @@ const handleResize = () => { onMounted(async () => { nextTick(async () => { - // 先获取鸿蒙项目城市分布数据 - await fetchHmCityData(); + // 先获取鸿蒙项目城市分布数据和鸿蒙开源项目数据 + await Promise.all([fetchHmCityData(), fetchHmProjects()]); initHmCityChart(); initHmEnterpriseChart();