提交 5609d81a17d7cc4c9bc586cbfa638e24cceb4e9f

作者 愚道
1 个父辈 a5680a6a

remove routes from accountsetting

1 1 import React, { Component } from 'react';
2 2 import { connect } from 'dva';
3   -import router from 'umi/router';
4 3 import { FormattedMessage } from 'umi/locale';
5 4 import { Menu } from 'antd';
6 5 import styles from './style.less';
... ... @@ -17,7 +16,6 @@ const { Item } = Menu;
17 16 class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
18 17 constructor(props) {
19 18 super(props);
20   - const { match, location } = props;
21 19 const menuMap = {
22 20 base: <FormattedMessage id="BLOCK_BAME.menuMap.basic" defaultMessage="Basic Settings" />,
23 21 security: (
... ... @@ -33,24 +31,13 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
33 31 />
34 32 ),
35 33 };
36   - const key = location.pathname.replace(`${match.path}/`, '');
37 34 this.state = {
38 35 mode: 'inline',
39 36 menuMap,
40   - selectKey: menuMap[key] ? key : 'base',
  37 + selectKey: 'base',
41 38 };
42 39 }
43 40
44   - static getDerivedStateFromProps(props, state) {
45   - const { location } = props;
46   - let selectKey = location.pathname.split('/').pop();
47   - selectKey = state.menuMap[selectKey] ? selectKey : 'base';
48   - if (selectKey !== state.selectKey) {
49   - return { selectKey };
50   - }
51   - return null;
52   - }
53   -
54 41 componentDidMount() {
55 42 const { dispatch } = this.props;
56 43 dispatch({
... ... @@ -75,7 +62,6 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
75 62 };
76 63
77 64 selectKey = ({ key }) => {
78   - router.push(`/account/settings/${key}`);
79 65 this.setState({
80 66 selectKey: key,
81 67 });
... ...
注册登录 后发表评论