This commit is contained in:
red-deng-deng 2021-11-19 11:08:05 +08:00
parent 7d0ccea130
commit 4bc146e866
1 changed files with 63 additions and 22 deletions

View File

@ -8,7 +8,7 @@ import "../../../assets/comm.css"
import {Select,Dialog,Button,ImageUpload ,onUpload,FormInputField,Notify,CopyButton } from "zent"
import Bus from "../../../assets/eventBus.js"
import {getExistName,getCompany,getPersonnel,handelResponse,getExistAccount} from "../../../assets/api.js"
import {getExistName,uploadImg,getCompany,getPersonnel,handelResponse,getExistAccount} from "../../../assets/api.js"
export default class adduserinfo extends React.Component{
constructor(props){
super(props)
@ -25,8 +25,9 @@ export default class adduserinfo extends React.Component{
company_id:'',
company_name:'',
identity_type:'',
head_img:''
head_img:""
},
uploadimgFile:{},//上传头像
companyList:[],
personnelList:[],
logVisible:false,
@ -56,9 +57,29 @@ export default class adduserinfo extends React.Component{
}
onUploadChange(files){
};
this.setState({uploadimgFile:files});
};
//点击上传头像按钮
upImgBtn(){
let files=this.state.uploadimgFile;
if(files&&files.length>0){
let formdata= new FormData();
formdata.append("file",files[0].file)
formdata.append("path","reseller_avatar")
uploadImg(formdata).then((res)=>{
handelResponse(res,(req,msg)=>{
let model2 = this.state.model;
model2.head_img = req.path;
this.setState({model:model2})
Notify.clear();
Notify.success(msg);
})
});
}else{
Notify.clear();
Notify.warn('请先选择图片!');
}
}
//选择销售人员
onsaleChange(e){
let model2 = this.state.model
@ -162,14 +183,35 @@ export default class adduserinfo extends React.Component{
}
//添加号码
addfieldArr(){
let arr=this.state.fieldArr;
if(arr.length>4){
Notify.clear();
Notify.error('添加的手机号码数量已经达到上限!');
}else{
arr.push({val:'',prop:''});
this.setState({fieldArr:arr});
}
// let arr=this.state.fieldArr;
// if(arr.length>4){
// Notify.clear();
// Notify.error('添加的手机号码数量已经达到上限!');
// }else{
// arr.push({val:'',prop:''});
// this.setState({fieldArr:arr});
// }
let emailDom= document.querySelector('#contacts_email');
let div=document.createElement('div');
// div.innerHTML=`
// <Form model={this.state.model} rules={rules} ref="form1" className="addform">
// <FormItem labelname="分销商全称" prop="fullname" >
// <Ipt onChange={(e)=>{
// let model2 = this.state.model;
// model2.name = e;
// this.setState({model:model2})
// }}
// onClearItem={(e)=>{
// let model2 = this.state.model;
// model2.name = "";
// this.setState({model:model2})
// }}
// onblurFn={(e)=>{this.NameblurFn(e)}}
// countShow= {false}
// value={this.state.model.name} placeholder={"请输入分销商全称"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'520px'} alignment={'left'}/>
// </FormItem>`;
console.log(div);
}
render(){
const companyOptions =this.state.companyList;
@ -285,7 +327,7 @@ export default class adduserinfo extends React.Component{
countShow= {true}
value={this.state.model.contact_name} placeholder={"请输入联系人"} labelWidth={'0px'} maxLength={16} height={'36px'} width={'520px'} alignment={'left'}/>
</FormItem>
<FormItem labelname="联系人手机号" prop="contacts_phone">
<FormItem labelname="联系人手机号" prop="contacts_phone" id="contacts_phone">
<div className="phonet">
<Ipt onChange={(e)=>{
let model2 = this.state.model;
@ -304,7 +346,7 @@ export default class adduserinfo extends React.Component{
</div>
</FormItem>
{
{/* {
this.state.fieldArr.map((item,i)=>{
return(
<FormItem labelname="分销商全称" prop={item.id} id={item.id}>
@ -313,7 +355,6 @@ export default class adduserinfo extends React.Component{
model2.name = e;
this.setState({model:model2})
}}
onClearItem={(e)=>{
let model2 = this.state.model;
model2.name = "";
@ -325,8 +366,8 @@ export default class adduserinfo extends React.Component{
</FormItem>
)
})
}
<FormItem labelname="联系人邮箱" prop="contacts_email">
} */}
<FormItem labelname="联系人邮箱" prop="contacts_email" id="contacts_email">
<div className="phonet">
<Ipt onChange={(e)=>{
@ -375,10 +416,10 @@ export default class adduserinfo extends React.Component{
maxSize={5 * 1024 * 1024}
tips="建议尺寸 30*30图片不超过 500kb"
maxAmount={1}
onChange={this.onUploadChange}
onUpload={this.onUpload}
/>
<Button className="putImage">上传头像</Button>
onChange={(e)=>{this.onUploadChange(e)}}
onUpload={this.onUpload}
/>
<Button className="putImage" onClick={()=>this.upImgBtn()}>上传头像</Button>
</div>
</div>
</div>