Browse Source

优化一些小问题

pull/11096/head
期贤 2 years ago
parent
commit
f8c16d6c5e
  1. 10
      src/pages/dashboard/analysis/components/IntroduceRow.tsx
  2. 11
      src/pages/dashboard/analysis/components/TopSearch.tsx
  3. 7
      src/pages/dashboard/monitor/components/ActiveChart/index.tsx
  4. 57
      src/pages/dashboard/monitor/index.tsx

10
src/pages/dashboard/analysis/components/IntroduceRow.tsx

@ -1,5 +1,5 @@
import { InfoCircleOutlined } from '@ant-design/icons'; import { InfoCircleOutlined } from '@ant-design/icons';
import { Tiny } from '@ant-design/plots'; import { Area, Column } from '@ant-design/plots';
import { Col, Progress, Row, Tooltip } from 'antd'; import { Col, Progress, Row, Tooltip } from 'antd';
import numeral from 'numeral'; import numeral from 'numeral';
import type { DataItem } from '../data.d'; import type { DataItem } from '../data.d';
@ -65,18 +65,19 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
footer={<Field label="日访问量" value={numeral(1234).format('0,0')} />} footer={<Field label="日访问量" value={numeral(1234).format('0,0')} />}
contentHeight={46} contentHeight={46}
> >
<Tiny.Area <Area
xField="x" xField="x"
yField="y" yField="y"
shapeField="smooth" shapeField="smooth"
height={46} height={46}
axis={false}
style={{ style={{
fill: 'linear-gradient(-90deg, white 0%, #975FE4 100%)', fill: 'linear-gradient(-90deg, white 0%, #975FE4 100%)',
fillOpacity: 0.6, fillOpacity: 0.6,
width: '100%', width: '100%',
}} }}
padding={[0, 0, 0, 0]}
data={visitData} data={visitData}
line={{ style: { stroke: '#975FE4' } }}
/> />
</ChartCard> </ChartCard>
</Col> </Col>
@ -94,9 +95,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
footer={<Field label="转化率" value="60%" />} footer={<Field label="转化率" value="60%" />}
contentHeight={46} contentHeight={46}
> >
<Tiny.Column <Column
xField="x" xField="x"
yField="y" yField="y"
axis={false}
height={46} height={46}
data={visitData} data={visitData}
scale={{ x: { paddingInner: 0.4 } }} scale={{ x: { paddingInner: 0.4 } }}

11
src/pages/dashboard/analysis/components/TopSearch.tsx

