Merge pull request '改nopage的问题' (#34) from tongChong/forgeplus-react:feature_router into feature_router
This commit is contained in:
commit
bddc0f2f91
|
@ -11,9 +11,9 @@ broadcastChannelOnmessage('refreshPage', () => {
|
|||
})
|
||||
|
||||
function locationurl(list) {
|
||||
// if (window.location.port !== "3007") {
|
||||
if (window.location.port !== "3007") {
|
||||
window.location.href = list
|
||||
// }
|
||||
}
|
||||
}
|
||||
// TODO 开发期多个身份切换
|
||||
let debugType = ""
|
||||
|
@ -85,7 +85,7 @@ export function initAxiosInterceptors(props) {
|
|||
}
|
||||
|
||||
if (response.data.status === 404) {
|
||||
let responseURL = response.data.request ? response.data.request.responseURL:'';
|
||||
let responseURL = response.request ? response.request.responseURL:'';
|
||||
if (responseURL.indexOf('/api/users/') === -1 && responseURL.indexOf('/api/organizations/') === -1) {
|
||||
locationurl('/nopage');
|
||||
}
|
||||
|
|
|
@ -17,78 +17,19 @@ const Projects = Loadable({
|
|||
})
|
||||
export default withRouter(
|
||||
(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props) => {
|
||||
console.log(props.location.pathname);
|
||||
let secondRouter = '';
|
||||
if (props.location.pathname) {
|
||||
secondRouter = props.location.pathname.split('/')[2];
|
||||
}
|
||||
let userRouterArr = ['statistics', 'projects', 'notice', 'devops', 'organizes', 'info', 'watchers', 'fan_users', 'password'];
|
||||
return (
|
||||
<Switch>
|
||||
|
||||
<Route
|
||||
path="/:username/statistics"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/:username/projects"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/:username/notice"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/:username/devops"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/:username/organizes"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/:username/watchers"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/:username/fan_users"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/:username/statistics"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path={"/:owner/:projectsId"}
|
||||
render={
|
||||
(p) => {
|
||||
return (<Projects {...props} {...p} />)
|
||||
}
|
||||
}>
|
||||
|
||||
</Route>
|
||||
<Route
|
||||
path="/:username"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p} />
|
||||
secondRouter && (!userRouterArr.includes(secondRouter)) ?
|
||||
<Projects {...props} {...p} /> : <Infos {...props} {...p} />
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
Loading…
Reference in New Issue