CardList.js 2.86 KB
Newer Older
1 2
import React, { PureComponent } from 'react';
import { connect } from 'dva';
nikogu's avatar
nikogu committed
3
import { Link } from 'dva/router';
ddcat1115's avatar
ddcat1115 committed
4
import { Card, Button, Icon, List } from 'antd';
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

import PageHeaderLayout from '../../layouts/PageHeaderLayout';

import styles from './CardList.less';

@connect(state => ({
  list: state.list,
}))
export default class CardList extends PureComponent {
  componentDidMount() {
    this.props.dispatch({
      type: 'list/fetch',
      payload: {
        count: 8,
      },
    });
  }

  render() {
    const { list: { list, loading } } = this.props;

    const content = (
      <div className={styles.pageHeaderContent}>
afc163's avatar
afc163 committed
28 29
        <p>
          段落示意蚂蚁金服务设计平台 design.alipay.com用最小的工作量无缝接入蚂蚁金服生态
afc163's avatar
afc163 committed
30 31
          提供跨越设计与开发的体验解决方案
        </p>
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
        <div className={styles.contentLink}>
          <a>
            <img alt="" src="https://gw.alipayobjects.com/zos/rmsportal/wUTAfuNZjhmCIxEPxQVY.svg" /> 快速开始
          </a>
          <a>
            <img alt="" src="https://gw.alipayobjects.com/zos/rmsportal/qsmGbwvxTAjXfkkrZYov.svg" /> 产品简介
          </a>
          <a>
            <img alt="" src="https://gw.alipayobjects.com/zos/rmsportal/UGEHGuwlGDalIJlbsNxL.svg" /> 产品文档
          </a>
        </div>
      </div>
    );

    const extraContent = (
      <div className={styles.extraImg}>
nikogu's avatar
nikogu committed
48
        <img alt="这是一个标题" src="https://gw.alipayobjects.com/zos/rmsportal/RzwpdLnhmvDJToTdfDPe.png" />
49 50 51 52 53
      </div>
    );

    return (
      <PageHeaderLayout
niko's avatar
niko committed
54
        title="卡片列表"
55 56 57 58
        content={content}
        extraContent={extraContent}
      >
        <div className={styles.cardList}>
nikogu's avatar
nikogu committed
59
          <List
nikogu's avatar
nikogu committed
60
            rowKey="id"
nikogu's avatar
nikogu committed
61
            loading={loading}
nikogu's avatar
nikogu committed
62
            grid={{ gutter: 24, lg: 3, md: 2, sm: 1, xs: 1 }}
nikogu's avatar
nikogu committed
63 64 65
            dataSource={['', ...list]}
            renderItem={item => (item ? (
              <List.Item key={item.id}>
niko's avatar
niko committed
66 67
                <Card hoverable actions={[<a>操作一</a>, <a>操作二</a>]}>
                  <Link to="/list/card-list">
nikogu's avatar
nikogu committed
68
                    <Card.Meta
ddcat1115's avatar
ddcat1115 committed
69
                      avatar={<img alt="" className={styles.cardAvatar} src={item.avatar} />}
nikogu's avatar
nikogu committed
70 71 72 73 74 75 76
                      title={item.title}
                      description={(
                        <p className={styles.cardDescription}>
                          <span>{item.description}</span>
                        </p>
                      )}
                    />
niko's avatar
niko committed
77 78
                  </Link>
                </Card>
nikogu's avatar
nikogu committed
79 80 81 82 83 84
              </List.Item>
              ) : (
                <List.Item>
                  <Button type="dashed" className={styles.newButton}>
                    <Icon type="plus" /> 新增产品
                  </Button>
nikogu's avatar
nikogu committed
85
                </List.Item>
nikogu's avatar
nikogu committed
86 87 88
              )
            )}
          />
89 90 91 92 93
        </div>
      </PageHeaderLayout>
    );
  }
}