From 7553c7ebd07aef9515d07611394bc89e7c52ea86 Mon Sep 17 00:00:00 2001 From: d266377 Date: Tue, 3 Feb 2026 15:17:55 +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-=E6=AD=A6=E6=B1=89?= =?UTF-8?q?=E4=BC=98=E8=B4=A8=E5=BC=80=E6=BA=90=E9=A1=B9=E7=9B=AE=E6=A6=9C?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Jyh/Community/index.vue | 135 ++++++++++++++++++------------ 1 file changed, 82 insertions(+), 53 deletions(-) diff --git a/src/views/Jyh/Community/index.vue b/src/views/Jyh/Community/index.vue index b387374..3dd3b7b 100644 --- a/src/views/Jyh/Community/index.vue +++ b/src/views/Jyh/Community/index.vue @@ -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(() => {