|
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; |
|
|
import { Layout, Icon, message } from 'antd'; |
|
|
import { Layout, Icon, message } from 'antd'; |
|
|
import DocumentTitle from 'react-document-title'; |
|
|
import DocumentTitle from 'react-document-title'; |
|
|
import { connect } from 'dva'; |
|
|
import { connect } from 'dva'; |
|
|
import { Route, Redirect, Switch } from 'dva/router'; |
|
|
import { Route, Redirect, Switch, routerRedux } from 'dva/router'; |
|
|
import { ContainerQuery } from 'react-container-query'; |
|
|
import { ContainerQuery } from 'react-container-query'; |
|
|
import classNames from 'classnames'; |
|
|
import classNames from 'classnames'; |
|
|
import { enquireScreen } from 'enquire-js'; |
|
|
import { enquireScreen } from 'enquire-js'; |
|
|
@ -98,6 +98,16 @@ class BasicLayout extends React.PureComponent { |
|
|
} |
|
|
} |
|
|
return title; |
|
|
return title; |
|
|
} |
|
|
} |
|
|
|
|
|
getBashRedirect = () => { |
|
|
|
|
|
// According to the url parameter to redirect
|
|
|
|
|
|
// 这里是重定向的,重定向到 url 的 redirect 参数所示地址
|
|
|
|
|
|
const urlParams = new URL(window.location.href); |
|
|
|
|
|
const redirect = urlParams.searchParams.get('redirect') || '/dashboard/analysis'; |
|
|
|
|
|
// Remove the parameters in the url
|
|
|
|
|
|
urlParams.searchParams.delete('redirect'); |
|
|
|
|
|
window.history.pushState(null, 'redirect', urlParams.href); |
|
|
|
|
|
return redirect; |
|
|
|
|
|
} |
|
|
handleMenuCollapse = (collapsed) => { |
|
|
handleMenuCollapse = (collapsed) => { |
|
|
this.props.dispatch({ |
|
|
this.props.dispatch({ |
|
|
type: 'global/changeLayoutCollapsed', |
|
|
type: 'global/changeLayoutCollapsed', |
|
|
@ -112,6 +122,10 @@ class BasicLayout extends React.PureComponent { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
handleMenuClick = ({ key }) => { |
|
|
handleMenuClick = ({ key }) => { |
|
|
|
|
|
if (key === 'triggerError') { |
|
|
|
|
|
this.props.dispatch(routerRedux.push('/exception/trigger')); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
if (key === 'logout') { |
|
|
if (key === 'logout') { |
|
|
this.props.dispatch({ |
|
|
this.props.dispatch({ |
|
|
type: 'login/logout', |
|
|
type: 'login/logout', |
|
|
@ -129,6 +143,7 @@ class BasicLayout extends React.PureComponent { |
|
|
const { |
|
|
const { |
|
|
currentUser, collapsed, fetchingNotices, notices, routerData, match, location, |
|
|
currentUser, collapsed, fetchingNotices, notices, routerData, match, location, |
|
|
} = this.props; |
|
|
} = this.props; |
|
|
|
|
|
const bashRedirect = this.getBashRedirect(); |
|
|
const layout = ( |
|
|
const layout = ( |
|
|
<Layout> |
|
|
<Layout> |
|
|
<SiderMenu |
|
|
<SiderMenu |
|
|
@ -178,7 +193,7 @@ class BasicLayout extends React.PureComponent { |
|
|
<Redirect key={item.from} exact from={item.from} to={item.to} /> |
|
|
<Redirect key={item.from} exact from={item.from} to={item.to} /> |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
<Redirect exact from="/" to="/dashboard/analysis" /> |
|
|
<Redirect exact from="/" to={bashRedirect} /> |
|
|
<Route render={NotFound} /> |
|
|
<Route render={NotFound} /> |
|
|
</Switch> |
|
|
</Switch> |
|
|
</div> |
|
|
</div> |
|
|
|