退出仓库

This commit is contained in:
caishi 2022-05-26 16:30:19 +08:00
parent dbcf0bb1b9
commit f053b25744
9 changed files with 64 additions and 6 deletions

View File

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 2340181 */
src: url('iconfont.woff2?t=1652927945088') format('woff2'),
url('iconfont.woff?t=1652927945088') format('woff'),
url('iconfont.ttf?t=1652927945088') format('truetype');
src: url('iconfont.woff2?t=1653550272457') format('woff2'),
url('iconfont.woff?t=1653550272457') format('woff'),
url('iconfont.ttf?t=1653550272457') format('truetype');
}
.iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-tuichuicon:before {
content: "\e936";
}
.icon-bangzhuzhongxinicon1:before {
content: "\e935";
}

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "29934961",
"name": "退出icon",
"font_class": "tuichuicon",
"unicode": "e936",
"unicode_decimal": 59702
},
{
"icon_id": "29811507",
"name": "帮助中心icon",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -644,7 +644,8 @@ class Detail extends Component {
open_devops={open_devops}
platform={platform}
urlFlag={urlFlag}
isManager={isManager}
showNotification={this.props.showNotification}
current_user={current_user}
/>
}
</div>

View File

@ -2,9 +2,12 @@ import React, { useEffect, useState } from 'react';
import { Skeleton , Tooltip} from 'antd';
import { Link } from 'react-router-dom';
import { numFormat } from 'educoder';
import QuitBox from './quit';
import axios from 'axios';
function DetailBanner({ history,list , owner , projectsId , isManager , url , pathname , state , urlFlag , projectDetail , platform ,open_devops }){
function DetailBanner({ history,list , owner , projectsId ,showNotification , url , pathname , state , urlFlag , projectDetail , platform ,open_devops ,current_user }){
const [ menuName , setMenuName ] = useState(undefined);
const [ visible , setVisible ] = useState(false);
useEffect(()=>{
if(list){
// banner
@ -19,8 +22,20 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
setMenuName(list);
}
},[list]);
function onSuccess(){
const url = `/${owner}/${projectsId}/quit.json`;
axios.post(url).then(result=>{
if(result){
showNotification("已成功退出仓库!");
history.push(`/${current_user && current_user.login}`);
}
}).catch(error=>{})
}
return(
<div className="f-wrap-between mt25">
<QuitBox visible={visible} onCancel={()=>setVisible(false)} name={projectDetail && projectDetail.name} onSuccess={onSuccess}/>
{
menuName && projectDetail ?
<ul className="headerMenu-wrapper">
@ -135,6 +150,10 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
</Link>
</li>
}
{
item.menu_name === "quit" &&
<a onClick={()=>setVisible(true)}><i className="iconfont icon-tuichuicon color-grey-3 mr5 font-14"></i>退出仓库</a>
}
</React.Fragment>
)
})

View File

@ -0,0 +1,27 @@
import React from 'react';
import { AlignCenter } from '../../Component/layout';
import Modals from '../../Component/PublicModal/Index';
import { Button } from 'antd';
function QuitBox({ visible , onCancel ,onSuccess , name }) {
return(
<Modals
visible={visible}
onCancel={onCancel}
title={"退出仓库"}
btn={
<div>
<Button size={'large'} onClick={onCancel}>取消</Button>
<Button type={"danger"} size={"large"} onClick={onSuccess}>确定</Button>
</div>
}
>
<div className="desc">
<AlignCenter className="descMain">
<i className="iconfont icon-jinggao1 mr10 font-20 red"></i>确定退出 {name} 仓库吗</AlignCenter>
<p style={{textAlign:"center"}}>请进行确认以防数据的丢失</p>
</div>
</Modals>
)
}
export default QuitBox;