diff --git a/.eslintrc b/.eslintrc index 3bd5636c76bed7367a8feb3732798827c90dc101..941f666a7775d0a1459cffccbbcc894ac2b66b71 100755 --- a/.eslintrc +++ b/.eslintrc @@ -24,6 +24,8 @@ "no-use-before-define": [0], "jsx-a11y/no-static-element-interactions": [0], "jsx-a11y/no-noninteractive-element-interactions": [0], + "jsx-a11y/click-events-have-key-events": [0], + "jsx-a11y/anchor-is-valid": [0], "no-nested-ternary": [0], "arrow-body-style": [0], "import/extensions": [0], @@ -37,6 +39,9 @@ "exports": "always-multiline", "functions": "ignore" }], + "object-curly-newline": [0], + "function-paren-newline": [0], + "no-restricted-globals": [0], "require-yield": [1] }, "parserOptions": { diff --git a/mock/api.js b/mock/api.js index d652f5bd934cd935f2286b8b734c64713f6d4935..75fb66aec48130374ce4478f9c2f6ee57c5049d0 100644 --- a/mock/api.js +++ b/mock/api.js @@ -73,7 +73,7 @@ export function fakeList(count) { export function getFakeList(req, res, u) { let url = u; if (!url || Object.prototype.toString.call(url) !== '[object String]') { - url = req.url; + url = req.url; // eslint-disable-line } const params = getUrlParams(url); diff --git a/mock/rule.js b/mock/rule.js index 13a4f353c924ea4d1d6b1753c6cbf55367bdec1b..1c494ca3dff559fda2c71327c37ca791b02a90af 100644 --- a/mock/rule.js +++ b/mock/rule.js @@ -22,7 +22,7 @@ for (let i = 0; i < 46; i += 1) { export function getRule(req, res, u) { let url = u; if (!url || Object.prototype.toString.call(url) !== '[object String]') { - url = req.url; + url = req.url; // eslint-disable-line } const params = getUrlParams(url); @@ -74,20 +74,18 @@ export function getRule(req, res, u) { export function postRule(req, res, u, b) { let url = u; if (!url || Object.prototype.toString.call(url) !== '[object String]') { - url = req.url; + url = req.url; // eslint-disable-line } const body = (b && b.body) || req.body; - const method = body.method; + const { method, no, description } = body; switch (method) { /* eslint no-case-declarations:0 */ case 'delete': - const no = body.no; tableListDataSource = tableListDataSource.filter(item => no.indexOf(item.no) === -1); break; case 'post': - const description = body.description; const i = Math.ceil(Math.random() * 10000); tableListDataSource.unshift({ key: i, diff --git a/mock/utils.js b/mock/utils.js index 229e69b830b7f0bf710b6dd5717ad7968694bfdd..8438a2658df6a3dd105de7961080c1c58ffaedc0 100644 --- a/mock/utils.js +++ b/mock/utils.js @@ -12,7 +12,7 @@ export function getUrlParams(url) { let queryString = url ? url.split('?')[1] : window.location.search.slice(1); const obj = {}; if (queryString) { - queryString = queryString.split('#')[0]; + queryString = queryString.split('#')[0]; // eslint-disable-line const arr = queryString.split('&'); for (let i = 0; i < arr.length; i += 1) { const a = arr[i].split('='); diff --git a/package.json b/package.json index 0643a0cdd2bed858240a1b76218893fb63fc4494..5bdbed305d3df0dd8ab0067e0fcf44e586f4813c 100755 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "site": "roadhog-api-doc static", "lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint": "eslint --ext .js src mock tests && npm run lint:style", + "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style", "test": "jest", "test:all": "node ./tests/run-tests.js" }, @@ -36,11 +37,11 @@ "babel-runtime": "^6.9.2", "cross-port-killer": "^1.0.1", "enzyme": "^2.9.1", - "eslint": "^3.0.0", - "eslint-config-airbnb": "^15.0.0", + "eslint": "^4.0.0", + "eslint-config-airbnb": "^16.0.0", "eslint-plugin-babel": "^4.0.0", "eslint-plugin-import": "^2.2.0", - "eslint-plugin-jsx-a11y": "^5.0.1", + "eslint-plugin-jsx-a11y": "^6.0.0", "eslint-plugin-markdown": "^1.0.0-beta.6", "eslint-plugin-react": "^7.0.1", "gh-pages": "^1.0.0", diff --git a/src/common/nav.js b/src/common/nav.js index 9605d415cdc0e05fe9746a6f2cae84ab255d572c..743551d728bb5ca2452536890819eb4be5f1785d 100644 --- a/src/common/nav.js +++ b/src/common/nav.js @@ -34,7 +34,7 @@ import RegisterResult from '../routes/User/RegisterResult'; const data = [{ component: BasicLayout, - name: '首页', // for breadcrumb + name: '首页', // for breadcrumb path: '', children: [{ name: 'Dashboard', diff --git a/src/components/Charts/Bar/index.js b/src/components/Charts/Bar/index.js index 89fe1ae7756907982bbb46e5e787dd26a2191a16..eaa57739982ca272a079b96c10546930c28b2a4e 100644 --- a/src/components/Charts/Bar/index.js +++ b/src/components/Charts/Bar/index.js @@ -34,7 +34,7 @@ class Bar extends PureComponent { // clean this.node.innerHTML = ''; - const Frame = G2.Frame; + const { Frame } = G2; const frame = new Frame(data); const chart = new G2.Chart({ diff --git a/src/components/Charts/ChartCard/index.js b/src/components/Charts/ChartCard/index.js index 40faf796750c4faf484414d6100e7df918574686..20adbb5e9b6e18fe2e79a5ba85288fe31554d37e 100644 --- a/src/components/Charts/ChartCard/index.js +++ b/src/components/Charts/ChartCard/index.js @@ -23,9 +23,11 @@ const ChartCard = ({ contentHeight, title, action, total, footer, children, ...r { - footer &&
- {footer} -
+ footer && ( +
+ {footer} +
+ ) } diff --git a/src/components/Charts/Gauge/index.js b/src/components/Charts/Gauge/index.js index d89543ebb1839973395a0f8d4ac742d779062d68..7766c7616cec1ef20d18bcd4de516cee9c349ddc 100644 --- a/src/components/Charts/Gauge/index.js +++ b/src/components/Charts/Gauge/index.js @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; import G2 from 'g2'; import equal from '../equal'; -const Shape = G2.Shape; +const { Shape } = G2; /* eslint no-underscore-dangle: 0 */ class Gauge extends PureComponent { @@ -75,7 +75,7 @@ class Gauge extends PureComponent { }, }); - const origin = cfg.origin; + const { origin } = cfg; group.addShape('text', { attrs: { x: center.x, diff --git a/src/components/Charts/MiniBar/index.js b/src/components/Charts/MiniBar/index.js index a3f32b20db3487c5972d82095ca19b3c27f4bf73..7153cf3c475689aa3fc7865afcabc1ea15352ac3 100644 --- a/src/components/Charts/MiniBar/index.js +++ b/src/components/Charts/MiniBar/index.js @@ -34,7 +34,7 @@ class MiniBar extends PureComponent { // clean this.node.innerHTML = ''; - const Frame = G2.Frame; + const { Frame } = G2; const frame = new Frame(data); const chart = new G2.Chart({ diff --git a/src/components/Charts/NumberInfo/index.js b/src/components/Charts/NumberInfo/index.js index 4971f99811c82ac4ebca7f82ced2443de6cc2802..473796b2da065d4f50a0a15b45d3e0c17a6520fd 100644 --- a/src/components/Charts/NumberInfo/index.js +++ b/src/components/Charts/NumberInfo/index.js @@ -20,12 +20,12 @@ export default ({ theme, title, subTitle, total, subTotal, status, ...rest }) =>
{total} { - (status || subTotal) && - { - status && - } - {subTotal} - + (status || subTotal) && ( + + {status && } + {subTotal} + + ) }
diff --git a/src/components/Charts/Pie/index.js b/src/components/Charts/Pie/index.js index fb83f9521c7d5096e1f6f40007e55b9b46839c4e..5d068caa41dd8da32a2acdc576031a6f383a4cc2 100644 --- a/src/components/Charts/Pie/index.js +++ b/src/components/Charts/Pie/index.js @@ -38,7 +38,7 @@ class Pie extends Component { const newItem = item; newItem.checked = !newItem.checked; - const legendData = this.state.legendData; + const { legendData } = this.state; legendData[i] = newItem; if (this.chart) { @@ -59,7 +59,7 @@ class Pie extends Component { margin, percent, color, inner = 0.75, animate = true, - } = this.props; + } = this.props; let selected = this.props.selected || true; let tooltip = this.props.tooltips || true; @@ -109,7 +109,7 @@ class Pie extends Component { // clean this.node.innerHTML = ''; - const Stat = G2.Stat; + const { Stat } = G2; const chart = new G2.Chart({ container: this.node, @@ -189,39 +189,43 @@ class Pie extends Component {
{ - (subTitle || total) &&
- { - subTitle &&

{subTitle}

- } - { - // eslint-disable-next-line - total &&

- } -

+ (subTitle || total) && ( +
+ { + subTitle &&

{subTitle}

+ } + { + // eslint-disable-next-line + total &&

+ } +

+ ) } { - hasLegend && + hasLegend && ( + + ) }
diff --git a/src/components/Charts/Radar/index.js b/src/components/Charts/Radar/index.js index f52d194741dd1a23f84df5467f9f90a8e7d69625..244b2634b0541be06d1c09ec43651789100265cf 100644 --- a/src/components/Charts/Radar/index.js +++ b/src/components/Charts/Radar/index.js @@ -34,7 +34,7 @@ class Radar extends PureComponent { const newItem = item; newItem.checked = !newItem.checked; - const legendData = this.state.legendData; + const { legendData } = this.state; legendData[i] = newItem; if (this.chart) { @@ -130,28 +130,30 @@ class Radar extends PureComponent { { title &&

{title}

}
{ - hasLegend && - { - legendData.map((item, i) => ( - this.handleLegendClick(item, i)} - > -
-

- - {item.name} -

-
{item.value}
- { - i !== (legendData.length - 1) &&
- } -
- - )) - } - + hasLegend && ( + + { + legendData.map((item, i) => ( + this.handleLegendClick(item, i)} + > +
+

+ + {item.name} +

+
{item.value}
+ { + i !== (legendData.length - 1) &&
+ } +
+ + )) + } + + ) }
diff --git a/src/components/Countdown/index.js b/src/components/Countdown/index.js index 6b364a75d6e5a10704180f111fac45f7f075a387..9a87949fa864f8592b3d744d71c6f5223f6ad78b 100644 --- a/src/components/Countdown/index.js +++ b/src/components/Countdown/index.js @@ -8,10 +8,9 @@ class Countdown extends Component { constructor(props) { super(props); - const { targetTime, lastTime } = this.initTime(props); + const { lastTime } = this.initTime(props); this.state = { - targetTime, lastTime, }; } @@ -22,10 +21,9 @@ class Countdown extends Component { componentWillReceiveProps(nextProps) { if (this.props.target !== nextProps.target) { - const { targetTime, lastTime } = this.initTime(nextProps); + const { lastTime } = this.initTime(nextProps); this.setState({ lastTime, - targetTime, }); } } @@ -53,7 +51,6 @@ class Countdown extends Component { return { lastTime, - targetTime, }; } // defaultFormat = time => ( diff --git a/src/components/EditableItem/index.js b/src/components/EditableItem/index.js index b5efcd8b1d4c1f79d1c4a3b4b78f62c797775a9a..ea2f44772d530b123e1d65d8cea2183d986f0a50 100644 --- a/src/components/EditableItem/index.js +++ b/src/components/EditableItem/index.js @@ -8,7 +8,7 @@ export default class EditableItem extends PureComponent { editable: false, }; handleChange = (e) => { - const value = e.target.value; + const { value } = e.target; this.setState({ value }); } check = () => { diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js index de6c44fd56c68cba86c0297559d954cedda6f9ee..f1ba25fdcdc2502aab81ee734b19f41b043ba24a 100644 --- a/src/components/HeaderSearch/index.js +++ b/src/components/HeaderSearch/index.js @@ -17,7 +17,7 @@ export default class HeaderSearch extends PureComponent { onKeyDown = (e) => { if (e.key === 'Enter') { this.timeout = setTimeout(() => { - this.props.onPressEnter(this.state.value); // Fix duplicate onPressEnter + this.props.onPressEnter(this.state.value); // Fix duplicate onPressEnter }, 0); } } diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index 364b5562d39df2386f5e597aff8b071beac183ba..01742a5478556343645744c976845ced5d412e2e 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -5,7 +5,7 @@ import { Link } from 'dva/router'; import classNames from 'classnames'; import styles from './index.less'; -const TabPane = Tabs.TabPane; +const { TabPane } = Tabs; function itemRender(route, params, routes, paths) { const last = routes.indexOf(route) === routes.length - 1; diff --git a/src/components/RadioText/index.js b/src/components/RadioText/index.js index 6d62dcdc240bb9498f55ed1dbea2e8317678675a..999e9ab1baaf3deb97ff754b1f0955e12746541c 100644 --- a/src/components/RadioText/index.js +++ b/src/components/RadioText/index.js @@ -3,8 +3,8 @@ import { Radio } from 'antd'; import styles from './index.less'; -const RadioButton = Radio.Button; - -export default props => (
- -
); +export default props => ( +
+ +
+); diff --git a/src/components/Result/demo/classic.md b/src/components/Result/demo/classic.md index 3b2ca727d6108459748a717924d832a486996b89..9d371a2f652e0efea0f9b872ae09e71493ab8c87 100644 --- a/src/components/Result/demo/classic.md +++ b/src/components/Result/demo/classic.md @@ -9,7 +9,7 @@ title: Classic import Result from 'ant-design-pro/lib/Result'; import { Button, Row, Col, Icon, Steps } from 'antd'; -const Step = Steps.Step; +const { Step } = Steps; const desc1 = (
diff --git a/src/components/StandardFormRow/index.js b/src/components/StandardFormRow/index.js index 27ecd79b3d63c5f69eeafcb2d86ef1c3bbc1b5c8..4ed6d9d9b9679352ab6daf7af48e5cbb49015bd4 100644 --- a/src/components/StandardFormRow/index.js +++ b/src/components/StandardFormRow/index.js @@ -12,9 +12,11 @@ export default ({ title, children, last, block, grid, ...rest }) => { return (
{ - title &&
- {title} -
+ title && ( +
+ {title} +
+ ) }
{children} diff --git a/src/components/StandardTable/index.js b/src/components/StandardTable/index.js index 4d6be6e8c3a43b4a016ef568f9a130f658edecc5..ef855758713b9e9673d3afe23a538f13c12a03de 100644 --- a/src/components/StandardTable/index.js +++ b/src/components/StandardTable/index.js @@ -6,16 +6,13 @@ import styles from './index.less'; class StandardTable extends PureComponent { state = { selectedRowKeys: [], - selectedRows: [], totalCallNo: 0, - loading: false, }; componentWillReceiveProps(nextProps) { // clean state if (nextProps.selectedRows.length === 0) { this.setState({ - selectedRows: [], selectedRowKeys: [], totalCallNo: 0, }); @@ -31,7 +28,7 @@ class StandardTable extends PureComponent { this.props.onSelectRow(selectedRows); } - this.setState({ selectedRowKeys, selectedRows, totalCallNo }); + this.setState({ selectedRowKeys, totalCallNo }); } handleTableChange = (pagination, filters, sorter) => { diff --git a/src/components/TagCloud/index.js b/src/components/TagCloud/index.js index 72693b956b3e8c58bf2a0d6f6c76950372169eae..88a8d7bd332d2a14f61fd4fe641708ee63117ce5 100644 --- a/src/components/TagCloud/index.js +++ b/src/components/TagCloud/index.js @@ -19,8 +19,7 @@ class TagCloud extends PureComponent { } initTagCloud = () => { - const Util = G2.Util; - const Shape = G2.Shape; + const { Util, Shape } = G2; function getTextAttrs(cfg) { const textAttrs = Util.mix(true, {}, { @@ -131,4 +130,3 @@ class TagCloud extends PureComponent { } export default TagCloud; - diff --git a/src/components/TagSelect/index.js b/src/components/TagSelect/index.js index e0969ebaf125e3e6676306be490306b83febf14b..74cf5ccf29f179a6d533f69f16e2b446453e0de2 100644 --- a/src/components/TagSelect/index.js +++ b/src/components/TagSelect/index.js @@ -4,7 +4,7 @@ import { Tag, Icon } from 'antd'; import styles from './index.less'; -const CheckableTag = Tag.CheckableTag; +const { CheckableTag } = Tag; const TagSelectOption = ({ children, checked, onChange, value }) => ( { const { onChange } = this.props; let checkedTags = []; - let expand = this.state.expand; + let expanded = this.state.expand; if (checked) { const tags = this.getAllTags(); checkedTags = tags.list; - expand = tags.expand; + expanded = tags.expand; } this.setState({ checkedAll: checked, checkedTags, - expand, + expand: expanded, }); if (onChange) { @@ -60,7 +60,7 @@ class TagSelect extends PureComponent { } getAllTags() { - let expand = this.state.expand; + let { expand } = this.state; const { children } = this.props; let checkedTags = children.filter(child => child.props.displayName === 'TagSelectOption').map(child => child.props.value); @@ -138,20 +138,24 @@ class TagSelect extends PureComponent { })) } { - expandNode && - { expand ? '收起' : '展开'} - + expandNode && ( + + { expand ? '收起' : '展开'} + + ) } { - expandNode &&
- { - expandNode.props.children.map(child => React.cloneElement(child, { - key: `tag-select-${child.props.value}`, - checked: checkedTags.indexOf(child.props.value) > -1, - onChange: this.handleTagChange, - })) - } -
+ expandNode && ( +
+ { + expandNode.props.children.map(child => React.cloneElement(child, { + key: `tag-select-${child.props.value}`, + checked: checkedTags.indexOf(child.props.value) > -1, + onChange: this.handleTagChange, + })) + } +
+ ) }
); diff --git a/src/e2e/login.e2e.js b/src/e2e/login.e2e.js index 8d5659889e4c25fa3b21c0b4a64543b03add7897..5e8e10a04bbdf51071e7311a0f58767c88229e26 100644 --- a/src/e2e/login.e2e.js +++ b/src/e2e/login.e2e.js @@ -11,7 +11,7 @@ describe('Login', () => { await page.type('#userName', 'mockuser') .type('#password', 'wrong_password') .click('button[type="submit"]') - .wait('.ant-alert-error') // should display error + .wait('.ant-alert-error') // should display error .end(); }); @@ -19,7 +19,7 @@ describe('Login', () => { const text = await page.type('#userName', 'admin') .type('#password', '888888') .click('button[type="submit"]') - .wait('.ant-layout-sider h1') // should display error + .wait('.ant-layout-sider h1') // should display error .evaluate(() => document.body.innerHTML) .end(); expect(text).toContain('

Ant Design Pro

'); diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 103c73bba63345ed4164f5a0c19bc726e87bc6b4..7a20b762cfe250c6be59e63e17b262bdc6cfde57 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -28,9 +28,6 @@ class BasicLayout extends React.PureComponent { openKeys: this.getDefaultCollapsedSubMenus(props), }; } - state = { - mode: 'inline', - }; getChildContext() { const { routes, params } = this.props; return { routes, params }; @@ -225,10 +222,10 @@ class BasicLayout extends React.PureComponent { placeholder="站内搜索" dataSource={['搜索提示一', '搜索提示二', '搜索提示三']} onSearch={(value) => { - console.log('input', value); // eslint-disable-line + console.log('input', value); // eslint-disable-line }} onPressEnter={(value) => { - console.log('enter', value); // eslint-disable-line + console.log('enter', value); // eslint-disable-line }} /> ); - const salesExtra = (
- ); + ); const columns = [ { @@ -233,10 +235,12 @@ export default class Analysis extends Component { title="线上购物转化率" action={} total="78%" - footer={ - 12.3% - 11% - } + footer={ + + 12.3% + 11% + + } contentHeight={46} > @@ -420,4 +424,4 @@ export default class Analysis extends Component {
); } - } +} diff --git a/src/routes/Forms/BasicForm.js b/src/routes/Forms/BasicForm.js index 34c44fccfdb6c1739428f8e040df19cbca4e44ba..482f976d8b67303ee2d690e8defc8ee23e8a2bf7 100644 --- a/src/routes/Forms/BasicForm.js +++ b/src/routes/Forms/BasicForm.js @@ -4,7 +4,7 @@ import { Form, Input, DatePicker, Select, Button, Card } from 'antd'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; const FormItem = Form.Item; -const Option = Select.Option; +const { Option } = Select; const { RangePicker } = DatePicker; @connect(state => ({ diff --git a/src/routes/Forms/StepForm/Step1.js b/src/routes/Forms/StepForm/Step1.js index 7ae811b07545dcc9abb4a76a1e84afcb8a69574f..5e80030757dc787a8291a01ef0b3815265d24ee4 100644 --- a/src/routes/Forms/StepForm/Step1.js +++ b/src/routes/Forms/StepForm/Step1.js @@ -3,7 +3,7 @@ import { Form, Input, Button, Select, Divider } from 'antd'; import { routerRedux } from 'dva/router'; import styles from './style.less'; -const Option = Select.Option; +const { Option } = Select; export default ({ formItemLayout, form, dispatch }) => { const { getFieldDecorator, validateFields } = form; diff --git a/src/routes/Forms/StepForm/index.js b/src/routes/Forms/StepForm/index.js index 85a0a20c960899e5e80068b72abb4283bfcc8118..bca88bb0a8afc3f76f3d12da12aaa29805898f85 100644 --- a/src/routes/Forms/StepForm/index.js +++ b/src/routes/Forms/StepForm/index.js @@ -5,7 +5,7 @@ import PageHeaderLayout from '../../../layouts/PageHeaderLayout'; import Step1 from './Step1'; import styles from '../style.less'; -const Step = Steps.Step; +const { Step } = Steps; @Form.create() class StepForm extends PureComponent { diff --git a/src/routes/List/BasicList.js b/src/routes/List/BasicList.js index 5dd0369c9a9972d419febb789aa8d3474ae6c6b5..c6f89a3a18bda8ebe0ae713147d0377365e40429 100644 --- a/src/routes/List/BasicList.js +++ b/src/routes/List/BasicList.js @@ -9,7 +9,7 @@ import styles from './BasicList.less'; const RadioButton = Radio.Button; const RadioGroup = Radio.Group; -const Search = Input.Search; +const { Search } = Input; @connect(state => ({ list: state.list, diff --git a/src/routes/List/CardList.js b/src/routes/List/CardList.js index 9b7cda8bba8729890b61934fa1273a21f124b219..b4a3681e4644ad95431aff9c98f4c993037d373b 100644 --- a/src/routes/List/CardList.js +++ b/src/routes/List/CardList.js @@ -26,7 +26,8 @@ export default class CardList extends PureComponent { const content = (

段落示意:蚂蚁金服务设计平台-design.alipay.com,用最小的工作量,无缝接入蚂蚁金服生态, - 提供跨越设计与开发的体验解决方案。

+ 提供跨越设计与开发的体验解决方案。 +

快速开始 diff --git a/src/routes/List/CoverCardList.js b/src/routes/List/CoverCardList.js index 0fef6b319f3e4302b88d4a4d0afd53f21e2fb210..06d3212bced4615d2ae708004568e2c1aa9ccc23 100644 --- a/src/routes/List/CoverCardList.js +++ b/src/routes/List/CoverCardList.js @@ -12,7 +12,7 @@ import SearchInput from '../../components/SearchInput'; import styles from './CoverCardList.less'; -const Option = Select.Option; +const { Option } = Select; const FormItem = Form.Item; const TagOption = TagSelect.Option; const TagExpand = TagSelect.Expand; diff --git a/src/routes/List/FilterCardList.js b/src/routes/List/FilterCardList.js index 0b93c1e6433e279c7e088237b597653d149669a4..e7c6489b81206ef5ddd46a7ae15041159dc71015 100644 --- a/src/routes/List/FilterCardList.js +++ b/src/routes/List/FilterCardList.js @@ -11,7 +11,7 @@ import SearchInput from '../../components/SearchInput'; import styles from './FilterCardList.less'; -const Option = Select.Option; +const { Option } = Select; const FormItem = Form.Item; const TagOption = TagSelect.Option; const TagExpand = TagSelect.Expand; diff --git a/src/routes/List/SearchList.js b/src/routes/List/SearchList.js index d0974e3ae18ddeaf39e52db79cfdaafe72e32fbd..0b051bfe3b000618e75fa7a6aaf20f77d5b05366 100644 --- a/src/routes/List/SearchList.js +++ b/src/routes/List/SearchList.js @@ -10,7 +10,7 @@ import TagSelect from '../../components/TagSelect'; import SearchInput from '../../components/SearchInput'; import styles from './SearchList.less'; -const Option = Select.Option; +const { Option } = Select; const FormItem = Form.Item; const TagOption = TagSelect.Option; const TagExpand = TagSelect.Expand; diff --git a/src/routes/List/TableList.js b/src/routes/List/TableList.js index 424e6e9ddaf49f7c520dcce3519c2368421ae765..042e65b66112a3cf05fb5ae31a55d5ab15dac702 100644 --- a/src/routes/List/TableList.js +++ b/src/routes/List/TableList.js @@ -7,7 +7,7 @@ import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import styles from './TableList.less'; const FormItem = Form.Item; -const Option = Select.Option; +const { Option } = Select; const getValue = obj => Object.keys(obj).map(key => obj[key]).join(','); @connect(state => ({ @@ -203,39 +203,43 @@ export default class TableList extends PureComponent { { - this.state.expandForm && - - - {getFieldDecorator('updatedAt')( - - )} - - - - - {getFieldDecorator('callNo')( - } - placeholder="请输入" - /> - )} - - - + this.state.expandForm && ( + + + + {getFieldDecorator('updatedAt')( + + )} + + + + + {getFieldDecorator('callNo')( + } + placeholder="请输入" + /> + )} + + + + ) }
{ - selectedRows.length > 0 && - - - - - + selectedRows.length > 0 && ( + + + + + + + ) }
diff --git a/src/routes/User/Login.js b/src/routes/User/Login.js index 4db2e4a7be522075882ef5ea4f9eb68086ced0ba..3866513004de9bedd2e5037a77a101379011e6b3 100644 --- a/src/routes/User/Login.js +++ b/src/routes/User/Login.js @@ -5,7 +5,7 @@ import { Form, Input, Tabs, Button, Icon, Checkbox, Row, Col, Alert } from 'antd import styles from './Login.less'; const FormItem = Form.Item; -const TabPane = Tabs.TabPane; +const { TabPane } = Tabs; @connect(state => ({ login: state.login, diff --git a/src/routes/User/Register.js b/src/routes/User/Register.js index 4bc444fc4b891c0d6162c89979f32f48eb38e5ac..58d60f1b20da7e4d354861f249c092e5a187c2f3 100644 --- a/src/routes/User/Register.js +++ b/src/routes/User/Register.js @@ -5,7 +5,7 @@ import { Form, Input, Button, Select, Row, Col, Popover, Progress } from 'antd'; import styles from './Register.less'; const FormItem = Form.Item; -const Option = Select.Option; +const { Option } = Select; const InputGroup = Input.Group; const passwordStatusMap = { @@ -55,7 +55,7 @@ export default class Register extends Component { } getPasswordStatus = () => { - const form = this.props.form; + const { form } = this.props; const value = form.getFieldValue('password'); if (value && value.length > 9) { return 'ok'; @@ -81,12 +81,12 @@ export default class Register extends Component { } handleConfirmBlur = (e) => { - const value = e.target.value; + const { value } = e.target; this.setState({ confirmDirty: this.state.confirmDirty || !!value }); } checkConfirm = (rule, value, callback) => { - const form = this.props.form; + const { form } = this.props; if (value && value !== form.getFieldValue('password')) { callback('两次输入的密码不匹配!'); } else { @@ -113,7 +113,7 @@ export default class Register extends Component { if (value.length < 6) { callback('error'); } else { - const form = this.props.form; + const { form } = this.props; if (value && this.state.confirmDirty) { form.validateFields(['confirm'], { force: true }); } @@ -123,7 +123,7 @@ export default class Register extends Component { } renderPasswordProgress = () => { - const form = this.props.form; + const { form } = this.props; const value = form.getFieldValue('password'); const passwordStatus = this.getPasswordStatus(); return value && value.length ?