mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-20 22:43:43 +00:00
eslint fix
This commit is contained in:
@@ -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 => <Menu.Item key={item.key}>{item.name}</Menu.Item>)
|
||||
return (<Dropdown
|
||||
overlay={<Menu onClick={onMenuClick}>{menu}</Menu>}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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 (
|
||||
<Input.Group compact size={size} className={styles.search} style={style}>
|
||||
|
||||
@@ -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(
|
||||
<Modal
|
||||
visible
|
||||
title="Title"
|
||||
transitionName="zoom"
|
||||
maskTransitionName="fade"
|
||||
onCancel={() => {
|
||||
ReactDOM.render(<Modal
|
||||
visible
|
||||
title="Title"
|
||||
transitionName="zoom"
|
||||
maskTransitionName="fade"
|
||||
onCancel={() => {
|
||||
layer.close(index)
|
||||
}}
|
||||
onOk={() => {
|
||||
onOk={() => {
|
||||
layer.close(index)
|
||||
}}
|
||||
{...modalProps}
|
||||
wrapClassName={classnames({ [styles.verticalCenter]: verticalCenter, [wrapClassName]: true })}
|
||||
className={classnames(prefixCls, className, [`${prefixCls}-${index}`])}
|
||||
>
|
||||
<div className={`${prefixCls}-body-wrapper`} style={{ maxHeight: document.body.clientHeight - 256 }}>
|
||||
{content}
|
||||
</div>
|
||||
</Modal>, div)
|
||||
{...modalProps}
|
||||
wrapClassName={classnames({ [styles.verticalCenter]: verticalCenter, [wrapClassName]: true })}
|
||||
className={classnames(prefixCls, className, [`${prefixCls}-${index}`])}
|
||||
>
|
||||
<div className={`${prefixCls}-body-wrapper`} style={{ maxHeight: document.body.clientHeight - 256 }}>
|
||||
{content}
|
||||
</div>
|
||||
</Modal>, div)
|
||||
|
||||
return index
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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 }) => (<div className={styles.container} style={{ minHeight, maxHeight }}>
|
||||
const Container = ({
|
||||
children, ratio = 5 / 2, minHeight = 250, maxHeight = 350,
|
||||
}) => (<div className={styles.container} style={{ minHeight, maxHeight }}>
|
||||
<div style={{ marginTop: `${100 / ratio}%` || '100%' }} />
|
||||
<div className={styles.content} style={{ minHeight, maxHeight }}>
|
||||
<ResponsiveContainer>
|
||||
|
||||
@@ -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 }) => (<div className={styles.container} style={{ minHeight, maxHeight }}>
|
||||
const Container = ({
|
||||
children, ratio = 5 / 2, minHeight = 250, maxHeight = 350,
|
||||
}) => (<div className={styles.container} style={{ minHeight, maxHeight }}>
|
||||
<div style={{ marginTop: `${100 / ratio}%` || '100%' }} />
|
||||
<div className={styles.content} style={{ minHeight, maxHeight }}>
|
||||
<ResponsiveContainer>
|
||||
|
||||
@@ -13,7 +13,9 @@ const countUpProps = {
|
||||
separator: ',',
|
||||
}
|
||||
|
||||
function Cpu ({ usage, space, cpu, data }) {
|
||||
function Cpu ({
|
||||
usage, space, cpu, data,
|
||||
}) {
|
||||
return (<div className={styles.cpu}>
|
||||
<div className={styles.number}>
|
||||
<div className={styles.item}>
|
||||
|
||||
@@ -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 (
|
||||
<div className={styles.quote}>
|
||||
<div className={styles.inner}>
|
||||
|
||||
@@ -13,7 +13,9 @@ const countUpProps = {
|
||||
separator: ',',
|
||||
}
|
||||
|
||||
function User ({ avatar, name, email, sales, sold }) {
|
||||
function User ({
|
||||
avatar, name, email, sales, sold,
|
||||
}) {
|
||||
return (<div className={styles.user}>
|
||||
<div className={styles.header}>
|
||||
<div className={styles.headerinner}>
|
||||
|
||||
@@ -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 (
|
||||
<Spin spinning={loading}>
|
||||
<div className={styles.weather}>
|
||||
|
||||
@@ -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 = () => (<Page inner>
|
||||
<div className={styles.error}>
|
||||
|
||||
@@ -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 {
|
||||
</div>,
|
||||
})
|
||||
request({ ...requestParams }).then((data) => {
|
||||
const state = this.state
|
||||
const { state } = this
|
||||
state.result = [this.state.result, <div key="complete"><div>请求完成</div>{JSON.stringify(data)}</div>]
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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 => <img alt={'avatar'} width={24} src={text} />,
|
||||
render: text => <img alt="avatar" width={24} src={text} />,
|
||||
}, {
|
||||
title: 'Name',
|
||||
dataIndex: 'name',
|
||||
|
||||
@@ -78,7 +78,7 @@ const modal = ({
|
||||
})(<Radio.Group>
|
||||
<Radio value>Male</Radio>
|
||||
<Radio value={false}>Female</Radio>
|
||||
</Radio.Group>)}
|
||||
</Radio.Group>)}
|
||||
</FormItem>
|
||||
<FormItem label="Age" hasFeedback {...formItemLayout}>
|
||||
{getFieldDecorator('age', {
|
||||
|
||||
@@ -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 })
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user