|
|
|
@ -1,12 +1,21 @@ |
|
|
|
|
import React from "react"; |
|
|
|
|
import {Button, Card, Col, Container, ListGroup, Row} from "react-bootstrap"; |
|
|
|
|
import {ActiveProps} from "../entity"; |
|
|
|
|
import {Page} from "../Page"; |
|
|
|
|
|
|
|
|
|
import {Page} from "../ui/Page"; |
|
|
|
|
import {ActiveDetail, BaseHelp, PageProps} from "../entity"; |
|
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
|
import {Active} from "../ui/Active"; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 首页 |
|
|
|
|
*/ |
|
|
|
|
export class IndexMenu extends React.Component<{ undefined?:undefined }, any>{ |
|
|
|
|
export class IndexMenu extends React.Component<{ user:string }, |
|
|
|
|
{ |
|
|
|
|
activeList:Array<Array<BaseHelp>>; |
|
|
|
|
page:PageProps; |
|
|
|
|
active?:ActiveDetail; |
|
|
|
|
openActive:boolean; |
|
|
|
|
}>{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -19,7 +28,8 @@ export class IndexMenu extends React.Component<{ undefined?:undefined }, any>{ |
|
|
|
|
currentPage:1, |
|
|
|
|
totalPage:3, |
|
|
|
|
pageSize:9 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
openActive:false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -27,6 +37,33 @@ export class IndexMenu extends React.Component<{ undefined?:undefined }, any>{ |
|
|
|
|
this.loadActive(1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 报名活动 |
|
|
|
|
* @param activeId |
|
|
|
|
*/ |
|
|
|
|
applyActive(activeId:number){ |
|
|
|
|
console.debug("报名活动"+activeId) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查找活动 |
|
|
|
|
* @param activeId |
|
|
|
|
*/ |
|
|
|
|
loadActiveWithId(activeId:number):ActiveDetail{ |
|
|
|
|
return { |
|
|
|
|
activeId:123, |
|
|
|
|
activeImg:"logo512.png", |
|
|
|
|
content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", |
|
|
|
|
title: "标题标题标题标题标题标题标题", |
|
|
|
|
activeEndTime:new Date().getTime(), |
|
|
|
|
activeStartTime:new Date().getTime() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 加载活动列表 |
|
|
|
|
* @param page |
|
|
|
|
*/ |
|
|
|
|
loadActive(page:number){ |
|
|
|
|
this.setState({ |
|
|
|
|
activeList:[[{ |
|
|
|
@ -83,8 +120,8 @@ export class IndexMenu extends React.Component<{ undefined?:undefined }, any>{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
const rowList=this.state.activeList.map((actives:Array<ActiveProps>, index:number)=> |
|
|
|
|
<Row className="p-3" key={"row"+index}>{actives.map((active:ActiveProps, subIndex:number)=> |
|
|
|
|
const rowList=this.state.activeList.map((actives:Array<BaseHelp>, index:number)=> |
|
|
|
|
<Row className="p-3" key={"row"+index}>{actives.map((active:BaseHelp, subIndex:number)=> |
|
|
|
|
<Col className="col-4" key={"col"+subIndex}> |
|
|
|
|
<Card> |
|
|
|
|
<Card.Header> |
|
|
|
@ -96,12 +133,16 @@ export class IndexMenu extends React.Component<{ undefined?:undefined }, any>{ |
|
|
|
|
{active.title} |
|
|
|
|
</ListGroup.Item> |
|
|
|
|
<ListGroup.Item> |
|
|
|
|
<p>{active.content}</p> |
|
|
|
|
<p className="active-text-limit text-ellipsis">{active.content}</p> |
|
|
|
|
</ListGroup.Item> |
|
|
|
|
</ListGroup> |
|
|
|
|
</Card.Body> |
|
|
|
|
<Card.Footer> |
|
|
|
|
<Button variant="primary" className="w-100">帮助</Button> |
|
|
|
|
<Button variant={"info"} onClick={()=>this.setState({ |
|
|
|
|
active:this.loadActiveWithId(active.activeId), |
|
|
|
|
openActive:true |
|
|
|
|
})} className="mr-2">查看活动详情</Button> |
|
|
|
|
<Button variant="primary" >帮助</Button> |
|
|
|
|
</Card.Footer> |
|
|
|
|
</Card> |
|
|
|
|
</Col>)} |
|
|
|
@ -119,6 +160,10 @@ export class IndexMenu extends React.Component<{ undefined?:undefined }, any>{ |
|
|
|
|
|
|
|
|
|
<Page onClick={(page:number)=>this.loadActive(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/> |
|
|
|
|
|
|
|
|
|
{this.state.active?<MyDialog content={<Active active={this.state.active} showButton={true} applyFunction={(activeId:number)=>this.applyActive(activeId)} />} |
|
|
|
|
open={this.state.openActive} titleId="view-active" menuName="活动详情" |
|
|
|
|
onClose={()=>this.setState({active:undefined,openActive:false})}/>:null} |
|
|
|
|
|
|
|
|
|
</Container> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|