|
|
@ -2,7 +2,7 @@ import React from "react"; |
|
|
|
import {Button, Card, Col, Container, Image, ListGroup, Row} from "react-bootstrap"; |
|
|
|
import {Button, Card, Col, Container, Image, ListGroup, Row} from "react-bootstrap"; |
|
|
|
|
|
|
|
|
|
|
|
import {Page} from "../ui/Page"; |
|
|
|
import {Page} from "../ui/Page"; |
|
|
|
import {ActivityDetail, PageProps, VolunteerStatus} from "../entity"; |
|
|
|
import {ActivityDetail, PageProps, UserType, VolunteerStatus} from "../entity"; |
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
import {Activity} from "../ui/Activity"; |
|
|
|
import {Activity} from "../ui/Activity"; |
|
|
|
import {Input} from "../ui/InputGroup"; |
|
|
|
import {Input} from "../ui/InputGroup"; |
|
|
@ -16,11 +16,13 @@ import { |
|
|
|
PageDataMessage, |
|
|
|
PageDataMessage, |
|
|
|
SimpleMessage |
|
|
|
SimpleMessage |
|
|
|
} from "../result"; |
|
|
|
} from "../result"; |
|
|
|
|
|
|
|
import {Cookies} from "react-cookie"; |
|
|
|
|
|
|
|
import {user_type_cookie} from "../account/PropCookie"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 首页 |
|
|
|
* 首页 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export class IndexMenu extends React.Component<{ user:string }, |
|
|
|
export class IndexMenu extends React.Component<{ cookies:Cookies }, |
|
|
|
{ |
|
|
|
{ |
|
|
|
//活动数据
|
|
|
|
//活动数据
|
|
|
|
activityList?:Array<Array<ActivityDetail>>; |
|
|
|
activityList?:Array<Array<ActivityDetail>>; |
|
|
@ -50,14 +52,6 @@ export class IndexMenu extends React.Component<{ user:string }, |
|
|
|
this.loadActivity(1) |
|
|
|
this.loadActivity(1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 报名活动 |
|
|
|
|
|
|
|
* @param activityId |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
applyActivity(activityId:number){ |
|
|
|
|
|
|
|
console.debug("报名活动"+activityId) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 报名活动 |
|
|
|
* 报名活动 |
|
|
|
* @param activityId 活动id |
|
|
|
* @param activityId 活动id |
|
|
@ -73,6 +67,7 @@ export class IndexMenu extends React.Component<{ user:string }, |
|
|
|
},new EmptyBodyTransform(),function (res:JSONResponse<SimpleMessage>) { |
|
|
|
},new EmptyBodyTransform(),function (res:JSONResponse<SimpleMessage>) { |
|
|
|
switch (res.customResult) { |
|
|
|
switch (res.customResult) { |
|
|
|
case SimpleMessage.ok: |
|
|
|
case SimpleMessage.ok: |
|
|
|
|
|
|
|
that.loadActivity(1) |
|
|
|
that.setState({ |
|
|
|
that.setState({ |
|
|
|
result:<h3 className="text-info text-center">报名成功</h3> |
|
|
|
result:<h3 className="text-info text-center">报名成功</h3> |
|
|
|
});break |
|
|
|
});break |
|
|
@ -129,6 +124,7 @@ export class IndexMenu extends React.Component<{ user:string }, |
|
|
|
});break |
|
|
|
});break |
|
|
|
case PageDataMessage.empty: |
|
|
|
case PageDataMessage.empty: |
|
|
|
that.setState({ |
|
|
|
that.setState({ |
|
|
|
|
|
|
|
activityList:[], |
|
|
|
page:res.page, |
|
|
|
page:res.page, |
|
|
|
result:<h3 className="text-info text-center">当前没有活动记录!!!</h3> |
|
|
|
result:<h3 className="text-info text-center">当前没有活动记录!!!</h3> |
|
|
|
});break; |
|
|
|
});break; |
|
|
@ -157,7 +153,7 @@ export class IndexMenu extends React.Component<{ user:string }, |
|
|
|
</Card.Body> |
|
|
|
</Card.Body> |
|
|
|
<Card.Footer> |
|
|
|
<Card.Footer> |
|
|
|
<Button variant={"info"} onClick={()=>this.loadActivityWithId(activity.activityId)} className="mr-2">查看活动详情</Button> |
|
|
|
<Button variant={"info"} onClick={()=>this.loadActivityWithId(activity.activityId)} className="mr-2">查看活动详情</Button> |
|
|
|
<Button variant="primary" onClick={()=>this.apply(activity.activityId)}>帮助</Button> |
|
|
|
{this.props.cookies.get(user_type_cookie)===UserType.help?<Button variant="primary" onClick={()=>this.apply(activity.activityId)}>帮助</Button>:null} |
|
|
|
</Card.Footer> |
|
|
|
</Card.Footer> |
|
|
|
</Card> |
|
|
|
</Card> |
|
|
|
</Col>)} |
|
|
|
</Col>)} |
|
|
@ -179,7 +175,10 @@ export class IndexMenu extends React.Component<{ user:string }, |
|
|
|
|
|
|
|
|
|
|
|
{this.state.page?<Page onClick={(page:number)=>this.loadActivity(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>:null} |
|
|
|
{this.state.page?<Page onClick={(page:number)=>this.loadActivity(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>:null} |
|
|
|
|
|
|
|
|
|
|
|
{this.state.activity?<MyDialog content={<Activity activity={this.state.activity} showButton={true} applyFunction={(activeId:number)=>this.applyActivity(activeId)} />} |
|
|
|
{this.state.activity?<MyDialog content={<Activity activity={this.state.activity} showButton={true} applyFunction={(activeId:number)=>{ |
|
|
|
|
|
|
|
this.apply(activeId) |
|
|
|
|
|
|
|
this.setState({activity:undefined,openActivity:false}) |
|
|
|
|
|
|
|
}} />} |
|
|
|
open={this.state.openActivity} titleId="view-active" menuName="活动详情" |
|
|
|
open={this.state.openActivity} titleId="view-active" menuName="活动详情" |
|
|
|
onClose={()=>this.setState({activity:undefined,openActivity:false})}/>:null} |
|
|
|
onClose={()=>this.setState({activity:undefined,openActivity:false})}/>:null} |
|
|
|
|
|
|
|
|
|
|
|