diff --git a/src/components/DropOption/DropOption.js b/src/components/DropOption/DropOption.js index 3fe6d85..47f185e 100644 --- a/src/components/DropOption/DropOption.js +++ b/src/components/DropOption/DropOption.js @@ -2,7 +2,9 @@ import React from 'react' import PropTypes from 'prop-types' import { Dropdown, Button, Icon, Menu } from 'antd' -const DropOption = ({ onMenuClick, menuOptions = [], buttonStyle, dropdownProps }) => { +const DropOption = ({ + onMenuClick, menuOptions = [], buttonStyle, dropdownProps, +}) => { const menu = menuOptions.map(item => {item.name}) return ({menu}} diff --git a/src/components/Page/Page.js b/src/components/Page/Page.js index fc2eb45..46be2c0 100644 --- a/src/components/Page/Page.js +++ b/src/components/Page/Page.js @@ -6,7 +6,9 @@ import styles from './Page.less' export default class Page extends Component { render () { - const { className, children, loading = false, inner = false } = this.props + const { + className, children, loading = false, inner = false, + } = this.props const loadingStyle = { height: 'calc(100vh - 184px)', overflow: 'hidden', diff --git a/src/components/Search/Search.js b/src/components/Search/Search.js index 8ef9008..01e06d6 100644 --- a/src/components/Search/Search.js +++ b/src/components/Search/Search.js @@ -38,7 +38,9 @@ class Search extends React.Component { this.handleSearch() } render () { - const { size, select, selectOptions, selectProps, style, keyword } = this.props + const { + size, select, selectOptions, selectProps, style, keyword, + } = this.props const { clearVisible } = this.state return ( diff --git a/src/components/layer/layer.js b/src/components/layer/layer.js index 4667388..9435f06 100644 --- a/src/components/layer/layer.js +++ b/src/components/layer/layer.js @@ -5,7 +5,9 @@ import ReactDOM from 'react-dom' import classnames from 'classnames' import styles from './layer.less' -const { info, success, error, warning, confirm } = Modal +const { + info, success, error, warning, confirm, +} = Modal const layer = { prefixCls: 'ant-layer', @@ -53,32 +55,31 @@ layer.open = (config) => { const { className, wrapClassName = '', verticalCenter = true } = modalProps const { prefixCls } = layer layer.index += 1 - const index = layer.index + const { index } = layer let div = document.createElement('div') div.id = `${prefixCls}-reference-${index}` div.className = `${prefixCls}-reference` document.body.appendChild(div) - ReactDOM.render( - { + ReactDOM.render( { layer.close(index) }} - onOk={() => { + onOk={() => { layer.close(index) }} - {...modalProps} - wrapClassName={classnames({ [styles.verticalCenter]: verticalCenter, [wrapClassName]: true })} - className={classnames(prefixCls, className, [`${prefixCls}-${index}`])} - > -
- {content} -
-
, div) + {...modalProps} + wrapClassName={classnames({ [styles.verticalCenter]: verticalCenter, [wrapClassName]: true })} + className={classnames(prefixCls, className, [`${prefixCls}-${index}`])} + > +
+ {content} +
+
, div) return index } diff --git a/src/models/app.js b/src/models/app.js index 711b13f..49ad4ae 100644 --- a/src/models/app.js +++ b/src/models/app.js @@ -1,6 +1,8 @@ /* global window */ /* global document */ /* global location */ +/* eslint no-restricted-globals: ["error", "event"] */ + import { routerRedux } from 'dva/router' import { parse } from 'qs' import config from 'config' diff --git a/src/models/user/detail.js b/src/models/user/detail.js index cfba61f..9b88e15 100644 --- a/src/models/user/detail.js +++ b/src/models/user/detail.js @@ -25,7 +25,9 @@ export default { payload, }, { call, put }) { const data = yield call(query, payload) - const { success, message, status, ...other } = data + const { + success, message, status, ...other + } = data if (success) { yield put({ type: 'querySuccess', diff --git a/src/routes/UIElement/dataTable/index.js b/src/routes/UIElement/dataTable/index.js index 482f52a..28da4ff 100644 --- a/src/routes/UIElement/dataTable/index.js +++ b/src/routes/UIElement/dataTable/index.js @@ -5,9 +5,11 @@ import { Table, Row, Col, Card, Select } from 'antd' class DataTablePage extends React.Component { constructor (props) { super(props) - this.state = { filterCase: { - gender: '', - } } + this.state = { + filterCase: { + gender: '', + }, + } } handleSelectChange = (gender) => { @@ -20,7 +22,11 @@ class DataTablePage extends React.Component { render () { const { filterCase } = this.state const staticDataTableProps = { - dataSource: [{ key: '1', name: 'John Brown', age: 24, address: 'New York' }, { key: '2', name: 'Jim Green', age: 23, address: 'London' }], + dataSource: [{ + key: '1', name: 'John Brown', age: 24, address: 'New York', + }, { + key: '2', name: 'Jim Green', age: 23, address: 'London', + }], columns: [{ title: 'name', dataIndex: 'name' }, { title: 'Age', dataIndex: 'age' }, { title: 'Address', dataIndex: 'address' }], pagination: false, } diff --git a/src/routes/chart/Container.js b/src/routes/chart/Container.js index 4534782..0ad00f0 100644 --- a/src/routes/chart/Container.js +++ b/src/routes/chart/Container.js @@ -3,7 +3,9 @@ import PropTypes from 'prop-types' import { ResponsiveContainer } from 'recharts' import styles from './Container.less' -const Container = ({ children, ratio = 5 / 2, minHeight = 250, maxHeight = 350 }) => (
+const Container = ({ + children, ratio = 5 / 2, minHeight = 250, maxHeight = 350, +}) => (
diff --git a/src/routes/chart/Recharts/Container.js b/src/routes/chart/Recharts/Container.js index 4534782..0ad00f0 100644 --- a/src/routes/chart/Recharts/Container.js +++ b/src/routes/chart/Recharts/Container.js @@ -3,7 +3,9 @@ import PropTypes from 'prop-types' import { ResponsiveContainer } from 'recharts' import styles from './Container.less' -const Container = ({ children, ratio = 5 / 2, minHeight = 250, maxHeight = 350 }) => (
+const Container = ({ + children, ratio = 5 / 2, minHeight = 250, maxHeight = 350, +}) => (
diff --git a/src/routes/dashboard/components/cpu.js b/src/routes/dashboard/components/cpu.js index e7774e6..adbc5e5 100644 --- a/src/routes/dashboard/components/cpu.js +++ b/src/routes/dashboard/components/cpu.js @@ -13,7 +13,9 @@ const countUpProps = { separator: ',', } -function Cpu ({ usage, space, cpu, data }) { +function Cpu ({ + usage, space, cpu, data, +}) { return (
diff --git a/src/routes/dashboard/components/quote.js b/src/routes/dashboard/components/quote.js index 709ce9a..decaa44 100644 --- a/src/routes/dashboard/components/quote.js +++ b/src/routes/dashboard/components/quote.js @@ -2,7 +2,9 @@ import React from 'react' import PropTypes from 'prop-types' import styles from './quote.less' -function Quote ({ name, content, title, avatar }) { +function Quote ({ + name, content, title, avatar, +}) { return (
diff --git a/src/routes/dashboard/components/user.js b/src/routes/dashboard/components/user.js index 384e05b..49d1400 100644 --- a/src/routes/dashboard/components/user.js +++ b/src/routes/dashboard/components/user.js @@ -13,7 +13,9 @@ const countUpProps = { separator: ',', } -function User ({ avatar, name, email, sales, sold }) { +function User ({ + avatar, name, email, sales, sold, +}) { return (
diff --git a/src/routes/dashboard/components/weather.js b/src/routes/dashboard/components/weather.js index defd58e..ad5b813 100644 --- a/src/routes/dashboard/components/weather.js +++ b/src/routes/dashboard/components/weather.js @@ -3,7 +3,9 @@ import PropTypes from 'prop-types' import { Spin } from 'antd' import styles from './weather.less' -function Weather ({ city, icon, dateTime, temperature, name, loading }) { +function Weather ({ + city, icon, dateTime, temperature, name, loading, +}) { return (
diff --git a/src/routes/error/index.js b/src/routes/error/index.js index 75fd68b..caa83ee 100644 --- a/src/routes/error/index.js +++ b/src/routes/error/index.js @@ -1,7 +1,7 @@ import React from 'react' import { Icon } from 'antd' -import styles from './index.less' import { Page } from 'components' +import styles from './index.less' const Error = () => (
diff --git a/src/routes/request/index.js b/src/routes/request/index.js index d6f5b6b..724787c 100644 --- a/src/routes/request/index.js +++ b/src/routes/request/index.js @@ -12,7 +12,9 @@ import { import styles from './index.less' const { api } = config -const { dashboard, users, userLogin, user, v1test, v2test } = api +const { + dashboard, users, userLogin, user, v1test, v2test, +} = api const requestOptions = [ { @@ -125,21 +127,22 @@ export default class RequestPage extends React.Component {
, }) request({ ...requestParams }).then((data) => { - const state = this.state + const { state } = this state.result = [this.state.result,
请求完成
{JSON.stringify(data)}
] this.setState(state) }) } handeleURLChange = (value) => { - const state = this.state + const { state } = this const curretUrl = value.split('?')[0] const curretMethod = value.split('?')[1] const currntItem = requestOptions.filter((item) => { const { method = 'get' } = item return curretUrl === item.url && curretMethod === method }) - state.currntRequest = currntItem[0] + const [currntRequest] = currntItem + state.currntRequest = currntRequest this.setState(state) } diff --git a/src/routes/user/List.js b/src/routes/user/List.js index abf1c03..4ec3dcc 100644 --- a/src/routes/user/List.js +++ b/src/routes/user/List.js @@ -8,9 +8,11 @@ import queryString from 'query-string' import AnimTableBody from 'components/DataTable/AnimTableBody' import styles from './List.less' -const confirm = Modal.confirm +const { confirm } = Modal -const List = ({ onDeleteItem, onEditItem, isMotion, location, ...tableProps }) => { +const List = ({ + onDeleteItem, onEditItem, isMotion, location, ...tableProps +}) => { location.query = queryString.parse(location.search) const handleMenuClick = (record, e) => { @@ -33,7 +35,7 @@ const List = ({ onDeleteItem, onEditItem, isMotion, location, ...tableProps }) = key: 'avatar', width: 64, className: styles.avatar, - render: text => {'avatar'}, + render: text => avatar, }, { title: 'Name', dataIndex: 'name', diff --git a/src/routes/user/Modal.js b/src/routes/user/Modal.js index ddb85b6..47141a6 100644 --- a/src/routes/user/Modal.js +++ b/src/routes/user/Modal.js @@ -78,7 +78,7 @@ const modal = ({ })( Male Female - )} + )} {getFieldDecorator('age', { diff --git a/src/utils/request.js b/src/utils/request.js index 08ba153..31c2a5f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -20,7 +20,7 @@ const fetch = (options) => { try { let domin = '' if (url.match(/[a-zA-z]+:\/\/[^/]*/)) { - domin = url.match(/[a-zA-z]+:\/\/[^/]*/)[0] + [domin] = url.match(/[a-zA-z]+:\/\/[^/]*/) url = url.slice(domin.length) } const match = pathToRegexp.parse(url) @@ -113,6 +113,8 @@ export default function request (options) { statusCode = 600 msg = error.message || 'Network Error' } + + /* eslint-disable */ return Promise.reject({ success: false, statusCode, message: msg }) }) }