From adca7f5c52696ca24525ad656f3c285c5a22224b Mon Sep 17 00:00:00 2001 From: niko <644506165@qq.com> Date: Thu, 8 Mar 2018 17:13:39 +0800 Subject: [PATCH] alias ant-design-pro (#1035) * alias ant-design-pro * fixed lint * change alias ant-design-pro/lib -> components * change alias ant-design-pro/lib -> components --- .webpackrc | 22 ---- .webpackrc.js | 25 ++++ src/routes/Dashboard/Analysis.js | 6 +- src/routes/Dashboard/Monitor.js | 48 ++++---- src/routes/Dashboard/Workplace.js | 4 +- src/routes/Exception/403.js | 2 +- src/routes/Exception/404.js | 2 +- src/routes/Exception/500.js | 2 +- src/routes/Forms/AdvancedForm.js | 2 +- src/routes/Forms/StepForm/Step3.js | 2 +- src/routes/List/Applications.js | 4 +- src/routes/List/Articles.js | 4 +- src/routes/List/CardList.js | 2 +- src/routes/List/Projects.js | 46 +++---- src/routes/List/TableList.js | 2 +- src/routes/Profile/AdvancedProfile.js | 2 +- src/routes/Profile/BasicProfile.js | 168 ++++++++++++++------------ src/routes/Result/Error.js | 2 +- src/routes/Result/Success.js | 2 +- src/routes/User/Login.js | 2 +- src/routes/User/RegisterResult.js | 2 +- 21 files changed, 177 insertions(+), 174 deletions(-) delete mode 100755 .webpackrc create mode 100755 .webpackrc.js diff --git a/.webpackrc b/.webpackrc deleted file mode 100755 index ab704dc9..00000000 --- a/.webpackrc +++ /dev/null @@ -1,22 +0,0 @@ -{ - "entry": "src/index.js", - "extraBabelPlugins": [ - "transform-decorators-legacy", - ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }] - ], - "env": { - "development": { - "extraBabelPlugins": [ - "dva-hmr" - ] - } - }, - "ignoreMomentLocale": true, - "theme": "./src/theme.js", - "html": { - "template": "./src/index.ejs" - }, - "publicPath": "/", - "disableDynamicImport": true, - "hash": true -} diff --git a/.webpackrc.js b/.webpackrc.js new file mode 100755 index 00000000..74bc5f6d --- /dev/null +++ b/.webpackrc.js @@ -0,0 +1,25 @@ +const path = require('path'); + +export default { + entry: 'src/index.js', + extraBabelPlugins: [ + 'transform-decorators-legacy', + ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }], + ], + env: { + development: { + extraBabelPlugins: ['dva-hmr'], + }, + }, + alias: { + 'components': path.resolve(__dirname, 'src/components/'), + }, + ignoreMomentLocale: true, + theme: './src/theme.js', + html: { + template: './src/index.ejs', + }, + publicPath: '/', + disableDynamicImport: true, + hash: true, +}; diff --git a/src/routes/Dashboard/Analysis.js b/src/routes/Dashboard/Analysis.js index f6df4406..9cb55a9a 100644 --- a/src/routes/Dashboard/Analysis.js +++ b/src/routes/Dashboard/Analysis.js @@ -24,9 +24,9 @@ import { Bar, Pie, TimelineChart, -} from '../../components/Charts'; -import Trend from '../../components/Trend'; -import NumberInfo from '../../components/NumberInfo'; +} from 'components/Charts'; +import Trend from 'components/Trend'; +import NumberInfo from 'components/NumberInfo'; import { getTimeDistance } from '../../utils/utils'; import styles from './Analysis.less'; diff --git a/src/routes/Dashboard/Monitor.js b/src/routes/Dashboard/Monitor.js index 897dc9ce..07bbae85 100644 --- a/src/routes/Dashboard/Monitor.js +++ b/src/routes/Dashboard/Monitor.js @@ -2,11 +2,11 @@ import React, { PureComponent, Fragment } from 'react'; import { connect } from 'dva'; import { Row, Col, Card, Tooltip } from 'antd'; import numeral from 'numeral'; +import { Pie, WaterWave, Gauge, TagCloud } from 'components/Charts'; +import NumberInfo from 'components/NumberInfo'; +import CountDown from 'components/CountDown'; +import ActiveChart from 'components/ActiveChart'; import Authorized from '../../utils/Authorized'; -import { Pie, WaterWave, Gauge, TagCloud } from '../../components/Charts'; -import NumberInfo from '../../components/NumberInfo'; -import CountDown from '../../components/CountDown'; -import ActiveChart from '../../components/ActiveChart'; import styles from './Monitor.less'; const { Secured } = Authorized; @@ -48,10 +48,7 @@ export default class Monitor extends PureComponent { /> - + } /> @@ -66,7 +63,10 @@ export default class Monitor extends PureComponent {
- map + map
@@ -105,11 +105,7 @@ export default class Monitor extends PureComponent { - + - - + + - - + + diff --git a/src/routes/Dashboard/Workplace.js b/src/routes/Dashboard/Workplace.js index 9159cbf3..e596118a 100644 --- a/src/routes/Dashboard/Workplace.js +++ b/src/routes/Dashboard/Workplace.js @@ -4,9 +4,9 @@ import { connect } from 'dva'; import { Link } from 'dva/router'; import { Row, Col, Card, List, Avatar } from 'antd'; +import { Radar } from 'components/Charts'; +import EditableLinkGroup from 'components/EditableLinkGroup'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import EditableLinkGroup from '../../components/EditableLinkGroup'; -import { Radar } from '../../components/Charts'; import styles from './Workplace.less'; diff --git a/src/routes/Exception/403.js b/src/routes/Exception/403.js index 1e01b58a..c6d86fe0 100644 --- a/src/routes/Exception/403.js +++ b/src/routes/Exception/403.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'dva/router'; -import Exception from '../../components/Exception'; +import Exception from 'components/Exception'; export default () => ( diff --git a/src/routes/Exception/404.js b/src/routes/Exception/404.js index 7d76d938..0a3d8766 100644 --- a/src/routes/Exception/404.js +++ b/src/routes/Exception/404.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'dva/router'; -import Exception from '../../components/Exception'; +import Exception from 'components/Exception'; export default () => ( diff --git a/src/routes/Exception/500.js b/src/routes/Exception/500.js index fa84eee5..40f659cb 100644 --- a/src/routes/Exception/500.js +++ b/src/routes/Exception/500.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'dva/router'; -import Exception from '../../components/Exception'; +import Exception from 'components/Exception'; export default () => ( diff --git a/src/routes/Forms/AdvancedForm.js b/src/routes/Forms/AdvancedForm.js index 1247e1d1..5b557646 100644 --- a/src/routes/Forms/AdvancedForm.js +++ b/src/routes/Forms/AdvancedForm.js @@ -1,8 +1,8 @@ import React, { PureComponent } from 'react'; import { Card, Button, Form, Icon, Col, Row, DatePicker, TimePicker, Input, Select, Popover } from 'antd'; import { connect } from 'dva'; +import FooterToolbar from 'components/FooterToolbar'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import FooterToolbar from '../../components/FooterToolbar'; import TableForm from './TableForm'; import styles from './style.less'; diff --git a/src/routes/Forms/StepForm/Step3.js b/src/routes/Forms/StepForm/Step3.js index 8df6388d..549878e8 100644 --- a/src/routes/Forms/StepForm/Step3.js +++ b/src/routes/Forms/StepForm/Step3.js @@ -2,7 +2,7 @@ import React, { Fragment } from 'react'; import { connect } from 'dva'; import { Button, Row, Col } from 'antd'; import { routerRedux } from 'dva/router'; -import Result from '../../../components/Result'; +import Result from 'components/Result'; import styles from './style.less'; class Step3 extends React.PureComponent { diff --git a/src/routes/List/Applications.js b/src/routes/List/Applications.js index 83d1369f..368a3e58 100644 --- a/src/routes/List/Applications.js +++ b/src/routes/List/Applications.js @@ -3,8 +3,8 @@ import numeral from 'numeral'; import { connect } from 'dva'; import { Row, Col, Form, Card, Select, Icon, Avatar, List, Tooltip, Dropdown, Menu } from 'antd'; -import StandardFormRow from '../../components/StandardFormRow'; -import TagSelect from '../../components/TagSelect'; +import TagSelect from 'components/TagSelect'; +import StandardFormRow from 'components/StandardFormRow'; import styles from './Applications.less'; diff --git a/src/routes/List/Articles.js b/src/routes/List/Articles.js index 436a7fa5..a095ef88 100644 --- a/src/routes/List/Articles.js +++ b/src/routes/List/Articles.js @@ -3,8 +3,8 @@ import moment from 'moment'; import { connect } from 'dva'; import { Form, Card, Select, List, Tag, Icon, Avatar, Row, Col, Button } from 'antd'; -import StandardFormRow from '../../components/StandardFormRow'; -import TagSelect from '../../components/TagSelect'; +import TagSelect from 'components/TagSelect'; +import StandardFormRow from 'components/StandardFormRow'; import styles from './Articles.less'; const { Option } = Select; diff --git a/src/routes/List/CardList.js b/src/routes/List/CardList.js index 9e3818ec..cd507865 100644 --- a/src/routes/List/CardList.js +++ b/src/routes/List/CardList.js @@ -2,8 +2,8 @@ import React, { PureComponent } from 'react'; import { connect } from 'dva'; import { Card, Button, Icon, List } from 'antd'; +import Ellipsis from 'components/Ellipsis'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import Ellipsis from '../../components/Ellipsis'; import styles from './CardList.less'; diff --git a/src/routes/List/Projects.js b/src/routes/List/Projects.js index 48e83c8f..d285dea3 100644 --- a/src/routes/List/Projects.js +++ b/src/routes/List/Projects.js @@ -3,10 +3,10 @@ import moment from 'moment'; import { connect } from 'dva'; import { Row, Col, Form, Card, Select, List } from 'antd'; -import StandardFormRow from '../../components/StandardFormRow'; -import TagSelect from '../../components/TagSelect'; -import AvatarList from '../../components/AvatarList'; -import Ellipsis from '../../components/Ellipsis'; +import TagSelect from 'components/TagSelect'; +import AvatarList from 'components/AvatarList'; +import Ellipsis from 'components/Ellipsis'; +import StandardFormRow from 'components/StandardFormRow'; import styles from './Projects.less'; @@ -45,7 +45,7 @@ export default class CoverCardList extends PureComponent { } }); }, 0); - } + }; render() { const { list: { list = [] }, loading, form } = this.props; @@ -72,15 +72,13 @@ export default class CoverCardList extends PureComponent { {moment(item.updatedAt).fromNow()}
- { - item.members.map((member, i) => ( - - )) - } + {item.members.map((member, i) => ( + + ))}
@@ -121,17 +119,10 @@ export default class CoverCardList extends PureComponent { )} - + - + {getFieldDecorator('author', {})(
-
- {cardList} -
+
{cardList}
); } diff --git a/src/routes/List/TableList.js b/src/routes/List/TableList.js index 776fde4a..24d20ea9 100644 --- a/src/routes/List/TableList.js +++ b/src/routes/List/TableList.js @@ -2,7 +2,7 @@ import React, { PureComponent, Fragment } from 'react'; import { connect } from 'dva'; import moment from 'moment'; import { Row, Col, Card, Form, Input, Select, Icon, Button, Dropdown, Menu, InputNumber, DatePicker, Modal, message, Badge, Divider } from 'antd'; -import StandardTable from '../../components/StandardTable'; +import StandardTable from 'components/StandardTable'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import styles from './TableList.less'; diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js index 3c0bb252..09065602 100644 --- a/src/routes/Profile/AdvancedProfile.js +++ b/src/routes/Profile/AdvancedProfile.js @@ -4,8 +4,8 @@ import Bind from 'lodash-decorators/bind'; import { connect } from 'dva'; import { Button, Menu, Dropdown, Icon, Row, Col, Steps, Card, Popover, Badge, Table, Tooltip, Divider } from 'antd'; import classNames from 'classnames'; +import DescriptionList from 'components/DescriptionList'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import DescriptionList from '../../components/DescriptionList'; import styles from './AdvancedProfile.less'; const { Step } = Steps; diff --git a/src/routes/Profile/BasicProfile.js b/src/routes/Profile/BasicProfile.js index ea006b01..ba585dc9 100644 --- a/src/routes/Profile/BasicProfile.js +++ b/src/routes/Profile/BasicProfile.js @@ -1,36 +1,45 @@ import React, { Component } from 'react'; import { connect } from 'dva'; import { Card, Badge, Table, Divider } from 'antd'; +import DescriptionList from 'components/DescriptionList'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import DescriptionList from '../../components/DescriptionList'; import styles from './BasicProfile.less'; const { Description } = DescriptionList; -const progressColumns = [{ - title: '时间', - dataIndex: 'time', - key: 'time', -}, { - title: '当前进度', - dataIndex: 'rate', - key: 'rate', -}, { - title: '状态', - dataIndex: 'status', - key: 'status', - render: text => ( - text === 'success' ? : - ), -}, { - title: '操作员ID', - dataIndex: 'operator', - key: 'operator', -}, { - title: '耗时', - dataIndex: 'cost', - key: 'cost', -}]; +const progressColumns = [ + { + title: '时间', + dataIndex: 'time', + key: 'time', + }, + { + title: '当前进度', + dataIndex: 'rate', + key: 'rate', + }, + { + title: '状态', + dataIndex: 'status', + key: 'status', + render: text => + (text === 'success' ? ( + + ) : ( + + )), + }, + { + title: '操作员ID', + dataIndex: 'operator', + key: 'operator', + }, + { + title: '耗时', + dataIndex: 'cost', + key: 'cost', + }, +]; @connect(({ profile, loading }) => ({ profile, @@ -71,60 +80,67 @@ export default class BasicProfile extends Component { } return obj; }; - const goodsColumns = [{ - title: '商品编号', - dataIndex: 'id', - key: 'id', - render: (text, row, index) => { - if (index < basicGoods.length) { - return {text}; - } - return { - children: 总计, - props: { - colSpan: 4, - }, - }; + const goodsColumns = [ + { + title: '商品编号', + dataIndex: 'id', + key: 'id', + render: (text, row, index) => { + if (index < basicGoods.length) { + return {text}; + } + return { + children: 总计, + props: { + colSpan: 4, + }, + }; + }, }, - }, { - title: '商品名称', - dataIndex: 'name', - key: 'name', - render: renderContent, - }, { - title: '商品条码', - dataIndex: 'barcode', - key: 'barcode', - render: renderContent, - }, { - title: '单价', - dataIndex: 'price', - key: 'price', - align: 'right', - render: renderContent, - }, { - title: '数量(件)', - dataIndex: 'num', - key: 'num', - align: 'right', - render: (text, row, index) => { - if (index < basicGoods.length) { - return text; - } - return {text}; + { + title: '商品名称', + dataIndex: 'name', + key: 'name', + render: renderContent, }, - }, { - title: '金额', - dataIndex: 'amount', - key: 'amount', - align: 'right', - render: (text, row, index) => { - if (index < basicGoods.length) { - return text; - } - return {text}; + { + title: '商品条码', + dataIndex: 'barcode', + key: 'barcode', + render: renderContent, }, - }]; + { + title: '单价', + dataIndex: 'price', + key: 'price', + align: 'right', + render: renderContent, + }, + { + title: '数量(件)', + dataIndex: 'num', + key: 'num', + align: 'right', + render: (text, row, index) => { + if (index < basicGoods.length) { + return text; + } + return {text}; + }, + }, + { + title: '金额', + dataIndex: 'amount', + key: 'amount', + align: 'right', + render: (text, row, index) => { + if (index < basicGoods.length) { + return text; + } + return {text}; + }, + }, + ]; return ( diff --git a/src/routes/Result/Error.js b/src/routes/Result/Error.js index 7ff64393..41f5d826 100644 --- a/src/routes/Result/Error.js +++ b/src/routes/Result/Error.js @@ -1,6 +1,6 @@ import React, { Fragment } from 'react'; import { Button, Icon, Card } from 'antd'; -import Result from '../../components/Result'; +import Result from 'components/Result'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; const extra = ( diff --git a/src/routes/Result/Success.js b/src/routes/Result/Success.js index f7aabd7f..76fde593 100644 --- a/src/routes/Result/Success.js +++ b/src/routes/Result/Success.js @@ -1,6 +1,6 @@ import React, { Fragment } from 'react'; import { Button, Row, Col, Icon, Steps, Card } from 'antd'; -import Result from '../../components/Result'; +import Result from 'components/Result'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; const { Step } = Steps; diff --git a/src/routes/User/Login.js b/src/routes/User/Login.js index 01a0f990..e45fc82b 100644 --- a/src/routes/User/Login.js +++ b/src/routes/User/Login.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { connect } from 'dva'; import { Link } from 'dva/router'; import { Checkbox, Alert, Icon } from 'antd'; -import Login from '../../components/Login'; +import Login from 'components/Login'; import styles from './Login.less'; const { Tab, UserName, Password, Mobile, Captcha, Submit } = Login; diff --git a/src/routes/User/RegisterResult.js b/src/routes/User/RegisterResult.js index ba635607..6dba5c1d 100644 --- a/src/routes/User/RegisterResult.js +++ b/src/routes/User/RegisterResult.js @@ -1,7 +1,7 @@ import React from 'react'; import { Button } from 'antd'; import { Link } from 'dva/router'; -import Result from '../../components/Result'; +import Result from 'components/Result'; import styles from './RegisterResult.less'; const actions = ( -- GitLab