index.js 7.74 KB
Newer Older
jim's avatar
jim committed
1
import React, { PureComponent } from 'react';
2
import { connect } from 'dva';
3
import { formatMessage, FormattedMessage } from 'umi/locale';
4
import { Row, Col, Card, Tooltip } from 'antd';
5 6
import { NumberInfo, Charts } from 'ant-design-pro';
import CountDown from 'ant-design-pro/lib/CountDown';
7
import numeral from 'numeral';
jim's avatar
jim committed
8

9 10
import ActiveChart from './components/ActiveChart';
import styles from './style.less';
11

12
const { Pie, WaterWave, Gauge, TagCloud } = Charts;
陈帅's avatar
陈帅 committed
13

14 15
const targetTime = new Date().getTime() + 3900000;

16 17
@connect(({ BLOCK_NAME_CAMEL_CASE, loading }) => ({
  BLOCK_NAME_CAMEL_CASE,
Andreas Cederström's avatar
Andreas Cederström committed
18
  loading: loading.models.monitor,
19
}))
20
class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
21
  componentDidMount() {
陈帅's avatar
陈帅 committed
22 23
    const { dispatch } = this.props;
    dispatch({
24
      type: 'BLOCK_NAME_CAMEL_CASE/fetchTags',
25
    });
nikogu's avatar
nikogu committed
26
  }
nikogu's avatar
nikogu committed
27

