|
@@ -5,18 +5,14 @@ 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, useIntl, useAccess } from 'umi'
|
|
import { useRequest, useIntl, useAccess } from 'umi'
|
|
|
-import { useModal } from '@/components/Modal'
|
|
|
|
|
-import MessageDrawer from './components/MessageDrawer'
|
|
|
|
|
import ws, { CmdType } from '@/utils/ws'
|
|
import ws, { CmdType } from '@/utils/ws'
|
|
|
import MarkDown from 'react-markdown'
|
|
import MarkDown from 'react-markdown'
|
|
|
-import { isMobile } from '@/utils/is'
|
|
|
|
|
|
|
+import { useModal } from '@/components/ModalStore'
|
|
|
|
|
|
|
|
const Notification = () => {
|
|
const Notification = () => {
|
|
|
const intl = useIntl()
|
|
const intl = useIntl()
|
|
|
- const { toggleDrawer, setDrawerProps } = useModal()
|
|
|
|
|
- // const { sendMsg } = useWebSocketFn()
|
|
|
|
|
|
|
+ const dispatchModal = useModal()
|
|
|
const { Paragraph } = Typography
|
|
const { Paragraph } = Typography
|
|
|
- const [ellipsis] = React.useState(true)
|
|
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
loading: false,
|
|
loading: false,
|
|
|
list: [],
|
|
list: [],
|
|
@@ -55,7 +51,6 @@ const Notification = () => {
|
|
|
manual: true,
|
|
manual: true,
|
|
|
onSuccess: result => {
|
|
onSuccess: result => {
|
|
|
initData({ current: state.current })
|
|
initData({ current: state.current })
|
|
|
- // tRef.current?.reload()
|
|
|
|
|
ws.sendMessage({
|
|
ws.sendMessage({
|
|
|
cmd: CmdType.NoticeOrMessage,
|
|
cmd: CmdType.NoticeOrMessage,
|
|
|
...result
|
|
...result
|
|
@@ -66,20 +61,6 @@ const Notification = () => {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // 展示drawer
|
|
|
|
|
- const showMessageDrawer = item => {
|
|
|
|
|
- setDrawerProps({
|
|
|
|
|
- closable: true,
|
|
|
|
|
- onClose: () => toggleDrawer(),
|
|
|
|
|
- bodyStyle: {
|
|
|
|
|
- height: '100vh'
|
|
|
|
|
- // overflowY: 'hidden'
|
|
|
|
|
- },
|
|
|
|
|
- children: <MessageDrawer item={item} />
|
|
|
|
|
- })
|
|
|
|
|
- toggleDrawer()
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
const hasPerm = useAccess()?.validatePermByType('notification_add')
|
|
const hasPerm = useAccess()?.validatePermByType('notification_add')
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -92,19 +73,20 @@ const Notification = () => {
|
|
|
id="scrollableDiv"
|
|
id="scrollableDiv"
|
|
|
className="pr-4"
|
|
className="pr-4"
|
|
|
style={{
|
|
style={{
|
|
|
- height: `calc(100vh - ${isMobile() ? '108px' : '156px'} - 1.5rem)`,
|
|
|
|
|
|
|
+ height: `calc(100vh - 156px - 1.5rem)`,
|
|
|
overflowY: 'auto'
|
|
overflowY: 'auto'
|
|
|
- }}>
|
|
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
<InfiniteScroll
|
|
<InfiniteScroll
|
|
|
dataLength={state.total}
|
|
dataLength={state.total}
|
|
|
next={loadMoreData}
|
|
next={loadMoreData}
|
|
|
hasMore={state.hasMore}
|
|
hasMore={state.hasMore}
|
|
|
loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
|
|
loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
|
|
|
endMessage={<Divider plain>别再滚啦,已是尽头</Divider>}
|
|
endMessage={<Divider plain>别再滚啦,已是尽头</Divider>}
|
|
|
- scrollableTarget="scrollableDiv">
|
|
|
|
|
|
|
+ scrollableTarget="scrollableDiv"
|
|
|
|
|
+ >
|
|
|
<List
|
|
<List
|
|
|
itemLayout="vertical"
|
|
itemLayout="vertical"
|
|
|
- // pagination={{ pageSize: 5 }}
|
|
|
|
|
dataSource={state.list}
|
|
dataSource={state.list}
|
|
|
renderItem={item => (
|
|
renderItem={item => (
|
|
|
<List.Item
|
|
<List.Item
|
|
@@ -113,13 +95,15 @@ const Notification = () => {
|
|
|
<span width={200} className="mt-1 text-hex-aaa">
|
|
<span width={200} className="mt-1 text-hex-aaa">
|
|
|
{item.createTime}
|
|
{item.createTime}
|
|
|
</span>
|
|
</span>
|
|
|
- }>
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
<List.Item.Meta
|
|
<List.Item.Meta
|
|
|
avatar={<Avatar src={item.avatar} />}
|
|
avatar={<Avatar src={item.avatar} />}
|
|
|
title={
|
|
title={
|
|
|
<span
|
|
<span
|
|
|
className="cursor-pointer text-primary"
|
|
className="cursor-pointer text-primary"
|
|
|
- onClick={() => showMessageDrawer(item)}>
|
|
|
|
|
|
|
+ onClick={() => dispatchModal('D_NOTICE_DETAIL', { item })}
|
|
|
|
|
+ >
|
|
|
{item.title}
|
|
{item.title}
|
|
|
</span>
|
|
</span>
|
|
|
}
|
|
}
|
|
@@ -134,14 +118,7 @@ const Notification = () => {
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
- <Paragraph
|
|
|
|
|
- ellipsis={
|
|
|
|
|
- ellipsis
|
|
|
|
|
- ? {
|
|
|
|
|
- rows: 4
|
|
|
|
|
- }
|
|
|
|
|
- : false
|
|
|
|
|
- }>
|
|
|
|
|
|
|
+ <Paragraph ellipsis={{ rows: 4 }}>
|
|
|
<MarkDown>{item.content}</MarkDown>
|
|
<MarkDown>{item.content}</MarkDown>
|
|
|
</Paragraph>
|
|
</Paragraph>
|
|
|
{/* <div className="mt-1 text-hex-aaa">{item.createTime}</div> */}
|
|
{/* <div className="mt-1 text-hex-aaa">{item.createTime}</div> */}
|