From aed4df4479e68cfae66efd640c8ea31c7f022e55 Mon Sep 17 00:00:00 2001 From: zhangxzz Date: Wed, 22 Nov 2023 16:41:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E6=9E=9C=E5=BA=93=E6=A6=82=E8=A7=88?= =?UTF-8?q?=E5=9B=BE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/military/achievement/achivChart/index.jsx | 45 +++++++++++++------ .../achievement/achivChart/index.scss | 10 ++--- src/modules/tpm/NewHeader.js | 7 +++ 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/src/military/achievement/achivChart/index.jsx b/src/military/achievement/achivChart/index.jsx index d23923ab3..e96575cdd 100644 --- a/src/military/achievement/achivChart/index.jsx +++ b/src/military/achievement/achivChart/index.jsx @@ -21,16 +21,25 @@ function AchivChart() { // 转换函数 function preprocessData(data) { - return data.map(function(item) { - if (item.value === 0) { - return { - value: null, - name: item.name - }; - } else { - return item; + let hasNonZeroValue = false; + + for (let i = 0; i < data.length; i++) { + if (data[i].value !== 0) { + hasNonZeroValue = true; + break; } - }); + } + + if (!hasNonZeroValue) { + // 如果所有value都为0,则不做任何改变 + return data; + } else { + // 部分value为0,则将0变为null + return data.map(item => ({ + ...item, + value: item.value === 0 ? null : item.value + })); + } } // echarts data @@ -42,6 +51,14 @@ function AchivChart() { { value: achivData.equipAchievement, name: '装备成果 ' + achivData.equipAchievement + '%' }, { value: achivData.anotherCount, name: '其他成果 ' + achivData.anotherCount + '%' } ]; + // let data = [ + // { value: 0, name: '开源项目 ' + achivData.osProjectCount + '%' }, + // { value: 0, name: '创客任务 ' + achivData.ckTaskCount + '%' }, + // { value: 0, name: '开放竞赛 ' + achivData.osContestCount + '%' }, + // { value: 0, name: '科研成果 ' + achivData.scienceAchievementCount + '%' }, + // { value: 0, name: '装备成果 ' + achivData.equipAchievement + '%' }, + // { value: 0, name: '其他成果 ' + achivData.anotherCount + '%' } + // ]; // 按照value从大到小排序 let sortedData = data.sort((a, b) => { return b.value - a.value } ); @@ -57,7 +74,7 @@ function AchivChart() { title: { text: '成果数量占比统计', left: 215, - top: 380, + top: 385, textStyle: { fontSize: 18 } @@ -65,7 +82,7 @@ function AchivChart() { legend: { orient: 'vertical', right: 10, - top: 105, + top: 108, itemGap: 16, itemWidth: 32, itemHeight: 24, @@ -86,7 +103,7 @@ function AchivChart() { name: 'Nightingale Chart', type: 'pie', radius: [35, 145], - center: ['150', '50%'], + center: ['160', '50%'], roseType: 'area', clockwise: false, startAngle: 45, @@ -107,10 +124,10 @@ function AchivChart() { ], graphic: { type: 'text', - left: '133', + left: '142', top: 'middle', style: { - text: '成果\n类型', + text: '成果\n来源', fill: '#333', fontSize: 18, fontWeight: 'bold', diff --git a/src/military/achievement/achivChart/index.scss b/src/military/achievement/achivChart/index.scss index f847e3197..9d2397c50 100644 --- a/src/military/achievement/achivChart/index.scss +++ b/src/military/achievement/achivChart/index.scss @@ -8,7 +8,7 @@ box-shadow:0px 6px 18px rgba(171, 202, 255, 0.24) inset; #leftBox { - width: 515px; + width: 495px; height: 450px; position: relative; .count-top { @@ -16,7 +16,7 @@ width: 190px; height: 95px; position: absolute; - top: 87px; + top: 110px; right: 130px; background:#f7faff; box-sizing: border-box; @@ -66,7 +66,7 @@ width: 190px; height: 95px; position: absolute; - top: 227px; + top: 250px; right: 130px; background:#f7faff; box-sizing: border-box; @@ -113,11 +113,11 @@ } } #chartBox { - width: 500px; + width: 515px; height: 450px; } #blankBox { - width: 185px; + width: 190px; height: 450px; } } diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index ecac55f69..4600b258f 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -576,6 +576,7 @@ class NewHeader extends Component { } matchpaths = (url) => { + console.log('@@@进入 newhead > matchpaths'); const { match } = this.props; const hostname = window.location.hostname; const port = window.location.port; @@ -596,8 +597,14 @@ class NewHeader extends Component { // console.log(str, (url + "/"), url && str === url); if (url && (str === url || str === (url + "/"))) { + console.log('@@@ matchpaths true'); + console.log('url:',url); + console.log('str:',str); return true } else { + console.log('@@@ matchpaths true'); + console.log('url:',url); + console.log('str:',str); return false }