From 4610001721aa40f8eac627b1526d6438b70f8548 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Tue, 26 May 2020 15:06:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=89=E5=8F=8A=E6=B4=BB=E5=8A=A8=E7=9A=84?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E3=80=81=E5=87=BD=E6=95=B0=E3=80=81=E7=B1=BB?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entity.ts | 14 ++--- src/index.css | 6 +- src/my/MyHelp.tsx | 28 +++++----- src/my/MyLeaveWord.tsx | 46 +++++++-------- src/my/SeekHelp.tsx | 14 ++--- src/sub/IndexMenu.tsx | 86 ++++++++++++++--------------- src/sub/SendHelp.tsx | 6 +- src/ui/{Active.tsx => Activity.tsx} | 20 +++---- 8 files changed, 110 insertions(+), 110 deletions(-) rename src/ui/{Active.tsx => Activity.tsx} (58%) diff --git a/src/entity.ts b/src/entity.ts index bb14f15..21b6bad 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -49,22 +49,22 @@ export enum RecommendType { */ export interface BaseHelp { //活动ID - activeId:number; + activityId:number; //活动标题 title:string; //活动内容 content:string; //活动背景图 - activeImg:string; + activityImg:string; } //活动详情 -export interface ActiveDetail extends BaseHelp{ +export interface ActivityDetail extends BaseHelp{ //活动开始时间 - activeStartTime:number; + activityStartTime:number; //活动结束时间 - activeEndTime:number; + activityEndTime:number; } //我的帮助信息 @@ -72,9 +72,9 @@ export interface MyHelpState extends BaseHelp{ //求助时间 seekHelpTime:number; //活动开始时间 - activeStartTime:number; + activityStartTime:number; //活动结束时间 - activeEndTime:number; + activityEndTime:number; //报名时间 applyTime:number; //参与时间 diff --git a/src/index.css b/src/index.css index a8161e7..9984eb2 100644 --- a/src/index.css +++ b/src/index.css @@ -14,7 +14,7 @@ width: 20px; } /*活动背景图尺寸*/ -.activeImage{ +.activityImage{ height: 100px; width: 100px; } @@ -65,7 +65,7 @@ /** * 活动首页正文内容限制 */ -.active-text-limit{ +.activity-text-limit{ -webkit-line-clamp:3; } @@ -133,7 +133,7 @@ /** * 活动详情高度 */ -.active-detail-height{ +.activity-detail-height{ height: 450px; } diff --git a/src/my/MyHelp.tsx b/src/my/MyHelp.tsx index 2dcb94e..5256c8f 100644 --- a/src/my/MyHelp.tsx +++ b/src/my/MyHelp.tsx @@ -71,19 +71,19 @@ export class MyHelp extends React.Component<{ undefined?:undefined }, { data:Arr this.setState({ data:[{ //活动Id - activeId:123, + activityId:123, //活动标题 title:"活动标题", //活动内容 content:"活动内容", //活动背景图 - activeImg: "logo512.png", + activityImg: "logo512.png", //求助时间 seekHelpTime:new Date().getTime(), //活动开始时间 - activeStartTime:new Date().getTime(), + activityStartTime:new Date().getTime(), //活动结束时间 - activeEndTime:new Date().getTime(), + activityEndTime:new Date().getTime(), //报名时间 applyTime:new Date().getTime(), //参与时间 @@ -95,19 +95,19 @@ export class MyHelp extends React.Component<{ undefined?:undefined }, { data:Arr }, { //活动Id - activeId:123, + activityId:123, //活动标题 title:"活动标题", //活动内容 content:"活动内容", //活动背景图 - activeImg: "logo512.png", + activityImg: "logo512.png", //求助时间 seekHelpTime:new Date().getTime(), //活动开始时间 - activeStartTime:new Date().getTime(), + activityStartTime:new Date().getTime(), //活动结束时间 - activeEndTime:new Date().getTime(), + activityEndTime:new Date().getTime(), //报名时间 applyTime:new Date().getTime(), //参与时间 @@ -118,19 +118,19 @@ export class MyHelp extends React.Component<{ undefined?:undefined }, { data:Arr score: Math.ceil(Math.random()*10), },{ //活动Id - activeId:123, + activityId:123, //活动标题 title:"活动标题", //活动内容 content:"活动内容", //活动背景图 - activeImg: "logo512.png", + activityImg: "logo512.png", //求助时间 seekHelpTime:new Date().getTime(), //活动开始时间 - activeStartTime:new Date().getTime(), + activityStartTime:new Date().getTime(), //活动结束时间 - activeEndTime:new Date().getTime(), + activityEndTime:new Date().getTime(), //报名时间 applyTime:new Date().getTime(), //参与时间 @@ -151,7 +151,7 @@ export class MyHelp extends React.Component<{ undefined?:undefined }, { data:Arr - +
{help.title}
@@ -164,7 +164,7 @@ export class MyHelp extends React.Component<{ undefined?:undefined }, { data:Arr )}
- {[help.seekHelpTime,help.activeStartTime,help.activeEndTime].map((time:number,index:number)=> + {[help.seekHelpTime,help.activityStartTime,help.activityEndTime].map((time:number, index:number)=> {moment(time).format("YYYY-MM-DD HH:mm:ss")} )} diff --git a/src/my/MyLeaveWord.tsx b/src/my/MyLeaveWord.tsx index 0f60a05..560ec20 100644 --- a/src/my/MyLeaveWord.tsx +++ b/src/my/MyLeaveWord.tsx @@ -1,10 +1,10 @@ import React from "react"; import {Button, Col, Container, Image, Row} from "react-bootstrap"; -import {ActiveDetail, User} from "../entity"; +import {ActivityDetail, User} from "../entity"; import {Tooltip} from "@material-ui/core"; import {MyDialog} from "../ui/MyDialog"; import {MyInfo} from "./MyInfo"; -import {Active} from "../ui/Active"; +import {Activity} from "../ui/Activity"; import {userObj} from "../ui/TestData"; enum LeaveWordType { @@ -16,7 +16,7 @@ enum LeaveWordType { } interface Type1{ - active:ActiveDetail; + activity:ActivityDetail; user:User; type:LeaveWordType; } @@ -38,16 +38,16 @@ export class MyLeaveWord extends React.Component<{ user:string }, //用户id userId?:string; //打开活动信息弹框 - openActive:boolean; + openActivity:boolean; //活动详情 - active?:ActiveDetail; + activity?:ActivityDetail; }>{ constructor(props: Readonly) { super(props); - this.state={data:[],openUserInfo:false,openActive:false} + this.state={data:[],openUserInfo:false,openActivity:false} } componentDidMount() { @@ -62,25 +62,25 @@ export class MyLeaveWord extends React.Component<{ user:string }, data:[ { user:userObj, - active:{ - activeId:1, + activity:{ + activityId:1, title:"活动标题1", content:"活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动", - activeImg:"logo512.png", - activeStartTime:new Date().getTime(), - activeEndTime:new Date().getTime() + activityImg:"logo512.png", + activityStartTime:new Date().getTime(), + activityEndTime:new Date().getTime() }, type:LeaveWordType.recommend }, { user:userObj, - active:{ - activeId:1, + activity:{ + activityId:1, title:"活动标题1", content:"活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动活动内容活动内容活动", - activeImg:"logo512.png", - activeStartTime:new Date().getTime(), - activeEndTime:new Date().getTime() + activityImg:"logo512.png", + activityStartTime:new Date().getTime(), + activityEndTime:new Date().getTime() }, type:LeaveWordType.apply }, @@ -113,16 +113,16 @@ export class MyLeaveWord extends React.Component<{ user:string }, */ getData(data:Type1|Type2,index:number){ let body - if("active" in data ){ + if("activity" in data ){ body=
-
{data.active.title}
+
{data.activity.title}
-

{data.active.content}

+

{data.activity.content}

- +
}else{ @@ -174,9 +174,9 @@ export class MyLeaveWord extends React.Component<{ user:string }, content={} open={this.state.openUserInfo} onClose={()=>this.setState({openUserInfo:false})}/> - {this.state.active?} - open={this.state.openActive} titleId="view-active" menuName="活动详情" - onClose={()=>this.setState({active:undefined,openActive:false})}/>:null} + {this.state.activity?} + open={this.state.openActivity} titleId="view-activity" menuName="活动详情" + onClose={()=>this.setState({activity:undefined,openActivity:false})}/>:null} ); } diff --git a/src/my/SeekHelp.tsx b/src/my/SeekHelp.tsx index ffe2265..6e74e1e 100644 --- a/src/my/SeekHelp.tsx +++ b/src/my/SeekHelp.tsx @@ -58,34 +58,34 @@ export class SeekHelp extends React.Component<{ user:string }, applyVolunteerList: [userObj,userObj], completeVolunteerList: [], joinVolunteerList: [], - activeImg: "logo512.png", + activityImg: "logo512.png", content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", time: new Date().getTime(), title:"活动标题", //活动Id - activeId:123, + activityId:123, }, { applyVolunteerList: [], completeVolunteerList: [], joinVolunteerList: [], - activeImg: "logo512.png", + activityImg: "logo512.png", content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", time: new Date().getTime(), title:"活动标题", //活动Id - activeId:123, + activityId:123, }, { applyVolunteerList: [], completeVolunteerList: [], joinVolunteerList: [], - activeImg: "logo512.png", + activityImg: "logo512.png", content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", time: new Date().getTime(), title:"活动标题", //活动Id - activeId:123, + activityId:123, } ]}) @@ -101,7 +101,7 @@ export class SeekHelp extends React.Component<{ user:string }, - +
{help.title}
diff --git a/src/sub/IndexMenu.tsx b/src/sub/IndexMenu.tsx index 018352f..055ec3f 100644 --- a/src/sub/IndexMenu.tsx +++ b/src/sub/IndexMenu.tsx @@ -2,9 +2,9 @@ import React from "react"; import {Button, Card, Col, Container, ListGroup, Row} from "react-bootstrap"; import {Page} from "../ui/Page"; -import {ActiveDetail, BaseHelp, PageProps} from "../entity"; +import {ActivityDetail, BaseHelp, PageProps} from "../entity"; import {MyDialog} from "../ui/MyDialog"; -import {Active} from "../ui/Active"; +import {Activity} from "../ui/Activity"; import {Input} from "../ui/InputGroup"; /** @@ -13,13 +13,13 @@ import {Input} from "../ui/InputGroup"; export class IndexMenu extends React.Component<{ user:string }, { //活动数据 - activeList:Array>; + activityList:Array>; //分页信息 page:PageProps; //活动 - active?:ActiveDetail; + activity?:ActivityDetail; //打开活动 - openActive:boolean; + openActivity:boolean; //检索活动标题 title:string; }>{ @@ -30,41 +30,41 @@ export class IndexMenu extends React.Component<{ user:string }, super(props); this.state={ - activeList:[], + activityList:[], page:{ currentPage:1, totalPage:3, pageSize:9 }, - openActive:false, + openActivity:false, title:"" } } componentDidMount() { - this.loadActive(1) + this.loadActivity(1) } /** * 报名活动 - * @param activeId + * @param activityId */ - applyActive(activeId:number){ - console.debug("报名活动"+activeId) + applyActivity(activityId:number){ + console.debug("报名活动"+activityId) } /** * 查找活动 - * @param activeId + * @param activityId */ - loadActiveWithId(activeId:number):ActiveDetail{ + loadActivityWithId(activityId:number):ActivityDetail{ return { - activeId:123, - activeImg:"logo512.png", + activityId:123, + activityImg:"logo512.png", content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", title: "标题标题标题标题标题标题标题", - activeEndTime:new Date().getTime(), - activeStartTime:new Date().getTime() + activityEndTime:new Date().getTime(), + activityStartTime:new Date().getTime() } } @@ -72,85 +72,85 @@ export class IndexMenu extends React.Component<{ user:string }, * 加载活动列表 * @param page */ - loadActive(page:number){ + loadActivity(page:number){ console.debug("检索活动关键字:"+this.state.title) this.setState({ - activeList:[[{ - activeId: 123, + activityList:[[{ + activityId: 123, //活动标题 title: "活动标题", //活动内容 content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", //活动图片 - activeImg: "/logo512.png" + activityImg: "/logo512.png" },{ - activeId: 123, + activityId: 123, //活动标题 title: "活动标题", //活动内容 content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", //活动图片 - activeImg: "/logo512.png" + activityImg: "/logo512.png" },{ - activeId: 123, + activityId: 123, //活动标题 title: "活动标题", //活动内容 content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", //活动图片 - activeImg: "/logo512.png" + activityImg: "/logo512.png" }],[{ - activeId: 123, + activityId: 123, //活动标题 title: "活动标题", //活动内容 content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", //活动图片 - activeImg: "/logo512.png" + activityImg: "/logo512.png" },{ - activeId: 123, + activityId: 123, //活动标题 title: "活动标题", //活动内容 content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", //活动图片 - activeImg: "/logo512.png" + activityImg: "/logo512.png" },{ - activeId: 123, + activityId: 123, //活动标题 title: "活动标题", //活动内容 content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容", //活动图片 - activeImg: "/logo512.png" + activityImg: "/logo512.png" }]] }) } render() { - const rowList=this.state.activeList.map((actives:Array, index:number)=> - {actives.map((active:BaseHelp, subIndex:number)=> + const rowList=this.state.activityList.map((activities:Array, index:number)=> + {activities.map((activity:BaseHelp, subIndex:number)=> - 活动图片 + 活动图片 - {active.title} + {activity.title} -

{active.content}

+

{activity.content}

@@ -165,7 +165,7 @@ export class IndexMenu extends React.Component<{ user:string }, this.setState({title:value})}/> - + {/*this.loadActive(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>*/} @@ -173,11 +173,11 @@ export class IndexMenu extends React.Component<{ user:string }, {rowList} - this.loadActive(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/> + this.loadActivity(page)} currentPage={this.state.page.currentPage} totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/> - {this.state.active?this.applyActive(activeId)} />} - open={this.state.openActive} titleId="view-active" menuName="活动详情" - onClose={()=>this.setState({active:undefined,openActive:false})}/>:null} + {this.state.activity?this.applyActivity(activeId)} />} + open={this.state.openActivity} titleId="view-active" menuName="活动详情" + onClose={()=>this.setState({activity:undefined,openActivity:false})}/>:null}
) diff --git a/src/sub/SendHelp.tsx b/src/sub/SendHelp.tsx index 2b6c688..fadfcdf 100644 --- a/src/sub/SendHelp.tsx +++ b/src/sub/SendHelp.tsx @@ -41,12 +41,12 @@ export class SendHelp extends React.Component<{ undefined?:undefined }, SendHelp const time=moment() this.state={ //活动Id - activeId:123, + activityId:123, title:"", content:"", startTime:time.add({days:1}).format("YYYY-MM-DD HH:mm:ss"), endTime:time.add({days:7}).format("YYYY-MM-DD HH:mm:ss"), - activeImg:"上传活动背景图", + activityImg:"上传活动背景图", address: "", recommendType: RecommendType.no, friendList:[], @@ -120,7 +120,7 @@ export class SendHelp extends React.Component<{ undefined?:undefined }, SendHelp }} dateFormat="YYYY-MM-DD" timeFormat="HH:mm:ss"/> - this.setState({activeImg:value})} imageName={this.state.activeImg}/> + this.setState({activityImg:value})} imageName={this.state.activityImg}/> {/*服务地点*/}
this.setState({address:value})}/> diff --git a/src/ui/Active.tsx b/src/ui/Activity.tsx similarity index 58% rename from src/ui/Active.tsx rename to src/ui/Activity.tsx index 586c532..82c8c78 100644 --- a/src/ui/Active.tsx +++ b/src/ui/Activity.tsx @@ -1,14 +1,14 @@ import React from "react"; import {Button, Image} from "react-bootstrap"; -import {ActiveDetail} from "../entity"; +import {ActivityDetail} from "../entity"; import moment from "moment"; /** * 活动信息 */ -export class Active extends React.Component< +export class Activity extends React.Component< { - active:ActiveDetail; + activity:ActivityDetail; /** * 显示报名按钮 */ @@ -21,13 +21,13 @@ export class Active extends React.Component< render() { return ( -
- -

{this.props.active.title}

-

{this.props.active.content}

-
{"活动开始时间:"+moment(this.props.active.activeStartTime).format("YYYY-MM-DD HH:mm:ss")}
-
{"活动结束时间:"+moment(this.props.active.activeStartTime).format("YYYY-MM-DD HH:mm:ss")}
- {this.props.showButton?
:null} +
+ +

{this.props.activity.title}

+

{this.props.activity.content}

+
{"活动开始时间:"+moment(this.props.activity.activityStartTime).format("YYYY-MM-DD HH:mm:ss")}
+
{"活动结束时间:"+moment(this.props.activity.activityStartTime).format("YYYY-MM-DD HH:mm:ss")}
+ {this.props.showButton?
:null}
); }