修改nopage的问题

This commit is contained in:
何童崇 2021-09-01 10:58:38 +08:00
parent 01b3ee8d49
commit 30a141c92e
2 changed files with 11 additions and 70 deletions

View File

@ -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');
}

View File

@ -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>