/默认进入

This commit is contained in:
caishi 2020-06-15 10:58:16 +08:00
parent a730072663
commit 83496803c1
4 changed files with 33 additions and 11 deletions

View File

@ -46,6 +46,10 @@ const Projects = Loadable({
loader: () => import('./forge/Index'),
loading: Loading,
})
const Home = Loadable({
loader: () => import('./forge/Home'),
loading: Loading,
})
//403页面
const Shixunauthority = Loadable({
loader: () => import('./modules/403/Shixunauthority'),
@ -249,7 +253,7 @@ class App extends Component {
<Route exact path="/"
render={
(props) => (
<Projects {...this.props} {...props} {...this.state}></Projects>
<Home {...this.props} {...props} {...this.state}></Home>
)
}
/>

View File

@ -100,9 +100,10 @@ export function initAxiosInterceptors(props) {
// TODO 读取到package.json中的配置
var proxy = "http://localhost:3000"
// proxy = "https://pre-newweb.educoder.net"
// proxy = "https://testforgeplus.trustie.net/"
proxy = "https://testforgeplus.trustie.net/"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制
const requestMap = {};
window.setfalseInRequestMap = function (keyName) {

26
src/forge/Home.jsx Normal file
View File

@ -0,0 +1,26 @@
import React , { useEffect } from 'react';
import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC";
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
import ProjectIndex from './Main/Index';
import PersonIndex from './users/Infos';
import { Spin } from 'antd';
export default (CNotificationHOC()(SnackbarHOC()(
TPMIndexHOC((props)=>{
const { pathname } = props.history.location;
const { current_user } = props;
useEffect(()=>{
if(pathname === "/" && (current_user && current_user.login)){
props.history.push(`/users/${current_user && current_user.login}`)
}
})
return(
pathname === "/" && (current_user && current_user.login) ?
<Spin spinning={true}/>
:
<ProjectIndex {...props} />
)
})
)))

View File

@ -29,7 +29,6 @@ const ProjectDetail = Loadable({
class Index extends Component {
render() {
console.log("ddd",document.cookie);
return (
<div className="newMain clearfix">
<Switch {...this.props}>
@ -52,14 +51,6 @@ class Index extends Component {
<ProjectIndex {...this.props} {...props} {...this.state} />
)}
></Route>
<Route exact path="/" render={(props) => (
<ProjectIndex
{...this.props}
{...props}
{...this.state}
></ProjectIndex>
)}
/>
</Switch>
</div>
);