diff --git a/src/components/GlobalHeader/index.js b/src/components/GlobalHeader/index.js index c31f2b89ace76c7314613646563ad43fe9fb2195..83c161be49ef22a5ff613b04fb15f35d31c02e1c 100644 --- a/src/components/GlobalHeader/index.js +++ b/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'; diff --git a/src/components/SiderMenu/BaseMenu.js b/src/components/SiderMenu/BaseMenu.js index e28d51f0c3ec54245314912740417c488af23d8d..a2922409f10068470344b6405cd788c33b6ea0ea 100644 --- a/src/components/SiderMenu/BaseMenu.js +++ b/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'; diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 8c2f77d1177f92427c83e6abf64bfd73a31f4cf2..58077b77f4bc5892e055c407c3bf7b5a44477d0d 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/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'; diff --git a/src/components/SiderMenu/SliderMenu.js b/src/components/SiderMenu/SliderMenu.js index 9ebfd44590abe9d655022a5812ac8c480d6220b6..4be375513a0dcea6685d2fcd2f9e316d6f9d0c3a 100644 --- a/src/components/SiderMenu/SliderMenu.js +++ b/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'; diff --git a/src/components/TopNavHeader/index.js b/src/components/TopNavHeader/index.js index dc4a9e5797da8011e0747360429c9d37cc6fcf39..a68c11714f7b6f6ce6fe96aeba611b107e4d5ff2 100644 --- a/src/components/TopNavHeader/index.js +++ b/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'; diff --git a/src/layouts/Header.js b/src/layouts/Header.js index d297c8883be44fd3c9926585db60e367389b99a4..77825be4df703df2294abbb1e77662762d7d1188 100644 --- a/src/layouts/Header.js +++ b/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') { diff --git a/src/layouts/PageHeaderLayout.js b/src/layouts/PageHeaderLayout.js index eeaac5e01c0464909301c96c18a5ac45cb5c48b4..4801264a518928a5ce0d62206e953984ded3c1c2 100644 --- a/src/layouts/PageHeaderLayout.js +++ b/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'; diff --git a/src/layouts/UserLayout.js b/src/layouts/UserLayout.js index 1ff6a42b97eefb65fa0c04b2488605e729c5449f..41e032ddef6ddb46f1ab565fd8c599eb0c6ffe70 100644 --- a/src/layouts/UserLayout.js +++ b/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'; diff --git a/src/pages/404.js b/src/pages/404.js index a653ef1705889c4d1c82e51a75d6cdd886d9c767..dd01d4b1f81aff9bd4b4b1594c6c53af5430ed5b 100644 --- a/src/pages/404.js +++ b/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 () => ( diff --git a/src/pages/Account/Center/Center.js b/src/pages/Account/Center/Center.js index 903e2ed80bb6e5ed25a3092faa3bf4408152ba9f..dbc17364ae831dfc12a327b92829f719bbceef0e 100644 --- a/src/pages/Account/Center/Center.js +++ b/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; diff --git a/src/pages/Account/Settings/Info.js b/src/pages/Account/Settings/Info.js index f53986f29c8842fecde72f938768240981c6ad93..23cedd8d3dca594c98edfce0209d988ab3f3003d 100644 --- a/src/pages/Account/Settings/Info.js +++ b/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, }); diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js index 986586e864da0b97b240839e138d10feed125c70..6d6e73a33440e36c96a9b3ca6173150259d70e6b 100644 --- a/src/pages/Dashboard/Workplace.js +++ b/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'; diff --git a/src/pages/Exception/403.js b/src/pages/Exception/403.js index c75724aa74fe3dd2d3416c9f8d34f94a26be0cb8..addd50eb5373843b8b800ec7110d01dd8e79cb6d 100644 --- a/src/pages/Exception/403.js +++ b/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 { diff --git a/src/pages/Exception/404.js b/src/pages/Exception/404.js index e9ecdff1d63774a38d125481ad812df187304fa0..813632c96238f36921738b50f1d4aeee63eb01e1 100644 --- a/src/pages/Exception/404.js +++ b/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 { diff --git a/src/pages/Exception/500.js b/src/pages/Exception/500.js index f85732e4c6ee5b4a5df26bef2e3e3d9333cf552f..72d3679d91d1247fcad1546b0b303f66040b4fdc 100644 --- a/src/pages/Exception/500.js +++ b/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 { diff --git a/src/pages/Forms/StepForm/Step1.js b/src/pages/Forms/StepForm/Step1.js index 03062009d2fe6435f9d8122a229ee1c4644d1b5d..07c3b02ea6f2866bec415af3c0c863e9f92bf740 100644 --- a/src/pages/Forms/StepForm/Step1.js +++ b/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'); } }); }; diff --git a/src/pages/Forms/StepForm/Step2.js b/src/pages/Forms/StepForm/Step2.js index 856ba7eee47d213bd4e80fd8edca60ea1e44a0df..fb6ad480993ab38dd38ef09227feb7036ef38a73 100644 --- a/src/pages/Forms/StepForm/Step2.js +++ b/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(); diff --git a/src/pages/Forms/StepForm/Step3.js b/src/pages/Forms/StepForm/Step3.js index 6b29dba10fafee80f3fabe16f2c405b66987a15e..5273a5d5fbce835a7c51d8811e78a41b566e6659 100644 --- a/src/pages/Forms/StepForm/Step3.js +++ b/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 = (