diff --git a/src/military/qz2022.js b/src/military/qz2022.js
index 4c3a4620..a2b1cc6b 100644
--- a/src/military/qz2022.js
+++ b/src/military/qz2022.js
@@ -184,7 +184,7 @@ const Qz2022 = (props) => {
{/* 数据统计 */}
()
+ () => ()
}
>
{/* 后台管理-报名列表 */}
diff --git a/src/military/qz2022/statistics/EchartBar/index.jsx b/src/military/qz2022/statistics/EchartBar/index.jsx
index 328cc024..7ede23ca 100644
--- a/src/military/qz2022/statistics/EchartBar/index.jsx
+++ b/src/military/qz2022/statistics/EchartBar/index.jsx
@@ -18,6 +18,8 @@ const colorArr0 = ['rgba(226, 217, 255, 1)', 'rgba(251, 201, 0, 0.36)', 'rgba(14
const colorArr1= ['rgba(155, 128, 245, 1)', 'rgba(254, 140, 0, 1)', 'rgba(37, 109, 255, 1)'];
export default ({ id, className, title, legendArr, xData, yData }) => {
+ console.log(yData);
+
useEffect(() => {
let newEchartBar = document.getElementById(id) && echarts.init(document.getElementById(id));
let textColor = "#7988a5";
diff --git a/src/military/qz2022/statistics/index.jsx b/src/military/qz2022/statistics/index.jsx
index 43c593d9..e8544453 100644
--- a/src/military/qz2022/statistics/index.jsx
+++ b/src/military/qz2022/statistics/index.jsx
@@ -23,50 +23,57 @@ const initPieArr = [
];
const initLegendArr = ["战略方向", "前沿技术", "作战领域"];
+const initBarYData = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
-function Statistics({ showNotification, match, history }) {
+function Statistics({ showNotification, qzDetail }) {
const [pieArr, setPieArr] = useState(initPieArr);
const [barXData, setBarXData] = useState(['LJLJLJ', 'HJHJHJ', 'KJKJKJ', 'HJJHJJHJJ', 'ZLZYBD', '联勤保障', 'WJWJWJ']);
const [legendArr, setLegendArr] = useState(initLegendArr);
- const [barYData, setBarYData] = useState([[3, 2, 3, 4, 2, 4, 7, 5], [3, 2, 3, 4, 7, 2, 4, 5], [3, 2, 2, 3, 4, 2, 4, 5]]);
+ const [barYData, setBarYData] = useState(initBarYData);
+ const [uploadCount, setUploadCount] = useState(0);
+ const [enrollCount, setEnrollCount] = useState(0);
+
useEffect(() => {
stattistics().then(res => {
- if (res && Array.isArray(res.data)) {
-
+ if (res && res.data && Array.isArray(res.data.data)) {
let pieArrList = [];
let xData = [];
let yData1 = [], yData2 = [], yData3 = [];
let barYDataArr = [];
- res.data.forEach(i => {
- i[0]&&xData.push(i[0].split('分赛区')[0]);
+ res.data.data.forEach(i => {
+ i[0] && xData.push(i[0].split('分赛区')[0]);
yData1.push(i[1]);
yData2.push(i[2]);
yData3.push(i[3]);
});
- setLegendArr(res.competition_subs);
+ setLegendArr(res.data.competition_subs);
+ setUploadCount(res.data.upload_count);
+ setEnrollCount(res.data.enroll_count);
setBarXData(xData);
barYDataArr[0] = yData1;
barYDataArr[1] = yData2;
barYDataArr[2] = yData3;
- // setBarYData(barYData);
+ setBarYData(barYDataArr);
let yData = [];
yData.push(yData1.reduce((pre, current) => { return pre + current }, 0));
yData.push(yData2.reduce((pre, current) => { return pre + current }, 0));
yData.push(yData3.reduce((pre, current) => { return pre + current }, 0));
- res.competition_subs.forEach((item, index) => {
+ res.data.competition_subs.forEach((item, index) => {
pieArrList.push({
name: item,
value: yData[index],
})
});
setPieArr(pieArrList);
+ }else{
+ showNotification((res&&res.message) || '请求数据失败!');
}
});
}, []);
@@ -78,7 +85,7 @@ function Statistics({ showNotification, match, history }) {
-
12121+
+
{enrollCount}+
竞赛总报名数
@@ -86,24 +93,24 @@ function Statistics({ showNotification, match, history }) {
-
1221+
+
{uploadCount}+
竞赛总作品提交数
{/* 外网 */}
- {/*
+ {!qzDetail.is_local &&
综合赛区报名数
- */}
+
}
{/* 内网 */}
-
+ {qzDetail.is_local &&
-
+
}
)
}