diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index e1534d052454e3fb8d312010131608c367916a10..60339b9905d24ae35eaebd0222a74ab608ad68fc 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -17,7 +17,7 @@ import { getMenuData } from '../common/menu'; import logo from '../assets/logo.svg'; const { Content, Header, Footer } = Layout; -const { AuthorizedRoute } = Authorized; +const { AuthorizedRoute, check } = Authorized; /** * 根据菜单取得重定向地址. @@ -109,7 +109,11 @@ class BasicLayout extends React.PureComponent { urlParams.searchParams.delete('redirect'); window.history.replaceState(null, 'redirect', urlParams.href); } else { - return '/dashboard/analysis'; + const { routerData } = this.props; + // get the first authorized route path in routerData + const authorizedPath = Object.keys(routerData).find(item => + check(routerData[item].authority, item) && item !== '/'); + return authorizedPath; } return redirect; }