|
|
@ -1,85 +1,67 @@ |
|
|
|
import React from "react"; |
|
|
|
import React from "react"; |
|
|
|
import {Button, Col, Container, Image, Row} from "react-bootstrap"; |
|
|
|
import {Button, Col, Container, Image, Row} from "react-bootstrap"; |
|
|
|
import {ActivityDetail, User} from "../entity"; |
|
|
|
import {LeaveWord, LeaveWordType} from "../entity"; |
|
|
|
import {Tooltip} from "@material-ui/core"; |
|
|
|
import {Tooltip} from "@material-ui/core"; |
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
import {MyInfo} from "./MyInfo"; |
|
|
|
import {MyInfo} from "./MyInfo"; |
|
|
|
import {Activity} from "../ui/Activity"; |
|
|
|
import {Activity} from "../ui/Activity"; |
|
|
|
import {activityObj, userObj} from "../ui/TestData"; |
|
|
|
import {API, Method, prefix, request} from "../interface"; |
|
|
|
|
|
|
|
import {LeaveWordRes, LeaveWordTransform, PageDataMessage} from "../result"; |
|
|
|
enum LeaveWordType { |
|
|
|
|
|
|
|
//推荐
|
|
|
|
|
|
|
|
recommend="recommend", |
|
|
|
|
|
|
|
//报名
|
|
|
|
|
|
|
|
apply="apply", |
|
|
|
|
|
|
|
//参与
|
|
|
|
|
|
|
|
join="join", |
|
|
|
|
|
|
|
//完成
|
|
|
|
|
|
|
|
complete="complete", |
|
|
|
|
|
|
|
//好友验证
|
|
|
|
|
|
|
|
friend="friend" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Type1{ |
|
|
|
|
|
|
|
activity:ActivityDetail; |
|
|
|
|
|
|
|
user:User; |
|
|
|
|
|
|
|
type:LeaveWordType; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Type2 { |
|
|
|
|
|
|
|
user:User; |
|
|
|
|
|
|
|
type:LeaveWordType; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 我的留言 |
|
|
|
* 我的留言 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export class MyLeaveWord extends React.Component<{ user:string }, |
|
|
|
export class MyLeaveWord extends React.Component< |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
user:string |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
//留言信息
|
|
|
|
//留言信息
|
|
|
|
data:Array<Type1|Type2>; |
|
|
|
data?:Array<LeaveWord>; |
|
|
|
//打开用户信息弹框
|
|
|
|
//打开用户信息弹框
|
|
|
|
openUserInfo:boolean; |
|
|
|
openUserInfo:boolean; |
|
|
|
//用户id
|
|
|
|
//用户id
|
|
|
|
userId?:string; |
|
|
|
userId?:string; |
|
|
|
//打开活动信息弹框
|
|
|
|
|
|
|
|
openActivity:boolean; |
|
|
|
|
|
|
|
//活动详情
|
|
|
|
//活动详情
|
|
|
|
activity?:ActivityDetail; |
|
|
|
activityId:number|null, |
|
|
|
|
|
|
|
//加载提示
|
|
|
|
|
|
|
|
result:JSX.Element|null |
|
|
|
}>{ |
|
|
|
}>{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(props: Readonly<any>) { |
|
|
|
constructor(props: Readonly<any>) { |
|
|
|
super(props); |
|
|
|
super(props); |
|
|
|
|
|
|
|
|
|
|
|
this.state={data:[],openUserInfo:false,openActivity:false} |
|
|
|
this.state={ |
|
|
|
|
|
|
|
result: <h3 className="text-info text-center">留言列表加载中</h3>, |
|
|
|
|
|
|
|
activityId: null, |
|
|
|
|
|
|
|
data:[], |
|
|
|
|
|
|
|
openUserInfo:false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
componentDidMount() { |
|
|
|
this.loadLeaveWord() |
|
|
|
this.loadLeaveWord(1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 加载留言 |
|
|
|
* 加载留言 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
loadLeaveWord(){ |
|
|
|
loadLeaveWord(page:number){ |
|
|
|
this.setState({ |
|
|
|
|
|
|
|
data:[ |
|
|
|
let that=this |
|
|
|
{ |
|
|
|
|
|
|
|
user:userObj, |
|
|
|
request(API.account.leaveWord+"?currentPage="+page,Method.GET,{},new LeaveWordTransform(),function (res:LeaveWordRes) { |
|
|
|
activity:activityObj, |
|
|
|
switch (res.customResult) { |
|
|
|
type:LeaveWordType.recommend |
|
|
|
case PageDataMessage.ok: |
|
|
|
}, |
|
|
|
that.setState({ |
|
|
|
{ |
|
|
|
data:res.dataList |
|
|
|
user:userObj, |
|
|
|
});break |
|
|
|
activity:activityObj, |
|
|
|
case PageDataMessage.fail: |
|
|
|
type:LeaveWordType.apply |
|
|
|
that.setState({ |
|
|
|
}, |
|
|
|
result:<h3 className="text-danger text-center">留言列表加载失败</h3> |
|
|
|
{ |
|
|
|
}) |
|
|
|
user:userObj, |
|
|
|
|
|
|
|
type:LeaveWordType.friend |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -102,18 +84,18 @@ export class MyLeaveWord extends React.Component<{ user:string }, |
|
|
|
* @param data |
|
|
|
* @param data |
|
|
|
* @param index |
|
|
|
* @param index |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
getData(data:Type1|Type2,index:number){ |
|
|
|
getData(data:LeaveWord,index:number){ |
|
|
|
let body |
|
|
|
let body |
|
|
|
if("activity" in data ){ |
|
|
|
if(data.activityId!=null){ |
|
|
|
body=<Col> |
|
|
|
body=<Col> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<h5 className="text-center">{data.activity.title}</h5> |
|
|
|
<h5 className="text-center">{data.title}</h5> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<p className="text-ellipsis leave-word-height">{data.activity.content}</p> |
|
|
|
<p className="text-ellipsis leave-word-height">{data.content}</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="text-center"> |
|
|
|
<div className="text-center"> |
|
|
|
<Button variant={"primary"} onClick={()=>this.setState({openActivity:true,activity:data.activity})}>查看活动详情</Button> |
|
|
|
<Button variant={"primary"} onClick={()=>this.setState({activityId:data.activityId})}>查看活动详情</Button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
@ -123,7 +105,7 @@ export class MyLeaveWord extends React.Component<{ user:string }, |
|
|
|
<h5>~</h5> |
|
|
|
<h5>~</h5> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<p className="text-ellipsis leave-word-height">{data.user.info}</p> |
|
|
|
<p className="text-ellipsis leave-word-height">{data.info}</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="text-center"> |
|
|
|
<div className="text-center"> |
|
|
|
<Button variant={"primary"} className="mr-2">同意</Button> |
|
|
|
<Button variant={"primary"} className="mr-2">同意</Button> |
|
|
@ -141,12 +123,12 @@ export class MyLeaveWord extends React.Component<{ user:string }, |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
<Row> |
|
|
|
<Row> |
|
|
|
<Col xs={3}> |
|
|
|
<Col xs={3}> |
|
|
|
<Image src={data.user.headImg} className="leave-word-headImg"/> |
|
|
|
<Image src={prefix.image+data.headImg} className="leave-word-headImg"/> |
|
|
|
<span className="text-center user-name ml-3">{data.user.name}</span> |
|
|
|
<span className="text-center user-name ml-3">{data.name}</span> |
|
|
|
|
|
|
|
|
|
|
|
{data.type===LeaveWordType.friend? |
|
|
|
{data.type===LeaveWordType.friend? |
|
|
|
<Tooltip title="查看用户信息" placement="right"> |
|
|
|
<Tooltip title="查看用户信息" placement="right"> |
|
|
|
<Image src="user.svg" className="ml-1 mb-1 userIcon" onClick={()=>this.setState({openUserInfo:true,userId:data.user.userId})}/> |
|
|
|
<Image src="user.svg" className="ml-1 mb-1 userIcon" onClick={()=>this.setState({openUserInfo:true,userId:data.userId})}/> |
|
|
|
</Tooltip>:null} |
|
|
|
</Tooltip>:null} |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
{body} |
|
|
|
{body} |
|
|
@ -160,14 +142,14 @@ export class MyLeaveWord extends React.Component<{ user:string }, |
|
|
|
render() { |
|
|
|
render() { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="overflow-auto my-leave-world-height"> |
|
|
|
<div className="overflow-auto my-leave-world-height"> |
|
|
|
{this.state.data.map((data,index) =>this.getData(data,index))} |
|
|
|
{this.state.data?this.state.data.map((data,index) =>this.getData(data,index)):this.state.result} |
|
|
|
<MyDialog titleId="view-user" menuName="用户信息" |
|
|
|
<MyDialog titleId="view-user" menuName="用户信息" |
|
|
|
content={<MyInfo isOwn={false} isMyFriend={false} isAdd={false} userId={this.state.userId?this.state.userId:""}/>} |
|
|
|
content={<MyInfo isOwn={false} isMyFriend={false} isAdd={false} userId={this.state.userId?this.state.userId:""}/>} |
|
|
|
open={this.state.openUserInfo} onClose={()=>this.setState({openUserInfo:false})}/> |
|
|
|
open={this.state.openUserInfo} onClose={()=>this.setState({openUserInfo:false})}/> |
|
|
|
|
|
|
|
|
|
|
|
{this.state.activity?<MyDialog content={<Activity activity={this.state.activity} showButton={false} />} |
|
|
|
<MyDialog content={<Activity activityId={this.state.activityId} showButton={false} />} |
|
|
|
open={this.state.openActivity} titleId="view-activity" menuName="活动详情" |
|
|
|
open={this.state.activityId!=null} titleId="view-activity" menuName="活动详情" |
|
|
|
onClose={()=>this.setState({activity:undefined,openActivity:false})}/>:null} |
|
|
|
onClose={()=>this.setState({activityId:null})}/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|