Commit 2b01db7a authored by afc163's avatar afc163

upgrade eslint-config-airbnb

parent cb286ee4
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
"no-use-before-define": [0], "no-use-before-define": [0],
"jsx-a11y/no-static-element-interactions": [0], "jsx-a11y/no-static-element-interactions": [0],
"jsx-a11y/no-noninteractive-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], "no-nested-ternary": [0],
"arrow-body-style": [0], "arrow-body-style": [0],
"import/extensions": [0], "import/extensions": [0],
...@@ -37,6 +39,9 @@ ...@@ -37,6 +39,9 @@
"exports": "always-multiline", "exports": "always-multiline",
"functions": "ignore" "functions": "ignore"
}], }],
"object-curly-newline": [0],
"function-paren-newline": [0],
"no-restricted-globals": [0],
"require-yield": [1] "require-yield": [1]
}, },
"parserOptions": { "parserOptions": {
......
...@@ -73,7 +73,7 @@ export function fakeList(count) { ...@@ -73,7 +73,7 @@ export function fakeList(count) {
export function getFakeList(req, res, u) { export function getFakeList(req, res, u) {
let url = u; let url = u;
if (!url || Object.prototype.toString.call(url) !== '[object String]') { if (!url || Object.prototype.toString.call(url) !== '[object String]') {
url = req.url; url = req.url; // eslint-disable-line
} }
const params = getUrlParams(url); const params = getUrlParams(url);
......
...@@ -22,7 +22,7 @@ for (let i = 0; i < 46; i += 1) { ...@@ -22,7 +22,7 @@ for (let i = 0; i < 46; i += 1) {
export function getRule(req, res, u) { export function getRule(req, res, u) {
let url = u; let url = u;
if (!url || Object.prototype.toString.call(url) !== '[object String]') { if (!url || Object.prototype.toString.call(url) !== '[object String]') {
url = req.url; url = req.url; // eslint-disable-line
} }
const params = getUrlParams(url); const params = getUrlParams(url);
...@@ -74,20 +74,18 @@ export function getRule(req, res, u) { ...@@ -74,20 +74,18 @@ export function getRule(req, res, u) {
export function postRule(req, res, u, b) { export function postRule(req, res, u, b) {
let url = u; let url = u;
if (!url || Object.prototype.toString.call(url) !== '[object String]') { 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 body = (b && b.body) || req.body;
const method = body.method; const { method, no, description } = body;
switch (method) { switch (method) {
/* eslint no-case-declarations:0 */ /* eslint no-case-declarations:0 */
case 'delete': case 'delete':
const no = body.no;
tableListDataSource = tableListDataSource.filter(item => no.indexOf(item.no) === -1); tableListDataSource = tableListDataSource.filter(item => no.indexOf(item.no) === -1);
break; break;
case 'post': case 'post':
const description = body.description;
const i = Math.ceil(Math.random() * 10000); const i = Math.ceil(Math.random() * 10000);
tableListDataSource.unshift({ tableListDataSource.unshift({
key: i, key: i,
......
...@@ -12,7 +12,7 @@ export function getUrlParams(url) { ...@@ -12,7 +12,7 @@ export function getUrlParams(url) {
let queryString = url ? url.split('?')[1] : window.location.search.slice(1); let queryString = url ? url.split('?')[1] : window.location.search.slice(1);
const obj = {}; const obj = {};
if (queryString) { if (queryString) {
queryString = queryString.split('#')[0]; queryString = queryString.split('#')[0]; // eslint-disable-line
const arr = queryString.split('&'); const arr = queryString.split('&');
for (let i = 0; i < arr.length; i += 1) { for (let i = 0; i < arr.length; i += 1) {
const a = arr[i].split('='); const a = arr[i].split('=');
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"site": "roadhog-api-doc static", "site": "roadhog-api-doc static",
"lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style", "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": "jest",
"test:all": "node ./tests/run-tests.js" "test:all": "node ./tests/run-tests.js"
}, },
...@@ -36,11 +37,11 @@ ...@@ -36,11 +37,11 @@
"babel-runtime": "^6.9.2", "babel-runtime": "^6.9.2",
"cross-port-killer": "^1.0.1", "cross-port-killer": "^1.0.1",
"enzyme": "^2.9.1", "enzyme": "^2.9.1",
"eslint": "^3.0.0", "eslint": "^4.0.0",
"eslint-config-airbnb": "^15.0.0", "eslint-config-airbnb": "^16.0.0",
"eslint-plugin-babel": "^4.0.0", "eslint-plugin-babel": "^4.0.0",
"eslint-plugin-import": "^2.2.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-markdown": "^1.0.0-beta.6",
"eslint-plugin-react": "^7.0.1", "eslint-plugin-react": "^7.0.1",
"gh-pages": "^1.0.0", "gh-pages": "^1.0.0",
......
...@@ -34,7 +34,7 @@ class Bar extends PureComponent { ...@@ -34,7 +34,7 @@ class Bar extends PureComponent {
// clean // clean
this.node.innerHTML = ''; this.node.innerHTML = '';
const Frame = G2.Frame; const { Frame } = G2;
const frame = new Frame(data); const frame = new Frame(data);
const chart = new G2.Chart({ const chart = new G2.Chart({
......
...@@ -23,9 +23,11 @@ const ChartCard = ({ contentHeight, title, action, total, footer, children, ...r ...@@ -23,9 +23,11 @@ const ChartCard = ({ contentHeight, title, action, total, footer, children, ...r
</div> </div>
</div> </div>
{ {
footer && <div className={styles.footer}> footer && (
<div className={styles.footer}>
{footer} {footer}
</div> </div>
)
} }
</div> </div>
</Card> </Card>
......
...@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; ...@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import G2 from 'g2'; import G2 from 'g2';
import equal from '../equal'; import equal from '../equal';
const Shape = G2.Shape; const { Shape } = G2;
/* eslint no-underscore-dangle: 0 */ /* eslint no-underscore-dangle: 0 */
class Gauge extends PureComponent { class Gauge extends PureComponent {
...@@ -75,7 +75,7 @@ class Gauge extends PureComponent { ...@@ -75,7 +75,7 @@ class Gauge extends PureComponent {
}, },
}); });
const origin = cfg.origin; const { origin } = cfg;
group.addShape('text', { group.addShape('text', {
attrs: { attrs: {
x: center.x, x: center.x,
......
...@@ -34,7 +34,7 @@ class MiniBar extends PureComponent { ...@@ -34,7 +34,7 @@ class MiniBar extends PureComponent {
// clean // clean
this.node.innerHTML = ''; this.node.innerHTML = '';
const Frame = G2.Frame; const { Frame } = G2;
const frame = new Frame(data); const frame = new Frame(data);
const chart = new G2.Chart({ const chart = new G2.Chart({
......
...@@ -20,12 +20,12 @@ export default ({ theme, title, subTitle, total, subTotal, status, ...rest }) => ...@@ -20,12 +20,12 @@ export default ({ theme, title, subTitle, total, subTotal, status, ...rest }) =>
<div> <div>
<span>{total}</span> <span>{total}</span>
{ {
(status || subTotal) && <span className={styles.subTotal}> (status || subTotal) && (
{ <span className={styles.subTotal}>
status && <Icon type={`caret-${status}`} /> {status && <Icon type={`caret-${status}`} />}
}
{subTotal} {subTotal}
</span> </span>
)
} }
</div> </div>
</div> </div>
......
...@@ -38,7 +38,7 @@ class Pie extends Component { ...@@ -38,7 +38,7 @@ class Pie extends Component {
const newItem = item; const newItem = item;
newItem.checked = !newItem.checked; newItem.checked = !newItem.checked;
const legendData = this.state.legendData; const { legendData } = this.state;
legendData[i] = newItem; legendData[i] = newItem;
if (this.chart) { if (this.chart) {
...@@ -109,7 +109,7 @@ class Pie extends Component { ...@@ -109,7 +109,7 @@ class Pie extends Component {
// clean // clean
this.node.innerHTML = ''; this.node.innerHTML = '';
const Stat = G2.Stat; const { Stat } = G2;
const chart = new G2.Chart({ const chart = new G2.Chart({
container: this.node, container: this.node,
...@@ -189,7 +189,8 @@ class Pie extends Component { ...@@ -189,7 +189,8 @@ class Pie extends Component {
<div className={styles.content}> <div className={styles.content}>
<div ref={this.handleRef} /> <div ref={this.handleRef} />
{ {
(subTitle || total) && <div (subTitle || total) && (
<div
className={styles.total} className={styles.total}
ref={this.handleTotalRef} ref={this.handleTotalRef}
style={{ marginLeft: left, opacity: left ? 1 : 0 }} style={{ marginLeft: left, opacity: left ? 1 : 0 }}
...@@ -202,9 +203,11 @@ class Pie extends Component { ...@@ -202,9 +203,11 @@ class Pie extends Component {
total && <p dangerouslySetInnerHTML={{ __html: total }} /> total && <p dangerouslySetInnerHTML={{ __html: total }} />
} }
</div> </div>
)
} }
{ {
hasLegend && <ul className={styles.legend} style={{ marginTop: mt }}> hasLegend && (
<ul className={styles.legend} style={{ marginTop: mt }}>
{ {
legendData.map((item, i) => ( legendData.map((item, i) => (
<li key={item.x} onClick={() => this.handleLegendClick(item, i)}> <li key={item.x} onClick={() => this.handleLegendClick(item, i)}>
...@@ -222,6 +225,7 @@ class Pie extends Component { ...@@ -222,6 +225,7 @@ class Pie extends Component {
)) ))
} }
</ul> </ul>
)
} }
</div> </div>
</div> </div>
......
...@@ -34,7 +34,7 @@ class Radar extends PureComponent { ...@@ -34,7 +34,7 @@ class Radar extends PureComponent {
const newItem = item; const newItem = item;
newItem.checked = !newItem.checked; newItem.checked = !newItem.checked;
const legendData = this.state.legendData; const { legendData } = this.state;
legendData[i] = newItem; legendData[i] = newItem;
if (this.chart) { if (this.chart) {
...@@ -130,7 +130,8 @@ class Radar extends PureComponent { ...@@ -130,7 +130,8 @@ class Radar extends PureComponent {
{ title && <h4>{title}</h4>} { title && <h4>{title}</h4>}
<div ref={this.handleRef} /> <div ref={this.handleRef} />
{ {
hasLegend && <Row className={styles.legend}> hasLegend && (
<Row className={styles.legend}>
{ {
legendData.map((item, i) => ( legendData.map((item, i) => (
<Col <Col
...@@ -152,6 +153,7 @@ class Radar extends PureComponent { ...@@ -152,6 +153,7 @@ class Radar extends PureComponent {
)) ))
} }
</Row> </Row>
)
} }
</div> </div>
</div> </div>
......
...@@ -8,10 +8,9 @@ class Countdown extends Component { ...@@ -8,10 +8,9 @@ class Countdown extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
const { targetTime, lastTime } = this.initTime(props); const { lastTime } = this.initTime(props);
this.state = { this.state = {
targetTime,
lastTime, lastTime,
}; };
} }
...@@ -22,10 +21,9 @@ class Countdown extends Component { ...@@ -22,10 +21,9 @@ class Countdown extends Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (this.props.target !== nextProps.target) { if (this.props.target !== nextProps.target) {
const { targetTime, lastTime } = this.initTime(nextProps); const { lastTime } = this.initTime(nextProps);
this.setState({ this.setState({
lastTime, lastTime,
targetTime,
}); });
} }
} }
...@@ -53,7 +51,6 @@ class Countdown extends Component { ...@@ -53,7 +51,6 @@ class Countdown extends Component {
return { return {
lastTime, lastTime,
targetTime,
}; };
} }
// defaultFormat = time => ( // defaultFormat = time => (
......
...@@ -8,7 +8,7 @@ export default class EditableItem extends PureComponent { ...@@ -8,7 +8,7 @@ export default class EditableItem extends PureComponent {
editable: false, editable: false,
}; };
handleChange = (e) => { handleChange = (e) => {
const value = e.target.value; const { value } = e.target;
this.setState({ value }); this.setState({ value });
} }
check = () => { check = () => {
......
...@@ -5,7 +5,7 @@ import { Link } from 'dva/router'; ...@@ -5,7 +5,7 @@ import { Link } from 'dva/router';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './index.less'; import styles from './index.less';
const TabPane = Tabs.TabPane; const { TabPane } = Tabs;
function itemRender(route, params, routes, paths) { function itemRender(route, params, routes, paths) {
const last = routes.indexOf(route) === routes.length - 1; const last = routes.indexOf(route) === routes.length - 1;
......
...@@ -3,8 +3,8 @@ import { Radio } from 'antd'; ...@@ -3,8 +3,8 @@ import { Radio } from 'antd';
import styles from './index.less'; import styles from './index.less';
const RadioButton = Radio.Button; export default props => (
<div className={styles.radioText}>
export default props => (<div className={styles.radioText}> <Radio.Button {...props} />
<RadioButton {...props} /> </div>
</div>); );
...@@ -9,7 +9,7 @@ title: Classic ...@@ -9,7 +9,7 @@ title: Classic
import Result from 'ant-design-pro/lib/Result'; import Result from 'ant-design-pro/lib/Result';
import { Button, Row, Col, Icon, Steps } from 'antd'; import { Button, Row, Col, Icon, Steps } from 'antd';
const Step = Steps.Step; const { Step } = Steps;
const desc1 = ( const desc1 = (
<div style={{ fontSize: 14 }}> <div style={{ fontSize: 14 }}>
......
...@@ -12,9 +12,11 @@ export default ({ title, children, last, block, grid, ...rest }) => { ...@@ -12,9 +12,11 @@ export default ({ title, children, last, block, grid, ...rest }) => {
return ( return (
<div className={cls} {...rest}> <div className={cls} {...rest}>
{ {
title && <div className={styles.label}> title && (
<div className={styles.label}>
<span>{title}</span> <span>{title}</span>
</div> </div>
)
} }
<div className={styles.content}> <div className={styles.content}>
{children} {children}
......
...@@ -6,16 +6,13 @@ import styles from './index.less'; ...@@ -6,16 +6,13 @@ import styles from './index.less';
class StandardTable extends PureComponent { class StandardTable extends PureComponent {
state = { state = {
selectedRowKeys: [], selectedRowKeys: [],
selectedRows: [],
totalCallNo: 0, totalCallNo: 0,
loading: false,
}; };
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
// clean state // clean state
if (nextProps.selectedRows.length === 0) { if (nextProps.selectedRows.length === 0) {
this.setState({ this.setState({
selectedRows: [],
selectedRowKeys: [], selectedRowKeys: [],
totalCallNo: 0, totalCallNo: 0,
}); });
...@@ -31,7 +28,7 @@ class StandardTable extends PureComponent { ...@@ -31,7 +28,7 @@ class StandardTable extends PureComponent {
this.props.onSelectRow(selectedRows); this.props.onSelectRow(selectedRows);
} }
this.setState({ selectedRowKeys, selectedRows, totalCallNo }); this.setState({ selectedRowKeys, totalCallNo });
} }
handleTableChange = (pagination, filters, sorter) => { handleTableChange = (pagination, filters, sorter) => {
......
...@@ -19,8 +19,7 @@ class TagCloud extends PureComponent { ...@@ -19,8 +19,7 @@ class TagCloud extends PureComponent {
} }
initTagCloud = () => { initTagCloud = () => {
const Util = G2.Util; const { Util, Shape } = G2;
const Shape = G2.Shape;
function getTextAttrs(cfg) { function getTextAttrs(cfg) {
const textAttrs = Util.mix(true, {}, { const textAttrs = Util.mix(true, {}, {
...@@ -131,4 +130,3 @@ class TagCloud extends PureComponent { ...@@ -131,4 +130,3 @@ class TagCloud extends PureComponent {
} }
export default TagCloud; export default TagCloud;
...@@ -4,7 +4,7 @@ import { Tag, Icon } from 'antd'; ...@@ -4,7 +4,7 @@ import { Tag, Icon } from 'antd';
import styles from './index.less'; import styles from './index.less';
const CheckableTag = Tag.CheckableTag; const { CheckableTag } = Tag;
const TagSelectOption = ({ children, checked, onChange, value }) => ( const TagSelectOption = ({ children, checked, onChange, value }) => (
<CheckableTag <CheckableTag
...@@ -40,18 +40,18 @@ class TagSelect extends PureComponent { ...@@ -40,18 +40,18 @@ class TagSelect extends PureComponent {
onSelectAll = (checked) => { onSelectAll = (checked) => {
const { onChange } = this.props; const { onChange } = this.props;
let checkedTags = []; let checkedTags = [];
let expand = this.state.expand; let expanded = this.state.expand;
if (checked) { if (checked) {
const tags = this.getAllTags(); const tags = this.getAllTags();
checkedTags = tags.list; checkedTags = tags.list;
expand = tags.expand; expanded = tags.expand;
} }
this.setState({ this.setState({
checkedAll: checked, checkedAll: checked,
checkedTags, checkedTags,
expand, expand: expanded,
}); });
if (onChange) { if (onChange) {
...@@ -60,7 +60,7 @@ class TagSelect extends PureComponent { ...@@ -60,7 +60,7 @@ class TagSelect extends PureComponent {
} }
getAllTags() { getAllTags() {
let expand = this.state.expand; let { expand } = this.state;
const { children } = this.props; const { children } = this.props;
let checkedTags = children.filter(child => child.props.displayName === 'TagSelectOption').map(child => child.props.value); let checkedTags = children.filter(child => child.props.displayName === 'TagSelectOption').map(child => child.props.value);
...@@ -138,12 +138,15 @@ class TagSelect extends PureComponent { ...@@ -138,12 +138,15 @@ class TagSelect extends PureComponent {
})) }))
} }
{ {
expandNode && <a className={styles.trigger} onClick={this.handleExpand}> expandNode && (
<a className={styles.trigger} onClick={this.handleExpand}>
{ expand ? '收起' : '展开'} <Icon type={expand ? 'up' : 'down'} /> { expand ? '收起' : '展开'} <Icon type={expand ? 'up' : 'down'} />
</a> </a>
)
} }
{ {
expandNode && <div className={expand ? styles.expand : styles.fold}> expandNode && (
<div className={expand ? styles.expand : styles.fold}>
{ {
expandNode.props.children.map(child => React.cloneElement(child, { expandNode.props.children.map(child => React.cloneElement(child, {
key: `tag-select-${child.props.value}`, key: `tag-select-${child.props.value}`,
...@@ -152,6 +155,7 @@ class TagSelect extends PureComponent { ...@@ -152,6 +155,7 @@ class TagSelect extends PureComponent {
})) }))
} }
</div> </div>
)
} }
</div> </div>
); );
......
...@@ -28,9 +28,6 @@ class BasicLayout extends React.PureComponent { ...@@ -28,9 +28,6 @@ class BasicLayout extends React.PureComponent {
openKeys: this.getDefaultCollapsedSubMenus(props), openKeys: this.getDefaultCollapsedSubMenus(props),
}; };
} }
state = {
mode: 'inline',
};
getChildContext() { getChildContext() {
const { routes, params } = this.props; const { routes, params } = this.props;
return { routes, params }; return { routes, params };
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
}, },
effects: { effects: {
*fetchList({ payload }, { call, put }) { *fetchList(_, { call, put }) {
yield put({ yield put({
type: 'changeLoading', type: 'changeLoading',
payload: true, payload: true,
......
...@@ -16,14 +16,14 @@ export default { ...@@ -16,14 +16,14 @@ export default {
}, },
effects: { effects: {
*fetch({ payload }, { call, put }) { *fetch(_, { call, put }) {
const response = yield call(fakeChartData); const response = yield call(fakeChartData);
yield put({ yield put({
type: 'save', type: 'save',
payload: response, payload: response,
}); });
}, },
*fetchSalesData({ payload }, { call, put }) { *fetchSalesData(_, { call, put }) {
const response = yield call(fakeChartData); const response = yield call(fakeChartData);
yield put({ yield put({
type: 'save', type: 'save',
......
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
}, },
effects: { effects: {
*fetchNotices({ payload }, { call, put }) { *fetchNotices(_, { call, put }) {
yield put({ yield put({
type: 'changeNoticeLoading', type: 'changeNoticeLoading',
payload: true, payload: true,
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
payload: false, payload: false,
}); });
}, },
*mobileSubmit({ payload }, { call, put }) { *mobileSubmit(_, { call, put }) {
yield put({ yield put({
type: 'changeSubmitting', type: 'changeSubmitting',
payload: true, payload: true,
......
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
}, },
effects: { effects: {
*fetchTags({ payload }, { call, put }) { *fetchTags(_, { call, put }) {
const response = yield call(queryTags); const response = yield call(queryTags);
yield put({ yield put({
type: 'saveTags', type: 'saveTags',
......
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
}, },
effects: { effects: {
*fetchBasic({ payload }, { call, put }) { *fetchBasic(_, { call, put }) {
yield put({ yield put({
type: 'changeLoading', type: 'changeLoading',
payload: { basicLoading: true }, payload: { basicLoading: true },
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
payload: { basicLoading: false }, payload: { basicLoading: false },
}); });
}, },
*fetchAdvanced({ payload }, { call, put }) { *fetchAdvanced(_, { call, put }) {
yield put({ yield put({
type: 'changeLoading', type: 'changeLoading',
payload: { advancedLoading: true }, payload: { advancedLoading: true },
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
}, },
effects: { effects: {
*fetchNotice({ payload }, { call, put }) { *fetchNotice(_, { call, put }) {
yield put({ yield put({
type: 'changeLoading', type: 'changeLoading',
payload: true, payload: true,
......
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
}, },
effects: { effects: {
*submit({ payload }, { call, put }) { *submit(_, { call, put }) {
yield put({ yield put({
type: 'changeSubmitting', type: 'changeSubmitting',
payload: true, payload: true,
......
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
}, },
effects: { effects: {
*fetch({ payload }, { call, put }) { *fetch(_, { call, put }) {
yield put({ yield put({
type: 'changeLoading', type: 'changeLoading',
payload: true, payload: true,
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
payload: false, payload: false,
}); });
}, },
*fetchCurrent({ payload }, { call, put }) { *fetchCurrent(_, { call, put }) {
const response = yield call(queryCurrent); const response = yield call(queryCurrent);
yield put({ yield put({
type: 'saveCurrentUser', type: 'saveCurrentUser',
......
...@@ -10,7 +10,7 @@ import { getTimeDistance } from '../../utils/utils'; ...@@ -10,7 +10,7 @@ import { getTimeDistance } from '../../utils/utils';
import styles from './Analysis.less'; import styles from './Analysis.less';
const TabPane = Tabs.TabPane; const { TabPane } = Tabs;
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const rankingListData = []; const rankingListData = [];
...@@ -101,7 +101,8 @@ export default class Analysis extends Component { ...@@ -101,7 +101,8 @@ export default class Analysis extends Component {
</span> </span>
); );
const salesExtra = (<div className={styles.salesExtraWrap}> const salesExtra = (
<div className={styles.salesExtraWrap}>
<div className={styles.salesExtra}> <div className={styles.salesExtra}>
<a onClick={() => this.selectDate('today')}>今日</a> <a onClick={() => this.selectDate('today')}>今日</a>
<a onClick={() => this.selectDate('week')}>本周</a> <a onClick={() => this.selectDate('week')}>本周</a>
...@@ -113,7 +114,8 @@ export default class Analysis extends Component { ...@@ -113,7 +114,8 @@ export default class Analysis extends Component {
onChange={this.handleRangePickerChange} onChange={this.handleRangePickerChange}
style={{ width: 256 }} style={{ width: 256 }}
/> />
</div>); </div>
);
const columns = [ const columns = [
{ {
...@@ -233,10 +235,12 @@ export default class Analysis extends Component { ...@@ -233,10 +235,12 @@ export default class Analysis extends Component {
title="线上购物转化率" title="线上购物转化率"
action={<Tooltip title="购买效率"><Icon type="exclamation-circle-o" /></Tooltip>} action={<Tooltip title="购买效率"><Icon type="exclamation-circle-o" /></Tooltip>}
total="78%" total="78%"
footer={<Trend> footer={
<Trend>
<Trend.Item title="周同比" flag="up">12.3%</Trend.Item> <Trend.Item title="周同比" flag="up">12.3%</Trend.Item>
<Trend.Item title="日环比" flag="down">11%</Trend.Item> <Trend.Item title="日环比" flag="down">11%</Trend.Item>
</Trend>} </Trend>
}
contentHeight={46} contentHeight={46}
> >
<MiniProgress percent={78} strokeWidth={8} target={80} color="#5DD1DD" /> <MiniProgress percent={78} strokeWidth={8} target={80} color="#5DD1DD" />
...@@ -420,4 +424,4 @@ export default class Analysis extends Component { ...@@ -420,4 +424,4 @@ export default class Analysis extends Component {
</div> </div>
); );
} }
} }
...@@ -4,7 +4,7 @@ import { Form, Input, DatePicker, Select, Button, Card } from 'antd'; ...@@ -4,7 +4,7 @@ import { Form, Input, DatePicker, Select, Button, Card } from 'antd';
import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import PageHeaderLayout from '../../layouts/PageHeaderLayout';
const FormItem = Form.Item; const FormItem = Form.Item;
const Option = Select.Option; const { Option } = Select;
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
@connect(state => ({ @connect(state => ({
......
...@@ -3,7 +3,7 @@ import { Form, Input, Button, Select, Divider } from 'antd'; ...@@ -3,7 +3,7 @@ import { Form, Input, Button, Select, Divider } from 'antd';
import { routerRedux } from 'dva/router'; import { routerRedux } from 'dva/router';
import styles from './style.less'; import styles from './style.less';
const Option = Select.Option; const { Option } = Select;
export default ({ formItemLayout, form, dispatch }) => { export default ({ formItemLayout, form, dispatch }) => {
const { getFieldDecorator, validateFields } = form; const { getFieldDecorator, validateFields } = form;
......
...@@ -5,7 +5,7 @@ import PageHeaderLayout from '../../../layouts/PageHeaderLayout'; ...@@ -5,7 +5,7 @@ import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
import Step1 from './Step1'; import Step1 from './Step1';
import styles from '../style.less'; import styles from '../style.less';
const Step = Steps.Step; const { Step } = Steps;
@Form.create() @Form.create()
class StepForm extends PureComponent { class StepForm extends PureComponent {
......
...@@ -9,7 +9,7 @@ import styles from './BasicList.less'; ...@@ -9,7 +9,7 @@ import styles from './BasicList.less';
const RadioButton = Radio.Button; const RadioButton = Radio.Button;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
const Search = Input.Search; const { Search } = Input;
@connect(state => ({ @connect(state => ({
list: state.list, list: state.list,
......
...@@ -26,7 +26,8 @@ export default class CardList extends PureComponent { ...@@ -26,7 +26,8 @@ export default class CardList extends PureComponent {
const content = ( const content = (
<div className={styles.pageHeaderContent}> <div className={styles.pageHeaderContent}>
<p>段落示意蚂蚁金服务设计平台-design.alipay.com用最小的工作量无缝接入蚂蚁金服生态 <p>段落示意蚂蚁金服务设计平台-design.alipay.com用最小的工作量无缝接入蚂蚁金服生态
提供跨越设计与开发的体验解决方案</p> 提供跨越设计与开发的体验解决方案
</p>
<div className={styles.contentLink}> <div className={styles.contentLink}>
<a> <a>
<img alt="" src="https://gw.alipayobjects.com/zos/rmsportal/wUTAfuNZjhmCIxEPxQVY.svg" /> 快速开始 <img alt="" src="https://gw.alipayobjects.com/zos/rmsportal/wUTAfuNZjhmCIxEPxQVY.svg" /> 快速开始
......
...@@ -12,7 +12,7 @@ import SearchInput from '../../components/SearchInput'; ...@@ -12,7 +12,7 @@ import SearchInput from '../../components/SearchInput';
import styles from './CoverCardList.less'; import styles from './CoverCardList.less';
const Option = Select.Option; const { Option } = Select;
const FormItem = Form.Item; const FormItem = Form.Item;
const TagOption = TagSelect.Option; const TagOption = TagSelect.Option;
const TagExpand = TagSelect.Expand; const TagExpand = TagSelect.Expand;
......
...@@ -11,7 +11,7 @@ import SearchInput from '../../components/SearchInput'; ...@@ -11,7 +11,7 @@ import SearchInput from '../../components/SearchInput';
import styles from './FilterCardList.less'; import styles from './FilterCardList.less';
const Option = Select.Option; const { Option } = Select;
const FormItem = Form.Item; const FormItem = Form.Item;
const TagOption = TagSelect.Option; const TagOption = TagSelect.Option;
const TagExpand = TagSelect.Expand; const TagExpand = TagSelect.Expand;
......
...@@ -10,7 +10,7 @@ import TagSelect from '../../components/TagSelect'; ...@@ -10,7 +10,7 @@ import TagSelect from '../../components/TagSelect';
import SearchInput from '../../components/SearchInput'; import SearchInput from '../../components/SearchInput';
import styles from './SearchList.less'; import styles from './SearchList.less';
const Option = Select.Option; const { Option } = Select;
const FormItem = Form.Item; const FormItem = Form.Item;
const TagOption = TagSelect.Option; const TagOption = TagSelect.Option;
const TagExpand = TagSelect.Expand; const TagExpand = TagSelect.Expand;
......
...@@ -7,7 +7,7 @@ import PageHeaderLayout from '../../layouts/PageHeaderLayout'; ...@@ -7,7 +7,7 @@ import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import styles from './TableList.less'; import styles from './TableList.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const Option = Select.Option; const { Option } = Select;
const getValue = obj => Object.keys(obj).map(key => obj[key]).join(','); const getValue = obj => Object.keys(obj).map(key => obj[key]).join(',');
@connect(state => ({ @connect(state => ({
...@@ -203,7 +203,8 @@ export default class TableList extends PureComponent { ...@@ -203,7 +203,8 @@ export default class TableList extends PureComponent {
</Col> </Col>
</Row> </Row>
{ {
this.state.expandForm && <Row> this.state.expandForm && (
<Row>
<Col md={8} sm={12} xs={24}> <Col md={8} sm={12} xs={24}>
<FormItem {...formItemLayout} label="更新时间"> <FormItem {...formItemLayout} label="更新时间">
{getFieldDecorator('updatedAt')( {getFieldDecorator('updatedAt')(
...@@ -222,13 +223,15 @@ export default class TableList extends PureComponent { ...@@ -222,13 +223,15 @@ export default class TableList extends PureComponent {
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
)
} }
</Form> </Form>
</div> </div>
<div className={styles.tableListOperator}> <div className={styles.tableListOperator}>
<Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>新建</Button> <Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>新建</Button>
{ {
selectedRows.length > 0 && <span> selectedRows.length > 0 && (
<span>
<Button>批量操作</Button> <Button>批量操作</Button>
<Dropdown overlay={menu}> <Dropdown overlay={menu}>
<Button> <Button>
...@@ -236,6 +239,7 @@ export default class TableList extends PureComponent { ...@@ -236,6 +239,7 @@ export default class TableList extends PureComponent {
</Button> </Button>
</Dropdown> </Dropdown>
</span> </span>
)
} }
</div> </div>
<StandardTable <StandardTable
......
...@@ -3,7 +3,7 @@ import { Button, Row, Col, Icon, Steps, Card } from 'antd'; ...@@ -3,7 +3,7 @@ import { Button, Row, Col, Icon, Steps, Card } from 'antd';
import Result from '../../components/Result'; import Result from '../../components/Result';
import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import PageHeaderLayout from '../../layouts/PageHeaderLayout';
const Step = Steps.Step; const { Step } = Steps;
const desc1 = ( const desc1 = (
<div style={{ fontSize: 14 }}> <div style={{ fontSize: 14 }}>
......
...@@ -5,7 +5,7 @@ import { Form, Input, Tabs, Button, Icon, Checkbox, Row, Col, Alert } from 'antd ...@@ -5,7 +5,7 @@ import { Form, Input, Tabs, Button, Icon, Checkbox, Row, Col, Alert } from 'antd
import styles from './Login.less'; import styles from './Login.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const TabPane = Tabs.TabPane; const { TabPane } = Tabs;
@connect(state => ({ @connect(state => ({
login: state.login, login: state.login,
......
...@@ -5,7 +5,7 @@ import { Form, Input, Button, Select, Row, Col, Popover, Progress } from 'antd'; ...@@ -5,7 +5,7 @@ import { Form, Input, Button, Select, Row, Col, Popover, Progress } from 'antd';
import styles from './Register.less'; import styles from './Register.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const Option = Select.Option; const { Option } = Select;
const InputGroup = Input.Group; const InputGroup = Input.Group;
const passwordStatusMap = { const passwordStatusMap = {
...@@ -55,7 +55,7 @@ export default class Register extends Component { ...@@ -55,7 +55,7 @@ export default class Register extends Component {
} }
getPasswordStatus = () => { getPasswordStatus = () => {
const form = this.props.form; const { form } = this.props;
const value = form.getFieldValue('password'); const value = form.getFieldValue('password');
if (value && value.length > 9) { if (value && value.length > 9) {
return 'ok'; return 'ok';
...@@ -81,12 +81,12 @@ export default class Register extends Component { ...@@ -81,12 +81,12 @@ export default class Register extends Component {
} }
handleConfirmBlur = (e) => { handleConfirmBlur = (e) => {
const value = e.target.value; const { value } = e.target;
this.setState({ confirmDirty: this.state.confirmDirty || !!value }); this.setState({ confirmDirty: this.state.confirmDirty || !!value });
} }
checkConfirm = (rule, value, callback) => { checkConfirm = (rule, value, callback) => {
const form = this.props.form; const { form } = this.props;
if (value && value !== form.getFieldValue('password')) { if (value && value !== form.getFieldValue('password')) {
callback('两次输入的密码不匹配!'); callback('两次输入的密码不匹配!');
} else { } else {
...@@ -113,7 +113,7 @@ export default class Register extends Component { ...@@ -113,7 +113,7 @@ export default class Register extends Component {
if (value.length < 6) { if (value.length < 6) {
callback('error'); callback('error');
} else { } else {
const form = this.props.form; const { form } = this.props;
if (value && this.state.confirmDirty) { if (value && this.state.confirmDirty) {
form.validateFields(['confirm'], { force: true }); form.validateFields(['confirm'], { force: true });
} }
...@@ -123,7 +123,7 @@ export default class Register extends Component { ...@@ -123,7 +123,7 @@ export default class Register extends Component {
} }
renderPasswordProgress = () => { renderPasswordProgress = () => {
const form = this.props.form; const { form } = this.props;
const value = form.getFieldValue('password'); const value = form.getFieldValue('password');
const passwordStatus = this.getPasswordStatus(); const passwordStatus = this.getPasswordStatus();
return value && value.length ? return value && value.length ?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment