From e0c8552c1e192e177dc17192a5bceb5c22f963eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 8 Oct 2021 14:41:02 +0800 Subject: [PATCH 1/2] issue --- src/forge/Main/CoderDepot.jsx | 4 +-- src/forge/Main/CoderRootCommit.js | 42 ++++++++++++++++++------------- src/forge/Main/Diff.jsx | 2 +- src/forge/Main/Index.scss | 2 +- src/forge/Main/version/New.jsx | 2 +- src/forge/Merge/Files.jsx | 21 +++------------- 6 files changed, 32 insertions(+), 41 deletions(-) diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 9bf831933..c6867c986 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -455,8 +455,8 @@ function CoderDepot(props){ lastCommit &&
-
props.history.push(`/${owner}/${projectsId}/commits/${truncateCommitId(lastCommit.sha)}`)} className={hideBtn && hide ? "ellipsistxt hidetxt" :"ellipsistxt"}> -
{lastCommit.message}
+
+
{lastCommit.message}
{ hideBtn && changeHide(hide)}> } diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index cdd8d59d9..f614006cd 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -25,10 +25,6 @@ function returnbar(str){ class CoderRootCommit extends Component{ constructor(props){ super(props); - // const params = new URLSearchParams(location && location.search); - // const [commitPage] = [params.get('commitPage')]; - // console.log('111',commitPage); - // commitPage && this.setState({page:commitPage}); this.state={ commitDatas:undefined, dataCount:undefined, @@ -61,13 +57,28 @@ class CoderRootCommit extends Component{ this.Init(); } } + + UrlParamHash(url){ + const params = {}; + let h; + let hash = url.slice(url.indexOf('?')+1).split('&'); + for(let i = 0; i{ const { branchName } = this.props.match.params; - const { page , limit } = this.state; + const { limit } = this.state; + const {search} = this.props.location; + const realPage = (search && this.UrlParamHash(search).page) ? parseInt(this.UrlParamHash(search).page) : 1; this.setState({ - isSpining:true + isSpining:true, + page:realPage }) - this.getCommitList( branchName , page , limit ); + this.getCommitList( branchName , realPage , limit ); } getCommitList=(branch , page , limit)=>{ @@ -106,7 +117,7 @@ class CoderRootCommit extends Component{ isSpining:false }) } - }).catch((error)=>{console.log(error)}) + }).catch((error)=>{console.log('error',error)}) } // 切换分支 search:tag为根据标签搜索 @@ -116,19 +127,14 @@ class CoderRootCommit extends Component{ } ChangePage=(page)=>{ - const { branchName } = this.props.match.params; - const { limit } = this.state; - this.setState({ - page: page - }) - this.getCommitList(branchName , page , limit); + this.props.history.push({pathname: this.props.history.location.pathname,search: `page=${page}`}) } render(){ const { commitDatas , dataCount , limit , page , isSpining , branchList } = this.state; + console.log('page', page); const { projectDetail, commit_class , defaultBranch } = this.props; const { projectsId , owner , branchName } = this.props.match.params; - console.log(branchName); let branch = returnbar(branchName || defaultBranch); return( @@ -153,7 +159,7 @@ class CoderRootCommit extends Component{
-
{item.message}
+
{item.message}

sha - {truncateCommitId(`${item.sha}`)} + {truncateCommitId(`${item.sha}`)} @@ -188,7 +194,7 @@ class CoderRootCommit extends Component{ { dataCount > limit ?

- +
:"" } diff --git a/src/forge/Main/Diff.jsx b/src/forge/Main/Diff.jsx index fe9c130fe..03321ea90 100644 --- a/src/forge/Main/Diff.jsx +++ b/src/forge/Main/Diff.jsx @@ -90,7 +90,7 @@ export default (props) => {
    diff --git a/src/forge/Main/Index.scss b/src/forge/Main/Index.scss index 9a0bf5391..8c0e18488 100644 --- a/src/forge/Main/Index.scss +++ b/src/forge/Main/Index.scss @@ -253,7 +253,7 @@ background-color: #FAFCFF; .ellipsistxt{ margin-top: 6px; - cursor: pointer; + // cursor: pointer; #ptxt{ margin-bottom: 0px; word-break: break-all; diff --git a/src/forge/Main/version/New.jsx b/src/forge/Main/version/New.jsx index ca9057caa..a235f31d9 100644 --- a/src/forge/Main/version/New.jsx +++ b/src/forge/Main/version/New.jsx @@ -247,7 +247,7 @@ export default Form.create()(

    语义化版本

    - 如果你是第一次发布版本,我们强烈建议你阅读语义化版本。 + 如果你是第一次发布版本,我们强烈建议你阅读语义化版本

    diff --git a/src/forge/Merge/Files.jsx b/src/forge/Merge/Files.jsx index fef63198b..310d586b7 100644 --- a/src/forge/Merge/Files.jsx +++ b/src/forge/Merge/Files.jsx @@ -10,22 +10,7 @@ function Files(props){ const [ files , setFiles ] = useState(data && data.files); const [ copyfileTipTitle, setCopyfileTipTitle] = useState("复制文件路径"); const [ isOpen, setIsOpen] = useState(false); - const commitPage = history && history.location && history.location.query && history.location.query.commitPage; - // console.log('222',commitPage); - // const nextHref = useRef(null); - - // useEffect(()=>{ - // const unlisten = history.listen((location)=>{ - // if(nextHref.current !== location.pathname){ - // nextHref.current = location.pathname; - // history.replace({pathname:location.pathname,search:`commitPage=${commitPage}`}); - // // history.replace({pathname:location.pathname, query:{page:commitPage}}); - // } else{ - // unlisten; - // } - // }) - // }) - + useEffect(()=>{ if(data){ setFiles(data.files); @@ -64,7 +49,7 @@ function Files(props){ {item.name}
    - 0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}> + 0 && ":"}${item.addition>0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}> {item.addition >0 && +{item.addition}} {item.deletion >0 && -{item.deletion}} @@ -112,7 +97,7 @@ function Files(props){
    - 0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}> + 0 && ":"} ${item.addition > 0 ? item.addition + "处添加" : ""}${item.addition > 0 && item.deletion > 0 ? "和" : ""}${item.deletion > 0 ? item.deletion + "处删除" : ""}`}> {item.addition+item.deletion}处 From 633a540fe761070898daad874180ff18652507a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 8 Oct 2021 14:46:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4consolo=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/CoderRootCommit.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index f614006cd..604917ba0 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -117,7 +117,7 @@ class CoderRootCommit extends Component{ isSpining:false }) } - }).catch((error)=>{console.log('error',error)}) + }).catch((error)=>{console.log(error)}) } // 切换分支 search:tag为根据标签搜索 @@ -132,7 +132,6 @@ class CoderRootCommit extends Component{ render(){ const { commitDatas , dataCount , limit , page , isSpining , branchList } = this.state; - console.log('page', page); const { projectDetail, commit_class , defaultBranch } = this.props; const { projectsId , owner , branchName } = this.props.match.params; let branch = returnbar(branchName || defaultBranch);