态势感知平台-武汉市开源生态建设-鸿蒙开源项目接口对接

This commit is contained in:
d266377
2026-01-29 17:34:40 +08:00
parent 33a617ef91
commit 97ab1a1e79

View File

@@ -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();