Merge pull request '修改新建合并请求页面目标分支存在但显示不存在bug以及提交详情页面的浏览文件按钮上移样式问题' (#177) from durian/forgeplus-react:router_v2_issue into pre_develop_dev

This commit is contained in:
jasder 2021-10-15 15:28:11 +08:00
commit 4b2651339b
2 changed files with 22 additions and 15 deletions

View File

@ -21,8 +21,8 @@ const Infos = styled.div`
& .markdown-body table{
background: #f1f8ff;
}
& .f-wrap-between{
align-items: center;
& .btnblue{
margin-top: 12px;
}
& .task-hide{
width: 65rem;

View File

@ -96,7 +96,6 @@ class CreateMerge extends Component {
// 再获取对应的仓库列表、分支列表
// 再调用比较接口
const branchParams = getBranchParams(this.props.location.pathname);
console.log('componentDidMount branchParams', branchParams);
this.getMergeInfo(branchParams);
};
@ -106,7 +105,6 @@ class CreateMerge extends Component {
const newPathname = this.props.location.pathname;
if (oldPathname !== newPathname) {
const branchParams = getBranchParams(newPathname);
console.log('componentDidUpdate branchParams', branchParams);
this.getMergeInfo(branchParams);
}
};
@ -142,22 +140,29 @@ class CreateMerge extends Component {
pull: pullBranch,
});
if (!noMergeBranch && !noPullBranch) {
this.compareProject(result.data.id, branchParams);
} else {
const _message = [];
noMergeBranch && _message.push('目标分支不存在');
noPullBranch && _message.push('源分支不存在');
//判断源分支是否存在
if(noPullBranch){
this.setState({
showMessage: true,
defaultMessage: _message.join(' , '),
defaultMessage:'源分支不存在',
isCompareSpin: false,
});
}else{
if(pullOwner === mergeOwner){
if (!noMergeBranch) {
this.compareProject(result.data.id, branchParams);
} else {
this.setState({
showMessage: true,
defaultMessage:'目标分支不存在',
isCompareSpin: false,
});
}
}else{
this.getBranchList(branchParams);
}
}
}
if (pullOwner !== mergeOwner) {
this.getBranchList(branchParams);
}
this.setState({ isSpin: false });
})
.catch((error) => {
@ -225,7 +230,9 @@ class CreateMerge extends Component {
.length === 0;
this.setState({
mergeBranches: result.data,
merge: noMergeBranch ? 'master' : mergeBranch,
showMessage: noMergeBranch,
defaultMessage: '目标分支不存在',
isCompareSpin: false,
});
}
this.setState({ isSpin: false });