diff --git a/.eslintignore b/.eslintignore index 69f9854da0954e4141af919207e78abe3e3d00b7..87467c1fdf12a0ebeb9b731996a8de7718167831 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1 @@ -/functions/mock \ No newline at end of file +/functions/mock diff --git a/.eslintrc.js b/.eslintrc.js index 9c1cf5f7fba297725d766633790417f120a9280d..1a1c24b6db3593abde172f1ebd009d9d086bd827 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,6 @@ module.exports = { - extends: ['eslint-config-umi', 'prettier'], + parser: 'babel-eslint', + extends: ['airbnb', 'prettier'], env: { browser: true, node: true, @@ -9,8 +10,20 @@ module.exports = { jasmine: true, }, rules: { - 'jsx-a11y/href-no-hash': [0], - 'react/sort-comp': 1, + 'react/jsx-filename-extension': [1, { extensions: ['.js'] }], + 'import/no-unresolved': 0, + 'jsx-a11y/anchor-is-valid': 0, + 'react/jsx-wrap-multilines': 0, + 'import/no-extraneous-dependencies': 0, + 'consistent-return': 0, + 'import/no-extraneous-dependencies': 0, + 'react/prop-types': 0, + 'jsx-a11y/click-events-have-key-events': 0, + 'jsx-a11y/no-static-element-interactions': 0, + 'react/prefer-stateless-function': 0, + 'jsx-a11y/no-noninteractive-element-interactions': 0, + 'react/forbid-prop-types': 0, + 'react/jsx-one-expression-per-line': 0, }, settings: { polyfills: ['fetch', 'promises'], diff --git a/package.json b/package.json index c4a07b73d41ed2d4cdf17be83bcfa53f0ff0146a..9aee5e4dccb0b5ac0fbdbf153e0c5020157a9aac 100755 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "eslint": "^5.4.0", "eslint-config-airbnb": "^17.0.0", "eslint-config-prettier": "^3.0.1", - "eslint-config-umi": "^0.1.4", "eslint-plugin-babel": "^5.1.0", "eslint-plugin-compat": "^2.5.1", "eslint-plugin-flowtype": "2.50.0", diff --git a/src/components/Authorized/CheckPermissions.js b/src/components/Authorized/CheckPermissions.js index 8aaad1ce5b01a913aa38e1954d8fd149c23bd406..5bc225e345119e75cb299b04ea888202e2c70131 100644 --- a/src/components/Authorized/CheckPermissions.js +++ b/src/components/Authorized/CheckPermissions.js @@ -82,8 +82,7 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => { export { checkPermissions }; -const check = (authority, target, Exception) => { - return checkPermissions(authority, CURRENT, target, Exception); -}; +const check = (authority, target, Exception) => + checkPermissions(authority, CURRENT, target, Exception); export default check; diff --git a/src/components/Authorized/CheckPermissions.test.js b/src/components/Authorized/CheckPermissions.test.js index 1e66cb9edac708ba803cf3a916e54ca36e54b329..3988d85a18fcfe7412bb72f672ffdf7c2501d8c2 100644 --- a/src/components/Authorized/CheckPermissions.test.js +++ b/src/components/Authorized/CheckPermissions.test.js @@ -1,4 +1,4 @@ -import { checkPermissions } from './CheckPermissions.js'; +import { checkPermissions } from './CheckPermissions'; const target = 'ok'; const error = 'error'; diff --git a/src/components/Authorized/index.js b/src/components/Authorized/index.js index 91eabf87f8debff26808ad2bb07588356dea03a1..22ac664d002844304b316e8c4f1acc79ede572d8 100644 --- a/src/components/Authorized/index.js +++ b/src/components/Authorized/index.js @@ -1,7 +1,7 @@ import Authorized from './Authorized'; import AuthorizedRoute from './AuthorizedRoute'; import Secured from './Secured'; -import check from './CheckPermissions.js'; +import check from './CheckPermissions'; import renderAuthorize from './renderAuthorize'; Authorized.Secured = Secured; diff --git a/src/components/Authorized/renderAuthorize.js b/src/components/Authorized/renderAuthorize.js index 16177edece45ef253789db30d32895344857d5de..5c5daa68cce8605d356a77b1d9c2f5449e7631f6 100644 --- a/src/components/Authorized/renderAuthorize.js +++ b/src/components/Authorized/renderAuthorize.js @@ -4,23 +4,21 @@ let CURRENT = 'NULL'; * use authority or getAuthority * @param {string|()=>String} currentAuthority */ -const renderAuthorize = Authorized => { - return currentAuthority => { - if (currentAuthority) { - if (currentAuthority.constructor.name === 'Function') { - CURRENT = currentAuthority(); - } - if ( - currentAuthority.constructor.name === 'String' || - currentAuthority.constructor.name === 'Array' - ) { - CURRENT = currentAuthority; - } - } else { - CURRENT = 'NULL'; +const renderAuthorize = Authorized => currentAuthority => { + if (currentAuthority) { + if (currentAuthority.constructor.name === 'Function') { + CURRENT = currentAuthority(); } - return Authorized; - }; + if ( + currentAuthority.constructor.name === 'String' || + currentAuthority.constructor.name === 'Array' + ) { + CURRENT = currentAuthority; + } + } else { + CURRENT = 'NULL'; + } + return Authorized; }; export { CURRENT }; diff --git a/src/components/Charts/Gauge/index.js b/src/components/Charts/Gauge/index.js index d9289eaa24bc9ae6b3f78c8a3cec438ec42cf6e2..093587d43c30233b8d8c5e63d8ff1c452124eb78 100644 --- a/src/components/Charts/Gauge/index.js +++ b/src/components/Charts/Gauge/index.js @@ -142,15 +142,13 @@ export default class Gauge extends React.Component { /> { - return ` + html={() => `

${title}

${data[0].value * 10}%

-
`; - }} + `} /> { if (value === '占比') { return color || 'rgba(24, 144, 255, 0.85)'; - } else { - return '#F0F2F5'; } + return '#F0F2F5'; }; data = [ @@ -257,7 +256,7 @@ export default class Pie extends Component { {item.x} - {`${(isNaN(item.percent) ? 0 : item.percent * 100).toFixed(2)}%`} + {`${(Number.isNaN(item.percent) ? 0 : item.percent * 100).toFixed(2)}%`} {valueFormat ? valueFormat(item.y) : item.y} diff --git a/src/components/Charts/autoHeight.js b/src/components/Charts/autoHeight.js index 01ae92dcdba0f7ceb43aa3fabddf586d6c0a816a..6ee9e098d3d926650f0f4ce6bfcd0cb3483c26ed 100644 --- a/src/components/Charts/autoHeight.js +++ b/src/components/Charts/autoHeight.js @@ -30,8 +30,8 @@ function getAutoHeight(n) { return height; } -const autoHeight = () => WrappedComponent => { - return class extends React.Component { +const autoHeight = () => WrappedComponent => + class extends React.Component { state = { computedHeight: 0, }; @@ -58,6 +58,5 @@ const autoHeight = () => WrappedComponent => { ); } }; -}; export default autoHeight; diff --git a/src/components/CountDown/index.js b/src/components/CountDown/index.js index 53815c9eb81e2770cfc1e7f5352b3d5a40db13fb..7565bd82da8c6331840861a1dc7bc3b49fad947f 100644 --- a/src/components/CountDown/index.js +++ b/src/components/CountDown/index.js @@ -23,6 +23,9 @@ const initTime = props => { }; class CountDown extends Component { + timer = 0; + + interval = 1000; constructor(props) { super(props); @@ -58,10 +61,6 @@ class CountDown extends Component { clearTimeout(this.timer); } - timer = 0; - - interval = 1000; - // defaultFormat = time => ( // {moment(time).format('hh:mm:ss')} // ); @@ -74,11 +73,7 @@ class CountDown extends Component { const s = Math.floor((time - h * hours - m * minutes) / 1000); return ( - {fixedZero(h)} - : - {fixedZero(m)} - : - {fixedZero(s)} + {fixedZero(h)}:{fixedZero(m)}:{fixedZero(s)} ); }; diff --git a/src/components/Ellipsis/index.js b/src/components/Ellipsis/index.js index 460361ef008787e6b3bf15b1df656a52335b7099..1d9daf1a18b6fb258a176199ea3b35195f8ce3e4 100644 --- a/src/components/Ellipsis/index.js +++ b/src/components/Ellipsis/index.js @@ -13,16 +13,14 @@ const TooltipOverlayStyle = { wordWrap: 'break-word', }; -export const getStrFullLength = (str = '') => { - return str.split('').reduce((pre, cur) => { +export const getStrFullLength = (str = '') => + str.split('').reduce((pre, cur) => { const charCode = cur.charCodeAt(0); if (charCode >= 0 && charCode <= 128) { return pre + 1; - } else { - return pre + 2; } + return pre + 2; }, 0); -}; export const cutStrByFullLength = (str = '', maxLength) => { let showLength = 0; @@ -35,9 +33,8 @@ export const cutStrByFullLength = (str = '', maxLength) => { } if (showLength <= maxLength) { return pre + cur; - } else { - return pre; } + return pre; }, ''); }; @@ -139,29 +136,26 @@ export default class Ellipsis extends Component { sh = shadowNode.offsetHeight; if (sh > th || mid === begin) { return mid; - } else { - begin = mid; - if (end - begin === 1) { - mid = 1 + begin; - } else { - mid = Math.floor((end - begin) / 2) + begin; - } - return this.bisection(th, mid, begin, end, text, shadowNode); - } - } else { - if (mid - 1 < 0) { - return mid; } - shadowNode.innerHTML = text.substring(0, mid - 1) + suffix; - sh = shadowNode.offsetHeight; - if (sh <= th) { - return mid - 1; + begin = mid; + if (end - begin === 1) { + mid = 1 + begin; } else { - end = mid; mid = Math.floor((end - begin) / 2) + begin; - return this.bisection(th, mid, begin, end, text, shadowNode); } + return this.bisection(th, mid, begin, end, text, shadowNode); + } + if (mid - 1 < 0) { + return mid; + } + shadowNode.innerHTML = text.substring(0, mid - 1) + suffix; + sh = shadowNode.offsetHeight; + if (sh <= th) { + return mid - 1; } + end = mid; + mid = Math.floor((end - begin) / 2) + begin; + return this.bisection(th, mid, begin, end, text, shadowNode); }; handleRoot = n => { diff --git a/src/components/Ellipsis/index.test.js b/src/components/Ellipsis/index.test.js index ab45463766536dc253df3b12ca59290c25ac7e5d..4d057b24e7f726f25165dcae7ec9cd064f577f11 100644 --- a/src/components/Ellipsis/index.test.js +++ b/src/components/Ellipsis/index.test.js @@ -1,4 +1,4 @@ -import { getStrFullLength, cutStrByFullLength } from './index.js'; +import { getStrFullLength, cutStrByFullLength } from './index'; describe('test calculateShowLength', () => { it('get full length', () => { diff --git a/src/components/Exception/index.js b/src/components/Exception/index.js index d514cf8ce2e031011fd8f93dadc5b485fe6412f4..b358d11b67e63e963feec6d234ff6e8082eb9b45 100644 --- a/src/components/Exception/index.js +++ b/src/components/Exception/index.js @@ -8,10 +8,12 @@ class Excrption extends React.PureComponent { static defaultProps = { backText: 'back to home', }; + constructor(props) { super(props); this.state = {}; } + render() { const { className, diff --git a/src/components/Login/LoginItem.js b/src/components/Login/LoginItem.js index c9a1a4f1332a8997c802a795f0cd6dc1140a18f0..762964c2fb041f002613e83c9a5e2ee010e647b5 100644 --- a/src/components/Login/LoginItem.js +++ b/src/components/Login/LoginItem.js @@ -122,22 +122,20 @@ class WarpFormItem extends Component { const LoginItem = {}; Object.keys(ItemMap).forEach(key => { const item = ItemMap[key]; - LoginItem[key] = props => { - return ( - - {context => ( - - )} - - ); - }; + LoginItem[key] = props => ( + + {context => ( + + )} + + ); }); export default LoginItem; diff --git a/src/components/Login/LoginTab.js b/src/components/Login/LoginTab.js index 0161caae17f9f993b65f34b4b27b33e13527985e..c50951c4a36f46ff3be04271caac755c8c27b37b 100644 --- a/src/components/Login/LoginTab.js +++ b/src/components/Login/LoginTab.js @@ -29,15 +29,11 @@ class LoginTab extends Component { } } -const warpContext = props => { - return ( - - {value => { - return ; - }} - - ); -}; +const warpContext = props => ( + + {value => } + +); // 标志位 用来判断是不是自定义组件 warpContext.typeName = 'LoginTab'; diff --git a/src/components/NoticeIcon/NoticeList.js b/src/components/NoticeIcon/NoticeList.js index 97b7e29f69dd3940dbc26659185bec081bc1e983..7dc17868b9bdefc4ad6e1de7b2a406b99dfc1c75 100644 --- a/src/components/NoticeIcon/NoticeList.js +++ b/src/components/NoticeIcon/NoticeList.js @@ -28,6 +28,7 @@ export default function NoticeList({ const itemCls = classNames(styles.item, { [styles.read]: item.read, }); + // eslint-disable-next-line no-nested-ternary const leftIcon = item.avatar ? ( typeof item.avatar === 'string' ? ( diff --git a/src/components/PageHeader/index.test.js b/src/components/PageHeader/index.test.js index 5238ac557b0d6ed327b7c7005cfaf20c1f3d70ef..e801a5855bd3297bfdc8cdb04ccc1e2e81935455 100644 --- a/src/components/PageHeader/index.test.js +++ b/src/components/PageHeader/index.test.js @@ -26,22 +26,18 @@ describe('test getBreadcrumb', () => { expect(getBreadcrumb(routerData, '/userinfo/2144/addr').name).toEqual('收货订单'); }); it('Loop through the parameters', () => { - const urlNameList = urlToList('/userinfo/2144/addr').map(url => { - return getBreadcrumb(routerData, url).name; - }); + const urlNameList = urlToList('/userinfo/2144/addr').map( + url => getBreadcrumb(routerData, url).name + ); expect(urlNameList).toEqual(['用户列表', '用户信息', '收货订单']); }); it('a path', () => { - const urlNameList = urlToList('/userinfo').map(url => { - return getBreadcrumb(routerData, url).name; - }); + const urlNameList = urlToList('/userinfo').map(url => getBreadcrumb(routerData, url).name); expect(urlNameList).toEqual(['用户列表']); }); it('Secondary path', () => { - const urlNameList = urlToList('/userinfo/2144').map(url => { - return getBreadcrumb(routerData, url).name; - }); + const urlNameList = urlToList('/userinfo/2144').map(url => getBreadcrumb(routerData, url).name); expect(urlNameList).toEqual(['用户列表', '用户信息']); }); }); diff --git a/src/components/SettingDrawer/BlockChecbox.js b/src/components/SettingDrawer/BlockChecbox.js index 2f05ec66394939a8d670188d44c8b3e565a99dec..be7e3ff1a11d4336c7ba1b53c2f74d56974db81e 100644 --- a/src/components/SettingDrawer/BlockChecbox.js +++ b/src/components/SettingDrawer/BlockChecbox.js @@ -2,32 +2,28 @@ import { Icon } from 'antd'; import React from 'react'; import style from './index.less'; -const BlockChecbox = ({ value, onChange, list }) => { - return ( -
- {list.map(item => { - return ( -
{ - onChange(item.key); - }} - > - {item.key} -
- -
-
- ); - })} -
- ); -}; +const BlockChecbox = ({ value, onChange, list }) => ( +
+ {list.map(item => ( +
{ + onChange(item.key); + }} + > + {item.key} +
+ +
+
+ ))} +
+); export default BlockChecbox; diff --git a/src/components/SettingDrawer/ThemeColor.js b/src/components/SettingDrawer/ThemeColor.js index f70bd4f824a9d737ba721b1d19bf1625e6439a33..6246dc61d481867321602b3210ba35164e71ff71 100644 --- a/src/components/SettingDrawer/ThemeColor.js +++ b/src/components/SettingDrawer/ThemeColor.js @@ -2,18 +2,16 @@ import { Icon } from 'antd'; import React from 'react'; import styles from './ThemeColor.less'; -const Tag = ({ color, check, ...rest }) => { - return ( -
- {check ? : ''} -
- ); -}; +const Tag = ({ color, check, ...rest }) => ( +
+ {check ? : ''} +
+); const ThemeColor = ({ colors, title, value, onChange }) => { let colorList = colors; @@ -33,17 +31,15 @@ const ThemeColor = ({ colors, title, value, onChange }) => {

{title}

- {colorList.map(color => { - return ( - onChange && onChange(color)} - /> - ); - })} + {colorList.map(color => ( + onChange && onChange(color)} + /> + ))}
); diff --git a/src/components/SettingDrawer/index.js b/src/components/SettingDrawer/index.js index fb299e01f1cfc131817b918d21bd763cf6359485..5fe2ef6774983e51ef5519ba084e96eeef6389e6 100644 --- a/src/components/SettingDrawer/index.js +++ b/src/components/SettingDrawer/index.js @@ -76,9 +76,7 @@ class SettingDrawer extends PureComponent { />, ], }, - ].filter(item => { - return !item.hide; - }); + ].filter(item => !item.hide); }; changeSetting = (key, value) => { diff --git a/src/components/SiderMenu/BaseMenu.js b/src/components/SiderMenu/BaseMenu.js index a2922409f10068470344b6405cd788c33b6ea0ea..9948571131ade6647979e7d16a123ef0836fe8a4 100644 --- a/src/components/SiderMenu/BaseMenu.js +++ b/src/components/SiderMenu/BaseMenu.js @@ -22,11 +22,8 @@ const getIcon = icon => { return icon; }; -export const getMenuMatches = (flatMenuKeys, path) => { - return flatMenuKeys.filter(item => { - return pathToRegexp(item).test(path); - }); -}; +export const getMenuMatches = (flatMenuKeys, path) => + flatMenuKeys.filter(item => pathToRegexp(item).test(path)); export default class BaseMenu extends PureComponent { constructor(props) { @@ -100,9 +97,8 @@ export default class BaseMenu extends PureComponent { {this.getNavMenuItems(item.children)} ); - } else { - return {this.getMenuItemPath(item)}; } + return {this.getMenuItemPath(item)}; }; /** @@ -143,6 +139,7 @@ export default class BaseMenu extends PureComponent { ); }; + // permission to check checkPermissionItem = (authority, ItemDom) => { const { Authorized } = this.props; @@ -156,9 +153,8 @@ export default class BaseMenu extends PureComponent { conversionPath = path => { if (path && path.indexOf('http') === 0) { return path; - } else { - return `/${path || ''}`.replace(/\/+/g, '/'); } + return `/${path || ''}`.replace(/\/+/g, '/'); }; render() { diff --git a/src/components/SiderMenu/SliderMenu.js b/src/components/SiderMenu/SliderMenu.js index 4be375513a0dcea6685d2fcd2f9e316d6f9d0c3a..ccbe5ea68ea1ed19a71cb862a8fe0a7499cbe277 100644 --- a/src/components/SiderMenu/SliderMenu.js +++ b/src/components/SiderMenu/SliderMenu.js @@ -18,9 +18,7 @@ const getDefaultCollapsedSubMenus = props => { flatMenuKeys, } = props; return urlToList(pathname) - .map(item => { - return getMenuMatches(flatMenuKeys, item)[0]; - }) + .map(item => getMenuMatches(flatMenuKeys, item)[0]) .filter(item => item); }; @@ -69,6 +67,7 @@ export default class SiderMenu extends PureComponent { } return null; } + isMainMenu = key => { const { menuData } = this.props; return menuData.some(item => { @@ -78,12 +77,14 @@ export default class SiderMenu extends PureComponent { return false; }); }; + handleOpenChange = openKeys => { const moreThanOne = openKeys.filter(openKey => this.isMainMenu(openKey)).length > 1; this.setState({ openKeys: moreThanOne ? [openKeys.pop()] : [...openKeys], }); }; + render() { const { logo, collapsed, onCollapse, fixSiderbar, theme } = this.props; const { openKeys } = this.state; diff --git a/src/components/StandardTable/index.js b/src/components/StandardTable/index.js index 14b4984d728ad1c84606c786bed8c3074fa61575..9e8c85ad19e7ca123da90b8002cceab8d3af6e34 100644 --- a/src/components/StandardTable/index.js +++ b/src/components/StandardTable/index.js @@ -38,14 +38,10 @@ class StandardTable extends PureComponent { handleRowSelectChange = (selectedRowKeys, selectedRows) => { let { needTotalList } = this.state; - needTotalList = needTotalList.map(item => { - return { - ...item, - total: selectedRows.reduce((sum, val) => { - return sum + parseFloat(val[item.dataIndex], 10); - }, 0), - }; - }); + needTotalList = needTotalList.map(item => ({ + ...item, + total: selectedRows.reduce((sum, val) => sum + parseFloat(val[item.dataIndex], 10), 0), + })); const { onSelectRow } = this.props; if (onSelectRow) { onSelectRow(selectedRows); diff --git a/src/components/TagSelect/index.js b/src/components/TagSelect/index.js index dff382423f68fd0a2e6c125cff90e303d173faa4..c36cd6722e4e32e28ae9140a95a6d53808cbe2f0 100644 --- a/src/components/TagSelect/index.js +++ b/src/components/TagSelect/index.js @@ -18,6 +18,7 @@ class TagSelect extends Component { static defaultProps = { hideCheckAll: false, }; + constructor(props) { super(props); this.state = { @@ -80,13 +81,10 @@ class TagSelect extends Component { }); }; - isTagSelectOption = node => { - return ( - node && - node.type && - (node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption') - ); - }; + isTagSelectOption = node => + node && + node.type && + (node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption'); render() { const { value, expand } = this.state; diff --git a/src/components/_utils/pathTools.js b/src/components/_utils/pathTools.js index 7d49400a41c6f975b072bb4cda467218be40e9c6..bfb94e74e0d354797ab573f7cdcf13a81983716b 100644 --- a/src/components/_utils/pathTools.js +++ b/src/components/_utils/pathTools.js @@ -1,7 +1,6 @@ // /userinfo/2144/id => ['/userinfo','/useinfo/2144,'/userindo/2144/id'] +// eslint-disable-next-line import/prefer-default-export export function urlToList(url) { const urllist = url.split('/').filter(i => i); - return urllist.map((urlItem, index) => { - return `/${urllist.slice(0, index + 1).join('/')}`; - }); + return urllist.map((urlItem, index) => `/${urllist.slice(0, index + 1).join('/')}`); } diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 9754ebd203df1fe79a3f28e7fd7f7be17f581f6f..e949f5276903b71e9afb9b908b7f1e35e37a89ab 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -174,6 +174,7 @@ class BasicLayout extends React.PureComponent { children, location: { pathname }, } = this.props; + const { rendering } = this.state; const isTop = PropsLayout === 'topmenu'; const layout = ( @@ -209,7 +210,7 @@ class BasicLayout extends React.PureComponent { )} - {this.state.rendering && process.env.NODE_ENV === 'production' ? null : ( // Do show SettingDrawer in production + {rendering && process.env.NODE_ENV === 'production' ? null : ( // Do show SettingDrawer in production )} diff --git a/src/layouts/Header.js b/src/layouts/Header.js index 77825be4df703df2294abbb1e77662762d7d1188..3229daf902cf66be1006f2bb2a6b6649786574c9 100644 --- a/src/layouts/Header.js +++ b/src/layouts/Header.js @@ -71,7 +71,7 @@ class HeaderView extends PureComponent { } }; - handScroll = e => { + handScroll = () => { const { autoHideHeader } = this.props; const { visible } = this.state; if (!autoHideHeader) { @@ -99,7 +99,6 @@ class HeaderView extends PureComponent { } this.oldScrollTop = scrollTop; this.ticking = false; - return; }); } this.ticking = false; diff --git a/src/layouts/PageHeaderLayout.js b/src/layouts/PageHeaderLayout.js index 9b8ae660ca1363906595b54e368bb3ae07e25acc..a3f51c595464d395c3dd40be4fd975ce34f31b7d 100644 --- a/src/layouts/PageHeaderLayout.js +++ b/src/layouts/PageHeaderLayout.js @@ -2,33 +2,31 @@ import React from 'react'; import { FormattedMessage } from 'umi/locale'; import Link from 'umi/link'; import PageHeader from '@/components/PageHeader'; +import { connect } from 'dva'; import GridContent from './GridContent'; import styles from './PageHeaderLayout.less'; import MenuContext from './MenuContext'; -import { connect } from 'dva'; const PageHeaderLayout = ({ children, grid, wrapperClassName, top, ...restProps }) => (
{top} - {value => { - return ( - } - {...value} - key="pageheader" - {...restProps} - linkElement={Link} - itemRender={item => { - if (item.locale) { - return ; - } - return item.name; - }} - /> - ); - }} + {value => ( + } + {...value} + key="pageheader" + {...restProps} + linkElement={Link} + itemRender={item => { + if (item.locale) { + return ; + } + return item.name; + }} + /> + )} {children ? (
diff --git a/src/pages/Account/Center/Articles.js b/src/pages/Account/Center/Articles.js index 610b36c9cef23e284e75fd1c0fb90fa92b8e2d97..ece186173ff77e752afc1f2cf094b2c2d4ddd686 100644 --- a/src/pages/Account/Center/Articles.js +++ b/src/pages/Account/Center/Articles.js @@ -24,7 +24,8 @@ export default class Center extends PureComponent {
{content}
- {owner} 发布在 {href} + {owner} 发布在 + {href} {moment(updatedAt).format('YYYY-MM-DD HH:mm')}
diff --git a/src/pages/Account/Settings/BindingView.js b/src/pages/Account/Settings/BindingView.js index 081ce9a17be3648e6c8de530ae23739a69917508..1080e3505c09b6414e1a634752f6631b8eefbd16 100644 --- a/src/pages/Account/Settings/BindingView.js +++ b/src/pages/Account/Settings/BindingView.js @@ -3,40 +3,38 @@ import { formatMessage, FormattedMessage } from 'umi/locale'; import { Icon, List } from 'antd'; class BindingView extends Component { - getData = () => { - return [ - { - title: formatMessage({ id: 'app.settings.binding.taobao' }, {}), - description: formatMessage({ id: 'app.settings.binding.taobao-description' }, {}), - actions: [ - - - , - ], - avatar: , - }, - { - title: formatMessage({ id: 'app.settings.binding.alipay' }, {}), - description: formatMessage({ id: 'app.settings.binding.alipay-description' }, {}), - actions: [ - - - , - ], - avatar: , - }, - { - title: formatMessage({ id: 'app.settings.binding.dingding' }, {}), - description: formatMessage({ id: 'app.settings.binding.dingding-description' }, {}), - actions: [ - - - , - ], - avatar: , - }, - ]; - }; + getData = () => [ + { + title: formatMessage({ id: 'app.settings.binding.taobao' }, {}), + description: formatMessage({ id: 'app.settings.binding.taobao-description' }, {}), + actions: [ + + + , + ], + avatar: , + }, + { + title: formatMessage({ id: 'app.settings.binding.alipay' }, {}), + description: formatMessage({ id: 'app.settings.binding.alipay-description' }, {}), + actions: [ + + + , + ], + avatar: , + }, + { + title: formatMessage({ id: 'app.settings.binding.dingding' }, {}), + description: formatMessage({ id: 'app.settings.binding.dingding-description' }, {}), + actions: [ + + + , + ], + avatar: , + }, + ]; render() { return ( diff --git a/src/pages/Account/Settings/GeographicView.js b/src/pages/Account/Settings/GeographicView.js index dab3a98005df7e9f4d1b7ea5dab9bffa0ef53d04..b4f7a99b1b956ad08677a9afbd5d352e3368d568 100644 --- a/src/pages/Account/Settings/GeographicView.js +++ b/src/pages/Account/Settings/GeographicView.js @@ -55,13 +55,11 @@ export default class GeographicView extends PureComponent { ); } - return list.map(item => { - return ( - - ); - }); + return list.map(item => ( + + )); }; selectProvinceItem = item => { diff --git a/src/pages/Account/Settings/SecurityView.js b/src/pages/Account/Settings/SecurityView.js index a58766b36ff330e85da4d6762bad1639d375d064..97cde06118333c641445a56e7dcf66d77ed07c5f 100644 --- a/src/pages/Account/Settings/SecurityView.js +++ b/src/pages/Account/Settings/SecurityView.js @@ -23,66 +23,64 @@ const passwordStrength = { }; class SecurityView extends Component { - getData = () => { - return [ - { - title: formatMessage({ id: 'app.settings.security.password' }, {}), - description: ( - - {formatMessage({ id: 'app.settings.security.password-description' }, {})}: - {passwordStrength.strong} - - ), - actions: [ - - - , - ], - }, - { - title: formatMessage({ id: 'app.settings.security.phone' }, {}), - description: `${formatMessage( - { id: 'app.settings.security.phone-description' }, - {} - )}:138****8293`, - actions: [ - - - , - ], - }, - { - title: formatMessage({ id: 'app.settings.security.question' }, {}), - description: formatMessage({ id: 'app.settings.security.question-description' }, {}), - actions: [ - - - , - ], - }, - { - title: formatMessage({ id: 'app.settings.security.email' }, {}), - description: `${formatMessage( - { id: 'app.settings.security.email-description' }, - {} - )}:ant***sign.com`, - actions: [ - - - , - ], - }, - { - title: formatMessage({ id: 'app.settings.security.mfa' }, {}), - description: formatMessage({ id: 'app.settings.security.mfa-description' }, {}), - actions: [ - - - , - ], - }, - ]; - }; + getData = () => [ + { + title: formatMessage({ id: 'app.settings.security.password' }, {}), + description: ( + + {formatMessage({ id: 'app.settings.security.password-description' }, {})}: + {passwordStrength.strong} + + ), + actions: [ + + + , + ], + }, + { + title: formatMessage({ id: 'app.settings.security.phone' }, {}), + description: `${formatMessage( + { id: 'app.settings.security.phone-description' }, + {} + )}:138****8293`, + actions: [ + + + , + ], + }, + { + title: formatMessage({ id: 'app.settings.security.question' }, {}), + description: formatMessage({ id: 'app.settings.security.question-description' }, {}), + actions: [ + + + , + ], + }, + { + title: formatMessage({ id: 'app.settings.security.email' }, {}), + description: `${formatMessage( + { id: 'app.settings.security.email-description' }, + {} + )}:ant***sign.com`, + actions: [ + + + , + ], + }, + { + title: formatMessage({ id: 'app.settings.security.mfa' }, {}), + description: formatMessage({ id: 'app.settings.security.mfa-description' }, {}), + actions: [ + + + , + ], + }, + ]; render() { return ( diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 62679aa8088e492500c392e09fffc8e4180afaa3..b7f7e6ba5060d494a10230fcc1b28e8d23144177 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -157,13 +157,12 @@ class Analysis extends Component { salesTypeDataOffline, } = chart; const loading = propsLoding || stateLoading; - const salesPieData = - salesType === 'all' - ? salesTypeData - : salesType === 'online' - ? salesTypeDataOnline - : salesTypeDataOffline; - + let salesPieData; + if (salesType === 'all') { + salesPieData = salesTypeData; + } else { + salesPieData = salesType === 'online' ? salesTypeDataOnline : salesTypeDataOffline; + } const menu = ( 操作一 diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js index 6d6e73a33440e36c96a9b3ca6173150259d70e6b..0b79072dcd106bdc733423b11c5a6e549db9f986 100644 --- a/src/pages/Dashboard/Workplace.js +++ b/src/pages/Dashboard/Workplace.js @@ -124,9 +124,13 @@ export default class Workplace extends PureComponent {
-
早安,{currentUser.name},祝你开心每一天!
+
+ 早安, + {currentUser.name} + ,祝你开心每一天! +
- {currentUser.title} | {currentUser.group} + {currentUser.title} |{currentUser.group}
@@ -141,8 +145,7 @@ export default class Workplace extends PureComponent {

团队内排名

- 8 - / 24 + 8 / 24

diff --git a/src/pages/Forms/TableForm.js b/src/pages/Forms/TableForm.js index 3ad0a79126acd66794f5fbb908a4a99e17181a5b..dc590fc5d73ac626c249008ea39a4f2b5b9f86d9 100644 --- a/src/pages/Forms/TableForm.js +++ b/src/pages/Forms/TableForm.js @@ -4,6 +4,9 @@ import isEqual from 'lodash.isequal'; import styles from './style.less'; export default class TableForm extends PureComponent { + index = 0; + + cacheOriginData = {}; constructor(props) { super(props); @@ -26,10 +29,6 @@ export default class TableForm extends PureComponent { }; } - index = 0; - - cacheOriginData = {}; - getRowByKey(key, newData) { const { data } = this.state; return (newData || data).filter(item => item.key === key)[0]; @@ -244,9 +243,7 @@ export default class TableForm extends PureComponent { columns={columns} dataSource={data} pagination={false} - rowClassName={record => { - return record.editable ? styles.editable : ''; - }} + rowClassName={record => (record.editable ? styles.editable : '')} />