Browse Source

fixed umi/link umi/router

pull/2046/head
zinkey 8 years ago
committed by 偏右
parent
commit
24e9ab7fc3
  1. 2
      src/components/GlobalHeader/index.js
  2. 2
      src/components/SiderMenu/BaseMenu.js
  3. 2
      src/components/SiderMenu/SiderMenu.js
  4. 2
      src/components/SiderMenu/SliderMenu.js
  5. 2
      src/components/TopNavHeader/index.js
  6. 8
      src/layouts/Header.js
  7. 2
      src/layouts/PageHeaderLayout.js
  8. 2
      src/layouts/UserLayout.js
  9. 2
      src/pages/404.js
  10. 11
      src/pages/Account/Center/Center.js
  11. 5
      src/pages/Account/Settings/Info.js
  12. 2
      src/pages/Dashboard/Workplace.js
  13. 2
      src/pages/Exception/403.js
  14. 2
      src/pages/Exception/404.js
  15. 2
      src/pages/Exception/500.js
  16. 4
      src/pages/Forms/StepForm/Step1.js
  17. 4
      src/pages/Forms/StepForm/Step2.js
  18. 6
      src/pages/Forms/StepForm/Step3.js
  19. 10
      src/pages/List/List.js
  20. 2
      src/pages/User/Login.js
  21. 5
      src/pages/User/Register.js
  22. 2
      src/pages/User/RegisterResult.js

2
src/components/GlobalHeader/index.js

@ -1,6 +1,6 @@
import React, { PureComponent } from 'react';
import { Icon, Divider } from 'antd';
import { Link } from 'dva/router';
import Link from 'umi/link';
import Debounce from 'lodash-decorators/debounce';
import styles from './index.less';
import RightContent from './RightContent';

2
src/components/SiderMenu/BaseMenu.js

@ -1,6 +1,6 @@
import React, { PureComponent } from 'react';
import { Menu, Icon } from 'antd';
import { Link } from 'dva/router';
import Link from 'umi/link';
import { formatMessage } from 'umi/locale';
import pathToRegexp from 'path-to-regexp';
import { urlToList } from '../_utils/pathTools';

2
src/components/SiderMenu/SiderMenu.js

@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import { Layout, Menu, Icon } from 'antd';
import pathToRegexp from 'path-to-regexp';
import { Link } from 'dva/router';
import Link from 'umi/link';
import styles from './index.less';
import { urlToList } from '../_utils/pathTools';

2
src/components/SiderMenu/SliderMenu.js

@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import { Layout } from 'antd';
import pathToRegexp from 'path-to-regexp';
import { Link } from 'dva/router';
import Link from 'umi/link';
import styles from './index.less';
import BaseMenu, { getMenuMatches } from './BaseMenu';
import { urlToList } from '../_utils/pathTools';

2
src/components/TopNavHeader/index.js

@ -1,5 +1,5 @@
import React, { PureComponent } from 'react';
import { Link } from 'dva/router';
import Link from 'umi/link';
import RightContent from '../GlobalHeader/RightContent';
import BaseMenu from '../SiderMenu/BaseMenu';
import styles from './index.less';

8
src/layouts/Header.js

