Merge branch 'pre_develop_dev' of https://git.trustie.net/Gitlink/forgeplus-react into pre_develop_dev

# Conflicts:
#	src/forge/Main/Detail.js
This commit is contained in:
caishi 2021-09-07 13:54:04 +08:00
commit daf81be4f6
5 changed files with 65 additions and 17 deletions

View File

@ -19,7 +19,7 @@ import moment from 'moment'
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles'; import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import SiderBar from './forge/Component/SiderBar' import SiderBar from './forge/Component/SiderBar'
import { SnackbarHOC } from 'educoder' import { SnackbarHOC } from 'educoder';
import { initAxiosInterceptors } from './AppConfig' import { initAxiosInterceptors } from './AppConfig'
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import configureStore from './redux/stores/configureStore'; import configureStore from './redux/stores/configureStore';
@ -39,6 +39,11 @@ const Projects = Loadable({
loader: () => import('./forge/Index'), loader: () => import('./forge/Index'),
loading: Loading, loading: Loading,
}) })
// forge项目详情
const ProjectDetail = Loadable({
loader: () => import("./forge/Main/DetailAdaptor"),
loading: Loading,
});
//forge安全设置 //forge安全设置
const Security = Loadable({ const Security = Loadable({
loader: () => import('./forge/SecuritySetting/Index'), loader: () => import('./forge/SecuritySetting/Index'),
@ -92,8 +97,13 @@ const ProjectIndex = Loadable({
loading: Loading, 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"]; const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize"];
class App extends Component { class App extends Component {
constructor(props) { constructor(props) {
@ -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 <Route
path={"/:owner/:projectId/devops/:opsId/detail"} path={"/:owner/:projectId/devops/:opsId/detail"}
@ -348,7 +365,7 @@ class App extends Component {
return (<OrganizeIndex {...props} {...this.props} {...this.state} />) return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
} }
}> }>
</Route> : pathType === '404' ? <Route path="/" component={Shixunnopage} /> : </Route> : pathType === '404' ? <Route component={Shixunnopage} />:
<Route exact path="/" <Route exact path="/"
render={ render={
(props) => ( (props) => (
@ -360,6 +377,7 @@ class App extends Component {
} }
/> />
// <Route path="/" component={Loading} /> // <Route path="/" component={Loading} />
// <Route path="/" component={Shixunnopage} />
} }

View File

@ -11,9 +11,9 @@ broadcastChannelOnmessage('refreshPage', () => {
}) })
function locationurl(list) { function locationurl(list) {
// if (window.location.port !== "3007") { if (window.location.port !== "3007") {
window.location.href = list window.location.href = list
// } }
} }
// TODO 开发期多个身份切换 // TODO 开发期多个身份切换
let debugType = "" let debugType = ""
@ -86,7 +86,7 @@ export function initAxiosInterceptors(props) {
if (response.data.status === 404) { if (response.data.status === 404) {
let responseURL = response.request ? response.request.responseURL:''; let responseURL = response.request ? response.request.responseURL:'';
if (responseURL.indexOf('/api/users/') === -1 && responseURL.indexOf('/api/organizations/') === -1 && responseURL.indexOf('/api/owners/') === -1) { if (responseURL.indexOf('/api/users/') === -1 && responseURL.indexOf('/api/organizations/') === -1 ) {
locationurl('/nopage'); locationurl('/nopage');
} }
} }

View File

@ -6,9 +6,6 @@ import DetailBanner from './sub/DetailBanner';
import '../css/index.scss' import '../css/index.scss'
import './list.css'; import './list.css';
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
import Loading from '../../Loading'; import Loading from '../../Loading';
@ -145,7 +142,7 @@ const WikiEdit = Loadable({
function checkPathname(projectsId, owner, pathname) { function checkPathname(projectsId, owner, pathname) {
let name = ""; let name = "";
if (pathname && pathname !== `/${owner}/${projectsId}`) { if (pathname && pathname !== `/${owner}/${projectsId}`) {
let url = pathname.split(`/${owner}/${projectsId}`)[1] || ""; let url = pathname.split(`/${owner}/${projectsId}`)[1] || '';
if (url.indexOf("/about") > -1) { if (url.indexOf("/about") > -1) {
name = "about" name = "about"
} else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) { } else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) {
@ -783,7 +780,4 @@ class Detail extends Component {
} }
} }
export default ImageLayerOfCommentHOC({ export default Detail;
imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
parentSelector: ".newContainer",
})(Detail);

View File

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