/**
|
* 柯礼钦<kelq@hugeinfo.com.cn>
|
* 2018年9月4日 16:00
|
*
|
*/
|
|
import React from "react";
|
import { Input, Button, message, Breadcrumb } from "antd";
|
import moment from "moment";
|
import BusDetailView from "../view/BusDetailView";
|
import LineView from "../view/LineView";
|
import HeadView from "../view/HeadView";
|
|
import Fetch from "../fetch";
|
const { TextArea } = Input;
|
const replyAdmin = {
|
display: 'block',
|
float: 'left',
|
color: 'green',
|
}
|
|
const replyUser = {
|
display: 'block',
|
float: 'left',
|
color: '#1790ff'
|
}
|
|
const timeUser = {
|
display: 'block',
|
color: '#1790ff'
|
}
|
|
const timeAdmin = {
|
display: 'block',
|
color: 'green'
|
}
|
function sexOfName(sexOfName) {
|
switch (sexOfName) {
|
case 0:
|
return "未知"
|
case 1:
|
return '男'
|
case 2:
|
return '女'
|
}
|
}
|
export default class BusDetail extends React.Component {
|
constructor(props) {
|
super(props);
|
this.state = {
|
savedate: {},
|
sweeping: {},
|
userInfo: {},
|
data: {}
|
};
|
}
|
|
componentDidMount() {
|
const { id } = this.props.match.params;
|
Fetch.getSweepingDetail(id).then(data => {
|
|
this.setState(
|
{
|
data: data,
|
userInfo: data.userInfo,
|
sweeping: data.crimeCrackdown,
|
savedate:
|
{
|
businessId: id,
|
businessType: 26,
|
approvalStatus: 2
|
}
|
}
|
);
|
})
|
}
|
|
goBack = () => {
|
this.props.history.goBack();
|
};
|
|
|
onInputChange = ({ target: { value, name } }) => {
|
this.setState(({ savedate }) => ({
|
savedate: {
|
...savedate,
|
[name]: value
|
}
|
}))
|
}
|
|
submitAudit = () => {
|
|
const { savedate } = this.state;
|
console.log(savedate);
|
if (!savedate.opinion) {
|
message.warning("回复内容不能为空!");
|
return;
|
}
|
|
Fetch.snapshotReply(savedate).then(res => {
|
if (res.code === 0) {
|
message.success("回复成功", 2, () => {
|
this.props.history.goBack();
|
});
|
} else {
|
message.error("回复失败,请联系管理员", 2);
|
}
|
});
|
};
|
|
render() {
|
|
// 居中样式
|
const center = {
|
display: "flex",
|
alignItems: "center",
|
justifyContent: "center"
|
};
|
const { sweeping, data, userInfo } = this.state;
|
const { flag } = this.props.match.params;
|
return (
|
<div className="app-page">
|
<HeadView history={this.props.history} />
|
<Breadcrumb style={{ padding: '20px' }}>
|
<Breadcrumb.Item><a href="">后台中心</a></Breadcrumb.Item>
|
<Breadcrumb.Item>扫黑除恶</Breadcrumb.Item>
|
</Breadcrumb>
|
<BusDetailView>
|
<div>
|
<LineView title="举报人信息" style="14vh" lineHeight="34px">
|
{sweeping.isRealName === 1 ?
|
<table>
|
<tbody>
|
<tr>
|
<td className="table-vaule1">姓名</td>
|
<td className="table-vaule2">{userInfo.userName}</td>
|
<td className="table-vaule3">电话号码</td>
|
<td className="table-vaule4">{userInfo.mobile}</td>
|
</tr>
|
<tr>
|
<td className="table-vaule1">地址</td>
|
<td className="table-vaule2">{userInfo.address}</td>
|
<td className="table-vaule3">出生日期</td>
|
<td className="table-vaule4">{userInfo.birthday || "暂无"}</td>
|
</tr>
|
<tr>
|
<td className="table-vaule1">身份证号码</td>
|
<td className="table-vaule2">{userInfo.cardNo}</td>
|
<td className="table-vaule3">性别</td>
|
<td className="table-vaule4">{sexOfName(userInfo.userSex || 0)}</td>
|
</tr>
|
<tr>
|
<td className="table-vaule1">身份证照片</td>
|
<td className="table-vaule2"></td>
|
</tr>
|
</tbody>
|
</table> : "已匿名"}
|
|
<div className="apply-img-div">
|
{sweeping.isRealName === 1
|
? userInfo.attList.map((data, key) => (
|
<div style={{ marginRight: "10px" }} key={key}>
|
<a href={data.path} target='_black'> <img
|
src={data.path}
|
width='70px'
|
height='70px'
|
/></a>
|
</div>
|
))
|
: null}
|
</div>
|
|
</LineView>
|
<LineView title="详细说明" style="13vh" lineHeight="20px">
|
<span>{sweeping.content}</span>
|
</LineView>
|
</div>
|
<LineView title="相关材料" style="14vh">
|
<div className="apply-img-div">
|
{sweeping.attList
|
? sweeping.attList.map((data, key) => (
|
<div style={{ marginRight: "10px" }} key={key}>
|
<a href={data.path} target='_black'><img src={data.path} width='70' height='70' /></a>
|
</div>
|
))
|
: null}
|
</div>
|
</LineView>
|
{
|
data.ReplyLogs ?
|
<LineView title="回复记录" style="15vh">
|
{data.ReplyLogs.map((contacts, key) => (
|
<div style={{ width: '100%', height: '70px' }} key={key}>
|
{contacts.userType === 1 ?
|
<React.Fragment>
|
<div style={timeUser} >{sweeping.isRealName === 1 ? contacts.replyerName : '匿名用户'}:{moment(contacts.createTime).format('YYYY/MM/DD HH:mm:ss')}</div>
|
<div style={replyUser}>{contacts.content}</div>
|
</React.Fragment>
|
:
|
<React.Fragment>
|
<div style={timeAdmin} > {contacts.replyerName}:{moment(contacts.createTime).format('YYYY/MM/DD HH:mm:ss')}</div>
|
<div style={replyAdmin}>{contacts.content}</div>
|
</React.Fragment>
|
}
|
|
</div>
|
))}
|
</LineView>
|
: null}
|
{flag == "do" ?
|
(sweeping.status == 1 ? (
|
<LineView title="回复" lineHeight="50px">
|
<table>
|
<tbody>
|
<tr>
|
<td>回复内容</td>
|
<td>
|
<TextArea
|
placeholder="请输入回复内容"
|
autosize={{ minRows: 2, maxRows: 6 }}
|
onChange={({ target: { value } }) => this.onInputChange({ target: { name: 'opinion', value } })}
|
/>
|
</td>
|
</tr>
|
</tbody>
|
</table>
|
<div>
|
<Button
|
type="primary"
|
className="app-btn"
|
onClick={this.submitAudit}
|
>
|
提交回复
|
</Button>
|
<Button className="app-btn" onClick={this.goBack}>
|
返回
|
</Button>
|
</div>
|
</LineView>
|
) : <div style={{ textAlign: 'center' }}><Button className="app-btn" onClick={this.goBack}>返回</Button></div>
|
) : <div style={{ textAlign: 'center' }}><Button className="app-btn" onClick={this.goBack}>返回</Button></div>
|
}
|
</BusDetailView>
|
</div>
|
);
|
}
|
}
|