forked from huge/frontEnd/hugeOA

Mr Ke
2020-04-14 7cd6587d43dfda47b043c775ea9e67ee4c1bbd08
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
/* eslint-disable */
/**柯礼钦
 * 4/6/2020, 10:41:26 AM
 * doc comment for the file goes here
 */
 
/** 通知列表 */
import React, { ReactNode, ReactEventHandler, Component } from 'react';
import { Alert } from 'antd';
import fetch from '../../../api/request';
 
import './index.scss';
 
export default class NotifyList extends Component {
  constructor(props) {
    super(props);
    this.config = {
    };
    this.state = {
      content: ''
    };
  }
 
  componentWillMount() {
    fetch({
      url: `api/document/getNewNotice`
    }).then(res => {
      console.log('res', res);
      this.setState({
        content: res.documentTitle || ''
      })
    })
  }
 
  componentDidMount() { }
 
  onClick = () => {
    this.props.history.push({ pathname: "/index/workbench/announcement" });
  }
 
  renderDom = () => {
    let { content } = this.state;
    return <div className="notify-list-main-dom">
      <span className="notify-list-main-dom-msg">最新通知:{content}</span>
      <span className="notify-list-main-dom-fuc" onClick={this.onClick}>[查看全部]</span>
    </div>
  }
 
  render() {
    let { content } = this.state;
 
    return (
      <div className="notify-list-main">
        {
          content &&
          <Alert
            // message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
            message={this.renderDom()}
            type="warning"
            closable={false}
          />
        }
      </div>
    )
  }
}
//export default function NotifyList({  }) {
//    return (
//     <div className="notify-list-main">
//
//      </div>
//    )
//}