This commit is contained in:
caishi 2023-04-18 16:58:23 +08:00
parent a0a83f63f6
commit a2e3617036
4 changed files with 16 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import { Modal , Form , Input , Button , message} from 'antd';
import './EAccount.scss';
import axios from 'axios';
function EducoderAccount({form , visible , current_user , onCancel,isCancel}){
function EducoderAccount({form , visible , current_user , onCancel,isCancel,showNotification}){
const { getFieldDecorator, validateFields , setFieldsValue } = form;
useEffect(()=>{
@ -31,7 +31,12 @@ function EducoderAccount({form , visible , current_user , onCancel,isCancel}){
function onSure(){
validateFields((error,values)=>{
if(!error){
onOk(values);
let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
if (reg.test(values.email)) {
onOk(values);
}else{
showNotification && showNotification("请输入正确的邮箱账号!");
}
}
})
}
@ -63,7 +68,9 @@ function EducoderAccount({form , visible , current_user , onCancel,isCancel}){
<Form {...layout}>
<Form.Item label="邮箱">
{getFieldDecorator("email",{
rules:[{required:true,message:"请输入邮箱账号"}]
rules:[
{required:true,message:"请输入邮箱账号"}
]
})(
<Input placeholder="请输入您的邮箱账号" width="220px" disabled={current_user && current_user.email}/>
)}

View File

@ -8,7 +8,7 @@ function Profile({
showCompeleteDialog ,
completeProfile,
className ,
current_user,checkIfLogin,showLoginDialog
current_user,checkIfLogin,showLoginDialog,showNotification
}) {
const [ giteaVisible , setGiteaVisible ] = useState(false);
@ -30,7 +30,7 @@ function Profile({
return(
<React.Fragment>
<EducoderAccount visible={giteaVisible} onCancel={()=>setGiteaVisible(false)} current_user={current_user}/>
<EducoderAccount showNotification={showNotification} visible={giteaVisible} onCancel={()=>setGiteaVisible(false)} current_user={current_user}/>
<a className={className} onClick={checkProfile}>{children}</a>
</React.Fragment>
)

View File

@ -436,7 +436,9 @@ class Index extends Component {
}
</div>
}
<EducoderAccount visible={giteaVisible} isCancel={false} onCancel={()=>{
<EducoderAccount visible={giteaVisible} isCancel={false}
showNotification={this.props.showNotification}
onCancel={()=>{
message.info('未填邮箱及密码,可能影响协同开发部分功能的使用');this.setState({giteaVisible:false})
}} current_user={this.props.current_user}/>
<AlignCenter>

View File

@ -260,6 +260,7 @@ export function TPMIndexHOC(WrappedComponent) {
onCancel={()=>{
message.info('未填邮箱及密码,可能影响协同开发部分功能的使用');this.setState({giteaVisible:false})
}}
showNotification={this.props.showNotification}
current_user={current_user}
/>
<ProfileModal