态势感知平台-开源生态与贡献价值全景-高校开源社区/俱乐部数量接口对接
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="index-module__NV_5cW__chartCard">
|
||||
<h3 class="chartCard__title">高校开源社团/俱乐部数量</h3>
|
||||
<div class="chartCard__container">
|
||||
<div class="num-empty" v-if="isEmpty"></div>
|
||||
<div class="num-empty" v-if="isEmpty || loading">加载中...</div>
|
||||
<div v-else id="communityChart" class="chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -12,9 +12,24 @@
|
||||
import { onMounted, ref, nextTick, watch, onUnmounted, computed } from 'vue';
|
||||
import * as echarts from 'echarts';
|
||||
import { usePageResize } from '@/utils/hooks/usePageResize';
|
||||
import { universityClubsPage2 } from '@/api/jyh/situation';
|
||||
|
||||
// 不再接收外部数据,组件内部管理数据
|
||||
const universityClubData = ref([
|
||||
// 响应式数据存储
|
||||
const universityClubData = ref<{ university: string; club: string }[]>([]);
|
||||
const loading = ref(true);
|
||||
|
||||
// 从API获取数据
|
||||
const fetchDataFromApi = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const response = await universityClubsPage2();
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
universityClubData.value = response.data;
|
||||
} else {
|
||||
console.error('获取高校开源社团数据失败:', response.msg || '未知错误');
|
||||
// 设置默认数据
|
||||
universityClubData.value = [
|
||||
// 华东地区
|
||||
{ university: '上海交通大学', club: 'SJTU-LUG (Linux User Group)' },
|
||||
{ university: '上海交通大学', club: '开放原子开源俱乐部' },
|
||||
@@ -55,20 +70,55 @@ const universityClubData = ref([
|
||||
{ university: '中南大学', club: 'CSU-LUG' },
|
||||
{ university: '山东大学', club: 'SDU-LUG' },
|
||||
{ university: '厦门大学', club: 'XMU-LUG' }
|
||||
]);
|
||||
|
||||
// 未来用于API调用的方法
|
||||
const fetchDataFromApi = async () => {
|
||||
try {
|
||||
// 这里是预留的API调用位置,例如:
|
||||
// const response = await fetch('/api/university-clubs-data');
|
||||
// const apiData = await response.json();
|
||||
// universityClubData.value = apiData;
|
||||
|
||||
// 暂时保留默认数据,实际使用时替换为API返回的数据
|
||||
console.log('Fetching university club data from API...');
|
||||
];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch university club data:', error);
|
||||
console.error('获取高校开源社团数据异常:', error);
|
||||
// 设置默认数据
|
||||
universityClubData.value = [
|
||||
// 华东地区
|
||||
{ university: '上海交通大学', club: 'SJTU-LUG (Linux User Group)' },
|
||||
{ university: '上海交通大学', club: '开放原子开源俱乐部' },
|
||||
{ university: '复旦大学', club: 'Fudan LUG' },
|
||||
{ university: '复旦大学', club: '开放原子开源俱乐部' },
|
||||
{ university: '浙江大学', club: 'ZJU-LUG' },
|
||||
{ university: '浙江大学', club: 'AAA (Azure Availability Association)' },
|
||||
{ university: '浙江大学', club: '开放原子开源俱乐部' },
|
||||
{ university: '南京大学', club: 'NJU-LUG' },
|
||||
{ university: '南京大学', club: 'eScience 协会' },
|
||||
{ university: '南京大学', club: '开放原子开源俱乐部' },
|
||||
{ university: '中国科学技术大学', club: 'USTC-LUG' },
|
||||
{ university: '中国科学技术大学', club: 'VLAB' },
|
||||
{ university: '同济大学', club: 'Tongji LUG' },
|
||||
{ university: '同济大学', club: '开放原子开源俱乐部' },
|
||||
{ university: '华东师范大学', club: 'ECNU LUG' },
|
||||
// 华北地区
|
||||
{ university: '清华大学', club: 'TUNA (清华大学学生网络与开源软件协会)' },
|
||||
{ university: '清华大学', club: '开放原子开源俱乐部' },
|
||||
{ university: '北京大学', club: 'PKU-LUG' },
|
||||
{ university: '北京大学', club: '开源软件协会' },
|
||||
{ university: '中国人民大学', club: 'RUC 开源社' },
|
||||
{ university: '北京航空航天大学', club: 'BUAA-LUG' },
|
||||
{ university: '北京理工大学', club: 'BIT-LUG' },
|
||||
{ university: '南开大学', club: 'NKU-LUG' },
|
||||
{ university: '天津大学', club: 'TJU-LUG' },
|
||||
// 华南地区
|
||||
{ university: '中山大学', club: 'SYSU-LUG' },
|
||||
{ university: '华南理工大学', club: 'SCUT-LUG' },
|
||||
{ university: '暨南大学', club: 'JNU-LUG' },
|
||||
{ university: '深圳大学', club: 'SZU-LUG' },
|
||||
{ university: '华南师范大学', club: 'SCNU-LUG' },
|
||||
// 华中地区
|
||||
{ university: '华中科技大学', club: 'HUST-LUG' },
|
||||
{ university: '华中科技大学', club: '开放原子开源俱乐部' },
|
||||
{ university: '武汉大学', club: 'WHU-LUG' },
|
||||
{ university: '武汉大学', club: '珞珈码农社' },
|
||||
{ university: '中南大学', club: 'CSU-LUG' },
|
||||
{ university: '山东大学', club: 'SDU-LUG' },
|
||||
{ university: '厦门大学', club: 'XMU-LUG' }
|
||||
];
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user