From c09541afb79231684e90e453b2d0bb304e57163a Mon Sep 17 00:00:00 2001 From: d266377 Date: Fri, 30 Jan 2026 10:22:54 +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-=E5=85=A8=E7=90=83=E5=BC=80=E6=BA=90=E9=A3=8E?= =?UTF-8?q?=E9=99=A9=E6=80=81=E5=8A=BF=E6=84=9F=E7=9F=A5=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=8E=A5=E5=8F=A3=E5=AD=97=E6=AE=B5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Jyh/security/components/CveTrendChart.vue | 22 ++++++++------- .../components/HighRiskComponentRank.vue | 6 ++-- .../components/IndustryDistribution.vue | 10 +++---- .../security/components/IntelligenceFeed.vue | 8 +++--- .../Jyh/security/components/ScatterChart.vue | 10 ++++--- .../security/components/ThreatIntelMap.vue | 28 +++++++++++-------- .../components/VulnerabilityLanguageChart.vue | 9 +++--- .../components/VulnerabilitySeverityChart.vue | 12 ++++---- 8 files changed, 58 insertions(+), 47 deletions(-) diff --git a/src/views/Jyh/security/components/CveTrendChart.vue b/src/views/Jyh/security/components/CveTrendChart.vue index 60ed764..d2b7db6 100644 --- a/src/views/Jyh/security/components/CveTrendChart.vue +++ b/src/views/Jyh/security/components/CveTrendChart.vue @@ -63,16 +63,17 @@ const fetchCveData = async () => { console.log('开始请求全球CVE数据...'); // 请求全球数据 const globalResponse = await cveDataGlobalPage1(); + const globalBusinessData = globalResponse.data; // Axios响应格式,业务数据在response.data中 console.log('全球CVE数据响应:', globalResponse); - if (globalResponse?.code === 200) { - console.log('全球CVE数据:', globalResponse.data); + if (globalBusinessData?.code === 200) { + console.log('全球CVE数据:', globalBusinessData.data); cveData.value.global = { - cveCount: globalResponse.data.cveCount, - acceleration: globalResponse.data.acceleration + cveCount: globalBusinessData.data.cveCount, + acceleration: globalBusinessData.data.acceleration }; } else { - console.error('获取全球CVE数据失败:', globalResponse?.msg || '未知错误'); + console.error('获取全球CVE数据失败:', globalBusinessData?.msg || '未知错误'); // 设置默认数据 setDefaultGlobalData(); } @@ -80,16 +81,17 @@ const fetchCveData = async () => { console.log('开始请求区域CVE数据...'); // 请求区域数据 const regionalResponse = await cveDataRegionalPage1(); + const regionalBusinessData = regionalResponse.data; // Axios响应格式,业务数据在response.data中 console.log('区域CVE数据响应:', regionalResponse); - if (regionalResponse?.code === 200) { - console.log('区域CVE数据:', regionalResponse.data); + if (regionalBusinessData?.code === 200) { + console.log('区域CVE数据:', regionalBusinessData.data); cveData.value.regional = { - cveCount: regionalResponse.data.cveCount, - acceleration: regionalResponse.data.acceleration + cveCount: regionalBusinessData.data.cveCount, + acceleration: regionalBusinessData.data.acceleration }; } else { - console.error('获取区域CVE数据失败:', regionalResponse?.msg || '未知错误'); + console.error('获取区域CVE数据失败:', regionalBusinessData?.msg || '未知错误'); // 设置默认数据 setDefaultRegionalData(); } diff --git a/src/views/Jyh/security/components/HighRiskComponentRank.vue b/src/views/Jyh/security/components/HighRiskComponentRank.vue index b265970..f8019a5 100644 --- a/src/views/Jyh/security/components/HighRiskComponentRank.vue +++ b/src/views/Jyh/security/components/HighRiskComponentRank.vue @@ -49,10 +49,10 @@ const componentData = ref([]); const fetchComponentData = async () => { try { const response = await highRiskComponentPage1(); - if (response.code === 200) { - componentData.value = response.data; + if (response.data.code === 200) { + componentData.value = response.data.data; } else { - console.error('获取高危组件数据失败:', response.msg); + console.error('获取高危组件数据失败:', response.data.msg || '未知错误'); // 如果接口调用失败,使用默认数据 componentData.value = [ { name: 'Log4j2', cvss: 9.8, vulnCount: 15, usage: '1200万+', desc: 'CVE-2021-44228等严重RCE漏洞' }, diff --git a/src/views/Jyh/security/components/IndustryDistribution.vue b/src/views/Jyh/security/components/IndustryDistribution.vue index 7a192dc..6d30568 100644 --- a/src/views/Jyh/security/components/IndustryDistribution.vue +++ b/src/views/Jyh/security/components/IndustryDistribution.vue @@ -96,11 +96,12 @@ const handleResize = () => { const fetchIndustryData = async () => { try { const response = await industryDistributionPage1(); - if (response.code === 200) { - internalData.value = response.data; + const businessData = response.data; // Axios响应格式,业务数据在response.data中 + + if (businessData.code === 200 && businessData.data) { + internalData.value = businessData.data; } else { - console.error('获取行业分布数据失败:', response.msg); - // 如果接口调用失败,使用默认数据 + console.error('获取行业分布数据失败:', businessData.msg || '未知错误'); internalData.value = [ { value: 25.8, name: '人工智能' }, { value: 18.4, name: '云计算' }, @@ -114,7 +115,6 @@ const fetchIndustryData = async () => { } } catch (error) { console.error('请求行业分布数据时发生错误:', error); - // 发生异常时使用默认数据 internalData.value = [ { value: 25.8, name: '人工智能' }, { value: 18.4, name: '云计算' }, diff --git a/src/views/Jyh/security/components/IntelligenceFeed.vue b/src/views/Jyh/security/components/IntelligenceFeed.vue index 1ba5ef9..3e52892 100644 --- a/src/views/Jyh/security/components/IntelligenceFeed.vue +++ b/src/views/Jyh/security/components/IntelligenceFeed.vue @@ -38,14 +38,14 @@ const props = defineProps<{ const feedList = ref([]); //获取情报流数据 -const fetchFeedData = async () => { +const fetchFeedData = async() => { try { console.log('开始请求情报流数据...'); const response = await feedListPage1(); - if (response.code === 200) { - feedList.value = response.data || []; + if (response.data?.code === 200) { + feedList.value = response.data.data || []; } else { - console.error('获取情报流数据失败:', response?.msg || '未知错误'); + console.error('获取情报流数据失败:', response?.data?.msg || '未知错误'); // 如果接口调用失败,使用默认数据 feedList.value = [ { diff --git a/src/views/Jyh/security/components/ScatterChart.vue b/src/views/Jyh/security/components/ScatterChart.vue index 01d3f4a..72cec50 100644 --- a/src/views/Jyh/security/components/ScatterChart.vue +++ b/src/views/Jyh/security/components/ScatterChart.vue @@ -41,19 +41,21 @@ const fetchScatterData = async () => { try { console.log('开始请求编程语言安全态势数据...'); const response = await scatterDataPage1(); + const businessData = response.data; // Axios响应格式,业务数据在response.data中 + console.log('API响应:', response); - if (response?.code === 200) { - console.log('API返回的数据:', response.data); + if (businessData?.code === 200) { + console.log('API返回的数据:', businessData.data); // 处理后端返回的数据格式 - const processedData = processBackendScatterData(response.data); + const processedData = processBackendScatterData(businessData.data); scatterData.value.scatterData = processedData; // 更新空数据标识 isEmpty.value.scatterData = !processedData || processedData.length === 0; } else { - console.error('获取编程语言安全态势数据失败:', response?.msg || '未知错误'); + console.error('获取编程语言安全态势数据失败:', businessData?.msg || '未知错误'); // 设置默认数据 setDefaultScatterData(); } diff --git a/src/views/Jyh/security/components/ThreatIntelMap.vue b/src/views/Jyh/security/components/ThreatIntelMap.vue index 38378b3..28d60be 100644 --- a/src/views/Jyh/security/components/ThreatIntelMap.vue +++ b/src/views/Jyh/security/components/ThreatIntelMap.vue @@ -96,13 +96,14 @@ const geoCoordMap = { const fetchAlertsData = async () => { try { const response = await mapVulnTypeStatsPage1(); - if (response.code === 200) { - alerts.value = response.data || []; + const businessData = response.data; // Axios响应格式,业务数据在response.data中 + if (businessData?.code === 200) { + alerts.value = businessData.data || []; if (alerts.value.length > 0) { currentAlert.value = alerts.value[0]; } } else { - console.error('获取实时情报数据失败:', response.msg); + console.error('获取实时情报数据失败:', businessData?.msg || '未知错误'); // 如果接口调用失败,使用默认数据 alerts.value = [ { title: "高危漏洞通告", desc: "Apache Log4j2 远程代码执行漏洞复现" }, @@ -151,10 +152,11 @@ const scatterData = ref([]); const fetchMapData = async () => { try { const response = await mapDataPage1(); - if (response.code === 200) { - mapData.value = response.data; + const businessData = response.data; // Axios响应格式,业务数据在response.data中 + if (businessData?.code === 200) { + mapData.value = businessData.data; } else { - console.error('获取地图数据失败:', response.msg); + console.error('获取地图数据失败:', businessData?.msg || '未知错误'); // 如果接口调用失败,使用默认数据 mapData.value = [ { name: 'China', value: 100 }, @@ -299,15 +301,16 @@ const setChart = async () => { const fetchVulnStats = async () => { try { const response = await mapVulnStatsPage1(); - if (response.code === 200) { + const businessData = response.data; // Axios响应格式,业务数据在response.data中 + if (businessData?.code === 200) { // 为每个数据项添加颜色 const colors = ['#ef4444', '#f97316', '#eab308', '#3b82f6', '#10b981', '#8b5cf6', '#ec4899', '#06b6d4']; - vulnStats.value = response.data.map((item, index) => ({ + vulnStats.value = businessData.data.map((item, index) => ({ ...item, color: colors[index % colors.length] })); } else { - console.error('获取漏洞类型统计数据失败:', response.msg); + console.error('获取漏洞类型统计数据失败:', businessData?.msg || '未知错误'); // 如果接口调用失败,使用默认数据 vulnStats.value = [ { name: 'XSS 跨站脚本', value: 32.1, color: '#ef4444' }, @@ -334,10 +337,11 @@ const fetchVulnStats = async () => { const fetchRegionStats = async () => { try { const response = await mapRegionStatsPage1(); - if (response.code === 200) { - regionStats.value = response.data; + const businessData = response.data; // Axios响应格式,业务数据在response.data中 + if (businessData?.code === 200) { + regionStats.value = businessData.data; } else { - console.error('获取威胁情报地域排行数据失败:', response.msg); + console.error('获取威胁情报地域排行数据失败:', businessData?.msg || '未知错误'); // 如果接口调用失败,使用默认数据 regionStats.value = [ { name: 'United States', score: 435202 }, diff --git a/src/views/Jyh/security/components/VulnerabilityLanguageChart.vue b/src/views/Jyh/security/components/VulnerabilityLanguageChart.vue index 7e51f9b..e882686 100644 --- a/src/views/Jyh/security/components/VulnerabilityLanguageChart.vue +++ b/src/views/Jyh/security/components/VulnerabilityLanguageChart.vue @@ -34,19 +34,20 @@ const fetchLanguageTrendData = async () => { try { console.log('开始请求漏洞语言分布数据...'); const response = await languageTrendPage1(); + const businessData = response.data; // Axios响应格式,业务数据在response.data中 console.log('API响应:', response); - if (response?.code === 0) { - console.log('API返回的数据:', response.data); + if (businessData?.code === 200) { + console.log('API返回的数据:', businessData.data); // 处理后端返回的数据格式 - const processedData = processBackendData(response.data); + const processedData = processBackendData(businessData.data); languageTrendData.value = processedData; // 更新空数据标识 isEmpty.value.languageTrend = !processedData.years || processedData.years.length === 0; } else { - console.error('获取漏洞语言分布数据失败:', response?.msg || '未知错误'); + console.error('获取漏洞语言分布数据失败:', businessData?.msg || '未知错误'); // 设置默认数据 setDefaultData(); } diff --git a/src/views/Jyh/security/components/VulnerabilitySeverityChart.vue b/src/views/Jyh/security/components/VulnerabilitySeverityChart.vue index 9d2fbb9..de33a86 100644 --- a/src/views/Jyh/security/components/VulnerabilitySeverityChart.vue +++ b/src/views/Jyh/security/components/VulnerabilitySeverityChart.vue @@ -30,23 +30,25 @@ const vulnerabilitySeverityData = ref({ }); // 获取后端数据 -const fetchVulnerabilitySeverityData = async () => { +const fetchVulnerabilitySeverityData = async() => { try { console.log('开始请求漏洞等级分布数据...'); const response = await vulnerabilitySeverityPage1(); console.log('API响应:', response); - if (response?.code === 200) { - console.log('API返回的数据:', response.data); + const severityData = response.data; // Axios响应格式,业务数据在response.data中 + + if (severityData?.code === 200) { + console.log('API返回的数据:', severityData.data); // 处理后端返回的数据格式 - const processedData = processBackendSeverityData(response.data); + const processedData = processBackendSeverityData(severityData.data); vulnerabilitySeverityData.value = processedData; // 更新空数据标识 isEmpty.value.vulnerabilitySeverity = !processedData.categories || processedData.categories.length === 0; } else { - console.error('获取漏洞等级分布数据失败:', response?.msg || '未知错误'); + console.error('获取漏洞等级分布数据失败:', severityData?.msg || '未知错误'); // 设置默认数据 setDefaultSeverityData(); }