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

This commit is contained in:
d266377
2026-02-03 15:17:55 +08:00
parent 4f58ace30c
commit 7553c7ebd0

View File

@@ -311,61 +311,89 @@ import * as echarts from 'echarts';
import { usePageResize } from '@/utils/hooks/usePageResize'; import { usePageResize } from '@/utils/hooks/usePageResize';
import StatsBar from './components/StatsBar.vue'; import StatsBar from './components/StatsBar.vue';
import HarmonyEcoCharts from './components/HarmonyEcoCharts.vue'; import HarmonyEcoCharts from './components/HarmonyEcoCharts.vue';
import { wuhanGithubProjectsPage3 } from '@/api/jyh/situation';
const { widthType } = usePageResize(); const { widthType } = usePageResize();
const githubProjects = ref([ const githubProjects = ref([]);
{
name: 'bootstrap', // 武汉优质开源项目备用数据
desc: 'The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.', const setgithubProjectsdata = () => {
stars: '174000' githubProjects.value = [
}, {
{ name: 'bootstrap',
name: 'JavaGuide', desc: 'The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.',
desc: 'Java 学习&面试指南Go、Python 后端面试通用,计算机基础面试总结)。准备后端技术面试,首选 JavaGuide', stars: '174000'
stars: '153000' },
}, {
{ name: 'JavaGuide',
name: 'cpython', desc: 'Java 学习&面试指南Go、Python 后端面试通用,计算机基础面试总结)。准备后端技术面试,首选 JavaGuide',
desc: 'The Python programming language', stars: '153000'
stars: '71000' },
}, {
{ name: 'cpython',
name: 'core', desc: 'The Python programming language',
desc: '🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.', stars: '71000'
stars: '52700' },
}, {
{ name: 'core',
name: 'bevy', desc: '🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.',
desc: 'A refreshingly simple data-driven game engine built in Rust', stars: '52700'
stars: '43900' },
}, {
{ name: 'bevy',
name: 'linux-insides', desc: 'A refreshingly simple data-driven game engine built in Rust',
desc: 'A book-in-progress about the Linux kernel and its insides.', stars: '43900'
stars: '31700' },
}, {
{ name: 'linux-insides',
name: 'podman', desc: 'A book-in-progress about the Linux kernel and its insides.',
desc: 'Podman: A tool for managing OCI containers and pods.', stars: '31700'
stars: '30300' },
}, {
{ name: 'podman',
name: 'fastai', desc: 'Podman: A tool for managing OCI containers and pods.',
desc: 'The fastai deep learning library', stars: '30300'
stars: '27800' },
}, {
{ name: 'fastai',
name: 'OI-wiki', desc: 'The fastai deep learning library',
desc: '🌟 Wiki of OI / ICPC for everyone. (某大型游戏线上攻略,内含炫酷算术魔法)', stars: '27800'
stars: '25200' },
}, {
{ name: 'OI-wiki',
name: 'bilibili-API-collect', desc: '🌟 Wiki of OI / ICPC for everyone. (某大型游戏线上攻略,内含炫酷算术魔法)',
desc: '哔哩哔哩-API收集整理【不断更新中....】', stars: '25200'
stars: '20100' },
{
name: 'bilibili-API-collect',
desc: '哔哩哔哩-API收集整理【不断更新中....】',
stars: '20100'
}
];
};
// 获取武汉优质开源项目数据
const fetchGithubProjects = async() => {
try {
const response = await wuhanGithubProjectsPage3();
const projectdata = response.data;
if (projectdata?.code === 200 && projectdata?.data) {
// 将星星数转换为字符串格式以匹配模板显示
const formattedData = projectdata.data.map(item => ({
...item,
stars: String(item.stars)
}));
githubProjects.value = formattedData;
} else {
console.error('获取武汉优质开源项目数据失败:', projectdata?.msg || '未知错误');
setgithubProjectsdata();
}
} catch (error) {
console.error('请求武汉优质开源项目数据时发生错误:', error);
setgithubProjectsdata();
} }
]); };
const activeTab = ref(0); const activeTab = ref(0);
@@ -769,8 +797,9 @@ watch(widthType, () => {
init(); init();
}); });
onMounted(() => { onMounted(async () => {
init(); await fetchGithubProjects(); // 先获取数据
init(); // 再初始化图表
}); });
onUnmounted(() => { onUnmounted(() => {