|
|
|
@ -4,19 +4,22 @@ import {Input} from "../ui/InputGroup"; |
|
|
|
|
import {PageProps, User} from "../entity"; |
|
|
|
|
import {Page} from "../ui/Page"; |
|
|
|
|
import {Address} from "../ui/Address"; |
|
|
|
|
import {userObj} from "../ui/TestData"; |
|
|
|
|
import {API, Method, request} from "../interface" |
|
|
|
|
import {FindUserMessage, FindUserRes, FindUserTransform} from "../result"; |
|
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 志愿者信息 |
|
|
|
|
*/ |
|
|
|
|
export class Volunteer extends React.Component<{ undefined?:undefined }, { |
|
|
|
|
export class Volunteer extends React.Component<{ undefined?:undefined }, |
|
|
|
|
{ |
|
|
|
|
form:{ |
|
|
|
|
keyword:string; |
|
|
|
|
address:string; |
|
|
|
|
serviceAddress:string|null; |
|
|
|
|
}; |
|
|
|
|
addressList:Array<{address:string}>; |
|
|
|
|
volunteerList:Array<Array<User>>; |
|
|
|
|
page:PageProps; |
|
|
|
|
volunteerList?:Array<Array<User>>; |
|
|
|
|
page?:PageProps; |
|
|
|
|
result:JSX.Element|null; |
|
|
|
|
}>{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -24,26 +27,10 @@ export class Volunteer extends React.Component<{ undefined?:undefined }, { |
|
|
|
|
super(props); |
|
|
|
|
|
|
|
|
|
this.state={ |
|
|
|
|
result: null, |
|
|
|
|
form:{ |
|
|
|
|
keyword:"", |
|
|
|
|
address:"" |
|
|
|
|
}, |
|
|
|
|
addressList:[ |
|
|
|
|
{ |
|
|
|
|
address:"北京", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
address:"广州", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
address:"上海", |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
volunteerList:[], |
|
|
|
|
page:{ |
|
|
|
|
currentPage:1, |
|
|
|
|
totalPage:3, |
|
|
|
|
pageSize:9 |
|
|
|
|
serviceAddress:"" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -57,10 +44,32 @@ export class Volunteer extends React.Component<{ undefined?:undefined }, { |
|
|
|
|
*/ |
|
|
|
|
loadVolunteerList(page:number){ |
|
|
|
|
|
|
|
|
|
const array=[userObj,userObj,userObj,userObj] |
|
|
|
|
|
|
|
|
|
this.setState({ |
|
|
|
|
volunteerList:[array,array,array,array] |
|
|
|
|
let that=this |
|
|
|
|
request(API.account.find+'?info='+this.state.form.keyword+'&serviceAddress='+this.state.form.serviceAddress |
|
|
|
|
+'¤tPage='+page+'&userTypes=seekHelp',Method.GET,{},new FindUserTransform(),function(res:FindUserRes){ |
|
|
|
|
switch (res.customResult) { |
|
|
|
|
case FindUserMessage.ok: |
|
|
|
|
that.setState({ |
|
|
|
|
volunteerList:res.dataList, |
|
|
|
|
form:{ |
|
|
|
|
keyword:that.state.form.keyword, |
|
|
|
|
serviceAddress:that.state.form.serviceAddress |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
break |
|
|
|
|
case FindUserMessage.fail: |
|
|
|
|
that.setState({ |
|
|
|
|
form:{ |
|
|
|
|
keyword:that.state.form.keyword, |
|
|
|
|
serviceAddress:that.state.form.serviceAddress |
|
|
|
|
}, |
|
|
|
|
result:<h3 className="text-center text-danger">志愿者搜索失败,请联系管理员</h3> |
|
|
|
|
});break |
|
|
|
|
case FindUserMessage.empty: |
|
|
|
|
that.setState({ |
|
|
|
|
result:<h3 className="text-center text-info">当前没有任何志愿者!!!</h3> |
|
|
|
|
});break |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -72,13 +81,13 @@ export class Volunteer extends React.Component<{ undefined?:undefined }, { |
|
|
|
|
|
|
|
|
|
<Input col={3} name="keyword" desc="描述信息关键字" onChange={(value:string)=>this.setState({form:{ |
|
|
|
|
keyword:value, |
|
|
|
|
address:this.state.form.address |
|
|
|
|
serviceAddress:this.state.form.serviceAddress |
|
|
|
|
}})}/> |
|
|
|
|
|
|
|
|
|
<Address onChange={(value:string)=>this.setState({ |
|
|
|
|
form:{ |
|
|
|
|
keyword:this.state.form.keyword, |
|
|
|
|
address:value |
|
|
|
|
serviceAddress:value |
|
|
|
|
} |
|
|
|
|
})}/> |
|
|
|
|
|
|
|
|
@ -87,7 +96,7 @@ export class Volunteer extends React.Component<{ undefined?:undefined }, { |
|
|
|
|
{/*<Page onClick={(page:number)=>this.loadVolunteerList(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>*/} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{this.state.volunteerList.map((volunteers:Array<User>, index:number)=> |
|
|
|
|
{this.state.volunteerList?this.state.volunteerList.map((volunteers:Array<User>, index:number)=> |
|
|
|
|
<div className="p-3 d-flex ml-auto mr-auto volunteer overflow-auto" key={"row"+index}>{volunteers.map((volunteer:User, subIndex:number)=> |
|
|
|
|
<div key={"col"+subIndex} className="mr-3"> |
|
|
|
|
<div className="border-info border"> |
|
|
|
@ -109,10 +118,11 @@ export class Volunteer extends React.Component<{ undefined?:undefined }, { |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
)}</div> |
|
|
|
|
)} |
|
|
|
|
):null} |
|
|
|
|
|
|
|
|
|
<MyDialog content={this.state.result} open={this.state.result!==null} titleId="find-volunteer" menuName="搜索志愿者" onClose={()=>this.setState({result:null})}/> |
|
|
|
|
|
|
|
|
|
<Page onClick={(page:number)=>this.loadVolunteerList(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/> |
|
|
|
|
{this.state.page?<Page onClick={(page:number)=>this.loadVolunteerList(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>:null} |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|