diff --git a/.eslintrc.js b/.eslintrc.js index e29c1a8a6221f03d61414a04824b100e0e46a6b7..c20a185d2d289f0a3c16702e83b7c484aca02e49 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,6 +19,7 @@ module.exports = { 'react/jsx-no-bind': [0], 'react/prop-types': [0], 'react/prefer-stateless-function': [0], + 'react/jsx-one-expression-per-line': [0], 'react/jsx-wrap-multilines': [ 'error', { diff --git a/src/components/Authorized/PromiseRender.js b/src/components/Authorized/PromiseRender.js index 02518ad5d0f03b00fdb4cef68ff69e2296130df3..b18bcbece1db86bf6bf1198dad5eb859f1b6408d 100644 --- a/src/components/Authorized/PromiseRender.js +++ b/src/components/Authorized/PromiseRender.js @@ -5,13 +5,16 @@ export default class PromiseRender extends React.PureComponent { state = { component: null, }; + componentDidMount() { this.setRenderComponent(this.props); } + componentWillReceiveProps(nextProps) { // new Props enter this.setRenderComponent(nextProps); } + // set render Component : ok or error setRenderComponent(props) { const ok = this.checkIsInstantiation(props.ok); @@ -28,6 +31,7 @@ export default class PromiseRender extends React.PureComponent { }); }); } + // Determine whether the incoming component has been instantiated // AuthorizedRoute is already instantiated // Authorized render is already instantiated, children is no instantiated @@ -38,6 +42,7 @@ export default class PromiseRender extends React.PureComponent { } return () => target; }; + render() { const Component = this.state.component; return Component ? ( diff --git a/src/components/Charts/TimelineChart/index.js b/src/components/Charts/TimelineChart/index.js index e7ab6b11dea63b237f423855757371bc5fcb3516..018464da5ea3c9f2dbe1d548bf9ec8038c753550 100644 --- a/src/components/Charts/TimelineChart/index.js +++ b/src/components/Charts/TimelineChart/index.js @@ -44,8 +44,7 @@ export default class TimelineChart extends React.Component { }); const dv = ds.createView(); - dv - .source(data) + dv.source(data) .transform({ type: 'filter', callback: obj => { diff --git a/src/components/Charts/WaterWave/index.js b/src/components/Charts/WaterWave/index.js index 709384274cdfcb76dc7cb47cb8f5b94530f02476..5ea6dcc36f01b65f15703556ad6d9d17f6a4e9fe 100644 --- a/src/components/Charts/WaterWave/index.js +++ b/src/components/Charts/WaterWave/index.js @@ -189,7 +189,10 @@ export default class WaterWave extends PureComponent {
{title && {title}} -

{percent}%

+

+ {percent} + % +

); diff --git a/src/components/CountDown/index.js b/src/components/CountDown/index.js index 875fb1e2c588fb58ea0860a828fb5bc863ef143c..b67fab2f9d4a21cce05be763a1f5b445188b31e4 100644 --- a/src/components/CountDown/index.js +++ b/src/components/CountDown/index.js @@ -39,7 +39,9 @@ class CountDown extends Component { } timer = 0; + interval = 1000; + initTime = props => { let lastTime = 0; let targetTime = 0; @@ -58,6 +60,7 @@ class CountDown extends Component { lastTime: lastTime < 0 ? 0 : lastTime, }; }; + // defaultFormat = time => ( // {moment(time).format('hh:mm:ss')} // ); @@ -70,10 +73,15 @@ 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)} ); }; + tick = () => { const { onEnd } = this.props; let { lastTime } = this.state; diff --git a/src/components/DescriptionList/Description.js b/src/components/DescriptionList/Description.js index 3e41c07173f868852899bccb5db79e8d58911520..002ad2849e50b0d5372e6e7f469fce3f709840d5 100644 --- a/src/components/DescriptionList/Description.js +++ b/src/components/DescriptionList/Description.js @@ -10,8 +10,8 @@ const Description = ({ term, column, className, children, ...restProps }) => { return ( {term &&
{term}
} - {children !== null && children !== undefined && -
{children}
} + {children !== null && + children !== undefined &&
{children}
} ); }; diff --git a/src/components/DescriptionList/DescriptionList.js b/src/components/DescriptionList/DescriptionList.js index 382d7e85f0cbf04507d76cf40e40a586911e075b..73bb5f5f92262c1e1f550d0e6e2a28811717b5da 100644 --- a/src/components/DescriptionList/DescriptionList.js +++ b/src/components/DescriptionList/DescriptionList.js @@ -22,7 +22,10 @@ const DescriptionList = ({
{title ?
{title}
: null} - {React.Children.map(children, child => child ? React.cloneElement(child, { column }) : child)} + {React.Children.map( + children, + child => (child ? React.cloneElement(child, { column }) : child) + )}
); diff --git a/src/components/EditableItem/index.js b/src/components/EditableItem/index.js index fcda844e3f5af30970b2b8b58b4e4d6a9dcfe8c7..5b22631c0e10c93f8a7f76aab29c32bc0d2a7550 100644 --- a/src/components/EditableItem/index.js +++ b/src/components/EditableItem/index.js @@ -7,19 +7,23 @@ export default class EditableItem extends PureComponent { value: this.props.value, editable: false, }; + handleChange = e => { const { value } = e.target; this.setState({ value }); }; + check = () => { this.setState({ editable: false }); if (this.props.onChange) { this.props.onChange(this.state.value); } }; + edit = () => { this.setState({ editable: true }); }; + render() { const { value, editable } = this.state; return ( diff --git a/src/components/EditableLinkGroup/index.js b/src/components/EditableLinkGroup/index.js index 2d0b4aa83a34921f6936c24b104d4933475c969d..ae3d93c712b8b019078fe37bd07286716349ef3f 100644 --- a/src/components/EditableLinkGroup/index.js +++ b/src/components/EditableLinkGroup/index.js @@ -17,6 +17,7 @@ class EditableLinkGroup extends PureComponent { onAdd: () => {}, linkElement: 'a', }; + render() { const { links, linkElement, onAdd } = this.props; return ( diff --git a/src/components/GlobalHeader/index.js b/src/components/GlobalHeader/index.js index 0f405f7bda25f77991dcce06f7aa24cefefbd9a0..f84d2d2eb2fffc1382925087655fb8aa3e96a94b 100644 --- a/src/components/GlobalHeader/index.js +++ b/src/components/GlobalHeader/index.js @@ -12,8 +12,9 @@ export default class GlobalHeader extends PureComponent { componentWillUnmount() { this.triggerResizeEvent.cancel(); } + getNoticeData() { - const { notices} = this.props; + const { notices } = this.props; if (notices == null || notices.length === 0) { return {}; } @@ -43,6 +44,7 @@ export default class GlobalHeader extends PureComponent { }); return groupBy(newNotices, 'type'); } + toggle = () => { const { collapsed, onCollapse } = this.props; onCollapse(!collapsed); @@ -67,7 +69,7 @@ export default class GlobalHeader extends PureComponent { onNoticeClear, } = this.props; if (currentUser == null) { - currentUser = {} + currentUser = {}; } const menu = ( diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js index a08ad7f4f6e074a98f9746983373f2239c576db8..de8a6be51786b08e45c9c6528e7a7c5a758b2dd8 100644 --- a/src/components/HeaderSearch/index.js +++ b/src/components/HeaderSearch/index.js @@ -31,17 +31,20 @@ export default class HeaderSearch extends PureComponent { searchMode: this.props.defaultOpen, value: '', }; + onKeyDown = e => { if (e.key === 'Enter') { this.debouncePressEnter(); } }; + onChange = value => { this.setState({ value }); if (this.props.onChange) { this.props.onChange(); } }; + // NOTE: 不能小于500,如果长按某键,第一次触发auto repeat的间隔是500ms,小于500会导致触发2次 @Bind() @Debounce(500, { @@ -51,6 +54,7 @@ export default class HeaderSearch extends PureComponent { debouncePressEnter() { this.props.onPressEnter(this.state.value); } + enterSearchMode = () => { this.setState({ searchMode: true }, () => { if (this.state.searchMode) { @@ -58,12 +62,14 @@ export default class HeaderSearch extends PureComponent { } }); }; + leaveSearchMode = () => { this.setState({ searchMode: false, value: '', }); }; + render() { const { className, placeholder, ...restProps } = this.props; delete restProps.defaultOpen; // for rc-select not affected diff --git a/src/components/Login/LoginItem.js b/src/components/Login/LoginItem.js index 98efb3337e49c204a747a84e1cdf09930104344a..a4504ad5436dc7fed6a3cfe4ccaa3019a892f951 100644 --- a/src/components/Login/LoginItem.js +++ b/src/components/Login/LoginItem.js @@ -14,20 +14,24 @@ function generator({ defaultProps, defaultRules, type }) { form: PropTypes.object, updateActive: PropTypes.func, }; + constructor(props) { super(props); this.state = { count: 0, }; } + componentDidMount() { if (this.context.updateActive) { this.context.updateActive(this.props.name); } } + componentWillUnmount() { clearInterval(this.interval); } + onGetCaptcha = () => { let count = 59; this.setState({ count }); @@ -42,6 +46,7 @@ function generator({ defaultProps, defaultRules, type }) { } }, 1000); }; + render() { const { getFieldDecorator } = this.context.form; const options = {}; diff --git a/src/components/Login/LoginTab.js b/src/components/Login/LoginTab.js index 750bfe7c24df5ec77e846475cef78aca787e0aff..52de12d2e098ae03946c6a0a6b9f5f0f5cb5442d 100644 --- a/src/components/Login/LoginTab.js +++ b/src/components/Login/LoginTab.js @@ -14,18 +14,22 @@ const generateId = (() => { export default class LoginTab extends Component { static __ANT_PRO_LOGIN_TAB = true; + static contextTypes = { tabUtil: PropTypes.object, }; + constructor(props) { super(props); this.uniqueId = generateId('login-tab-'); } + componentWillMount() { if (this.context.tabUtil) { this.context.tabUtil.addTab(this.uniqueId); } } + render() { return ; } diff --git a/src/components/Login/index.js b/src/components/Login/index.js index 58c4e468dcf1c299e60dbe076686192d58b9ec08..31235017cc4f260f204c36d92c71e43bb9d0ba4a 100644 --- a/src/components/Login/index.js +++ b/src/components/Login/index.js @@ -33,6 +33,7 @@ class Login extends Component { tabs: [], active: {}, }; + getChildContext() { return { tabUtil: { @@ -61,12 +62,14 @@ class Login extends Component { }, }; } + onSwitch = type => { this.setState({ type, }); this.props.onTabChange(type); }; + handleSubmit = e => { e.preventDefault(); const { active, type } = this.state; @@ -75,6 +78,7 @@ class Login extends Component { this.props.onSubmit(err, values); }); }; + render() { const { className, children } = this.props; const { type, tabs } = this.state; diff --git a/src/components/NoticeIcon/index.js b/src/components/NoticeIcon/index.js index a207be8692606d266097f6dc866c114a88e34eba..5561f0ef73ddc8c7ccf5dc165062387ce46e80d0 100644 --- a/src/components/NoticeIcon/index.js +++ b/src/components/NoticeIcon/index.js @@ -21,6 +21,7 @@ export default class NoticeIcon extends PureComponent { }, emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg', }; + constructor(props) { super(props); this.state = {}; @@ -28,14 +29,17 @@ export default class NoticeIcon extends PureComponent { this.state.tabType = props.children[0].props.title; } } + onItemClick = (item, tabProps) => { const { onItemClick } = this.props; onItemClick(item, tabProps); }; + onTabChange = tabType => { this.setState({ tabType }); this.props.onTabChange(tabType); }; + getNotificationBox() { const { children, loading, locale } = this.props; if (!children) { @@ -67,6 +71,7 @@ export default class NoticeIcon extends PureComponent { ); } + render() { const { className, count, popupAlign, onPopupVisibleChange } = this.props; const noticeButtonClass = classNames(className, styles.noticeButton); diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index 3080ed041a6bb43fd728cb8cba3fabe907e1d748..ac9f628c17539e675a22786b856f879db899c10c 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -40,11 +40,13 @@ export default class PageHeader extends PureComponent { this.getBreadcrumbDom(); } } + onChange = key => { if (this.props.onTabChange) { this.props.onTabChange(key); } }; + getBreadcrumbProps = () => { return { routes: this.props.routes || this.context.routes, @@ -53,12 +55,14 @@ export default class PageHeader extends PureComponent { breadcrumbNameMap: this.props.breadcrumbNameMap || this.context.breadcrumbNameMap, }; }; + getBreadcrumbDom = () => { const breadcrumb = this.conversionBreadcrumbList(); this.setState({ breadcrumb, }); }; + // Generated according to props conversionFromProps = () => { const { breadcrumbList, breadcrumbSeparator, linkElement = 'a' } = this.props; @@ -80,6 +84,7 @@ export default class PageHeader extends PureComponent { ); }; + conversionFromLocation = (routerLocation, breadcrumbNameMap) => { const { breadcrumbSeparator, linkElement = 'a' } = this.props; // Convert the url to an array @@ -116,6 +121,7 @@ export default class PageHeader extends PureComponent { ); }; + /** * 将参数转化为面包屑 * Convert parameters into breadcrumbs @@ -146,6 +152,7 @@ export default class PageHeader extends PureComponent { } return null; }; + // 渲染Breadcrumb 子节点 // Render the Breadcrumb child node itemRender = (route, params, routes, paths) => { diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 2068b7b88c5f9e42da785a4c0b2bea16f3142a34..fc93fca84aab6628987459586ccc7db745d2c306 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -28,14 +28,13 @@ const getIcon = icon => { * @param menu */ export const getFlatMenuKeys = menu => - menu - .reduce((keys, item) => { - keys.push(item.path); - if (item.children) { - return keys.concat(getFlatMenuKeys(item.children)); - } - return keys; - }, []); + menu.reduce((keys, item) => { + keys.push(item.path); + if (item.children) { + return keys.concat(getFlatMenuKeys(item.children)); + } + return keys; + }, []); /** * Find all matched menu keys based on paths @@ -43,11 +42,11 @@ export const getFlatMenuKeys = menu => * @param paths: [/abc, /abc/11, /abc/11/info] */ export const getMenuMatchKeys = (flatMenuKeys, paths) => - paths - .reduce((matchKeys, path) => ( - matchKeys.concat( - flatMenuKeys.filter(item => pathToRegexp(item).test(path)) - )), []); + paths.reduce( + (matchKeys, path) => + matchKeys.concat(flatMenuKeys.filter(item => pathToRegexp(item).test(path))), + [] + ); export default class SiderMenu extends PureComponent { constructor(props) { @@ -58,6 +57,7 @@ export default class SiderMenu extends PureComponent { openKeys: this.getDefaultCollapsedSubMenus(props), }; } + componentWillReceiveProps(nextProps) { if (nextProps.location.pathname !== this.props.location.pathname) { this.setState({ @@ -65,15 +65,20 @@ export default class SiderMenu extends PureComponent { }); } } + /** * Convert pathname to openKeys * /list/search/articles = > ['list','/list/search'] * @param props */ getDefaultCollapsedSubMenus(props) { - const { location: { pathname } } = props || this.props; + const { + location: { pathname }, + } = + props || this.props; return getMenuMatchKeys(this.flatMenuKeys, urlToList(pathname)); } + /** * 判断是否是http链接.返回 Link 或 a * Judge whether it is http link.return a or Link @@ -110,6 +115,7 @@ export default class SiderMenu extends PureComponent { ); }; + /** * get SubMenu or Item */ @@ -141,6 +147,7 @@ export default class SiderMenu extends PureComponent { return {this.getMenuItemPath(item)}; } }; + /** * 获得菜单子节点 * @memberof SiderMenu @@ -158,11 +165,15 @@ export default class SiderMenu extends PureComponent { }) .filter(item => item); }; + // Get the currently selected menu getSelectedMenuKeys = () => { - const { location: { pathname } } = this.props; + const { + location: { pathname }, + } = this.props; return getMenuMatchKeys(this.flatMenuKeys, urlToList(pathname)); }; + // conversion Path // 转化路径 conversionPath = path => { @@ -172,6 +183,7 @@ export default class SiderMenu extends PureComponent { return `/${path || ''}`.replace(/\/+/g, '/'); } }; + // permission to check checkPermissionItem = (authority, ItemDom) => { if (this.props.Authorized && this.props.Authorized.check) { @@ -180,9 +192,11 @@ export default class SiderMenu extends PureComponent { } return ItemDom; }; + isMainMenu = key => { return this.menus.some(item => key && (item.key === key || item.path === key)); }; + handleOpenChange = openKeys => { const lastOpenKey = openKeys[openKeys.length - 1]; const moreThanOne = openKeys.filter(openKey => this.isMainMenu(openKey)).length > 1; @@ -190,6 +204,7 @@ export default class SiderMenu extends PureComponent { openKeys: moreThanOne ? [lastOpenKey] : [...openKeys], }); }; + render() { const { logo, collapsed, onCollapse } = this.props; const { openKeys } = this.state; diff --git a/src/components/StandardTable/index.js b/src/components/StandardTable/index.js index 281d60e6b2f771609ec250f768191b5dbbf749f7..ea255cf80e63035e9d42ccadf9847a1aace76de0 100644 --- a/src/components/StandardTable/index.js +++ b/src/components/StandardTable/index.js @@ -63,7 +63,12 @@ class StandardTable extends PureComponent { render() { const { selectedRowKeys, needTotalList } = this.state; - const { data: { list, pagination }, loading, columns, rowKey } = this.props; + const { + data: { list, pagination }, + loading, + columns, + rowKey, + } = this.props; const paginationProps = { showSizeChanger: true, @@ -88,7 +93,8 @@ class StandardTable extends PureComponent { 已选择 {selectedRowKeys.length} 项   {needTotalList.map(item => ( - {item.title}总计  + {item.title} + 总计  {item.render ? item.render(item.total) : item.total} diff --git a/src/components/TagSelect/index.js b/src/components/TagSelect/index.js index 773b9c841a13fc1d9d8b098ef9ffd1ec66d5277b..d86425c120608a92a3b96a7af5e2cfa71bc24760 100644 --- a/src/components/TagSelect/index.js +++ b/src/components/TagSelect/index.js @@ -19,6 +19,7 @@ class TagSelect extends Component { expand: false, value: this.props.value || this.props.defaultValue || [], }; + componentWillReceiveProps(nextProps) { if ('value' in nextProps && nextProps.value) { this.setState({ value: nextProps.value }); diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index e587bc955e3c662060f0ead8754dd60e48e949d2..a6350edf651d0ebaa6bd8aa7add10e0ac3b8d5bc 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -89,9 +89,11 @@ class BasicLayout extends React.PureComponent { location: PropTypes.object, breadcrumbNameMap: PropTypes.object, }; + state = { isMobile, }; + getChildContext() { const { location, routerData } = this.props; return { @@ -99,6 +101,7 @@ class BasicLayout extends React.PureComponent { breadcrumbNameMap: getBreadcrumbNameMap(getMenuData(), routerData), }; } + componentDidMount() { this.enquireHandler = enquireScreen(mobile => { this.setState({ @@ -109,9 +112,11 @@ class BasicLayout extends React.PureComponent { type: 'user/fetchCurrent', }); } + componentWillUnmount() { unenquireScreen(this.enquireHandler); } + getPageTitle() { const { routerData, location } = this.props; const { pathname } = location; @@ -128,6 +133,7 @@ class BasicLayout extends React.PureComponent { } return title; } + getBaseRedirect = () => { // According to the url parameter to redirect // 这里是重定向的,重定向到 url 的 redirect 参数所示地址 @@ -148,12 +154,14 @@ class BasicLayout extends React.PureComponent { } return redirect; }; + handleMenuCollapse = collapsed => { this.props.dispatch({ type: 'global/changeLayoutCollapsed', payload: collapsed, }); }; + handleNoticeClear = type => { message.success(`清空了${type}`); this.props.dispatch({ @@ -161,6 +169,7 @@ class BasicLayout extends React.PureComponent { payload: type, }); }; + handleMenuClick = ({ key }) => { if (key === 'triggerError') { this.props.dispatch(routerRedux.push('/exception/trigger')); @@ -172,6 +181,7 @@ class BasicLayout extends React.PureComponent { }); } }; + handleNoticeVisibleChange = visible => { if (visible) { this.props.dispatch({ @@ -179,6 +189,7 @@ class BasicLayout extends React.PureComponent { }); } }; + render() { const { currentUser, diff --git a/src/layouts/UserLayout.js b/src/layouts/UserLayout.js index 8fb53534efcdba4d264bf88eeb9b0f531f2704ad..447f44fbb5eb23217b443fb95c11da1e9c9b34ee 100644 --- a/src/layouts/UserLayout.js +++ b/src/layouts/UserLayout.js @@ -41,6 +41,7 @@ class UserLayout extends React.PureComponent { } return title; } + render() { const { routerData, match } = this.props; return ( diff --git a/src/routes/Dashboard/Analysis.js b/src/routes/Dashboard/Analysis.js index 5e691e423ecb8d81a950f03ae30836e71e279000..617048998c8727d0be27671f979c6c757e8f379e 100644 --- a/src/routes/Dashboard/Analysis.js +++ b/src/routes/Dashboard/Analysis.js @@ -43,7 +43,9 @@ for (let i = 0; i < 7; i += 1) { } const Yuan = ({ children }) => ( - /* eslint-disable-line react/no-danger */ + /* eslint-disable-line react/no-danger */ ); @connect(({ chart, loading }) => ({ @@ -134,7 +136,9 @@ export default class Analysis extends Component { const salesPieData = salesType === 'all' ? salesTypeData - : salesType === 'online' ? salesTypeDataOnline : salesTypeDataOffline; + : salesType === 'online' + ? salesTypeDataOnline + : salesTypeDataOffline; const menu = ( @@ -201,7 +205,10 @@ export default class Analysis extends Component { sorter: (a, b) => a.range - b.range, render: (text, record) => ( - {text}% + + {text} + % + ), align: 'right', @@ -261,10 +268,12 @@ export default class Analysis extends Component { contentHeight={46} > - 周同比12% + 周同比 + 12% - 日环比11% + 日环比 + 11% @@ -313,10 +322,12 @@ export default class Analysis extends Component { footer={
- 周同比12% + 周同比 + 12% - 日环比11% + 日环比 + 11%
} @@ -455,9 +466,7 @@ export default class Analysis extends Component { {salesPieData.reduce((pre, now) => now.y + pre, 0)} - } + total={() => {salesPieData.reduce((pre, now) => now.y + pre, 0)}} data={salesPieData} valueFormat={value => {value}} height={248} diff --git a/src/routes/Dashboard/Workplace.js b/src/routes/Dashboard/Workplace.js index 9c8bdc799d1ceaabd7893713fae6d2d8a56004f3..4488561809248e5b2db1fe60b701ee7206329007 100644 --- a/src/routes/Dashboard/Workplace.js +++ b/src/routes/Dashboard/Workplace.js @@ -99,7 +99,9 @@ export default class Workplace extends PureComponent { } renderActivities() { - const { activities: { list } } = this.props; + const { + activities: { list }, + } = this.props; return list.map(item => { const events = item.template.split(/@\{([^{}]*)\}/gi).map(key => { if (item[key]) { @@ -165,7 +167,8 @@ export default class Workplace extends PureComponent {

团队内排名

- 8 / 24 + 8 + / 24

diff --git a/src/routes/Exception/triggerException.js b/src/routes/Exception/triggerException.js index 2dccfb75f29bd25dd16d9280114869c32462fb80..4699d4584b893f59b2b17b2f4ad815d7962ba6fe 100644 --- a/src/routes/Exception/triggerException.js +++ b/src/routes/Exception/triggerException.js @@ -10,6 +10,7 @@ export default class TriggerException extends PureComponent { state = { isloading: false, }; + triggerError = code => { this.setState({ isloading: true, @@ -21,6 +22,7 @@ export default class TriggerException extends PureComponent { }, }); }; + render() { return ( diff --git a/src/routes/Forms/AdvancedForm.js b/src/routes/Forms/AdvancedForm.js index 16b7e3b02946570445720cb9e3b69d24bd8aa52e..741a37b101156285270968a099f48f793ebfff44 100644 --- a/src/routes/Forms/AdvancedForm.js +++ b/src/routes/Forms/AdvancedForm.js @@ -61,12 +61,15 @@ class AdvancedForm extends PureComponent { state = { width: '100%', }; + componentDidMount() { window.addEventListener('resize', this.resizeFooterToolbar); } + componentWillUnmount() { window.removeEventListener('resize', this.resizeFooterToolbar); } + resizeFooterToolbar = () => { const sider = document.querySelectorAll('.ant-layout-sider')[0]; const width = `calc(100% - ${sider.style.width})`; @@ -74,6 +77,7 @@ class AdvancedForm extends PureComponent { this.setState({ width }); } }; + render() { const { form, dispatch, submitting } = this.props; const { getFieldDecorator, validateFieldsAndScroll, getFieldsError } = form; diff --git a/src/routes/Forms/BasicForm.js b/src/routes/Forms/BasicForm.js index ed41cb3b81bc4dad529ba6c5bc293a8ca1a726f9..7f5c7e0b517725fc1b61ddbb56cb3645785735c5 100644 --- a/src/routes/Forms/BasicForm.js +++ b/src/routes/Forms/BasicForm.js @@ -36,6 +36,7 @@ export default class BasicForms extends PureComponent { } }); }; + render() { const { submitting } = this.props; const { getFieldDecorator, getFieldValue } = this.props.form; @@ -134,7 +135,8 @@ export default class BasicForms extends PureComponent { {...formItemLayout} label={ - 邀评人(选填) + 邀评人 + (选填) } > @@ -146,7 +148,8 @@ export default class BasicForms extends PureComponent { {...formItemLayout} label={ - 权重(选填) + 权重 + (选填) } > diff --git a/src/routes/Forms/StepForm/Step2.js b/src/routes/Forms/StepForm/Step2.js index 4e7df540b99226de3e28c4b485173f11501094e6..9b142007a8aaef7e6c2af22b2bc06d882dca8772 100644 --- a/src/routes/Forms/StepForm/Step2.js +++ b/src/routes/Forms/StepForm/Step2.js @@ -55,7 +55,11 @@ class Step2 extends React.PureComponent { {data.amount} - ({digitUppercase(data.amount)}) + + ( + {digitUppercase(data.amount)} + ) + diff --git a/src/routes/Forms/StepForm/index.js b/src/routes/Forms/StepForm/index.js index 3ab2374ba7c223bec541d1fe2cf9e9287033dc8a..5b7f703c8890f879d2fdeb8a9551c00d100c249e 100644 --- a/src/routes/Forms/StepForm/index.js +++ b/src/routes/Forms/StepForm/index.js @@ -24,6 +24,7 @@ export default class StepForm extends PureComponent { return 0; } } + render() { const { match, routerData, location } = this.props; return ( diff --git a/src/routes/Forms/TableForm.js b/src/routes/Forms/TableForm.js index 0cc07fd16a5f85d1b0f3824fd81877e424c9405c..65b679d584f8cdc8810e026bac53b54564f17975 100644 --- a/src/routes/Forms/TableForm.js +++ b/src/routes/Forms/TableForm.js @@ -11,6 +11,7 @@ export default class TableForm extends PureComponent { loading: false, }; } + componentWillReceiveProps(nextProps) { if ('value' in nextProps) { this.setState({ @@ -18,11 +19,15 @@ export default class TableForm extends PureComponent { }); } } + getRowByKey(key, newData) { return (newData || this.state.data).filter(item => item.key === key)[0]; } + index = 0; + cacheOriginData = {}; + toggleEditable = (e, key) => { e.preventDefault(); const newData = this.state.data.map(item => ({ ...item })); @@ -36,11 +41,13 @@ export default class TableForm extends PureComponent { this.setState({ data: newData }); } }; + remove(key) { const newData = this.state.data.filter(item => item.key !== key); this.setState({ data: newData }); this.props.onChange(newData); } + newMember = () => { const newData = this.state.data.map(item => ({ ...item })); newData.push({ @@ -54,11 +61,13 @@ export default class TableForm extends PureComponent { this.index += 1; this.setState({ data: newData }); }; + handleKeyPress(e, key) { if (e.key === 'Enter') { this.saveRow(e, key); } } + handleFieldChange(e, fieldName, key) { const newData = this.state.data.map(item => ({ ...item })); const target = this.getRowByKey(key, newData); @@ -67,6 +76,7 @@ export default class TableForm extends PureComponent { this.setState({ data: newData }); } } + saveRow(e, key) { e.persist(); this.setState({ @@ -94,6 +104,7 @@ export default class TableForm extends PureComponent { }); }, 500); } + cancel(e, key) { this.clickedCancel = true; e.preventDefault(); @@ -107,6 +118,7 @@ export default class TableForm extends PureComponent { this.setState({ data: newData }); this.clickedCancel = false; } + render() { const columns = [ { diff --git a/src/routes/List/Applications.js b/src/routes/List/Applications.js index bfc3337548a5eef58c78d5af7555be1ef42c5327..60a846f5d2a035d8ed0afc2703519113197a57c5 100644 --- a/src/routes/List/Applications.js +++ b/src/routes/List/Applications.js @@ -63,7 +63,11 @@ export default class FilterCardList extends PureComponent { }; render() { - const { list: { list }, loading, form } = this.props; + const { + list: { list }, + loading, + form, + } = this.props; const { getFieldDecorator } = form; const CardInfo = ({ activeUser, newUser }) => ( diff --git a/src/routes/List/Articles.js b/src/routes/List/Articles.js index 2f6b639d1d73e7f9a261273333ff8a89a211fd4a..405f8ec560c84395acef6f6d87d666bb575a460b 100644 --- a/src/routes/List/Articles.js +++ b/src/routes/List/Articles.js @@ -39,7 +39,11 @@ export default class SearchList extends Component { }; render() { - const { form, list: { list }, loading } = this.props; + const { + form, + list: { list }, + loading, + } = this.props; const { getFieldDecorator } = form; const owners = [ @@ -77,7 +81,8 @@ export default class SearchList extends Component {
{content}
- {owner} 发布在 {href} + {owner} 发布在 + {href} {moment(updatedAt).format('YYYY-MM-DD HH:mm')}
diff --git a/src/routes/List/BasicList.js b/src/routes/List/BasicList.js index 78e81192a90fc390567129a41d9502286fe1dc5d..155be87c2c26e888c2a585f2d18a471a1cf80a5c 100644 --- a/src/routes/List/BasicList.js +++ b/src/routes/List/BasicList.js @@ -39,7 +39,10 @@ export default class BasicList extends PureComponent { } render() { - const { list: { list }, loading } = this.props; + const { + list: { list }, + loading, + } = this.props; const Info = ({ title, value, bordered }) => (
diff --git a/src/routes/List/CardList.js b/src/routes/List/CardList.js index 8111770f80f89c3c046ffc0e8405bd12335b495c..1441596ede3ef700bae3efdd4a1008f9a3909ce0 100644 --- a/src/routes/List/CardList.js +++ b/src/routes/List/CardList.js @@ -22,7 +22,10 @@ export default class CardList extends PureComponent { } render() { - const { list: { list }, loading } = this.props; + const { + list: { list }, + loading, + } = this.props; const content = (
diff --git a/src/routes/List/Projects.js b/src/routes/List/Projects.js index 1617cf5529e120a94b764af9464d491f549a5207..b17209729b73761f6891f71190cc751228719eaa 100644 --- a/src/routes/List/Projects.js +++ b/src/routes/List/Projects.js @@ -48,7 +48,11 @@ export default class CoverCardList extends PureComponent { }; render() { - const { list: { list = [] }, loading, form } = this.props; + const { + list: { list = [] }, + loading, + form, + } = this.props; const { getFieldDecorator } = form; const cardList = list ? ( diff --git a/src/routes/List/TableList.js b/src/routes/List/TableList.js index d67fef726ca10855229980cdb040650b1b85d38e..fa8b6d129783377cc7fed76adea4641bd32bfffd 100644 --- a/src/routes/List/TableList.js +++ b/src/routes/List/TableList.js @@ -312,7 +312,10 @@ export default class TableList extends PureComponent { } render() { - const { rule: { data }, loading } = this.props; + const { + rule: { data }, + loading, + } = this.props; const { selectedRows, modalVisible } = this.state; const columns = [ diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js index cb0ccce9a36a79457f505ff16cfd54f354c7ae87..0df2beae879b680dda2622b44a83d00dd2c1ec6e 100644 --- a/src/routes/Profile/AdvancedProfile.js +++ b/src/routes/Profile/AdvancedProfile.js @@ -333,7 +333,8 @@ export default class AdvancedProfile extends Component {
- 暂无数据 + + 暂无数据
- 您的账户已被冻结 + + 您的账户已被冻结 立即解冻
- 您的账户还不具备申请资格 + + 您的账户还不具备申请资格 立即升级 diff --git a/src/routes/Result/Success.js b/src/routes/Result/Success.js index 9e20e2780a4117bd4a3cd018aa11cba340ebc499..61263b5609fd65a501416f1f50af440661d52a89 100644 --- a/src/routes/Result/Success.js +++ b/src/routes/Result/Success.js @@ -15,7 +15,8 @@ const desc1 = ( }} >
- 曲丽丽 + 曲丽丽 +
2016-12-12 12:32
@@ -24,7 +25,8 @@ const desc1 = ( const desc2 = (
- 周毛毛 + 周毛毛 +
催一下 diff --git a/src/routes/User/RegisterResult.js b/src/routes/User/RegisterResult.js index 9c9bbe5f939d5af1fe1913a5bd71ab1e4f1a7500..3e86ee6ea9af6398ae6ce8c9ffd3f076f1af3c0f 100644 --- a/src/routes/User/RegisterResult.js +++ b/src/routes/User/RegisterResult.js @@ -23,7 +23,8 @@ export default ({ location }) => ( type="success" title={
- 你的账户:{location.state ? location.state.account : 'AntDesign@example.com'} 注册成功 + 你的账户: + {location.state ? location.state.account : 'AntDesign@example.com'} 注册成功
} description="激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。"