未登录判断

This commit is contained in:
caishi 2021-03-19 17:22:02 +08:00
parent 0c0203a8ef
commit 8a1feed72b
2 changed files with 28 additions and 8 deletions

View File

@ -3,6 +3,7 @@ import { WhiteBack , Box , LongWidth , ShortWidth , Gap , AlignCenter , FlexAJ
import { Dropdown , Menu , Divider , Spin } from 'antd';
import { getImageUrl } from "educoder";
import { Link } from 'react-router-dom';
import CloneAddress from '../Branch/CloneAddress';
import SelectBranch from '../Branch/Select';
import User from '../Component/User';
@ -142,8 +143,8 @@ function CoderDepot(props){
//
const fileMenu =(
<Menu>
<Menu.Item><Link to={`/projects/${owner}/${projectsId}/${branchName || (projectDetail && projectDetail.default_branch)}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`}>上传文件</Link></Menu.Item>
<Menu.Item><Link to={`/projects/${owner}/${projectsId}/${branchName || (projectDetail && projectDetail.default_branch)}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`}>新建文件</Link></Menu.Item>
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${branchName || (projectDetail && projectDetail.default_branch)}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件</a></Menu.Item>
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${branchName || (projectDetail && projectDetail.default_branch)}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件</a></Menu.Item>
</Menu>
)
@ -186,11 +187,26 @@ function CoderDepot(props){
setHide(!hide);
}
function urlLink(link){
if(props.checkIfLogin()===false){
props.showLoginDialog()
return false;
}
props.history.push(link);
}
const downloadMenu = (
<Menu>
<Menu.Item><a href={zip_url}>ZIP</a></Menu.Item>
<Menu.Item><a href={tar_url}>TAR.GZ</a></Menu.Item>
</Menu>
<div className="downMenu">
<div style={{padding:"20px",borderBottom:"1px solid #eee"}}>
<CloneAddress
http_url={projectDetail && projectDetail.clone_url}
showNotification={props.showNotification}/>
</div>
<Menu className="edu-txt-center">
<Menu.Item><a href={zip_url}>下载 ZIP</a></Menu.Item>
<Menu.Item><a href={tar_url}>下载 TAR.GZ</a></Menu.Item>
</Menu>
</div>
)
return(
<WhiteBack>
@ -250,8 +266,8 @@ function CoderDepot(props){
</AlignCenter>
<AlignCenter>
<div className="mr20 addOptionBtn">
<Link to={`/projects/${owner}/${projectsId}/pulls/new`}>+ 合并请求</Link>
<Link to={`/projects/${owner}/${projectsId}/issues/new`}>+ 任务</Link>
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</a>
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务</a>
</div>
{ type === "dir" && <Dropdown.Button overlay={fileMenu} className="mr20">文件</Dropdown.Button>}
<Dropdown.Button overlay={downloadMenu} type={'primary'}>下载</Dropdown.Button>

View File

@ -269,4 +269,8 @@
i{
color: #d9d9d9;
}
}
.downMenu{
box-shadow: 0px 0px 9px rgba(134, 134, 134,0.4);
background-color: #fff;
}