|
@@ -4,27 +4,22 @@ import InfiniteScroll from 'react-infinite-scroll-component'
|
|
|
import { queryMessageList, sendMessage } from '@/services/staff'
|
|
import { queryMessageList, sendMessage } from '@/services/staff'
|
|
|
import AddMessage from './components/AddMessage'
|
|
import AddMessage from './components/AddMessage'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
-import { useRequest } from 'umi'
|
|
|
|
|
|
|
+import { useRequest, useIntl } from 'umi'
|
|
|
import { useModal } from '@/components/Modal'
|
|
import { useModal } from '@/components/Modal'
|
|
|
import MessageDrawer from './components/MessageDrawer'
|
|
import MessageDrawer from './components/MessageDrawer'
|
|
|
import ws, { CmdType } from '@/utils/ws'
|
|
import ws, { CmdType } from '@/utils/ws'
|
|
|
-// import MarkDown from 'react-markdown'
|
|
|
|
|
|
|
|
|
|
const Notification = () => {
|
|
const Notification = () => {
|
|
|
|
|
+ const intl = useIntl()
|
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
|
// const { sendMsg } = useWebSocketFn()
|
|
// const { sendMsg } = useWebSocketFn()
|
|
|
- const msgTypeEnum = {
|
|
|
|
|
- message: '消息',
|
|
|
|
|
- notification: '通知'
|
|
|
|
|
- }
|
|
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
loading: false,
|
|
loading: false,
|
|
|
list: [],
|
|
list: [],
|
|
|
hasMore: false,
|
|
hasMore: false,
|
|
|
current: 1,
|
|
current: 1,
|
|
|
pageSize: 15,
|
|
pageSize: 15,
|
|
|
- total: 0,
|
|
|
|
|
- msgType: 'notification'
|
|
|
|
|
|
|
+ total: 0
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const initData = async params => {
|
|
const initData = async params => {
|
|
@@ -36,7 +31,7 @@ const Notification = () => {
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
setState({
|
|
setState({
|
|
|
...state,
|
|
...state,
|
|
|
- list: params?.current === 1 ? list : state.list.concat(message),
|
|
|
|
|
|
|
+ list: params?.current === 1 ? list : state.list.concat(list),
|
|
|
total,
|
|
total,
|
|
|
loading: false,
|
|
loading: false,
|
|
|
hasMore: total > params.current * state.pageSize,
|
|
hasMore: total > params.current * state.pageSize,
|
|
@@ -114,7 +109,10 @@ const Notification = () => {
|
|
|
}
|
|
}
|
|
|
description={
|
|
description={
|
|
|
<div className="mb-1">
|
|
<div className="mb-1">
|
|
|
- <Tag color="purple">{msgTypeEnum[item.msgType]}</Tag> '发布于',
|
|
|
|
|
|
|
+ <Tag color="purple">
|
|
|
|
|
+ {intl.formatMessage({ id: `component.globalHeader.${item.msgType}` })}
|
|
|
|
|
+ </Tag>{' '}
|
|
|
|
|
+ '发布于',
|
|
|
<span className="ml-2">全公司</span>
|
|
<span className="ml-2">全公司</span>
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|