import React, { Component } from 'react'
|
import { notification } from 'antd'
|
import { MessageFilled } from '@ant-design/icons'
|
|
import Api from '@/api'
|
import MKEmitter from '@/utils/events.js'
|
|
class SysIcon extends Component {
|
state = {
|
notices: []
|
}
|
|
componentDidMount () {
|
setTimeout(() => {
|
this.getMsgList()
|
}, 2000)
|
}
|
|
getMsgList = () => {
|
let param = {
|
func: 's_get_kei'
|
}
|
|
Api.getSystemConfig(param).then(result => {
|
if (result.status) {
|
let notices = result.data || []
|
|
this.setState({ notices })
|
MKEmitter.emit('sysMessageChange', notices)
|
|
setTimeout(() => {
|
this.getMsgList()
|
}, 600000)
|
} else {
|
notification.warning({
|
top: 92,
|
message: result.message,
|
duration: 5
|
})
|
}
|
})
|
}
|
|
open = () => {
|
MKEmitter.emit('sysMessageOpen')
|
}
|
|
render() {
|
const { notices } = this.state
|
|
return (
|
<MessageFilled className="mk-msg-icon" data-title={notices.length ? notices.length : ''} onClick={this.open} />
|
)
|
}
|
}
|
|
export default SysIcon
|