infoList.js
2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import React, { Component } from 'react';
import { connect } from 'dva';
import { Toast } from 'antd-mobile';
import moment from 'moment';
import shareHide from "../../utils/shareHide";
import css from './css.less';
class InfoList extends Component{
constructor(props) {
super(props);
this.state = {
userId: '',
isloading: true,
infolist: []
}
}
componentDidMount() {
document.title = '信息中心';
const _this = this;
shareHide();
Toast.loading('loading...', 1000);
const userId = localStorage.id;
const roleId = localStorage.roleId;
this.setState({
userId
})
const { search } = this.props.location;
let subData = { roleId };
if (search) {
const sign = search.substr(6);
if (roleId === '3') {
if (sign === '1') {
subData.supervisionId = userId;
subData.requestType = 'system';
}
if (sign === '2') {
subData.supervisionId = userId;
subData.requestType = 'customer';
}
}
}
this.props.dispatch({
type: 'infoCenter/GetSubInfoList',
payload: {
...subData,
orgId:localStorage.getItem('orgId')
},
callback(res) {
_this.setState({
infolist: res,
isloading: false
}, () => {
Toast.hide();
})
},
error(err) {
Toast.error(err.message)
}
})
}
render() {
const { infolist,isloading } = this.state;
return <div className={css.wrap+' '+(infolist.length===0 && !isloading?css.noInfo:'')}>
{
infolist.length>0 && infolist.map((itm,index) => {
return <div key={index} className={css.listItm}>
<div className={css.infoTime}>{moment(itm.updateTime).format('YYYY-MM-DD HH:mm:ss')}</div>
<div className={css.infoContent}>
<div className={css.tit}>{itm.messageHeader}</div>
<dl>
<dt className={css[itm.infoType]}></dt>
<dd>{itm.notification}</dd>
</dl>
</div>
</div>
})
}
</div>
}
}
export default connect()(InfoList);