From a148aa486b9438169b8f6b1e827e3d2ca47e4b99 Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 22 Jul 2022 10:32:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=BA=E8=AE=BE=E9=83=A8=E5=88=86=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../footer/build/AutoRollComponent.js | 139 ++++++++++++++++++ .../containers/footer/build/Rightcenter.js | 86 ++++++++++- .../quanju/containers/footer/build/index.js | 6 +- .../quanju/containers/footer/build/style.less | 35 ++++- 4 files changed, 256 insertions(+), 10 deletions(-) create mode 100644 web/client/src/sections/quanju/containers/footer/build/AutoRollComponent.js diff --git a/web/client/src/sections/quanju/containers/footer/build/AutoRollComponent.js b/web/client/src/sections/quanju/containers/footer/build/AutoRollComponent.js new file mode 100644 index 00000000..744e02cb --- /dev/null +++ b/web/client/src/sections/quanju/containers/footer/build/AutoRollComponent.js @@ -0,0 +1,139 @@ + +import React, { Component } from 'react'; +import { Row, Col } from 'antd'; + +export default class AutoRollComponent extends Component { + + constructor(props) { + super(props); + this.scrollElem = null; + this.stopscroll = false; + this.preTop = 0; + this.cloneEle = null; + this.currentTop = 0; + this.marqueesHeight = 0; + this.interval = null; + this.state = { + enabledScroll: false + } + } + + get enabledScroll() { + let scrollElem = document.getElementById(this.props.divId); + let fatherElem = scrollElem?.parentNode || null; + if (scrollElem && fatherElem) { + return scrollElem.scrollHeight > fatherElem.scrollHeight + } + + return false; + } + + + marque = (height) => { + try { + this.scrollElem = document.getElementById(this.props.divId); + this.marqueesHeight = height; + if (this.scrollElem) { + this.scrollElem.style.height = this.marqueesHeight; + this.scrollElem.style.overflow = 'hidden'; + } + this.repeat(); + } catch (e) { console.log(e) } + } + + + repeat = () => { + this.scrollElem.scrollTop = 0; + let offset = 1.5 + + this.interval = setInterval(() => { + if (this.stopscroll) return; + this.currentTop = this.currentTop + offset; + this.preTop = this.scrollElem.scrollTop; + this.scrollElem.scrollTop = this.scrollElem.scrollTop + offset; + // console.log(`this.scrollElem.scrollTop:${this.scrollElem.scrollTop} === this.preTop:${this.preTop}`); + if (this.preTop === this.scrollElem.scrollTop) { + this.scrollElem.scrollTop = this.marqueesHeight; + this.scrollElem.scrollTop = this.scrollElem.scrollTop + offset; + } + }, 40); + } + + + componentWillUnmount() { + clearInterval(this.interval); + } + + componentWillReceiveProps(nextProps) { + requestAnimationFrame(() => { + if (this.enabledScroll) { + if (!this.state.enabledScroll) { + this.setState({ enabledScroll: true }, () => { + this.marque(10) + }) + } + + } + }) + } + + componentDidMount() { + if (this.enabledScroll) { + this.setState({ enabledScroll: true }, () => { + this.marque(10) + }) + } + } + + onMouseOver = () => { + this.stopscroll = true; + } + + onMouseOut = () => { + this.stopscroll = false; + } + + + render() { + + const { changeStyleCol, heads, spans, data, divId, divHeight, content, containerStyle = {} } = this.props; + + return ( +
+ { + heads ? + + {heads.map((c, index) => { + return {c} + }) + } + : '' + } + +
+
+ {content ? content : ''} + {this.state.enabledScroll && content ? content : ''} + { + data ? + data.map((q, idx) => { + return ( +
+ + {heads.map((c, index) => { + return + {index == 1 ? q.data[index] == -1 ? "-" : q.data[index] : index == 2 ? q.data[1] == -1 ? '-' : q.data[index] : q.data[index]} + }) + } + +
+ ) + }) : '' + } +
+
+
+
+ ) + } +} \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/build/Rightcenter.js b/web/client/src/sections/quanju/containers/footer/build/Rightcenter.js index 708e945c..9f9948cb 100644 --- a/web/client/src/sections/quanju/containers/footer/build/Rightcenter.js +++ b/web/client/src/sections/quanju/containers/footer/build/Rightcenter.js @@ -1,7 +1,91 @@ import React from 'react' import './style.less' +import AutoRollComponent from './AutoRollComponent' export default function Rightcenter() { + const data =[ {name: '莲塘镇', total: 12739}, + {name: '向塘镇', total: 2445}, + {name: '蒋巷镇', total: 2035}, + {name: '幽兰镇', total: 1999}, + {name: '塘南镇', total: 1915}, + {name: '武阳镇', total: 1842}, + {name: '冈上镇', total: 1446}, + {name: '广福镇', total: 1063}, + {name: '三江镇', total: 851}, + {name: '泾口乡', total: 657}, + {name: '南新镇', total: 640}, + {name: '八一乡', total: 569}, + {name: '黄马乡', total: 541}, + {name: '塔城乡', total: 534}, + {name: '富山乡', total: 515}, + {name: '东新乡', total: 513}, + {name: '银三角', total: 513}, + {name: '八月湖街道', total: 513},] + const province = undefined + const FIRST = "linear-gradient(360deg, rgba(43, 180, 211, 0.1) 0%, rgba(43, 180, 211, 0.4) 100%)" +const SECOND = "linear-gradient(360deg, rgba(255, 209, 86, 0.1) 0%, rgba(255, 209, 86, 0.4) 100%)" +const THIRD = "linear-gradient(360deg, rgba(148, 148, 255, 0.1) 0%, rgba(148, 148, 255, 0.4) 100%)" +const OTHER = "linear-gradient(360deg, rgba(28, 96, 253, 0) 0%, rgba(28, 96, 253, 0.2) 100%)" +let TOTALS = data?.map(({ name, total }, index) => { + let max = province ? data.length * 30 + 100 : data.length * 500 + 100 + return { + name, + value: total, + percent: (total * 100 / max).toFixed(2) + "%" + } +}) +let new_TOTALS = TOTALS && TOTALS.length > 10 ? TOTALS.slice(0, 10) : TOTALS +function Cell(props) { + const { name, rank, value, percent, style = {} } = props + let bg = RNAKS[rank] || OTHER + console.log(percent,'百分比') + return
+
+ {name} +
+
+ {/*
{name}
*/} + +
+
+
+
+
+
{value}
+
+
+
+} +const renderContent = () => { + return
+ {new_TOTALS?.map(({ name, value, percent }, index) => { + return + })} +
+} +const RNAKS = [FIRST, SECOND, THIRD] + return ( -
Rightcenter
+
+
+ +
在线公路工程数量
+

1234,123

+
+ +
) } diff --git a/web/client/src/sections/quanju/containers/footer/build/index.js b/web/client/src/sections/quanju/containers/footer/build/index.js index d613f54e..85e8c26c 100644 --- a/web/client/src/sections/quanju/containers/footer/build/index.js +++ b/web/client/src/sections/quanju/containers/footer/build/index.js @@ -3,7 +3,7 @@ import React from 'react' // import LeftCenter from './Leftcenter' import LeftBottom from './Leftbottom' // import RightTop from './Righttop' -// import Rightcenter from './Rightcenter' +import Rightcenter from './Rightcenter' // import Rightbottom from './Rightbottom' import { Carousel } from 'antd' import Module from '../../public/module' @@ -115,7 +115,9 @@ const Build = () => { + }}> + + diff --git a/web/client/src/sections/quanju/containers/footer/build/style.less b/web/client/src/sections/quanju/containers/footer/build/style.less index 3f6da806..4db9bf41 100644 --- a/web/client/src/sections/quanju/containers/footer/build/style.less +++ b/web/client/src/sections/quanju/containers/footer/build/style.less @@ -166,7 +166,6 @@ width: 25%; height: 100%; .build-right-top{ - width: 100%; height: 100%; padding: 0 10px 10px; @@ -188,16 +187,38 @@ line-height: 31px; background-image: url('/assets/images/quanju/bgxuanchuanlan.png'); background-size: 100% 100%; - - - } } .build-right-center{ width: 100%; - height: 33%; - background-color: pink; - margin-bottom: 3%; + height: 100%; + // background-color: pink; + .build-right-center-top{ + width: 100%; + height: 30%; + display: flex; + justify-content: space-around; + align-items: center; + img{ + width:12% ; + height: 80%; + } + div{ + font-size: 16px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #C2EEFF; + line-height: 22px; + letter-spacing: 1px + } + h2{ + font-size: 28px; + font-family: YouSheBiaoTiHei; + color: #FFFFFF; + margin-bottom : 0!important; + text-shadow: 0px 0px 4px #07B9FE; + } + } } .build-right-bottom{ width: 100%;