@ -1,5 +1,5 @@
import { InfoCircleOutlined } from '@ant-design/icons'; import { InfoCircleOutlined } from '@ant-design/icons';
import { Tiny } from '@ant-design/plots'; import { Area } from '@ant-design/plots';
import { Card, Col, Row, Table, Tooltip } from 'antd'; import { Card, Col, Row, Table, Tooltip } from 'antd';
import numeral from 'numeral'; import numeral from 'numeral';
import React from 'react'; import React from 'react';
@ -44,7 +44,6 @@ const TopSearch = ({
count: number; count: number;
}, },
) => a.count - b.count, ) => a.count - b.count,
className: styles.alignRight,
}, },
{ {
title: '周涨幅', title: '周涨幅',
@ -112,14 +111,14 @@ const TopSearch = ({
status="up" status="up"
subTotal={17.1} subTotal={17.1}
/> />
<Tiny.Area <Area
xField="x" xField="x"
yField="y" yField="y"
shapeField="smooth" shapeField="smooth"
height={45} height={45}
axis={false}
style={{ fill: 'linear-gradient(-90deg, white 0%, #6294FA 100%)', fillOpacity: 0.4 }} style={{ fill: 'linear-gradient(-90deg, white 0%, #6294FA 100%)', fillOpacity: 0.4 }}
data={visitData2} data={visitData2}
line={{ style: { stroke: '#6294FA' } }}
/> />
</Col> </Col>
<Col <Col
@ -147,14 +146,14 @@ const TopSearch = ({
subTotal={26.2} subTotal={26.2}
gap={8} gap={8}
/> />
<Tiny.Area <Area
xField="x" xField="x"
yField="y" yField="y"
shapeField="smooth" shapeField="smooth"
height={45} height={45}
style={{ fill: 'linear-gradient(-90deg, white 0%, #6294FA 100%)', fillOpacity: 0.4 }} style={{ fill: 'linear-gradient(-90deg, white 0%, #6294FA 100%)', fillOpacity: 0.4 }}
data={visitData2} data={visitData2}
line={{ style: { stroke: '#6294FA' } }} axis={false}
/> />
</Col> </Col>
</Row> </Row>

7
src/pages/dashboard/monitor/components/ActiveChart/index.tsx

@ -1,4 +1,4 @@
import { Tiny } from '@ant-design/plots'; import { Area } from '@ant-design/plots';
import { Statistic } from 'antd'; import { Statistic } from 'antd';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import useStyles from './index.style'; import useStyles from './index.style';
@ -48,13 +48,14 @@ const ActiveChart = () => {
marginTop: 32, marginTop: 32,
}} }}
> >
<Tiny.Area <Area
padding={[0, 0, 0, 0]}
xField="x" xField="x"
axis={false}
yField="y" yField="y"
height={84} height={84}
style={{ fill: 'linear-gradient(-90deg, white 0%, #6294FA 100%)', fillOpacity: 0.6 }} style={{ fill: 'linear-gradient(-90deg, white 0%, #6294FA 100%)', fillOpacity: 0.6 }}
data={activeData} data={activeData}
line={{ style: { stroke: '#6294FA' } }}
/> />
</div> </div>
{activeData && ( {activeData && (

57
src/pages/dashboard/monitor/index.tsx

@ -1,30 +1,17 @@
import { Gauge, Liquid, Tiny, WordCloud } from '@ant-design/plots'; import { Gauge, Liquid, WordCloud } from '@ant-design/plots';
import { GridContent } from '@ant-design/pro-components'; import { GridContent } from '@ant-design/pro-components';
import { useRequest } from '@umijs/max'; import { useRequest } from '@umijs/max';
import { Card, Col, Row, Statistic } from 'antd'; import { Card, Col, Progress, Row, Statistic } from 'antd';
import numeral from 'numeral'; import numeral from 'numeral';
import type { FC } from 'react'; import type { FC } from 'react';
import ActiveChart from './components/ActiveChart'; import ActiveChart from './components/ActiveChart';
import Map from './components/Map'; import Map from './components/Map';
import { queryTags } from './service'; import { queryTags } from './service';
import useStyles from './style.style'; import useStyles from './style.style';
const { Countdown } = Statistic; const { Countdown } = Statistic;
const deadline = Date.now() + 1000 * 60 * 60 * 24 * 2 + 1000 * 30; // Moment is also OK const deadline = Date.now() + 1000 * 60 * 60 * 24 * 2 + 1000 * 30; // Moment is also OK
const getAnnotations = (value: number) => [
{
type: 'text',
style: {
text: `${value * 100}%`,
x: '50%',
y: '50%',
textAlign: 'center',
fontSize: 16,
fontStyle: 'bold',
},
},
];
const Monitor: FC = () => { const Monitor: FC = () => {
const { styles } = useStyles(); const { styles } = useStyles();
const { loading, data } = useRequest(queryTags); const { loading, data } = useRequest(queryTags);
@ -95,12 +82,15 @@ const Monitor: FC = () => {
> >
<Gauge <Gauge
height={180} height={180}
data={{ data={
target: 80, {
total: 100, target: 80,
name: 'score', total: 100,
thresholds: [20, 40, 60, 80, 100], name: 'score',
}} thresholds: [20, 40, 60, 80, 100],
} as any
}
padding={[0, 0, 0, 0]}
style={{ style={{
textContent: () => ``, textContent: () => ``,
}} }}
@ -123,35 +113,20 @@ const Monitor: FC = () => {
marginBottom: 24, marginBottom: 24,
}} }}
> >
<Card title="各品类占比" bordered={false} className={styles.pieCard}> <Card title="各品类占比" bordered={false}>
<Row <Row
style={{ style={{
padding: '16px 0', padding: '16px 0',
}} }}
> >
<Col span={8}> <Col span={8}>
<Tiny.Ring <Progress type="dashboard" percent={75} />
height={128}
percent={0.3}
color={['#E8EEF4', '#5FABF4']}
annotations={getAnnotations(0.3)}
/>
</Col> </Col>
<Col span={8}> <Col span={8}>
<Tiny.Ring <Progress type="dashboard" percent={48} />
height={128}
percent={0.22}
color={['#E8EEF4', '#5DDECF']}
annotations={getAnnotations(0.22)}
/>
</Col> </Col>
<Col span={8}> <Col span={8}>
<Tiny.Ring <Progress type="dashboard" percent={33} />
height={128}
percent={0.32}
color={['#E8EEF4', '#2FC25B']}
annotations={getAnnotations(0.32)}
/>
</Col> </Col>
</Row> </Row>
</Card> </Card>

Loading…
Cancel
Save