From ebf75ed433c34ef5e5967707acdf4d2a8f63c2a5 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Fri, 21 May 2021 18:58:17 +0800
Subject: [PATCH] issue
---
src/forge/Main/CoderDepot.jsx | 25 +++++++++++++++----------
src/forge/Main/CoderDepotReadme.jsx | 4 +++-
src/forge/Merge/MessageCount.js | 2 +-
src/forge/Newfile/m_editor.js | 2 +-
src/forge/Order/order.js | 2 +-
src/modules/ecs/Home/index.js | 1 +
6 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx
index f446ebb4..9b13e8c3 100644
--- a/src/forge/Main/CoderDepot.jsx
+++ b/src/forge/Main/CoderDepot.jsx
@@ -45,19 +45,22 @@ function CoderDepot(props){
const [ desc , setDesc ] = useState(undefined);
const [ website , setWebsite ] = useState(undefined);
const [ lesson_url , setLessonUrl ] = useState(undefined);
+ const [ readme , setReadme ] = useState(undefined)
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
const branchName = props.match.params.branchName;
+ const details = props.projectDetail;
let pathname = props.history.location.pathname;
+
useEffect(()=>{
- if(props.projectDetail){
- setProjectDetail(props.projectDetail);
- setDesc(props.projectDetail.description);
- setWebsite(props.projectDetail.website);
- setLessonUrl(props.projectDetail.lesson_url);
+ if(details){
+ setProjectDetail(details);
+ setDesc(details.description);
+ setWebsite(details.website);
+ setLessonUrl(details.lesson_url);
}
- },[props])
+ },[details])
useEffect(()=>{
if(treeValue){
@@ -67,18 +70,19 @@ function CoderDepot(props){
}
},[treeValue])
+
useEffect(()=>{
- if (pathname && projectDetail){
+ if (projectsId && owner){
if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) {
let url = pathname.split(`/tree/${branchName}/`)[1];
setTreeValue(url);
getFileInfo(url,branchName);
}else{
setTreeValue(undefined);
- getDirInfo(branchName ||projectDetail.default_branch);
+ getDirInfo(branchName ||(projectDetail && projectDetail.default_branch));
}
}
- },[pathname,projectDetail])
+ },[projectsId,owner,pathname])
// 获取主目录列表
function getDirInfo(branch){
@@ -98,6 +102,7 @@ function CoderDepot(props){
setLastCommitAuthor(c && c.committer);
setMainFlag(true);
setReadOnly(true);
+ setReadme(result.data.readme);
}
setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);})
@@ -373,7 +378,7 @@ function CoderDepot(props){
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ?
该Pull Request无法自动合并,你通过如下命令,手动合并
+该分支存在冲突,无法自动合并,你可以尝试通过如下命令手动合并
this.jsCopy()}>