态势感知平台-开源生态与贡献价值全景接口字段修改
This commit is contained in:
@@ -28,21 +28,22 @@ const infrastructureData = ref<InfrastructureItem[]>([]);
|
||||
const loading = ref(true);
|
||||
|
||||
// 从API获取数据
|
||||
const fetchDataFromApi = async () => {
|
||||
const fetchDataFromApi = async() => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const response = await infrastructurePage2();
|
||||
const businessData = response.data; // Axios响应格式,业务数据在response.data中
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
if (businessData.code === 200 && businessData.data) {
|
||||
// 为每个数据项添加颜色和半径配置
|
||||
infrastructureData.value = response.data.map((item: InfrastructureItem, index: number) => ({
|
||||
infrastructureData.value = businessData.data.map((item: InfrastructureItem, index: number) => ({
|
||||
name: item.name,
|
||||
value: item.value,
|
||||
color: baseColors[index % baseColors.length],
|
||||
radius: [`calc(${70 - index * 20}%)`, `calc(${80 - index * 20}%)`] // 根据索引计算半径
|
||||
radius: [`${70 - index * 20}%`, `${80 - index * 20}%`] // 根据索引计算半径,移除calc函数以避免潜在问题
|
||||
}));
|
||||
} else {
|
||||
console.error('获取基础设施覆盖率数据失败:', response.msg || '未知错误');
|
||||
console.error('获取基础设施覆盖率数据失败:', businessData.msg || '未知错误');
|
||||
// 设置默认数据
|
||||
infrastructureData.value = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user