28
  render() {
29 30
    const { BLOCK_NAME_CAMEL_CASE, loading } = this.props;
    const { tags } = BLOCK_NAME_CAMEL_CASE;
31 32

    return (
33
      <React.Fragment>
34
        <Row gutter={24}>
niko's avatar
niko committed
35
          <Col xl={18} lg={24} md={24} sm={24} xs={24} style={{ marginBottom: 24 }}>
36 37 38
            <Card
              title={
                <FormattedMessage
39
                  id="BLOCK_NAME.monitor.trading-activity"
40 41 42 43 44
                  defaultMessage="Real-Time Trading Activity"
                />
              }
              bordered={false}
            >
45
              <Row>
niko's avatar
niko committed
46
                <Col md={6} sm={12} xs={24}>
47
                  <NumberInfo
48 49
                    subTitle={
                      <FormattedMessage
50
                        id="BLOCK_NAME.monitor.total-transactions"
51 52 53
                        defaultMessage="Total transactions today"
                      />
                    }
niko's avatar
niko committed
54
                    suffix=""
55 56 57
                    total={numeral(124543233).format('0,0')}
                  />
                </Col>
niko's avatar
niko committed
58
                <Col md={6} sm={12} xs={24}>
59 60 61
                  <NumberInfo
                    subTitle={
                      <FormattedMessage
62
                        id="BLOCK_NAME.monitor.sales-target"
63 64 65 66 67
                        defaultMessage="Sales target completion rate"
                      />
                    }
                    total="92%"
                  />
68
                </Col>
niko's avatar
niko committed
69
                <Col md={6} sm={12} xs={24}>
70 71 72
                  <NumberInfo
                    subTitle={
                      <FormattedMessage
73
                        id="BLOCK_NAME.monitor.remaining-time"
74 75 76 77 78
                        defaultMessage="Remaining time of activity"
                      />
                    }
                    total={<CountDown target={targetTime} />}
                  />
79
                </Col>
niko's avatar
niko committed
80
                <Col md={6} sm={12} xs={24}>
81
                  <NumberInfo
82 83
                    subTitle={
                      <FormattedMessage
84
                        id="BLOCK_NAME.monitor.total-transactions-per-second"
85 86 87
                        defaultMessage="Total transactions per second"
                      />
                    }
niko's avatar
niko committed
88
                    suffix=""
89 90 91 92 93
                    total={numeral(234).format('0,0')}
                  />
                </Col>
              </Row>
              <div className={styles.mapChart}>
94 95 96
                <Tooltip
                  title={
                    <FormattedMessage
97
                      id="BLOCK_NAME.monitor.waiting-for-implementation"
98 99 100 101
                      defaultMessage="Waiting for implementation"
                    />
                  }
                >
niko's avatar
niko committed
102 103 104 105
                  <img
                    src="https://gw.alipayobjects.com/zos/rmsportal/HBWnDEUXCnGnGrRfrpKa.png"
                    alt="map"
                  />
106
                </Tooltip>
107 108 109
              </div>
            </Card>
          </Col>
niko's avatar
niko committed
110
          <Col xl={6} lg={24} md={24} sm={24} xs={24}>
111 112 113
            <Card
              title={
                <FormattedMessage
114
                  id="BLOCK_NAME.monitor.activity-forecast"
115 116 117 118 119 120
                  defaultMessage="Activity forecast"
                />
              }
              style={{ marginBottom: 24 }}
              bordered={false}
            >
nikogu's avatar
nikogu committed
121
              <ActiveChart />
122
            </Card>
123
            <Card
124
              title={<FormattedMessage id="BLOCK_NAME.monitor.efficiency" defaultMessage="Efficiency" />}
125 126 127 128
              style={{ marginBottom: 24 }}
              bodyStyle={{ textAlign: 'center' }}
              bordered={false}
            >
129
              <Gauge
130
                title={formatMessage({ id: 'BLOCK_NAME.monitor.ratio', defaultMessage: 'Ratio' })}
131 132 133
                height={180}
                percent={87}
              />
134 135 136 137
            </Card>
          </Col>
        </Row>
        <Row gutter={24}>
afc163's avatar
afc163 committed
138
          <Col xl={12} lg={24} sm={24} xs={24} style={{ marginBottom: 24 }}>
139 140 141
            <Card
              title={
                <FormattedMessage
142
                  id="BLOCK_NAME.monitor.proportion-per-category"
143 144 145 146 147 148
                  defaultMessage="Proportion Per Category"
                />
              }
              bordered={false}
              className={styles.pieCard}
            >
afc163's avatar
afc163 committed
149
              <Row style={{ padding: '16px 0' }}>
150 151
                <Col span={8}>
                  <Pie
nikogu's avatar
nikogu committed
152
                    animate={false}
153
                    percent={28}
154
                    subTitle={
155
                      <FormattedMessage id="BLOCK_NAME.monitor.fast-food" defaultMessage="Fast food" />
156
                    }
157
                    total="28%"
偏右's avatar
偏右 committed
158
                    height={128}
afc163's avatar
afc163 committed
159
                    lineWidth={2}
160 161 162 163
                  />
                </Col>
                <Col span={8}>
                  <Pie
nikogu's avatar
nikogu committed
164
                    animate={false}
niko's avatar
niko committed
165
                    color="#5DDECF"
166
                    percent={22}
167 168
                    subTitle={
                      <FormattedMessage
169
                        id="BLOCK_NAME.monitor.western-food"
170 171 172
                        defaultMessage="Western food"
                      />
                    }
173
                    total="22%"
偏右's avatar
偏右 committed
174
                    height={128}
afc163's avatar
afc163 committed
175
                    lineWidth={2}
176 177 178 179
                  />
                </Col>
                <Col span={8}>
                  <Pie
nikogu's avatar
nikogu committed
180
                    animate={false}
niko's avatar
niko committed
181
                    color="#2FC25B"
182
                    percent={32}
183
                    subTitle={
184
                      <FormattedMessage id="BLOCK_NAME.monitor.hot-pot" defaultMessage="Hot pot" />
185
                    }
186
                    total="32%"
偏右's avatar
偏右 committed
187
                    height={128}
afc163's avatar
afc163 committed
188
                    lineWidth={2}
189 190 191 192 193
                  />
                </Col>
              </Row>
            </Card>
          </Col>
afc163's avatar
afc163 committed
194
          <Col xl={6} lg={12} sm={24} xs={24} style={{ marginBottom: 24 }}>
niko's avatar
niko committed
195
            <Card
196 197
              title={
                <FormattedMessage
198
                  id="BLOCK_NAME.monitor.popular-searches"
199 200 201
                  defaultMessage="Popular Searches"
                />
              }
niko's avatar
niko committed
202 203 204 205 206
              loading={loading}
              bordered={false}
              bodyStyle={{ overflow: 'hidden' }}
            >
              <TagCloud data={tags} height={161} />
207 208
            </Card>
          </Col>
afc163's avatar
afc163 committed
209
          <Col xl={6} lg={12} sm={24} xs={24} style={{ marginBottom: 24 }}>
niko's avatar
niko committed
210
            <Card
211 212
              title={
                <FormattedMessage
213
                  id="BLOCK_NAME.monitor.resource-surplus"
214 215 216
                  defaultMessage="Resource Surplus"
                />
              }
niko's avatar
niko committed
217 218 219
              bodyStyle={{ textAlign: 'center', fontSize: 0 }}
              bordered={false}
            >
220 221 222
              <WaterWave
                height={161}
                title={
223
                  <FormattedMessage id="BLOCK_NAME.monitor.fund-surplus" defaultMessage="Fund Surplus" />
224 225 226
                }
                percent={34}
              />
227 228 229
            </Card>
          </Col>
        </Row>
230
      </React.Fragment>
231 232 233
    );
  }
}
陈帅's avatar
陈帅 committed
234

235
export default PAGE_NAME_UPPER_CAMEL_CASE;