diff --git a/src/components/Charts/Bar/index.js b/src/components/Charts/Bar/index.js index 1a2d5c70add7cd0509a50675c568d138131536f7..c91e6701231fc5ff9cb1465aa8b13a21a9f42cc1 100644 --- a/src/components/Charts/Bar/index.js +++ b/src/components/Charts/Bar/index.js @@ -12,7 +12,7 @@ class Bar extends Component { }; componentDidMount() { - window.addEventListener('resize', this.resize); + window.addEventListener('resize', this.resize, { passive: true }); } componentWillUnmount() { diff --git a/src/components/Charts/Pie/index.js b/src/components/Charts/Pie/index.js index 0d1c4aca8ca039eb7caa77e6dd1b49b05af0610e..b17dc88b4db2a0e4d8bc5827013b959f8aa4ba7c 100644 --- a/src/components/Charts/Pie/index.js +++ b/src/components/Charts/Pie/index.js @@ -19,7 +19,7 @@ export default class Pie extends Component { }; componentDidMount() { - window.addEventListener('resize', this.resize); + window.addEventListener('resize', this.resize, { passive: true }); } componentDidUpdate(preProps) { diff --git a/src/components/Charts/TagCloud/index.js b/src/components/Charts/TagCloud/index.js index 2c45e05e600c585228710ab0a8c9bac785adf9d7..5e8ca5842c73eb627de760a5292c465cdb9c58b6 100644 --- a/src/components/Charts/TagCloud/index.js +++ b/src/components/Charts/TagCloud/index.js @@ -23,7 +23,7 @@ class TagCloud extends Component { this.initTagCloud(); this.renderChart(); }); - window.addEventListener('resize', this.resize); + window.addEventListener('resize', this.resize, { passive: true }); } componentDidUpdate(preProps) { diff --git a/src/components/Charts/WaterWave/index.js b/src/components/Charts/WaterWave/index.js index 2da301a0b6b12c8066573ddf0e56286e61a5e91e..c1369c42081b0c4079713c9e274e3f89d40a9eca 100644 --- a/src/components/Charts/WaterWave/index.js +++ b/src/components/Charts/WaterWave/index.js @@ -17,7 +17,7 @@ export default class WaterWave extends PureComponent { this.renderChart(); this.resize(); }); - window.addEventListener('resize', this.resize); + window.addEventListener('resize', this.resize, { passive: true }); } componentWillUnmount() { diff --git a/src/components/GlobalHeader/RightContent.js b/src/components/GlobalHeader/RightContent.js index 3998e4074df0e7fc9b9feac47333c0970c9bdb64..35d41309558b683e6f5bfb504e9942099e05ab00 100644 --- a/src/components/GlobalHeader/RightContent.js +++ b/src/components/GlobalHeader/RightContent.js @@ -12,7 +12,7 @@ export default class GlobalHeaderRight extends PureComponent { if (notices.length === 0) { return {}; } - const newNotices = notices.map((notice) => { + const newNotices = notices.map(notice => { const newNotice = { ...notice }; if (newNotice.datetime) { newNotice.datetime = moment(notice.datetime).fromNow(); @@ -69,15 +69,15 @@ export default class GlobalHeaderRight extends PureComponent { className = `${styles.right} ${styles.dark}`; } return ( -
+
{ + onSearch={value => { console.log('input', value); // eslint-disable-line }} - onPressEnter={(value) => { + onPressEnter={value => { console.log('enter', value); // eslint-disable-line }} /> @@ -87,6 +87,7 @@ export default class GlobalHeaderRight extends PureComponent { href="http://pro.ant.design/docs/getting-started" rel="noopener noreferrer" className={styles.action} + title="使用文档" > @@ -124,11 +125,7 @@ export default class GlobalHeaderRight extends PureComponent { {currentUser.name ? ( - + {currentUser.name} diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js index 855e7ac1811d5eab54e6af984779426bdaff86a5..5912dc503b25bceae5c00b9ae55e2840e47a6e05 100644 --- a/src/components/HeaderSearch/index.js +++ b/src/components/HeaderSearch/index.js @@ -75,10 +75,10 @@ export default class HeaderSearch extends PureComponent { onChange={this.onChange} > { this.input = node; }} + placeholder={placeholder} onKeyDown={this.onKeyDown} onBlur={this.leaveSearchMode} /> diff --git a/src/components/SettingDarwer/index.js b/src/components/SettingDarwer/index.js index e4a534e3f0336088563ff155da3d9ac803cd7176..ce8c6abb3f6d3093df8bfcb8f3f5a31d85eb41d0 100644 --- a/src/components/SettingDarwer/index.js +++ b/src/components/SettingDarwer/index.js @@ -21,10 +21,13 @@ const Body = ({ children, title, style }) => ( @connect(({ setting }) => ({ setting })) class SettingDarwer extends PureComponent { componentDidMount() { - const { themeColor } = this.props.setting; + const { themeColor, colorWeak } = this.props.setting; if (themeColor !== '#1890FF') { this.colorChange(themeColor); } + if (colorWeak === 'open') { + document.body.className = 'colorWeak'; + } } getLayOutSetting = () => { const { grid, fixedHeader, autoHideHeader, fixSiderbar } = this.props.setting; @@ -85,6 +88,13 @@ class SettingDarwer extends PureComponent { nextState.grid = 'Fluid'; } } + if (key === 'colorWeak') { + if (value === 'open') { + document.body.className = 'colorWeak'; + } else { + document.body.className = ''; + } + } this.setState(nextState, () => { this.props.dispatch({ type: 'setting/changeSetting', @@ -112,7 +122,7 @@ class SettingDarwer extends PureComponent { }, 200); }; render() { - const { collapse, silderTheme, themeColor, layout } = this.props.setting; + const { collapse, silderTheme, themeColor, layout, colorWeak } = this.props.setting; return (
@@ -177,6 +187,26 @@ class SettingDarwer extends PureComponent { dataSource={this.getLayOutSetting()} renderItem={item => {item.title}} /> + + + + + this.changeSetting('colorWeak', value)} + style={{ width: 80 }} + > + close + open + , + ]} + > + 色弱模式 + +
diff --git a/src/index.less b/src/index.less index d8b1560fcea1d25f534ee86f7c120f34bef4f470..9383a5b21326a3c1595ef8b710d2b63c5c8927f9 100644 --- a/src/index.less +++ b/src/index.less @@ -5,6 +5,10 @@ body, overflow: auto; } +:global(.colorWeak) { + filter: invert(80%); +} + :global(.ant-layout) { min-height: 100%; } diff --git a/src/routes/Forms/AdvancedForm.js b/src/routes/Forms/AdvancedForm.js index ecb0f247e16827e5da2491aa324e25c23159c459..074390b77dc6ed7117b83b5995f0f0d7d2c29af2 100644 --- a/src/routes/Forms/AdvancedForm.js +++ b/src/routes/Forms/AdvancedForm.js @@ -62,7 +62,7 @@ class AdvancedForm extends PureComponent { width: '100%', }; componentDidMount() { - window.addEventListener('resize', this.resizeFooterToolbar); + window.addEventListener('resize', this.resizeFooterToolbar, { passive: true }); } componentWillUnmount() { window.removeEventListener('resize', this.resizeFooterToolbar); diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js index 727dbb3090cde75be997f759e41655dbf4f0124a..5289b6771058859ddfe7cee753e45d5f4e4a9e97 100644 --- a/src/routes/Profile/AdvancedProfile.js +++ b/src/routes/Profile/AdvancedProfile.js @@ -197,7 +197,7 @@ export default class AdvancedProfile extends Component { }); this.setStepDirection(); - window.addEventListener('resize', this.setStepDirection); + window.addEventListener('resize', this.setStepDirection, { passive: true }); } componentWillUnmount() {