上传PR修改

This commit is contained in:
何童崇 2021-09-04 11:16:08 +08:00
parent 1764fbdb88
commit a90eeac318
3 changed files with 53 additions and 6 deletions

View File

@ -19,7 +19,7 @@ import moment from 'moment'
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import SiderBar from './forge/Component/SiderBar'
import { SnackbarHOC } from 'educoder'
import { SnackbarHOC } from 'educoder';
import { initAxiosInterceptors } from './AppConfig'
import { Provider } from 'react-redux';
import configureStore from './redux/stores/configureStore';
@ -39,6 +39,11 @@ const Projects = Loadable({
loader: () => import('./forge/Index'),
loading: Loading,
})
// forge项目详情
const ProjectDetail = Loadable({
loader: () => import("./forge/Main/DetailAdaptor"),
loading: Loading,
});
//forge安全设置
const Security = Loadable({
loader: () => import('./forge/SecuritySetting/Index'),
@ -92,6 +97,11 @@ const ProjectIndex = Loadable({
loading: Loading,
});
const CreateMerge = Loadable({
loader: () => import('./forge/Merge/NewMerge'),
loading: Loading,
})
// 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。
const keyWord = ["explore", "settings", "setting", "CCF", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search"];
@ -268,6 +278,13 @@ class App extends Component {
}
} />
{/* 项目PR */}
<Route path="/:owner/:projectsId/pulls/new"
render={
(props) => (<ProjectDetail {...this.props} {...props} {...this.state} />)
}
></Route>
{/*项目*/}
<Route
path={"/:owner/:projectId/devops/:opsId/detail"}

View File

@ -1,6 +1,28 @@
import Detail from "./Detail";
import React from 'react';
import { Route, Switch } from "react-router-dom";
import { withRouter } from "react-router";
import Loadable from "react-loadable";
import Loading from "../../Loading";
import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC";
import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC";
export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Detail)));
// forge项目详情
const ProjectDetail = Loadable({
loader: () => import("../Main/Detail"),
loading: Loading,
});
export default withRouter(
(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props) => {
return (
<Switch>
<Route
path="/:owner/:projectsId"
render={(p) => (
<ProjectDetail {...props} {...p} />
)}
></Route>
</Switch>
)
}))))
)

View File

@ -48,8 +48,10 @@ class NewMerge extends Component {
this.compareProject(this.state.id,pull,"master");
}
}
// 页面销毁取消监听
componentWillUnmount () {
console.log('----------destoyed---------');
window.removeEventListener('popstate', this.handleBack, false);
};
@ -60,8 +62,11 @@ class NewMerge extends Component {
//获取新建分支数据
getmergelist = (projectsId) => {
this.setState({isSpin: true})
const { owner } = this.props.match.params;
this.setState({isSpin: true});
// const { owner } = this.props.match.params;
let owner =this.props.history.location.pathname.split('/')[1];
console.log('owner:'+owner);
console.log(this.props);
const url = `/${owner}/${projectsId}/pulls/new.json`;
axios
.get(url)
@ -264,7 +269,9 @@ class NewMerge extends Component {
show_message,
default_message,
merge_head,
projects_names,id,comparesData
projects_names,
id,
comparesData
} = this.state;
const renderBrances = (list, type) => {
@ -298,6 +305,7 @@ class NewMerge extends Component {
return <div dangerouslySetInnerHTML={{ __html: html }}></div>;
};
let { project } = this.props;
return (
<div>
<div className="main">