组织设置为私有+弹框

This commit is contained in:
caishi 2022-12-12 16:05:00 +08:00
parent fd042dec1b
commit 156b2fd5e3
2 changed files with 21 additions and 4 deletions

View File

@ -25,8 +25,9 @@ export default Form.create()(
const [ password , setPassword ] = useState(undefined);
const [ passwordFlag , setPasswordFlag ] = useState(false);
const [ visible , setVisible ] = useState(false);
const [ privacyVisible , setPrivacyVisible ] = useState(false);
const [ descNum , setDescNum ] = useState(0);
const { getFieldDecorator , validateFields , setFieldsValue } = form;
const { getFieldDecorator , validateFields , setFieldsValue , getFieldsValue} = form;
useEffect(()=>{
if(organizeDetail){
@ -109,10 +110,24 @@ export default Form.create()(
callback();
}
function changeVisibility(e){
if(e.target.value === "privacy"){
setPrivacyVisible(true);
}
}
function concelChangePrivacy(){
setPrivacyVisible(false);
setFieldsValue({
visibility:organizeDetail && organizeDetail.visibility
})
}
return(
<div>
<WhiteBack>
<Title>基本设置</Title>
<Modals visible={privacyVisible} okText={"确认"} cancelText={"取消"} onCancel={concelChangePrivacy} onOk={()=>setPrivacyVisible(false)}>
<p className="font-16 edu-txt-center">设置私有后该组织内所有仓库将更改为私有仓库确认更改</p>
</Modals>
<Div>
<Form>
{helper(
@ -161,7 +176,7 @@ export default Form.create()(
'可见性:',
"visibility",
[],
<Radio.Group>
<Radio.Group onChange={changeVisibility}>
<Radio value="common" style={radioStyle}>公开</Radio>
<Radio value="limited" style={radioStyle}>受限<span>仅对登录用户可见</span></Radio>
<Radio value="privacy" style={radioStyle}>私有<span>仅对组织成员可见</span></Radio>

View File

@ -172,7 +172,7 @@ export function TPMIndexHOC(WrappedComponent) {
tpmLoading: false,
completeProfile:response.data.profile_completed
})
if(response.data && response.data.login){
if(response.data.login){
if(response.data.need_edit_info){
this.setState({
giteaVisible:true,
@ -180,7 +180,9 @@ export function TPMIndexHOC(WrappedComponent) {
})
}
// 如果处于登录状态,且刚刚打开,那么跳到个人主页
if(this.props.match.path === "/" && this.props.history.length===2){
// let hrefStr = this.props.match.path === "/login" || this.props.match.path === "/register" || this.props.match.path === "/resetPassword";
// console.log("111:",hrefStr,this.props.match.path);
if((this.props.match.path === "/" && this.props.history.length===2)){
this.props.history.push(`/${response.data.login}`)
}
if(!response.data.phone){