diff --git a/public/imgs/titleBorder3.png b/public/imgs/titleBorder3.png new file mode 100644 index 0000000..8d40f7e Binary files /dev/null and b/public/imgs/titleBorder3.png differ diff --git a/public/imgs/titleBorder4.png b/public/imgs/titleBorder4.png new file mode 100644 index 0000000..51dc6e1 Binary files /dev/null and b/public/imgs/titleBorder4.png differ diff --git a/src/components/RightPage/BarChart/index.jsx b/src/components/RightPage/BarChart/index.jsx index ea27a6a..dd13c5c 100644 --- a/src/components/RightPage/BarChart/index.jsx +++ b/src/components/RightPage/BarChart/index.jsx @@ -1,25 +1,24 @@ -import {useEffect, useRef, useState} from "react"; +import React, {useEffect, useRef, useState} from "react"; import rightPageApi from "@/https/apis/rightPageApi"; const {Bar} = window.charts; -const DemoBar = ({requestDate,onClick}) => { +const DemoBar = ({requestDate, onClick}) => { - - const [list,setList] = useState([]) + const [list, setList] = useState([]) const pieRef = useRef(); - useEffect(()=>{ + useEffect(() => { getCollegeCount() clickPie(pieRef?.current?.getChart()) - },[requestDate]) + }, [requestDate]) const getCollegeCount = () => { - rightPageApi.collegeCount(requestDate.format("YYYY-MM-DD")).then(res=>{ - if(res.code == 200){ + rightPageApi.collegeCount(requestDate.format("YYYY-MM-DD")).then(res => { + if (res.code == 200) { setList(res.data.map(it => { - return {collegeName:it.collegeName.substr(0,10), sales: parseInt(it.count,10),collegeNo:it.collegeNo} + return {collegeName: it.collegeName.substr(0, 10), sales: parseInt(it.count, 10), collegeNo: it.collegeNo} })) } }) @@ -28,7 +27,7 @@ const DemoBar = ({requestDate,onClick}) => { const clickPie = (plot) => { plot.off("plot:click"); plot.on('plot:click', (...args) => { - onClick && onClick(args[0]?.data?.data,requestDate.format('YYYY-MM')) + onClick && onClick(args[0]?.data?.data, requestDate.format('YYYY-MM')) }) } @@ -38,20 +37,21 @@ const DemoBar = ({requestDate,onClick}) => { xField: 'sales', yField: 'collegeName', color: '#3B90FF', - xAxis:{ - label:{ - style:{ - fill:'#F2F2F2' + autoFit: true, + xAxis: { + label: { + style: { + fill: '#F2F2F2' } } }, barStyle: { fill: 'l(180) 0:#3B90FF 1:rgba(47, 253, 239, 0)', }, - yAxis:{ - label:{ - style:{ - fill:'#F2F2F2' + yAxis: { + label: { + style: { + fill: '#F2F2F2' } } }, @@ -62,14 +62,12 @@ const DemoBar = ({requestDate,onClick}) => { sales: { alias: '违规总数', }, - no:{ - alias:'编号' + no: { + alias: '编号' } }, - minBarWidth: 25, - maxBarWidth: 25, }; - return ; + return ; }; export default DemoBar diff --git a/src/components/RightPage/ColumnChart/index.jsx b/src/components/RightPage/ColumnChart/index.jsx index 927f6bd..eacf4fa 100644 --- a/src/components/RightPage/ColumnChart/index.jsx +++ b/src/components/RightPage/ColumnChart/index.jsx @@ -1,21 +1,21 @@ import rightPageApi from "@/https/apis/rightPageApi"; -import {useEffect, useState} from "react"; +import React, {useEffect, useState} from "react"; -const { Column } = window.charts; +const {Column} = window.charts; const DemoColumn = ({onClick}) => { - const [dataCount,setDataCount] = useState([]) + const [dataCount, setDataCount] = useState([]) - useEffect(()=>{ + useEffect(() => { getSevenCount() - },[]) + }, []) const getSevenCount = () => { - rightPageApi.sevenCount().then(res=>{ - if(res.code == 200){ - setDataCount(res.data.map(it=>{ - return {type:it.week.substr(5,5),sales:parseInt(it.count,10)} + rightPageApi.sevenCount().then(res => { + if (res.code == 200) { + setDataCount(res.data.map(it => { + return {type: it.week.substr(5, 5), sales: parseInt(it.count, 10)} })) } }) @@ -33,6 +33,7 @@ const DemoColumn = ({onClick}) => { xField: 'type', yField: 'sales', color: '#4AE7E0', + autoFit: true, label: { // 可手动配置 label 数据标签位置 position: 'middle', @@ -43,7 +44,7 @@ const DemoColumn = ({onClick}) => { }, }, xAxis: { - name:'type', + name: 'type', label: { autoHide: true, autoRotate: false, @@ -55,10 +56,10 @@ const DemoColumn = ({onClick}) => { barStyle: { fill: 'red', }, - yAxis:{ - label:{ - style:{ - fill:'#F2F2F2' + yAxis: { + label: { + style: { + fill: '#F2F2F2' } } }, @@ -71,7 +72,7 @@ const DemoColumn = ({onClick}) => { }, }, }; - return ; + return ; }; export default DemoColumn diff --git a/src/components/RightPage/PieChart/index.jsx b/src/components/RightPage/PieChart/index.jsx index cdbe4c4..5584f2e 100644 --- a/src/components/RightPage/PieChart/index.jsx +++ b/src/components/RightPage/PieChart/index.jsx @@ -1,5 +1,5 @@ import rightPageApi from "@/https/apis/rightPageApi"; -import {useEffect, useState} from "react"; +import React, {useEffect, useState} from "react"; const {Pie, G2} = window.charts; const G = G2.getEngine('canvas'); @@ -10,6 +10,7 @@ const cfg = { colorField: 'type', radius: 0.75, legend: false, + autoFit: true, label: { type: 'spider', labelHeight: 40, @@ -76,7 +77,7 @@ const DemoPie = ({onClick}) => { }) } - return ; + return ; }; export default DemoPie diff --git a/src/components/RightPage/index.jsx b/src/components/RightPage/index.jsx index 3427adb..cdca04f 100644 --- a/src/components/RightPage/index.jsx +++ b/src/components/RightPage/index.jsx @@ -1,12 +1,13 @@ -import React, {useEffect, useState} from "react"; +import React, {useState} from "react"; import style from './index.less' import BarChart from './BarChart' import ColumnChart from './ColumnChart' import PieChart from './PieChart' import dayjs from "dayjs"; import Flex from "@/components/Flex"; +import TitleView from "@/components/TitleView"; -const monthList = [] +const monthList = []; for (let i = 1; i < 13; i++) { monthList.push({ name: i + '月', @@ -16,57 +17,45 @@ for (let i = 1; i < 13; i++) { const rightPage = ({onPieClick}) => { - const [dateNum, setDate] = useState(dayjs()) - const [copyDate, setCopyDate] = useState(dayjs()) - const [dataBoxVisible, setDataBoxVisible] = useState(false) - - const {middle_box, bottom_box, title_box} = style; - + const [copyDate, setCopyDate] = useState(dayjs()); + const [dataBoxVisible, setDataBoxVisible] = useState(false); ///////////////////////////////////////// 页面渲染 return -
-
- - 学院违章排行 -
setDataBoxVisible(!dataBoxVisible)} className={style.time_box}>{copyDate.format("YYYY-MM")} -
-
-
-
-
-
- - 车辆违规统计 -
-
onPieClick(args)}/>
-
-
onPieClick(args)}/>
- { - dataBoxVisible &&
-
- setDate(dateNum.add(-1, 'year'))}>« - {dateNum.format('YYYY')} - setDate(dateNum.add(1, 'year'))}>» -
-
- { - monthList.map(it => { - return
{ - setDataBoxVisible(false) - setCopyDate(dayjs(dateNum.format("YYYY-") + it.value + "-01")); - }} key={it.value}>{it.name}
- }) - } -
-
- } + + + + setDataBoxVisible(!dataBoxVisible)} + >{copyDate.format("YYYY-MM")} + + } + /> + + + +
+ + + + + + onPieClick(args)}/> + + + + + onPieClick(args)}/> + + -} +}; export default rightPage diff --git a/src/components/RightPage/index.less b/src/components/RightPage/index.less index 1add0a7..6eb6bc8 100644 --- a/src/components/RightPage/index.less +++ b/src/components/RightPage/index.less @@ -1,72 +1,53 @@ .container { - width: 400px; - height: 100%; - color:#fff; - font-size:16px; - background-color: rgba(0,0,0,0.1); + width: 440px; + height: 100vh; + color: #fff; + padding: 20px; + font-size: 16px; + background-color: rgba(0, 0, 0, 0.1); .top_box { width: 100%; - height: 35%; - padding: 18px; + height: 0; + margin-bottom: 20px; - .title_box { - position: relative; - height:18%; - overflow: hidden; + .time_box { + text-align: center; + padding: 1px 8px 1.5px 8px; + font-size: 16px; + transform: translateY(10px); + background-size: 100%; + background: url("../../assets/time_box.png") no-repeat; + cursor: pointer; - .time_box { - text-align: center; - position: absolute; - right: 15px; - padding: 1px 8px 1.5px 8px; - font-size: 16px; - overflow: hidden; - transform: translateY(10px); - background-size: 100%; - background: url("../../assets/time_box.png") no-repeat; - cursor: pointer; - &:hover { - background-color: rgba(169,169,169,.2); - transition: all 0.2s; - } + &:hover { + background-color: rgba(169, 169, 169, .2); + transition: all 0.2s; } } } + .middle_box { position: relative; width: 100%; - height: 35%; - padding: 18px; - //background-color: white; + height: 0; + margin-bottom: 20px; .title_box { position: relative; - height:18%; + height: 18%; .time_box { position: absolute; - width:80px; - height:30px; + width: 80px; + height: 30px; transform: translateY(10px); } - } - .middle_box { - height: 20%; - background-color: chocolate; - } - - //background-color: saddlebrown; } - .bottom_box { - width: 100%; - height: 30%; - //background-color: crimson; - padding: 18px; - } + @keyframes fadeInDown { 0% { -webkit-transform: matrix3d(.7, 0, 0, 0, 0, .7, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); @@ -173,12 +154,13 @@ } } + .dataBox { top: 58px; right: 32px; position: absolute; width: 250px; - background-color: rgba(0,0,0,.9); + background-color: rgba(0, 0, 0, .9); border-radius: 15px; animation: fadeInDown .3s; @@ -189,6 +171,7 @@ margin: 10px 0; border-bottom: 1px solid grey; } + .data_body { display: flex; flex-wrap: wrap; @@ -203,6 +186,7 @@ line-height: 40px; cursor: pointer; vertical-align: center; + &:hover { color: black; background-color: grey; diff --git a/src/pages/index.jsx b/src/pages/index.jsx index a23ba9b..2353cb6 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -1,21 +1,13 @@ -import React, {useRef, useState} from "react"; +import React from "react"; import less from './index.less' import LeftPage from '../components/LeftPage' import RightPage from '../components/RightPage' -import MiddlePage from '../components/MiddlePage' -import {BorderBox6} from "@jiaminghi/data-view-react"; -import CarModalPage from "@/components/CarModalPage"; -import ModalPage from "@/components/UserModalPage"; import Flex from "@/components/Flex"; -const width = 2120, height = 1295; const bgUrl = window.sessionStorage.getItem('core_3d_map_bg'); export default () => { - const carModalPageRef = useRef(); - - ///////////////////////////////////////// 页面渲染 return @@ -26,10 +18,7 @@ export default () => { - - - - +