Merge branch 'develop_new' into develop_educoder

This commit is contained in:
caishi 2021-03-19 16:31:51 +08:00
commit 917958c880
2 changed files with 17 additions and 5 deletions

View File

@ -4,13 +4,18 @@ import './Component.scss';
import axios from 'axios';
const { TreeNode , DirectoryTree } = Tree;
function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name}){
function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , list}){
const [ treeData , setTreeData ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(true);
const [first , setFirst ] = useState(true);
useEffect(()=>{
if(visible && first){
getMenulist();
if(list){
setTreeData(list);
setIsSpin(false);
}else{
getMenulist();
}
setFirst(false);
}
},[visible])

View File

@ -36,6 +36,7 @@ function CoderDepot(props){
const [ readOnly , setReadOnly] = useState(true);
const [ isSpin , setIsSpin] = useState(true);
const [ visible ,setVisible ] = useState(false);
const [ mainFlag ,setMainFlag ] = useState(false);
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
@ -85,6 +86,7 @@ function CoderDepot(props){
let c = result.data.last_commit
setLastCommit(c && c.commit);
setLastCommitAuthor(c && (c.author || (c.commit && c.commit.author)));
setMainFlag(true);
}
setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);})
@ -125,6 +127,7 @@ function CoderDepot(props){
let c = result.data.last_commit
setLastCommit(c && c.commit);
setLastCommitAuthor(c && (c.author || (c.commit && c.commit.author)));
setMainFlag(false);
}
setTimeout(function(){setIsSpin(false);},500)
}).catch(error=>{setIsSpin(false);})
@ -193,7 +196,7 @@ function CoderDepot(props){
<WhiteBack>
<Spin spinning={isSpin}>
{
dirInfo &&
(dirInfo || fileInfo) &&
<React.Fragment>
<DrawerPanel
history={props.history}
@ -203,6 +206,7 @@ function CoderDepot(props){
branch={branchName || (projectDetail && projectDetail.default_branch)}
visible={visible}
onClose={()=>setVisible(false)}
list = {mainFlag ? dirInfo : undefined}
/>
<div className="drawerBtn" onClick={()=>setVisible(true)}><i className="iconfont icon-youjiantou"></i></div>
</React.Fragment>
@ -264,7 +268,7 @@ function CoderDepot(props){
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }
<span className="ml12 color-grey-9 mt3">{lastCommit && lastCommit.time_from_now}</span>
{ commitCount ? <span className="ml12 color-grey-9"><i className="iconfont icon-tijiao mr3 font-17 color-grey-9"></i>{commitCount}次提交</span>:"" }
{ commitCount ? <Link to={`/projects/${owner}/${projectsId}/commits`} className="ml12 color-grey-9"><i className="iconfont icon-tijiao mr3 font-17 color-grey-9"></i>{commitCount}次提交</Link>:"" }
</div>
}
<ul className="listtablebody">
@ -303,8 +307,11 @@ function CoderDepot(props){
}
</ul>
</div>
: <Nodata _html="暂未发现文件"/>
: ""
}
{
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
}
{/* readme文件显示(显示文件详情时不显示readme文件) */}
{ dirInfo && <ReadMe ChangeFile={ChangeFile} readme={projectDetail && projectDetail.readme} operate={props && (props.isManager || props.isDeveloper)} history={props.history} /> }
</div>