From 66108083fd2e207e5a200d1edd754e141eadbff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 15 Oct 2021 15:22:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E8=AF=B7=E6=B1=82=E9=A1=B5=E9=9D=A2=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E5=88=86=E6=94=AF=E5=AD=98=E5=9C=A8=E4=BD=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8bug=E4=BB=A5=E5=8F=8A=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E6=96=87=E4=BB=B6=E6=8C=89=E9=92=AE=E4=B8=8A=E7=A7=BB?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/Diff.jsx | 4 ++-- src/forge/Merge/CreateMerge.js | 33 ++++++++++++++++++++------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/forge/Main/Diff.jsx b/src/forge/Main/Diff.jsx index 6556023e..8dad59fb 100644 --- a/src/forge/Main/Diff.jsx +++ b/src/forge/Main/Diff.jsx @@ -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; diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index 0f685907..c335d79f 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -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 });