Skip to content

Commit

Permalink
1.add list search layout
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohuoni committed Jul 7, 2018
1 parent 5ef482e commit 20c01e0
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/pages/Account/Center/Applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { List, Card, Icon, Dropdown, Menu, Avatar, Tooltip } from 'antd';
import numeral from 'numeral';
import { formatWan } from '../../../utils/utils';
import stylesApplications from '../../List/Applications.less';
import stylesApplications from '../../List/Search/Applications.less';

export default props => {
const { list } = props;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Account/Center/Articles.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { List, Icon, Avatar, Tag } from 'antd';
import moment from 'moment';
import stylesArticles from '../../List/Articles.less';
import stylesArticles from '../../List/Search/Articles.less';
import styles from './Articles.less';

export default props => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Account/Center/Projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { List, Card } from 'antd';
import moment from 'moment';
import AvatarList from '../../../components/AvatarList';
import stylesProjects from '../../List/Projects.less';
import stylesProjects from '../../List/Search/Projects.less';

export default props => {
const { list } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Row, Col, Form, Card, Select, Icon, Avatar, List, Tooltip, Dropdown, Me
import TagSelect from 'components/TagSelect';
import StandardFormRow from 'components/StandardFormRow';

import { formatWan } from '../../utils/utils';
import { formatWan } from '../../../utils/utils';

import styles from './Applications.less';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '~antd/lib/style/themes/default.less';
@import '../../utils/utils.less';
@import '../../../utils/utils.less';

.filterCardList {
margin-bottom: -24px;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '~antd/lib/style/themes/default.less';
@import '../../utils/utils.less';
@import '../../../utils/utils.less';

.listContent {
.description {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '~antd/lib/style/themes/default.less';
@import '../../utils/utils.less';
@import '../../../utils/utils.less';

.coverCardList {
margin-bottom: -24px;
Expand Down
31 changes: 15 additions & 16 deletions src/pages/List/List.js → src/pages/List/Search/_layout.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import React, { Component } from 'react';
import { routerRedux, Route, Switch } from 'dva/router';
import { routerRedux } from 'dva/router';
import { connect } from 'dva';
import { Input } from 'antd';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import { getRoutes } from '../../utils/utils';
import PageHeaderLayout from '../../../layouts/PageHeaderLayout';

@connect()
export default class SearchList extends Component {
handleTabChange = key => {
const { dispatch, match } = this.props;
switch (key) {
case 'articles':
dispatch(routerRedux.push(`${match.url}/articles`));
case 'Articles':
dispatch(routerRedux.push(`${match.url}/Articles`));
break;
case 'applications':
dispatch(routerRedux.push(`${match.url}/applications`));
case 'Applications':
dispatch(routerRedux.push(`${match.url}/Applications`));
break;
case 'projects':
dispatch(routerRedux.push(`${match.url}/projects`));
case 'Projects':
dispatch(routerRedux.push(`${match.url}/Projects`));
break;
default:
break;
Expand All @@ -27,15 +26,15 @@ export default class SearchList extends Component {
render() {
const tabList = [
{
key: 'articles',
key: 'Articles',
tab: '文章',
},
{
key: 'applications',
key: 'Applications',
tab: '应用',
},
{
key: 'projects',
key: 'Projects',
tab: '项目',
},
];
Expand All @@ -52,8 +51,7 @@ export default class SearchList extends Component {
</div>
);

const { match, routerData, location } = this.props;
const routes = getRoutes(match.path, routerData);
const { match, children, location } = this.props;

return (
<PageHeaderLayout
Expand All @@ -63,11 +61,12 @@ export default class SearchList extends Component {
tabActiveKey={location.pathname.replace(`${match.path}/`, '')}
onTabChange={this.handleTabChange}
>
<Switch>
{children}
{/* <Switch>
{routes.map(item => (
<Route key={item.key} path={item.path} component={item.component} exact={item.exact} />
))}
</Switch>
</Switch> */}
</PageHeaderLayout>
);
}
Expand Down

0 comments on commit 20c01e0

Please sign in to comment.