|
|
@ -5,8 +5,8 @@ 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 {API, Method, prefix, request} from "../interface"; |
|
|
|
import {API, JSONResponse, Method, prefix, request} from "../interface"; |
|
|
|
import {LeaveWordRes, LeaveWordTransform, PageDataMessage} from "../result"; |
|
|
|
import {EmptyBodyTransform, LeaveWordRes, LeaveWordTransform, PageDataMessage, SimpleMessage} from "../result"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 我的留言 |
|
|
|
* 我的留言 |
|
|
@ -33,7 +33,7 @@ export class MyLeaveWord extends React.Component< |
|
|
|
super(props); |
|
|
|
super(props); |
|
|
|
|
|
|
|
|
|
|
|
this.state={ |
|
|
|
this.state={ |
|
|
|
result: <h3 className="text-info text-center">留言列表加载中</h3>, |
|
|
|
result: null, |
|
|
|
activityId: null, |
|
|
|
activityId: null, |
|
|
|
data:[], |
|
|
|
data:[], |
|
|
|
openUserInfo:false |
|
|
|
openUserInfo:false |
|
|
@ -61,6 +61,7 @@ export class MyLeaveWord extends React.Component< |
|
|
|
that.setState({ |
|
|
|
that.setState({ |
|
|
|
result:<h3 className="text-danger text-center">留言列表加载失败</h3> |
|
|
|
result:<h3 className="text-danger text-center">留言列表加载失败</h3> |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -79,6 +80,55 @@ export class MyLeaveWord extends React.Component< |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 拒绝好友邀请 |
|
|
|
|
|
|
|
* @param id |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
doRefuse(id:number){ |
|
|
|
|
|
|
|
let that=this |
|
|
|
|
|
|
|
request(API.account.refuse+"/"+id,Method.POST, {},new EmptyBodyTransform(),function (res:JSONResponse<SimpleMessage>) { |
|
|
|
|
|
|
|
switch (res.customResult) { |
|
|
|
|
|
|
|
case SimpleMessage.ok: |
|
|
|
|
|
|
|
that.setState({ |
|
|
|
|
|
|
|
result:<h3 className="text-info text-center">成功拒绝邀请</h3> |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
that.loadLeaveWord(1) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
case SimpleMessage.fail: |
|
|
|
|
|
|
|
that.setState({ |
|
|
|
|
|
|
|
result:<h3 className="text-danger text-center">拒绝邀请失败,请联系管理员</h3> |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 同意好友邀请 |
|
|
|
|
|
|
|
* @param data |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
doAgree(data:LeaveWord){ |
|
|
|
|
|
|
|
let that=this |
|
|
|
|
|
|
|
request(API.account.agree,Method.POST, { |
|
|
|
|
|
|
|
leaveWordId:data.leaveWordId+"", |
|
|
|
|
|
|
|
sourceUserId:data.userId |
|
|
|
|
|
|
|
},new EmptyBodyTransform(),function (res:JSONResponse<SimpleMessage>) { |
|
|
|
|
|
|
|
switch (res.customResult) { |
|
|
|
|
|
|
|
case SimpleMessage.ok: |
|
|
|
|
|
|
|
that.setState({ |
|
|
|
|
|
|
|
result:<h3 className="text-info text-center">添加好友成功</h3> |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
case SimpleMessage.fail: |
|
|
|
|
|
|
|
that.loadLeaveWord(1) |
|
|
|
|
|
|
|
that.setState({ |
|
|
|
|
|
|
|
result:<h3 className="text-danger text-center">添加好友失败,请联系管理员</h3> |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 解析留言 |
|
|
|
* 解析留言 |
|
|
|
* @param data |
|
|
|
* @param data |
|
|
@ -108,8 +158,8 @@ export class MyLeaveWord extends React.Component< |
|
|
|
<p className="text-ellipsis leave-word-height">{data.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" onClick={()=>this.doAgree(data)}>同意</Button> |
|
|
|
<Button variant={"danger"}>拒绝</Button> |
|
|
|
<Button variant={"danger"} onClick={()=>this.doRefuse(data.leaveWordId)}>拒绝</Button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
} |
|
|
|
} |
|
|
@ -142,7 +192,7 @@ export class MyLeaveWord extends React.Component< |
|
|
|
render() { |
|
|
|
render() { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="overflow-auto my-leave-world-height"> |
|
|
|
<div className="overflow-auto my-leave-world-height"> |
|
|
|
{this.state.data?this.state.data.map((data,index) =>this.getData(data,index)):this.state.result} |
|
|
|
{this.state.data?this.state.data.length===0?<h3 className="text-info text-center">没有留言记录</h3>:this.state.data.map((data,index) =>this.getData(data,index)):<h3 className="text-info text-center">留言加载中</h3>} |
|
|
|
<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})}/> |
|
|
@ -150,6 +200,11 @@ export class MyLeaveWord extends React.Component< |
|
|
|
<MyDialog content={<Activity activityId={this.state.activityId} showButton={false} />} |
|
|
|
<MyDialog content={<Activity activityId={this.state.activityId} showButton={false} />} |
|
|
|
open={this.state.activityId!=null} titleId="view-activity" menuName="活动详情" |
|
|
|
open={this.state.activityId!=null} titleId="view-activity" menuName="活动详情" |
|
|
|
onClose={()=>this.setState({activityId:null})}/> |
|
|
|
onClose={()=>this.setState({activityId:null})}/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<MyDialog content={this.state.result} open={this.state.result!==null} titleId="my_leave_word_dialog" menuName="提示" onClose={()=>this.setState({ |
|
|
|
|
|
|
|
result:null |
|
|
|
|
|
|
|
})}/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|