4 changed files with 2 additions and 120 deletions
@ -1,5 +0,0 @@ |
|||
.normal { |
|||
font-family: Georgia, sans-serif; |
|||
margin-top: 3em; |
|||
text-align: center; |
|||
} |
|||
@ -1,101 +0,0 @@ |
|||
import React, { PureComponent } from 'react'; |
|||
import { connect } from 'dva'; |
|||
import { Row, Col, Card, Table, Icon, Divider } from 'antd'; |
|||
|
|||
const columns = [{ |
|||
title: 'Name', |
|||
dataIndex: 'name', |
|||
key: 'name', |
|||
}, { |
|||
title: 'Age', |
|||
dataIndex: 'age', |
|||
key: 'age', |
|||
}, { |
|||
title: 'Address', |
|||
dataIndex: 'address', |
|||
key: 'address', |
|||
}, { |
|||
title: 'Action', |
|||
key: 'action', |
|||
render: (text, record) => ( |
|||
<span> |
|||
<a href="">Action 一 {record.name}</a> |
|||
<Divider type="vertical" /> |
|||
<a href="">Delete</a> |
|||
<Divider type="vertical" /> |
|||
<a href="" className="ant-dropdown-link"> |
|||
More actions <Icon type="down" /> |
|||
</a> |
|||
</span> |
|||
), |
|||
}]; |
|||
|
|||
class Dashboard extends PureComponent { |
|||
componentDidMount() { |
|||
this.props.dispatch({ |
|||
type: 'user/fetch', |
|||
}); |
|||
} |
|||
render() { |
|||
const { user: { list }, loading } = this.props; |
|||
return ( |
|||
<div> |
|||
<Row gutter={24}> |
|||
<Col span={8}> |
|||
<Card bordered={false}> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
</Card> |
|||
</Col> |
|||
<Col span={8}> |
|||
<Card bordered={false}> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
</Card> |
|||
</Col> |
|||
<Col span={8}> |
|||
<Card bordered={false}> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
</Card> |
|||
</Col> |
|||
</Row> |
|||
<Row gutter={24} style={{ marginTop: 24 }}> |
|||
<Col span={12}> |
|||
<Card bordered={false}> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
</Card> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Card bordered={false}> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
<p>卡片内容</p> |
|||
</Card> |
|||
</Col> |
|||
</Row> |
|||
<Row gutter={24} style={{ marginTop: 24 }}> |
|||
<Col span={24}> |
|||
<Card |
|||
title="业务表格" |
|||
bordered={false} |
|||
extra={<Icon type="setting" />} |
|||
> |
|||
<Table dataSource={list} loading={loading} columns={columns} /> |
|||
</Card> |
|||
</Col> |
|||
</Row> |
|||
</div> |
|||
); |
|||
} |
|||
} |
|||
|
|||
export default connect(({ user, loading }) => ({ |
|||
user, |
|||
loading: loading.effects['user/fetch'], |
|||
}))(Dashboard); |
|||
@ -1,12 +0,0 @@ |
|||
import React from 'react'; |
|||
import { shallow } from 'enzyme'; |
|||
import Dashboard from './Dashboard'; |
|||
|
|||
it('renders Dashboard', () => { |
|||
const fetchFn = jest.fn(); |
|||
const wrapper = shallow( |
|||
<Dashboard.WrappedComponent user={{ list: [] }} dispatch={fetchFn} /> |
|||
); |
|||
expect(wrapper.find('Table').props().dataSource).toEqual([]); |
|||
expect(fetchFn).toBeCalled(); |
|||
}); |
|||
Loading…
Reference in new issue