@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import { Layout, message } from 'antd';
import Animate from 'rc-animate';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import router from 'umi/router';
import GlobalHeader from '@/components/GlobalHeader';
import TopNavHeader from '@/components/TopNavHeader';
import styles from './Header.less';
@ -44,15 +44,15 @@ class HeaderView extends PureComponent {
handleMenuClick = ({ key }) => {
const { dispatch } = this.props;
if (key === 'userCenter') {
dispatch(routerRedux.push('/account/center'));
router.push('/account/center');
return;
}
if (key === 'triggerError') {
dispatch(routerRedux.push('/exception/trigger'));
router.push('/exception/trigger');
return;
}
if (key === 'userinfo') {
dispatch(routerRedux.push('/account/settings/base'));
router.push('/account/settings/base');
return;
}
if (key === 'logout') {

2
src/layouts/PageHeaderLayout.js

@ -1,6 +1,6 @@
import React from 'react';
import { FormattedMessage } from 'umi/locale';
import { Link } from 'dva/router';
import Link from 'umi/link';
import PageHeader from '@/components/PageHeader';
import GridContent from './GridContent';
import styles from './PageHeaderLayout.less';

2
src/layouts/UserLayout.js

@ -1,5 +1,5 @@
import React, { Fragment } from 'react';
import { Link } from 'dva/router';
import Link from 'umi/link';
import { Icon } from 'antd';
import GlobalFooter from '@/components/GlobalFooter';
import styles from './UserLayout.less';

2
src/pages/404.js

@ -1,5 +1,5 @@
import React from 'react';
import { Link } from 'dva/router';
import Link from 'umi/link';
import Exception from '@/components/Exception';
export default () => (

11
src/pages/Account/Center/Center.js

@ -1,6 +1,7 @@
import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { Link, routerRedux } from 'dva/router';
import Link from 'umi/link';
import router from 'umi/router';
import { Card, Row, Col, Icon, Avatar, Tag, Divider, Spin, Input } from 'antd';
import GridContent from '@/layouts/GridContent';
import styles from './Center.less';
@ -36,16 +37,16 @@ export default class Center extends PureComponent {
}
onTabChange = key => {
const { dispatch, match } = this.props;
const { match } = this.props;
switch (key) {
case 'articles':
dispatch(routerRedux.push(`${match.url}/articles`));
router.push(`${match.url}/articles`);
break;
case 'applications':
dispatch(routerRedux.push(`${match.url}/applications`));
router.push(`${match.url}/applications`);
break;
case 'projects':
dispatch(routerRedux.push(`${match.url}/projects`));
router.push(`${match.url}/projects`);
break;
default:
break;

5
src/pages/Account/Settings/Info.js

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import router from 'umi/router';
import { FormattedMessage } from 'umi/locale';
import { Menu } from 'antd';
import styles from './Info.less';
@ -71,8 +71,7 @@ export default class Info extends Component {
};
selectKey = ({ key }) => {
const { dispatch } = this.props;
dispatch(routerRedux.push(`/account/settings/${key}`));
router.push(`/account/settings/${key}`);
this.setState({
selectKey: key,
});

2
src/pages/Dashboard/Workplace.js

@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import moment from 'moment';
import { connect } from 'dva';
import { Link } from 'dva/router';
import Link from 'umi/link';
import { Row, Col, Card, List, Avatar } from 'antd';
import { Radar } from '@/components/Charts';

2
src/pages/Exception/403.js

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { formatMessage } from 'umi/locale';
import { Link } from 'dva/router';
import Link from 'umi/link';
import Exception from '@/components/Exception';
class Exception403 extends Component {

2
src/pages/Exception/404.js

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { formatMessage } from 'umi/locale';
import { Link } from 'dva/router';
import Link from 'umi/link';
import Exception from '@/components/Exception';
class Exception404 extends Component {

2
src/pages/Exception/500.js

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { formatMessage } from 'umi/locale';
import { Link } from 'dva/router';
import Link from 'umi/link';
import Exception from '@/components/Exception';
class Exception500 extends Component {

4
src/pages/Forms/StepForm/Step1.js

@ -1,7 +1,7 @@
import React, { Fragment } from 'react';
import { connect } from 'dva';
import { Form, Input, Button, Select, Divider } from 'antd';
import { routerRedux } from 'dva/router';
import router from 'umi/router';
import styles from './style.less';
const { Option } = Select;
@ -30,7 +30,7 @@ export default class Step1 extends React.PureComponent {
type: 'form/saveStepFormData',
payload: values,
});
dispatch(routerRedux.push('/form/step-form/confirm'));
router.push('/form/step-form/confirm');
}
});
};

4
src/pages/Forms/StepForm/Step2.js

@ -1,7 +1,7 @@
import React from 'react';
import { connect } from 'dva';
import { Form, Input, Button, Alert, Divider } from 'antd';
import { routerRedux } from 'dva/router';
import router from 'umi/router';
import { digitUppercase } from '@/utils/utils';
import styles from './style.less';
@ -20,7 +20,7 @@ class Step2 extends React.PureComponent {
const { form, data, dispatch, submitting } = this.props;
const { getFieldDecorator, validateFields } = form;
const onPrev = () => {
dispatch(routerRedux.push('/form/step-form/info'));
router.push('/form/step-form/info');
};
const onValidateForm = e => {
e.preventDefault();

6
src/pages/Forms/StepForm/Step3.js

@ -1,7 +1,7 @@
import React, { Fragment } from 'react';
import { connect } from 'dva';
import { Button, Row, Col } from 'antd';
import { routerRedux } from 'dva/router';
import router from 'umi/router';
import Result from '@/components/Result';
import styles from './style.less';
@ -10,9 +10,9 @@ import styles from './style.less';
}))
export default class Step3 extends React.PureComponent {
render() {
const { dispatch, data } = this.props;
const { data } = this.props;
const onFinish = () => {
dispatch(routerRedux.push('/form/step-form/info'));
router.push('/form/step-form/info');
};
const information = (
<div className={styles.information}>

10
src/pages/List/List.js

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { routerRedux } from 'dva/router';
import router from 'umi/router';
import { connect } from 'dva';
import { Input } from 'antd';
import PageHeaderLayout from '@/layouts/PageHeaderLayout';
@ -7,16 +7,16 @@ import PageHeaderLayout from '@/layouts/PageHeaderLayout';
@connect()
export default class SearchList extends Component {
handleTabChange = key => {
const { dispatch, match } = this.props;
const { match } = this.props;
switch (key) {
case 'articles':
dispatch(routerRedux.push(`${match.url}/articles`));
router.push(`${match.url}/articles`);
break;
case 'applications':
dispatch(routerRedux.push(`${match.url}/applications`));
router.push(`${match.url}/applications`);
break;
case 'projects':
dispatch(routerRedux.push(`${match.url}/projects`));
router.push(`${match.url}/projects`);
break;
default:
break;

2
src/pages/User/Login.js

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { connect } from 'dva';
import { Link } from 'dva/router';
import Link from 'umi/link';
import { Checkbox, Alert, Icon } from 'antd';
import Login from '@/components/Login';
import styles from './Login.less';

5
src/pages/User/Register.js

@ -1,6 +1,7 @@
import React, { Component } from 'react';
import { connect } from 'dva';
import { routerRedux, Link } from 'dva/router';
import Link from 'umi/link';
import router from 'umi/router';
import { Form, Input, Button, Select, Row, Col, Popover, Progress } from 'antd';
import styles from './Register.less';
@ -39,7 +40,7 @@ export default class Register extends Component {
const account = form.getFieldValue('mail');
if (register.status === 'ok') {
dispatch(
routerRedux.push({
router.push({
pathname: '/user/register-result',
state: {
account,

2
src/pages/User/RegisterResult.js

@ -1,6 +1,6 @@
import React from 'react';
import { Button } from 'antd';
import { Link } from 'dva/router';
import Link from 'umi/link';
import Result from '@/components/Result';
import styles from './RegisterResult.less';

Loading…
Cancel
Save