|
|
|
@ -2,15 +2,14 @@ import React from "react"; |
|
|
|
|
import {Button, Card, Col, Container, Image, ListGroup, Row} from "react-bootstrap"; |
|
|
|
|
|
|
|
|
|
import {Page} from "../ui/Page"; |
|
|
|
|
import {ActivityDetail, ActivityStatus, PageProps, UserType} from "../entity"; |
|
|
|
|
import {ActivityDetail, ActivityStatus, PageProps} from "../entity"; |
|
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
|
import {Activity} from "../ui/Activity"; |
|
|
|
|
import {Input} from "../ui/InputGroup"; |
|
|
|
|
import {API, Method, prefix, request} from "../interface"; |
|
|
|
|
import {FindActivityRes, FindActivityTransform, PageDataMessage} from "../result"; |
|
|
|
|
import {Cookies} from "react-cookie"; |
|
|
|
|
import {user_cookie, user_type_cookie} from "../account/PropCookie"; |
|
|
|
|
import {changeActivity} from "../public"; |
|
|
|
|
import {changeActivity, showActivityTip} from "../public"; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 首页 |
|
|
|
@ -46,6 +45,8 @@ export class IndexMenu extends React.Component<{ cookies:Cookies }, |
|
|
|
|
this.loadActivity(1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 加载活动列表 |
|
|
|
|
* @param page |
|
|
|
@ -77,6 +78,7 @@ export class IndexMenu extends React.Component<{ cookies:Cookies }, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
let that=this |
|
|
|
|
const rowList=this.state.activityList?this.state.activityList.length===0?<h3 className="text-center text-info">当前没有活动可报名</h3>:this.state.activityList.map((activities:Array<ActivityDetail>, index:number)=> |
|
|
|
|
<Row className="p-3" key={"row"+index}>{activities.map((activity:ActivityDetail, subIndex:number)=> |
|
|
|
|
<Col className="col-4" key={"col"+subIndex}> |
|
|
|
@ -95,18 +97,13 @@ export class IndexMenu extends React.Component<{ cookies:Cookies }, |
|
|
|
|
</ListGroup> |
|
|
|
|
</Card.Body> |
|
|
|
|
<Card.Footer> |
|
|
|
|
<Button variant={"info"} onClick={()=>this.setState({activityId:activity.activityId,hideButton: |
|
|
|
|
this.props.cookies.get(user_type_cookie)===UserType.seekHelp |
|
|
|
|
||activity.userId===this.props.cookies.get(user_cookie) |
|
|
|
|
||activity.hasApply||activity.hasStart})} className="mr-2">查看活动详情</Button> |
|
|
|
|
{this.props.cookies.get(user_type_cookie)===UserType.seekHelp |
|
|
|
|
||activity.userId===this.props.cookies.get(user_cookie) |
|
|
|
|
||activity.hasApply||activity.hasStart?null:<Button variant="primary" onClick={()=> { |
|
|
|
|
let that=this |
|
|
|
|
<Button variant={"info"} onClick={()=>this.setState({activityId:activity.activityId})} className="mr-2">查看活动详情</Button> |
|
|
|
|
|
|
|
|
|
{showActivityTip(activity,this,<Button variant="primary" onClick={()=> { |
|
|
|
|
changeActivity(activity.activityId,ActivityStatus.apply, this,function(){ |
|
|
|
|
that.loadActivity(1) |
|
|
|
|
}) |
|
|
|
|
}}>帮助</Button>} |
|
|
|
|
}}>帮助</Button>)} |
|
|
|
|
</Card.Footer> |
|
|
|
|
</Card> |
|
|
|
|
</Col>)} |
|
|
|
@ -128,7 +125,7 @@ export class IndexMenu extends React.Component<{ cookies:Cookies }, |
|
|
|
|
|
|
|
|
|
{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} |
|
|
|
|
|
|
|
|
|
<MyDialog content={<Activity activityId={this.state.activityId} hideButton={this.state.hideButton} applyFunction={(activeId:number)=>{ |
|
|
|
|
<MyDialog content={<Activity cookies={this.props.cookies} activityId={this.state.activityId} hideButton={this.state.hideButton} applyFunction={(activeId:number)=>{ |
|
|
|
|
let that=this |
|
|
|
|
changeActivity(activeId,ActivityStatus.apply, this,function () { |
|
|
|
|
that.loadActivity(1) |
|
|
|
|