update energy

This commit is contained in:
lb 2023-07-02 10:55:10 +08:00
parent 54b3cce498
commit 60616fcb0e
7 changed files with 133 additions and 108 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

View File

@ -4,6 +4,7 @@ import cls from './container.module.less';
import IconStack from '../assets/Icon/icon-stack.png'; import IconStack from '../assets/Icon/icon-stack.png';
import IconGood from '../assets/Icon/icon-good.png'; import IconGood from '../assets/Icon/icon-good.png';
import IconCharger from '../assets/Icon/icon-charge.png';
const Container = (props) => { const Container = (props) => {
let icon = useRef(null); let icon = useRef(null);
@ -15,6 +16,9 @@ const Container = (props) => {
case 'good': // case 'good': //
icon.current = IconGood; icon.current = IconGood;
break; break;
case 'charger':
icon.current = IconCharger;
break;
} }
return ( return (

View File

@ -1,17 +1,16 @@
.EnergyCostChart { .energyCostChart {
margin-top: 12px; margin-top: 12px;
height: 1px; height: 1px;
flex: 1; flex: 1;
padding-top: 8px; padding-top: 8px;
background: #ae27276a;
} }
.EnergyCostChart .titleBar { .energyCostChart .titleBar {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
color: white; color: white;
} }
.EnergyCostChart .titleBar h2 { .energyCostChart .titleBar h2 {
margin: 0; margin: 0;
font-size: 18px; font-size: 18px;
line-height: 32px; line-height: 32px;
@ -19,17 +18,17 @@
color: #52fff8; color: #52fff8;
} }
.EnergyCostChart .titleBar .legend { .energyCostChart .titleBar .legend {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.EnergyCostChart .titleBar .legend * { .energyCostChart .titleBar .legend * {
font-size: 14px; font-size: 14px;
line-height: 14px; line-height: 14px;
color: #dff1fe; color: #dff1fe;
} }
.EnergyCostChart .titleBar .legend ul { .energyCostChart .titleBar .legend ul {
display: flex; display: flex;
margin: 0; margin: 0;
margin-left: 8px; margin-left: 8px;
@ -37,12 +36,12 @@
list-style: none; list-style: none;
align-items: center; align-items: center;
} }
.EnergyCostChart .titleBar .legend ul li { .energyCostChart .titleBar .legend ul li {
position: relative; position: relative;
margin: 4px; margin: 4px;
padding-left: 16px; padding-left: 16px;
} }
.EnergyCostChart .titleBar .legend ul li::before { .energyCostChart .titleBar .legend ul li::before {
content: ''; content: '';
position: absolute; position: absolute;
left: 2px; left: 2px;
@ -53,15 +52,15 @@
border-radius: 2px; border-radius: 2px;
} }
.EnergyCostChart .titleBar .legend ul li:first-child::before { .energyCostChart .titleBar .legend ul li:first-child::before {
background-color: #ffd160; background-color: #ffd160;
} }
.EnergyCostChart .titleBar .legend ul li:nth-child(2)::before { .energyCostChart .titleBar .legend ul li:nth-child(2)::before {
background-color: #12fff5; background-color: #12fff5;
} }
.EnergyCostChart .titleBar .legend ul li:nth-child(3)::before { .energyCostChart .titleBar .legend ul li:nth-child(3)::before {
background-color: #2760ff; background-color: #2760ff;
} }

View File

@ -6,8 +6,11 @@ import EnergyCostChart from './EnergyCostChart';
function EnergyCost(props) { function EnergyCost(props) {
return ( return (
<Container title="能耗" icon="charger" className={cls.energyCost}> <Container title="能耗" icon="charger" className={cls.energyCost}>
<div className={`flex flex-col`}>
<div className={`${cls.cost__info} flex`}> <div className={`${cls.cost__info} flex`}>
<div className={`${cls.info__item} flex flex-col items-center`}> <div
className={`${cls.info__item} ${cls.hAuto} flex flex-col justify-center items-center self-stretch`}
>
<span> </span> <span> </span>
<span>922kwh</span> <span>922kwh</span>
</div> </div>
@ -22,6 +25,7 @@ function EnergyCost(props) {
<TechSplitline /> <TechSplitline />
<EnergyCostChart /> <EnergyCostChart />
</div>
</Container> </Container>
); );
} }

View File

@ -1,9 +1,16 @@
.energyCost { .energyCost {
background: #b730305c; background: url(../../../assets/energy.png) no-repeat;
background-size: 100% 100%;
width: 626px;
} }
.cost__info { .cost__info {
margin-top: 8px;
margin-bottom: 12px; margin-bottom: 12px;
div {
flex-grow: 1;
}
} }
.info__item { .info__item {
@ -19,6 +26,10 @@
user-select: none; user-select: none;
} }
.hAuto {
height: auto;
}
.info__item_groups { .info__item_groups {
margin-left: 8px; margin-left: 8px;
display: grid; display: grid;

View File

@ -1,49 +1,43 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import RightChart1Icon2 from '../../../../assets/Icon/RightChart1Icon2.png' // import RightChart1Icon2 from '../../../../assets/Icon/RightChart1Icon2.png'
import Chart1 from './Chart1.jsx' import Chart1 from './Chart1.jsx';
import './index.less'
import './index.less';
//#52FFF8 //#52FFF8
function Index(props) { function Index(props) {
const switchColor = (index) => { const switchColor = (index) => {
switch (index) { switch (index) {
case 1: return '#52FFF8'; case 1:
case 2: return '#49B2FF'; return '#52FFF8';
case 3: return '#FFB94D'; case 2:
default: return '#fff' return '#49B2FF';
case 3:
return '#FFB94D';
default:
return '#fff';
} }
} };
let Border = styled.div` let Border = styled.div`
width: 74px; width: 74px;
height: 24px; height: 24px;
margin-top: 50px; margin-top: 50px;
overflow: hidden; overflow: hidden;
` `;
// background: url(${RightChart1Icon2});
let Ion2 = styled.div` let Ion2 = styled.div`
width: 100%; width: 100%;
height: 100%; height: 100%;
float: left; float: left;
background: url(${RightChart1Icon2});
background-repeat: no-repeat; background-repeat: no-repeat;
transform: translatex(-82px); transform: translatex(-82px);
filter: drop-shadow(82px 1px ${switchColor(props.index)}); filter: drop-shadow(82px 1px ${switchColor(props.index)});
` `;
//75 //75
let Stuff = styled.div` let Stuff = styled.div`
@ -52,9 +46,8 @@ function Index(props) {
transform: translatex(3px); transform: translatex(3px);
width: ${58}%; width: ${58}%;
height: 12px; height: 12px;
background: linear-gradient(to right,#051226,${switchColor(props.index)}) background: linear-gradient(to right, #051226, ${switchColor(props.index)});
` `;
//gap //gap
@ -66,7 +59,7 @@ function Index(props) {
width: 2px; width: 2px;
height: 13px; height: 13px;
background-color: #051226; background-color: #051226;
` `;
const Gap2 = styled(Gap1)` const Gap2 = styled(Gap1)`
transform: translatex(29px); transform: translatex(29px);
@ -76,15 +69,17 @@ function Index(props) {
transform: translatex(45px); transform: translatex(45px);
`; `;
return ( return (
<div className="RightChart1ItemBorderRow">
<div className='RightChart1ItemBorderRow' > <div className="RightChart1ItemB1">
<div className='RightChart1ItemB1'> <Chart1
<Chart1 color={switchColor(props.index)} data={props.data} unit={props.unit}/> color={switchColor(props.index)}
data={props.data}
unit={props.unit}
/>
</div> </div>
<div className='RightChart1ItemB2'> <div className="RightChart1ItemB2">
<h2 className='RightChart1ItemB2TXT'>{props.name}</h2> <h2 className="RightChart1ItemB2TXT">{props.name}</h2>
<Border> <Border>
<Ion2></Ion2> <Ion2></Ion2>
<Stuff></Stuff> <Stuff></Stuff>

View File

@ -14,6 +14,10 @@
justify-content: start; justify-content: start;
} }
.justify-center {
justify-content: center;
}
.justify-start { .justify-start {
justify-content: center; justify-content: center;
} }
@ -22,6 +26,10 @@
align-items: center; align-items: center;
} }
.self-stretch {
align-self: stretch;
}
.w-full { .w-full {
width: 100%; width: 100%;
} }
@ -33,3 +41,7 @@
.h-half { .h-half {
height: 50%; height: 50%;
} }
.h-auto {
height: auto;
}