|
@@ -1,39 +1,54 @@
|
|
import PageContent from '@/components/PageContent';
|
|
import PageContent from '@/components/PageContent';
|
|
import TabsContent from '@/components/TabsContent';
|
|
import TabsContent from '@/components/TabsContent';
|
|
import { getNotificationList } from '@/services/message';
|
|
import { getNotificationList } from '@/services/message';
|
|
|
|
+import { UnityAction } from '@/utils/utils';
|
|
import { useParams, useRequest } from '@umijs/max';
|
|
import { useParams, useRequest } from '@umijs/max';
|
|
import { Button } from 'antd';
|
|
import { Button } from 'antd';
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
|
+import { useState } from 'react';
|
|
import styles from './index.less';
|
|
import styles from './index.less';
|
|
const icon = require('@/assets/air-conditioner.png');
|
|
const icon = require('@/assets/air-conditioner.png');
|
|
|
|
|
|
const MessageCenter = () => {
|
|
const MessageCenter = () => {
|
|
const { projectId } = useParams();
|
|
const { projectId } = useParams();
|
|
|
|
+ const [tab, setTab] = useState('1');
|
|
const { data, run, loading } = useRequest(getNotificationList, {
|
|
const { data, run, loading } = useRequest(getNotificationList, {
|
|
defaultParams: [{ projectId, msgType: 11 }], //, msgType: 工况:11, 自检:12
|
|
defaultParams: [{ projectId, msgType: 11 }], //, msgType: 工况:11, 自检:12
|
|
});
|
|
});
|
|
- console.log(data);
|
|
|
|
|
|
|
|
const handleTabsChange = (tab) => {
|
|
const handleTabsChange = (tab) => {
|
|
|
|
+ setTab(tab);
|
|
tab == '1'
|
|
tab == '1'
|
|
? run({ projectId, msgType: 11 })
|
|
? run({ projectId, msgType: 11 })
|
|
: run({ projectId, msgType: 12 });
|
|
: run({ projectId, msgType: 12 });
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ const handleReadClick = () => {
|
|
|
|
+ UnityAction.sendMsg('notiReadAll', '');
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const handlerSeeClick = () => {
|
|
|
|
+ UnityAction.sendMsg('noti', tab == '1' ? 'gongKuang' : 'ziJian');
|
|
|
|
+ };
|
|
|
|
+
|
|
const renderItem = (item) => {
|
|
const renderItem = (item) => {
|
|
- const time = item?.CreatedOn ? dayjs(item?.CreatedOn) : '';
|
|
|
|
|
|
+ const time = item?.CreatedOn
|
|
|
|
+ ? dayjs(item.CreatedOn).format('YYYY-MM-DD hh:mm:ss')
|
|
|
|
+ : '';
|
|
return (
|
|
return (
|
|
<div className={`card-box ${styles.itemContent}`}>
|
|
<div className={`card-box ${styles.itemContent}`}>
|
|
<img style={{ width: '30px', height: '30px' }} src={icon} />
|
|
<img style={{ width: '30px', height: '30px' }} src={icon} />
|
|
<div>
|
|
<div>
|
|
- <div style={{ marginBottom: '30px' }}>
|
|
|
|
- 那么大了可能圣诞快乐那算啦到哪啦凯撒到啦
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div style={{ marginBottom: '30px' }}>{item.MsgBady}</div>
|
|
<div>{time}</div>
|
|
<div>{time}</div>
|
|
</div>
|
|
</div>
|
|
<div className={styles.right}>
|
|
<div className={styles.right}>
|
|
- {item?.ReadStatus && <div className={styles.redPoint} />}
|
|
|
|
- <Button type="primary">查看</Button>
|
|
|
|
|
|
+ <div
|
|
|
|
+ className={item?.ReadStatus ? styles.redPoint : styles.nonePoint}
|
|
|
|
+ />
|
|
|
|
+ <Button type="primary" onClick={handlerSeeClick}>
|
|
|
|
+ 查看
|
|
|
|
+ </Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
@@ -57,7 +72,9 @@ const MessageCenter = () => {
|
|
},
|
|
},
|
|
]}
|
|
]}
|
|
/>
|
|
/>
|
|
- <div className={styles.allRead}>全部已读</div>
|
|
|
|
|
|
+ <div className={styles.allRead} onClick={handleReadClick}>
|
|
|
|
+ 全部已读
|
|
|
|
+ </div>
|
|
</PageContent>
|
|
</PageContent>
|
|
);
|
|
);
|
|
};
|
|
};
|