|
|
@ -1,5 +1,5 @@ |
|
|
|
import React from "react"; |
|
|
|
import React from "react"; |
|
|
|
import {Button, Form, Image, Tab, Table, Tabs} from "react-bootstrap"; |
|
|
|
import {Button, Col, Form, Image, Row, Tab, Table, Tabs} from "react-bootstrap"; |
|
|
|
import {PageProps, UserEntity, UserType} from "./entity"; |
|
|
|
import {PageProps, UserEntity, UserType} from "./entity"; |
|
|
|
import {Input} from "./ui/InputGroup"; |
|
|
|
import {Input} from "./ui/InputGroup"; |
|
|
|
import {JSONResponse, Method, request} from "./interface"; |
|
|
|
import {JSONResponse, Method, request} from "./interface"; |
|
|
@ -39,22 +39,32 @@ class EditUser extends React.Component<{ |
|
|
|
render() { |
|
|
|
render() { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Form> |
|
|
|
<Form> |
|
|
|
<div className="text-center ml-auto mr-auto"> |
|
|
|
<Row> |
|
|
|
<UploadImg tip={"点击更新头像"} maxImageSize={maxImageSize} onChange={(value:string)=> |
|
|
|
<Col className={"text-center"}> |
|
|
|
|
|
|
|
<UploadImg imgClass={"mt-3 col-12"} tip={"点击更新头像"} maxImageSize={maxImageSize} onChange={(value:string)=> |
|
|
|
this.setState({ user:{...this.state.user,...{activityImgFile:value}}})} /> |
|
|
|
this.setState({ user:{...this.state.user,...{activityImgFile:value}}})} /> |
|
|
|
</div> |
|
|
|
</Col> |
|
|
|
<Input name="name" desc="姓名" value={this.state.user.name} onChange={(value:string)=> |
|
|
|
</Row> |
|
|
|
|
|
|
|
<Row> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 ml-auto"} name="name" desc="姓名" value={this.state.user.name} onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{name:value}} |
|
|
|
user:{...this.state.user,...{name:value}} |
|
|
|
})} valid={{check:this.isNotEmpty(this.state.user.name)}}/> |
|
|
|
})} valid={{check:this.isNotEmpty(this.state.user.name)}}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
<Input col={4} name="age" desc="年龄" value={this.state.user.age+""} onChange={(value:string)=> |
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 mr-auto"} name="age" desc="年龄" value={this.state.user.age+""} onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{age:+value}} |
|
|
|
user:{...this.state.user,...{age:+value}} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} as={"select"} options={this.ages.map(value=><option key={value} value={value}>{value}</option>)}/> |
|
|
|
} as={"select"} valid={{check:true}} options={this.ages.map(value=><option key={value} value={value}>{value}</option>)}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
|
|
<Input col={4} name="sex" desc="性别" as="select" value={this.state.user.sex} onChange={(value:string)=>{ |
|
|
|
<Row> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 ml-auto"} valid={{check:this.state.user.sex!==""}} name="sex" desc="性别" as="select" value={this.state.user.sex} onChange={(value:string)=>{ |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{sex:value}} |
|
|
|
user:{...this.state.user,...{sex:value}} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -63,20 +73,27 @@ class EditUser extends React.Component<{ |
|
|
|
<option value="" key={"sex"+0}>请选择性别</option>, |
|
|
|
<option value="" key={"sex"+0}>请选择性别</option>, |
|
|
|
<option value="man" key={"sex"+1}>男</option>, |
|
|
|
<option value="man" key={"sex"+1}>男</option>, |
|
|
|
<option value="women" key={"sex"+2}>女</option>]}/> |
|
|
|
<option value="women" key={"sex"+2}>女</option>]}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
<Input name="address" desc="住址" value={this.state.user.address} onChange={(value:string)=>this.setState({ |
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 mr-auto"} name="address" desc="住址" value={this.state.user.address} onChange={(value:string)=>this.setState({ |
|
|
|
user:{...this.state.user,...{address:value}} |
|
|
|
user:{...this.state.user,...{address:value}} |
|
|
|
})} valid={{check:this.isNotEmpty(this.state.user.address)}}/> |
|
|
|
})} valid={{check:this.isNotEmpty(this.state.user.address)}}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
|
|
<div className="mt-3"> |
|
|
|
<Row> |
|
|
|
<Address value={this.state.user.serviceAddress} onChange={(value:string)=> |
|
|
|
|
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<Address className={"mt-3 ml-auto"} value={this.state.user.serviceAddress} onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{serviceAddress:value}} |
|
|
|
user:{...this.state.user,...{serviceAddress:value}} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}/> |
|
|
|
}/> |
|
|
|
</div> |
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
<Input col={4} name="userType" desc="用户身份" as="select" value={this.state.user.userType} onChange={(value:string)=> |
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 mr-auto"} name="userType" desc="用户身份" as="select" value={this.state.user.userType} onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{userType:value}} |
|
|
|
user:{...this.state.user,...{userType:value}} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -84,26 +101,40 @@ class EditUser extends React.Component<{ |
|
|
|
options={[<option value="" key={"userType0"}>请选择用户身份</option>, |
|
|
|
options={[<option value="" key={"userType0"}>请选择用户身份</option>, |
|
|
|
<option key={"userType1"} value={UserType.seekHelp}>服务发起者</option>, |
|
|
|
<option key={"userType1"} value={UserType.seekHelp}>服务发起者</option>, |
|
|
|
<option key={"userType2"} value={UserType.help}>服务接收者</option>]}/> |
|
|
|
<option key={"userType2"} value={UserType.help}>服务接收者</option>]}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Row> |
|
|
|
|
|
|
|
|
|
|
|
<Input col={4} name="mobile" desc="电话" value={this.state.user.mobile} onChange={(value:string)=> |
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 ml-auto"} name="mobile" desc="电话" maxLength={11} value={this.state.user.mobile} onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{mobile:value}} |
|
|
|
user:{...this.state.user,...{mobile:value}} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} valid={{check:this.checkMobile()}}/> |
|
|
|
} valid={{check:this.checkMobile()}}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
<Input col={4} name="email" value={this.state.user.email} desc="邮箱" onChange={(value:string)=> |
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 mr-auto"} name="email" value={this.state.user.email} desc="邮箱" onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{email:value}} |
|
|
|
user:{...this.state.user,...{email:value}} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} valid={{check:this.checkEmail()}}/> |
|
|
|
} valid={{check:this.checkEmail()}}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
<Input col={7} name="info" desc="简介" value={this.state.user.info} as={"textarea"} onChange={(value:string)=> |
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Row> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"ml-auto mr-auto mt-3 pl-0 pr-0"} name="info" desc="简介" value={this.state.user.info} as={"textarea"} onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{info:value}} |
|
|
|
user:{...this.state.user,...{info:value}} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
valid={{check:this.isNotEmpty(this.state.user.info)}}/> |
|
|
|
valid={{check:this.isNotEmpty(this.state.user.info)}}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Button variant="info" block={true} disabled={!this.check()} className={"ml-auto mr-auto mt-3 col-3"} onClick={()=>this.props.modifyUser(this.state.user)}>确认修改</Button> |
|
|
|
<Button variant="info" block={true} disabled={!this.check()} className={"ml-auto mr-auto mt-3 col-3"} onClick={()=>this.props.modifyUser(this.state.user)}>确认修改</Button> |
|
|
|