态势感知平台-武汉市开源生态建设-武汉优质开源项目榜接口对接
This commit is contained in:
@@ -311,61 +311,89 @@ 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 } from '@/api/jyh/situation';
|
||||
|
||||
const { widthType } = usePageResize();
|
||||
|
||||
const githubProjects = ref([
|
||||
{
|
||||
name: 'bootstrap',
|
||||
desc: 'The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.',
|
||||
stars: '174000'
|
||||
},
|
||||
{
|
||||
name: 'JavaGuide',
|
||||
desc: 'Java 学习&面试指南(Go、Python 后端面试通用,计算机基础面试总结)。准备后端技术面试,首选 JavaGuide!',
|
||||
stars: '153000'
|
||||
},
|
||||
{
|
||||
name: 'cpython',
|
||||
desc: 'The Python programming language',
|
||||
stars: '71000'
|
||||
},
|
||||
{
|
||||
name: 'core',
|
||||
desc: '🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.',
|
||||
stars: '52700'
|
||||
},
|
||||
{
|
||||
name: 'bevy',
|
||||
desc: 'A refreshingly simple data-driven game engine built in Rust',
|
||||
stars: '43900'
|
||||
},
|
||||
{
|
||||
name: 'linux-insides',
|
||||
desc: 'A book-in-progress about the Linux kernel and its insides.',
|
||||
stars: '31700'
|
||||
},
|
||||
{
|
||||
name: 'podman',
|
||||
desc: 'Podman: A tool for managing OCI containers and pods.',
|
||||
stars: '30300'
|
||||
},
|
||||
{
|
||||
name: 'fastai',
|
||||
desc: 'The fastai deep learning library',
|
||||
stars: '27800'
|
||||
},
|
||||
{
|
||||
name: 'OI-wiki',
|
||||
desc: '🌟 Wiki of OI / ICPC for everyone. (某大型游戏线上攻略,内含炫酷算术魔法)',
|
||||
stars: '25200'
|
||||
},
|
||||
{
|
||||
name: 'bilibili-API-collect',
|
||||
desc: '哔哩哔哩-API收集整理【不断更新中....】',
|
||||
stars: '20100'
|
||||
const githubProjects = ref([]);
|
||||
|
||||
// 武汉优质开源项目备用数据
|
||||
const setgithubProjectsdata = () => {
|
||||
githubProjects.value = [
|
||||
{
|
||||
name: 'bootstrap',
|
||||
desc: 'The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.',
|
||||
stars: '174000'
|
||||
},
|
||||
{
|
||||
name: 'JavaGuide',
|
||||
desc: 'Java 学习&面试指南(Go、Python 后端面试通用,计算机基础面试总结)。准备后端技术面试,首选 JavaGuide!',
|
||||
stars: '153000'
|
||||
},
|
||||
{
|
||||
name: 'cpython',
|
||||
desc: 'The Python programming language',
|
||||
stars: '71000'
|
||||
},
|
||||
{
|
||||
name: 'core',
|
||||
desc: '🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.',
|
||||
stars: '52700'
|
||||
},
|
||||
{
|
||||
name: 'bevy',
|
||||
desc: 'A refreshingly simple data-driven game engine built in Rust',
|
||||
stars: '43900'
|
||||
},
|
||||
{
|
||||
name: 'linux-insides',
|
||||
desc: 'A book-in-progress about the Linux kernel and its insides.',
|
||||
stars: '31700'
|
||||
},
|
||||
{
|
||||
name: 'podman',
|
||||
desc: 'Podman: A tool for managing OCI containers and pods.',
|
||||
stars: '30300'
|
||||
},
|
||||
{
|
||||
name: 'fastai',
|
||||
desc: 'The fastai deep learning library',
|
||||
stars: '27800'
|
||||
},
|
||||
{
|
||||
name: 'OI-wiki',
|
||||
desc: '🌟 Wiki of OI / ICPC for everyone. (某大型游戏线上攻略,内含炫酷算术魔法)',
|
||||
stars: '25200'
|
||||
},
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -769,8 +797,9 @@ watch(widthType, () => {
|
||||
init();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
init();
|
||||
onMounted(async () => {
|
||||
await fetchGithubProjects(); // 先获取数据
|
||||
init(); // 再初始化图表
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user