|
|
@ -2,15 +2,14 @@ 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, ActivityStatus, PageProps, UserType} from "../entity"; |
|
|
|
import {ActivityDetail, ActivityStatus, PageProps} 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"; |
|
|
|
import {API, Method, prefix, request} from "../interface"; |
|
|
|
import {API, Method, prefix, request} from "../interface"; |
|
|
|
import {FindActivityRes, FindActivityTransform, PageDataMessage} from "../result"; |
|
|
|
import {FindActivityRes, FindActivityTransform, PageDataMessage} from "../result"; |
|
|
|
import {Cookies} from "react-cookie"; |
|
|
|
import {Cookies} from "react-cookie"; |
|
|
|
import {user_cookie, user_type_cookie} from "../account/PropCookie"; |
|
|
|
import {changeActivity, showActivityTip} from "../public"; |
|
|
|
import {changeActivity} from "../public"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 首页 |
|
|
|
* 首页 |
|
|
@ -46,6 +45,8 @@ export class IndexMenu extends React.Component<{ cookies:Cookies }, |
|
|
|
this.loadActivity(1) |
|
|
|
this.loadActivity(1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 加载活动列表 |
|
|
|
* 加载活动列表 |
|
|
|
* @param page |
|
|
|
* @param page |
|
|
@ -77,6 +78,7 @@ export class IndexMenu extends React.Component<{ cookies:Cookies }, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
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)=> |
|
|
|
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)=> |
|
|
|
<Row className="p-3" key={"row"+index}>{activities.map((activity:ActivityDetail, subIndex:number)=> |
|
|
|
<Col className="col-4" key={"col"+subIndex}> |
|
|
|
<Col className="col-4" key={"col"+subIndex}> |
|
|
@ -95,18 +97,13 @@ export class IndexMenu extends React.Component<{ cookies:Cookies }, |
|
|
|
</ListGroup> |
|
|
|
</ListGroup> |
|
|
|
</Card.Body> |
|
|
|
</Card.Body> |
|
|
|
<Card.Footer> |
|
|
|
<Card.Footer> |
|
|
|
<Button variant={"info"} onClick={()=>this.setState({activityId:activity.activityId,hideButton: |
|
|
|
<Button variant={"info"} onClick={()=>this.setState({activityId:activity.activityId})} className="mr-2">查看活动详情</Button> |
|
|
|
this.props.cookies.get(user_type_cookie)===UserType.seekHelp |
|
|
|
|
|
|
|
||activity.userId===this.props.cookies.get(user_cookie) |
|
|
|
{showActivityTip(activity,this,<Button variant="primary" onClick={()=> { |
|
|
|
||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 |
|
|
|
|
|
|
|
changeActivity(activity.activityId,ActivityStatus.apply, this,function(){ |
|
|
|
changeActivity(activity.activityId,ActivityStatus.apply, this,function(){ |
|
|
|
that.loadActivity(1) |
|
|
|
that.loadActivity(1) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}}>帮助</Button>} |
|
|
|
}}>帮助</Button>)} |
|
|
|
</Card.Footer> |
|
|
|
</Card.Footer> |
|
|
|
</Card> |
|
|
|
</Card> |
|
|
|
</Col>)} |
|
|
|
</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} |
|
|
|
{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 |
|
|
|
let that=this |
|
|
|
changeActivity(activeId,ActivityStatus.apply, this,function () { |
|
|
|
changeActivity(activeId,ActivityStatus.apply, this,function () { |
|
|
|
that.loadActivity(1) |
|
|
|
that.loadActivity(1) |
|
|
|