|
|
@ -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,71 +39,102 @@ 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"}> |
|
|
|
this.setState({ user:{...this.state.user,...{activityImgFile:value}}})} /> |
|
|
|
<UploadImg imgClass={"mt-3 col-12"} tip={"点击更新头像"} maxImageSize={maxImageSize} onChange={(value:string)=> |
|
|
|
</div> |
|
|
|
this.setState({ user:{...this.state.user,...{activityImgFile:value}}})} /> |
|
|
|
<Input name="name" desc="姓名" value={this.state.user.name} onChange={(value:string)=> |
|
|
|
</Col> |
|
|
|
this.setState({ |
|
|
|
</Row> |
|
|
|
user:{...this.state.user,...{name:value}} |
|
|
|
<Row> |
|
|
|
})} valid={{check:this.isNotEmpty(this.state.user.name)}}/> |
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 ml-auto"} name="name" desc="姓名" value={this.state.user.name} onChange={(value:string)=> |
|
|
|
<Input col={4} name="age" desc="年龄" value={this.state.user.age+""} onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{name:value}} |
|
|
|
user:{...this.state.user,...{age:+value}} |
|
|
|
})} valid={{check:this.isNotEmpty(this.state.user.name)}}/> |
|
|
|
}) |
|
|
|
</Col> |
|
|
|
} as={"select"} options={this.ages.map(value=><option key={value} value={value}>{value}</option>)}/> |
|
|
|
|
|
|
|
|
|
|
|
<Col> |
|
|
|
<Input col={4} name="sex" desc="性别" as="select" value={this.state.user.sex} onChange={(value:string)=>{ |
|
|
|
<Input className={"mt-3 mr-auto"} name="age" desc="年龄" value={this.state.user.age+""} onChange={(value:string)=> |
|
|
|
this.setState({ |
|
|
|
|
|
|
|
user:{...this.state.user,...{sex:value}} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
options={[ |
|
|
|
|
|
|
|
<option value="" key={"sex"+0}>请选择性别</option>, |
|
|
|
|
|
|
|
<option value="man" key={"sex"+1}>男</option>, |
|
|
|
|
|
|
|
<option value="women" key={"sex"+2}>女</option>]}/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Input name="address" desc="住址" value={this.state.user.address} onChange={(value:string)=>this.setState({ |
|
|
|
|
|
|
|
user:{...this.state.user,...{address:value}} |
|
|
|
|
|
|
|
})} valid={{check:this.isNotEmpty(this.state.user.address)}}/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mt-3"> |
|
|
|
|
|
|
|
<Address value={this.state.user.serviceAddress} onChange={(value:string)=> |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{serviceAddress:value}} |
|
|
|
user:{...this.state.user,...{age:+value}} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}/> |
|
|
|
} as={"select"} valid={{check:true}} options={this.ages.map(value=><option key={value} value={value}>{value}</option>)}/> |
|
|
|
</div> |
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> |
|
|
|
<Input col={4} name="userType" desc="用户身份" as="select" value={this.state.user.userType} onChange={(value:string)=> |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
<Row> |
|
|
|
user:{...this.state.user,...{userType:value}} |
|
|
|
<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({ |
|
|
|
options={[<option value="" key={"userType0"}>请选择用户身份</option>, |
|
|
|
user:{...this.state.user,...{sex:value}} |
|
|
|
<option key={"userType1"} value={UserType.seekHelp}>服务发起者</option>, |
|
|
|
}) |
|
|
|
<option key={"userType2"} value={UserType.help}>服务接收者</option>]}/> |
|
|
|
}} |
|
|
|
|
|
|
|
options={[ |
|
|
|
<Input col={4} name="mobile" desc="电话" value={this.state.user.mobile} onChange={(value:string)=> |
|
|
|
<option value="" key={"sex"+0}>请选择性别</option>, |
|
|
|
this.setState({ |
|
|
|
<option value="man" key={"sex"+1}>男</option>, |
|
|
|
user:{...this.state.user,...{mobile:value}} |
|
|
|
<option value="women" key={"sex"+2}>女</option>]}/> |
|
|
|
}) |
|
|
|
</Col> |
|
|
|
} valid={{check:this.checkMobile()}}/> |
|
|
|
|
|
|
|
|
|
|
|
<Col> |
|
|
|
<Input col={4} name="email" value={this.state.user.email} desc="邮箱" onChange={(value:string)=> |
|
|
|
<Input className={"mt-3 mr-auto"} name="address" desc="住址" value={this.state.user.address} onChange={(value:string)=>this.setState({ |
|
|
|
this.setState({ |
|
|
|
user:{...this.state.user,...{address:value}} |
|
|
|
user:{...this.state.user,...{email:value}} |
|
|
|
})} valid={{check:this.isNotEmpty(this.state.user.address)}}/> |
|
|
|
}) |
|
|
|
</Col> |
|
|
|
} valid={{check:this.checkEmail()}}/> |
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
|
|
<Input col={7} name="info" desc="简介" value={this.state.user.info} as={"textarea"} onChange={(value:string)=> |
|
|
|
<Row> |
|
|
|
this.setState({ |
|
|
|
|
|
|
|
user:{...this.state.user,...{info:value}} |
|
|
|
<Col> |
|
|
|
}) |
|
|
|
<Address className={"mt-3 ml-auto"} value={this.state.user.serviceAddress} onChange={(value:string)=> |
|
|
|
} |
|
|
|
this.setState({ |
|
|
|
valid={{check:this.isNotEmpty(this.state.user.info)}}/> |
|
|
|
user:{...this.state.user,...{serviceAddress:value}} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 mr-auto"} name="userType" desc="用户身份" as="select" value={this.state.user.userType} onChange={(value:string)=> |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
|
|
|
|
user:{...this.state.user,...{userType:value}} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
options={[<option value="" key={"userType0"}>请选择用户身份</option>, |
|
|
|
|
|
|
|
<option key={"userType1"} value={UserType.seekHelp}>服务发起者</option>, |
|
|
|
|
|
|
|
<option key={"userType2"} value={UserType.help}>服务接收者</option>]}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 ml-auto"} name="mobile" desc="电话" maxLength={11} value={this.state.user.mobile} onChange={(value:string)=> |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
|
|
|
|
user:{...this.state.user,...{mobile:value}} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} valid={{check:this.checkMobile()}}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<Input className={"mt-3 mr-auto"} name="email" value={this.state.user.email} desc="邮箱" onChange={(value:string)=> |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
|
|
|
|
user:{...this.state.user,...{email:value}} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} valid={{check:this.checkEmail()}}/> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</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({ |
|
|
|
|
|
|
|
user:{...this.state.user,...{info:value}} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
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> |
|
|
@ -259,7 +290,7 @@ export class User extends React.Component< |
|
|
|
<td className="align-middle">{user.info}</td> |
|
|
|
<td className="align-middle">{user.info}</td> |
|
|
|
<td className="align-middle"> |
|
|
|
<td className="align-middle"> |
|
|
|
<Button variant="info" className="mr-3" onClick={()=>this.setState({ |
|
|
|
<Button variant="info" className="mr-3" onClick={()=>this.setState({ |
|
|
|
dialog:<MyDialog content={<EditUser modifyUser={(user:UserEntity)=>this.modifyUser(user)} user={user}/>} open={true} titleId={"user-edit-dialog"} menuName={"修改用户信息"} |
|
|
|
dialog:<MyDialog content={<EditUser modifyUser={(user:UserEntity)=>this.modifyUser(user)} user={user}/>} open={true} titleId={"user-edit-dialog"} menuName={"修改用户信息"} |
|
|
|
onClose={()=>this.setState({dialog:null})}/> |
|
|
|
onClose={()=>this.setState({dialog:null})}/> |
|
|
|
})}>修改用户信息</Button> |
|
|
|
})}>修改用户信息</Button> |
|
|
|
<Button variant="danger" className="mr-3">删除</Button> |
|
|
|
<Button variant="danger" className="mr-3">删除</Button> |
|
|
|