Commit cec0e548 authored by 李腾's avatar 李腾

feat: 优化消息提醒列初始化展示

parent 96a8df76
...@@ -43,7 +43,7 @@ const MessageItem = props => { ...@@ -43,7 +43,7 @@ const MessageItem = props => {
<span className={styles.time}>订单时间:{message.time}</span> <span className={styles.time}>订单时间:{message.time}</span>
<span className={styles['read-status']}> <span className={styles['read-status']}>
{readStatus === 0 ? ( {readStatus === 0 ? (
<a className={styles['read-status--un-read']} onClick={() => onMark([item.id], item)}> <a className={styles['read-status--un-read']} onClick={() => onMark([item.id])}>
标记为已读 标记为已读
</a> </a>
) : ( ) : (
...@@ -72,10 +72,12 @@ const Complex = props => { ...@@ -72,10 +72,12 @@ const Complex = props => {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [dataTotal, setDataTotal] = useState(10); const [dataTotal, setDataTotal] = useState(10);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
// 消息列表数据
const [messageData, setMessageData] = useState([]); const [messageData, setMessageData] = useState([]);
// 未读消息 // 未读消息
const [orderUnReadCount, setOrderUnReadCount] = useState(0); const [orderUnReadCount, setOrderUnReadCount] = useState(0);
const [afterUnReadCount, setAfterUnReadCount] = useState(0); const [afterUnReadCount, setAfterUnReadCount] = useState(0);
// 消息列表参数
const [queryParams, setQueryParams] = useState({ ...INIT_QUERY_PARAMS, ...INIT_PAGINATION }); const [queryParams, setQueryParams] = useState({ ...INIT_QUERY_PARAMS, ...INIT_PAGINATION });
const userInfo = JSON.parse(localStorage.getItem('user') || '{}'); const userInfo = JSON.parse(localStorage.getItem('user') || '{}');
...@@ -154,6 +156,7 @@ const Complex = props => { ...@@ -154,6 +156,7 @@ const Complex = props => {
}; };
const close = () => { const close = () => {
setMessageData([]);
setVisible(false); setVisible(false);
}; };
...@@ -199,7 +202,7 @@ const Complex = props => { ...@@ -199,7 +202,7 @@ const Complex = props => {
}; };
// 标记已读 // 标记已读
const onMark = (idsList, item) => { const onMark = idsList => {
if (!idsList.length) { if (!idsList.length) {
return; return;
} }
...@@ -312,7 +315,7 @@ const Complex = props => { ...@@ -312,7 +315,7 @@ const Complex = props => {
<Spin spinning={loading}> <Spin spinning={loading}>
<FilterRender /> <FilterRender />
<div className={styles['complex-list']}> <div className={styles['complex-list']}>
{messageData.length ? ( {visible && messageData.length ? (
messageData.map(item => ( messageData.map(item => (
<MessageItem key={item.id} item={item} onMark={onMark} viewDetail={viewDetail} /> <MessageItem key={item.id} item={item} onMark={onMark} viewDetail={viewDetail} />
)) ))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment