Applications.js 2.53 KB
Newer Older
ζ„šι“'s avatar
ζ„šι“ committed
1
import React, { PureComponent } from 'react';
ddcat1115's avatar
ddcat1115 committed
2 3
import { List, Card, Icon, Dropdown, Menu, Avatar, Tooltip } from 'antd';
import numeral from 'numeral';
ζ„šι“'s avatar
ζ„šι“ committed
4
import { connect } from 'dva';
5
import { formatWan } from '@/utils/utils';
ζ„šι“'s avatar
ζ„šι“ committed
6
import stylesApplications from '../../List/Applications.less';
ddcat1115's avatar
ddcat1115 committed
7

ζ„šι“'s avatar
ζ„šι“ committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
@connect(({ list }) => ({
  list,
}))
export default class Center extends PureComponent {
  render() {
    const {
      list: { list },
    } = this.props;
    const itemMenu = (
      <Menu>
        <Menu.Item>
          <a target="_blank" rel="noopener noreferrer" href="http://www.alipay.com/">
            1st menu item
          </a>
        </Menu.Item>
        <Menu.Item>
          <a target="_blank" rel="noopener noreferrer" href="http://www.taobao.com/">
            2nd menu item
          </a>
        </Menu.Item>
        <Menu.Item>
          <a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
            3d menu item
          </a>
        </Menu.Item>
      </Menu>
    );
    const CardInfo = ({ activeUser, newUser }) => (
      <div className={stylesApplications.cardInfo}>
        <div>
          <p>ζ΄»θ·ƒη”¨ζˆ·</p>
          <p>{activeUser}</p>
        </div>
        <div>
          <p>ζ–°ε’žη”¨ζˆ·</p>
          <p>{newUser}</p>
        </div>
ddcat1115's avatar
ddcat1115 committed
45
      </div>
ζ„šι“'s avatar
ζ„šι“ committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
    );
    return (
      <List
        rowKey="id"
        className={stylesApplications.filterCardList}
        grid={{ gutter: 24, xxl: 3, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }}
        dataSource={list}
        renderItem={item => (
          <List.Item key={item.id}>
            <Card
              hoverable
              bodyStyle={{ paddingBottom: 20 }}
              actions={[
                <Tooltip title="δΈ‹θ½½">
                  <Icon type="download" />
                </Tooltip>,
                <Tooltip title="ηΌ–θΎ‘">
                  <Icon type="edit" />
                </Tooltip>,
                <Tooltip title="εˆ†δΊ«">
                  <Icon type="share-alt" />
                </Tooltip>,
                <Dropdown overlay={itemMenu}>
                  <Icon type="ellipsis" />
                </Dropdown>,
              ]}
            >
              <Card.Meta avatar={<Avatar size="small" src={item.avatar} />} title={item.title} />
              <div className={stylesApplications.cardItemContent}>
                <CardInfo
                  activeUser={formatWan(item.activeUser)}
                  newUser={numeral(item.newUser).format('0,0')}
                />
              </div>
            </Card>
          </List.Item>
        )}
      />
    );
  }
}