更新添加邮箱

This commit is contained in:
red-deng-deng 2021-11-26 19:46:39 +08:00
parent 2f1e67c5b3
commit 172b340e7b
1 changed files with 739 additions and 707 deletions

View File

@ -20,6 +20,7 @@ export default class adduserinfo extends React.Component{
uploadimgFile:'',//分销商头像files
email_nums:1,
disabled:false,
pwdtype:'password',
defaultFileList:[{src:'',}],//默认回显头像,//默认回显头像
model:{ //数据模型不可少
name:'',
@ -39,6 +40,7 @@ export default class adduserinfo extends React.Component{
email2:"",
email3:"",
email4:"",
addemail:[]
},
rules:{
fullname: [
@ -278,8 +280,6 @@ export default class adduserinfo extends React.Component{
//添加邮箱
addEmailArr(){
let emilnum = this.state.email_nums + 1;
if(this.state.email_nums>5){
Notify.clear();
Notify.error('添加的联系人邮箱数量已经达到上限!');
@ -296,7 +296,10 @@ export default class adduserinfo extends React.Component{
this.setState({rules:rules});
}
this.setState({email_nums:emilnum})
console.log(this.state);
}
changeType(e){
this.setState({pwdtype:e});
}
render(){
const companyOptions =this.state.companyList;
@ -349,7 +352,7 @@ export default class adduserinfo extends React.Component{
<FormItem labelname="密码" prop="pwd">
<Ipt kind={"password"} onChange={(e)=>{
<Ipt markedShow={(e)=>{this.changeType(e)}} kind={this.state.pwdtype} onChange={(e)=>{
let model2 = this.state.model;
model2.password = e;
@ -403,6 +406,7 @@ export default class adduserinfo extends React.Component{
this.state.phone_nums > 1 ?
(
<FormItem labelname={"联系人手机号1"} prop={"phone1"} id={"phone1"}>
<div className="phonet">
<Ipt onChange={(e)=>{
let model2 = this.state.model;
model2.phone1 = e;
@ -411,20 +415,17 @@ export default class adduserinfo extends React.Component{
}}
onClearItem={(e)=>{
console.log(this.state.phone_nums);
let model2 = this.state.model;
model2.phone1 = "";
this.setState({model:model2})
let nums = this.state.phone_nums - 1;
delete this.state.rules.phone1;
this.setState({phone_nums:nums,rules:this.state.rules })
}}
countShow= {false}
value={this.state.model.phone1} placeholder={"请输入联系人手机号"} labelWidth={'0px'} maxLength={11} height={'36px'} width={'520px'} alignment={'left'}/>
<Button type="danger" onClick={(e)=>{
let nums = this.state.phone_nums - 1;
delete this.state.rules.phone1;
this.setState({phone_nums:nums,rules:this.state.rules })}} >删除此项</Button>
</div>
</FormItem>
) : null
@ -434,6 +435,7 @@ export default class adduserinfo extends React.Component{
this.state.phone_nums > 2 ?
(
<FormItem labelname={"联系人手机号2"} prop={"phone2"} id={"phone2"}>
<div className="phonet">
<Ipt onChange={(e)=>{
console.log(777777)
let model2 = this.state.model;
@ -445,14 +447,16 @@ export default class adduserinfo extends React.Component{
let model2 = this.state.model;
model2.phone2 = "";
delete this.state.rules.phone2;
this.setState({model:model2})
let nums = this.state.phone_nums - 1;
this.setState({phone_nums:nums,rules:this.state.rules })
}}
countShow= {false}
value={this.state.model.phone2} placeholder={"请输入联系人手机号"} labelWidth={'0px'} maxLength={11} height={'36px'} width={'520px'} alignment={'left'}/>
<Button type="danger" onClick={(e)=>{
let nums = this.state.phone_nums - 1;
delete this.state.rules.phone2;
this.setState({phone_nums:nums,rules:this.state.rules })}} >删除此项</Button>
</div>
</FormItem>
) : null
@ -462,6 +466,7 @@ export default class adduserinfo extends React.Component{
this.state.phone_nums > 3 ?
(
<FormItem labelname={"联系人手机号3"} prop={"phone3"} id={"phone3"}>
<div className="phonet">
<Ipt onChange={(e)=>{
console.log(777777)
let model2 = this.state.model;
@ -474,15 +479,16 @@ export default class adduserinfo extends React.Component{
let model2 = this.state.model;
model2.phone3 = "";
delete this.state.rules.phone3;
this.setState({model:model2,rules:this.state.rules})
let nums = this.state.phone_nums - 1;
this.setState({phone_nums:nums})
this.setState({model:model2})
}}
countShow= {false}
value={this.state.model.phone3} placeholder={"请输入联系人手机号"} labelWidth={'0px'} maxLength={11} height={'36px'} width={'520px'} alignment={'left'}/>
<Button type="danger" onClick={(e)=>{
let nums = this.state.phone_nums - 1;
delete this.state.rules.phone3;
this.setState({phone_nums:nums,rules:this.state.rules })}} >删除此项</Button>
</div>
</FormItem>
) : null
@ -492,6 +498,7 @@ export default class adduserinfo extends React.Component{
this.state.phone_nums > 4 ?
(
<FormItem labelname={"联系人手机号4"} prop={"phone4"} id={"phone4"}>
<div className="phonet">
<Ipt onChange={(e)=>{
console.log(777777)
let model2 = this.state.model;
@ -504,15 +511,16 @@ export default class adduserinfo extends React.Component{
let model2 = this.state.model;
model2.phone4 = "";
delete this.state.rules.phone4;
this.setState({model:model2,rules:this.state.rules})
let nums = this.state.phone_nums - 1;
this.setState({phone_nums:nums})
this.setState({model:model2})
}}
countShow= {false}
value={this.state.model.phone4} placeholder={"请输入联系人手机号"} labelWidth={'0px'} maxLength={11} height={'36px'} width={'520px'} alignment={'left'}/>
<Button type="danger" onClick={(e)=>{
let nums = this.state.phone_nums - 1;
delete this.state.rules.phone4;
this.setState({phone_nums:nums,rules:this.state.rules })}} >删除此项</Button>
</div>
</FormItem>
) : null
@ -542,12 +550,13 @@ export default class adduserinfo extends React.Component{
</div>
</FormItem>
{
this.state.email_nums > 1 ?
this.state.email_nums >1 &&this.state.model.email1!==null ?
(
<FormItem labelname={"联系人邮箱1"} prop={"email1"} id={"email1"}>
<div className="phonet">
<Ipt onChange={(e)=>{
let model2 = this.state.model;
model2.email1 = e;
model2.addemail[1] = e;
this.setState({model:model2})
// Bus.emit('input',"email1" ,e);
}}
@ -555,27 +564,33 @@ export default class adduserinfo extends React.Component{
onClearItem={(e)=>{
let model2 = this.state.model;
model2.email1 = "";
delete this.state.rules.email1;
this.setState({model:model2,rules:this.state.rules})
let nums = this.state.email_nums - 1;
this.setState({email_nums:nums})
model2.addemail[1] = "";
this.setState({model:model2})
}}
countShow= {false}
value={this.state.model.email1} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
value={this.state.model.addemail[1]} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
<Button type="danger" onClick={(e)=>{
console.log('邮箱1',this.state);
let nums = this.state.email_nums-1;
delete this.state.rules.email1;
let model3= this.state.model;
model3.addemail[1]=null;
this.setState({email_nums:nums,rules:this.state.rules,model:model3 });console.log(570,nums);}} >删除此项</Button>
</div>
</FormItem>
) : null
}
{
this.state.email_nums > 2 ?
this.state.email_nums > 2 &&this.state.model.email2!==null ?
(
<FormItem labelname={"联系人邮箱2"} prop={"email2"} id={"email2"}>
<div className="phonet">
<Ipt onChange={(e)=>{
let model2 = this.state.model;
model2.email2 = e;
model2.addemail[2] = e;
this.setState({model:model2})
// Bus.emit('input',"email2" ,e);
}}
@ -583,28 +598,34 @@ export default class adduserinfo extends React.Component{
onClearItem={(e)=>{
let model2 = this.state.model;
model2.email2 = "";
delete this.state.rules.email2;
this.setState({model:model2,rules:this.state.rules})
let nums = this.state.email_nums - 1;
this.setState({email_nums:nums})
model2.addemail[2] = "";
this.setState({model:model2})
}}
countShow= {false}
value={this.state.model.email2} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
value={this.state.model.addemail[2]} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
<Button type="danger" onClick={(e)=>{
console.log('邮箱2',this.state);
let nums = this.state.email_nums-1;
delete this.state.rules.email2;
let model3= this.state.model;
model3.email2=null;
console.log(570,this.state);
this.setState({email_nums:nums,rules:this.state.rules,model:model3 })}} >删除此项</Button>
</div>
</FormItem>
) : null
}
{
this.state.email_nums > 3 ?
this.state.email_nums > 3 &&this.state.model.email3!==null ?
(
<FormItem labelname={"联系人邮箱3"} prop={"email3"} id={"email3"}>
<div className="phonet">
<Ipt onChange={(e)=>{
let model2 = this.state.model;
model2.email3 = e;
model2.addemail[3] = e;
this.setState({model:model2})
// Bus.emit('input',"email3" ,e);
}}
@ -612,29 +633,34 @@ export default class adduserinfo extends React.Component{
onClearItem={(e)=>{
let model2 = this.state.model;
model2.email3 = "";
delete this.state.rules.email3;
this.setState({model:model2,rules:this.state.rules})
let nums = this.state.email_nums - 1;
this.setState({phone_nums:nums})
model2.addemail[3] = "";
this.setState({model:model2})
}}
countShow= {false}
value={this.state.model.email3} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
value={this.state.model.addemail[3]} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
<Button type="danger" onClick={(e)=>{
console.log('邮箱3',this.state);
let nums = this.state.email_nums - 1;
delete this.state.rules.email3;
let model3= this.state.model;
model3.email3=null;
console.log(570,this.state);
this.setState({email_nums:nums,rules:this.state.rules,model:model3 })}} >删除此项</Button>
</div>
</FormItem>
) : null
}
{
this.state.email_nums > 4 ?
this.state.email_nums > 4 &&this.state.model.email4!==null?
(
<FormItem labelname={"联系人邮箱4"} prop={"email4"} id={"email4"}>
<div className="phonet">
<Ipt onChange={(e)=>{
let model2 = this.state.model;
model2.email4 = e;
model2.addemail[4] = e;
this.setState({model:model2})
// Bus.emit('input',"email4" ,e);
}}
@ -642,16 +668,22 @@ export default class adduserinfo extends React.Component{
onClearItem={(e)=>{
let model2 = this.state.model;
model2.email4 = "";
delete this.state.rules.email4;
this.setState({model:model2,rules:this.state.rules})
let nums = this.state.email_nums - 1;
this.setState({phone_nums:nums})
model2.addemail[4] = "";
this.setState({model:model2})
}}
countShow= {false}
value={this.state.model.email4} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
value={this.state.model.addemail[4]} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
<Button type="danger" onClick={(e)=>{
console.log('邮箱4',this.state);
let nums = this.state.email_nums - 1;
delete this.state.rules.email4;
let model3= this.state.model;
model3.email4=null;
console.log(570,this.state);
this.setState({email_nums:nums,rules:this.state.rules,model:model3 })}} >删除此项</Button>
</div>
</FormItem>
) : null