Commit fe26f899 authored by ddcat1115's avatar ddcat1115

remove useless code

parent b290f01d
......@@ -4,8 +4,8 @@ import moment from 'moment';
import groupBy from 'lodash/groupBy';
import Debounce from 'lodash-decorators/debounce';
import { Link } from 'dva/router';
import NoticeIcon from '../../components/NoticeIcon';
import HeaderSearch from '../../components/HeaderSearch';
import NoticeIcon from '../NoticeIcon';
import HeaderSearch from '../HeaderSearch';
import styles from './index.less';
const { Header } = Layout;
......
.normal {
font-family: Georgia, sans-serif;
margin-top: 3em;
text-align: center;
}
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);
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();
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment