优化代码

This commit is contained in:
smallchill 2019-01-04 13:52:53 +08:00
parent c46bb5f3db
commit 4bb1c2a7cf
4 changed files with 379 additions and 379 deletions

View File

@ -1,16 +1,16 @@
import { connect } from 'dva'; import { connect } from 'dva';
import { Card, Col, Icon, Row, Tabs } from 'antd'; import { Card, Col, Icon, Row, Tabs } from 'antd';
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import styles from '../../../../layouts/Sword.less'; import styles from '../../layouts/Sword.less';
import { iconData } from './IconData'; import { iconData } from './IconData';
import { MENU_SELECT_ICON } from '../../../../actions/menu'; import { MENU_SELECT_ICON } from '../../actions/menu';
const { TabPane } = Tabs; const { TabPane } = Tabs;
@connect(({ menu }) => ({ @connect(({ menu }) => ({
menu, menu,
})) }))
class IconCategory extends PureComponent { class Index extends PureComponent {
handelClick = type => { handelClick = type => {
const { onCancel, dispatch } = this.props; const { onCancel, dispatch } = this.props;
dispatch(MENU_SELECT_ICON(type.icon)); dispatch(MENU_SELECT_ICON(type.icon));
@ -42,4 +42,4 @@ class IconCategory extends PureComponent {
); );
} }
} }
export default IconCategory; export default Index;

View File

@ -17,7 +17,7 @@ import Panel from '../../../components/Panel';
import styles from '../../../layouts/Sword.less'; import styles from '../../../layouts/Sword.less';
import func from '../../../utils/Func'; import func from '../../../utils/Func';
import { MENU_INIT, MENU_SUBMIT, MENU_DETAIL, MENU_CLEAR_DETAIL } from '../../../actions/menu'; import { MENU_INIT, MENU_SUBMIT, MENU_DETAIL, MENU_CLEAR_DETAIL } from '../../../actions/menu';
import IconCategory from './IconPreview/IconCategory'; import IconPreview from '../../../components/IconPreview';
const FormItem = Form.Item; const FormItem = Form.Item;
const { TextArea, Search } = Input; const { TextArea, Search } = Input;
@ -288,7 +288,7 @@ class MenuAdd extends PureComponent {
</Card> </Card>
</Form> </Form>
<Modal width={900} visible={visible} onCancel={this.handleCancel} footer={null}> <Modal width={900} visible={visible} onCancel={this.handleCancel} footer={null}>
<IconCategory onCancel={this.handleCancel} /> <IconPreview onCancel={this.handleCancel} />
</Modal> </Modal>
</Panel> </Panel>
); );

View File

@ -17,7 +17,7 @@ import Panel from '../../../components/Panel';
import styles from '../../../layouts/Sword.less'; import styles from '../../../layouts/Sword.less';
import { MENU_DETAIL, MENU_INIT, MENU_SUBMIT } from '../../../actions/menu'; import { MENU_DETAIL, MENU_INIT, MENU_SUBMIT } from '../../../actions/menu';
import func from '../../../utils/Func'; import func from '../../../utils/Func';
import IconCategory from './IconPreview/IconCategory'; import IconPreview from '../../../components/IconPreview';
const FormItem = Form.Item; const FormItem = Form.Item;
const { TextArea, Search } = Input; const { TextArea, Search } = Input;
@ -306,7 +306,7 @@ class MenuEdit extends PureComponent {
</Card> </Card>
</Form> </Form>
<Modal width={900} visible={visible} onCancel={this.handleCancel} footer={null}> <Modal width={900} visible={visible} onCancel={this.handleCancel} footer={null}>
<IconCategory onCancel={this.handleCancel} /> <IconPreview onCancel={this.handleCancel} />
</Modal> </Modal>
</Panel> </Panel>
); );