Commit 4f2f9e57 authored by afc163's avatar afc163

update notification

parent c0e2d671
import React from 'react'; import React from 'react';
import { Avatar, Icon, List } from 'antd'; import { Avatar, List } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './NoticeList.less'; import styles from './NoticeList.less';
export default function NoticeList({ data = [], onClick, onClear, title, locale }) { export default function NoticeList({
data = [], onClick, onClear, title, locale, emptyText, emptyImage,
}) {
if (data.length === 0) { if (data.length === 0) {
return ( return (
<div className={styles.notFound}> <div className={styles.notFound}>
<Icon type="frown-o" /> {emptyImage ? (
{locale.emptyText} <img src={emptyImage} alt="not found" />
) : null}
<div>{emptyText || locale.emptyText}</div>
</div> </div>
); );
} }
......
...@@ -54,15 +54,12 @@ ...@@ -54,15 +54,12 @@
.notFound { .notFound {
text-align: center; text-align: center;
height: 120px; padding: 73px 0 88px 0;
line-height: 120px;
font-size: 14px;
color: @text-color-secondary; color: @text-color-secondary;
> i { img {
font-size: 16px; display: inline-block;
margin-right: 8px; margin-bottom: 16px;
vertical-align: middle; height: 76px;
margin-top: -1px;
} }
} }
......
...@@ -51,9 +51,24 @@ ReactDOM.render( ...@@ -51,9 +51,24 @@ ReactDOM.render(
}} }}
> >
<NoticeIcon count={5} onItemClick={onItemClick} onClear={onClear}> <NoticeIcon count={5} onItemClick={onItemClick} onClear={onClear}>
<NoticeIcon.Tab list={data} title="通知" /> <NoticeIcon.Tab
<NoticeIcon.Tab list={data} title="消息" /> list={noticeData['通知']}
<NoticeIcon.Tab list={[]} title="待办" /> title="通知"
emptyText="你已查看所有通知"
emptyImage="https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg"
/>
<NoticeIcon.Tab
list={noticeData['消息']}
title="消息"
emptyText="您已读完所有消息"
emptyImage="https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg"
/>
<NoticeIcon.Tab
list={noticeData['待办']}
title="待办"
emptyText="你已完成所有待办"
emptyImage="https://gw.alipayobjects.com/zos/rmsportal/HsIsxMZiWKrNUavQUXqx.svg"
/>
</NoticeIcon> </NoticeIcon>
</div> </div>
, mountNode); , mountNode);
......
...@@ -17,6 +17,7 @@ export default class NoticeIcon extends PureComponent { ...@@ -17,6 +17,7 @@ export default class NoticeIcon extends PureComponent {
emptyText: '暂无数据', emptyText: '暂无数据',
clear: '清空', clear: '清空',
}, },
emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg',
}; };
static Tab = TabPane; static Tab = TabPane;
constructor(props) { constructor(props) {
...@@ -45,6 +46,7 @@ export default class NoticeIcon extends PureComponent { ...@@ -45,6 +46,7 @@ export default class NoticeIcon extends PureComponent {
return ( return (
<TabPane tab={title} key={child.props.title}> <TabPane tab={title} key={child.props.title}>
<List <List
{...child.props}
data={child.props.list} data={child.props.list}
onClick={item => this.onItemClick(item, child.props)} onClick={item => this.onItemClick(item, child.props)}
onClear={() => this.props.onClear(child.props.title)} onClear={() => this.props.onClear(child.props.title)}
......
...@@ -239,9 +239,24 @@ class BasicLayout extends React.PureComponent { ...@@ -239,9 +239,24 @@ class BasicLayout extends React.PureComponent {
loading={fetchingNotices} loading={fetchingNotices}
popupAlign={{ offset: [20, -16] }} popupAlign={{ offset: [20, -16] }}
> >
<NoticeIcon.Tab list={noticeData['通知']} title="通知" /> <NoticeIcon.Tab
<NoticeIcon.Tab list={noticeData['消息']} title="消息" /> list={noticeData['通知']}
<NoticeIcon.Tab list={noticeData['待办']} title="待办" /> title="通知"
emptyText="你已查看所有通知"
emptyImage="https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg"
/>
<NoticeIcon.Tab
list={noticeData['消息']}
title="消息"
emptyText="您已读完所有消息"
emptyImage="https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg"
/>
<NoticeIcon.Tab
list={noticeData['待办']}
title="待办"
emptyText="你已完成所有待办"
emptyImage="https://gw.alipayobjects.com/zos/rmsportal/HsIsxMZiWKrNUavQUXqx.svg"
/>
</NoticeIcon> </NoticeIcon>
{currentUser.name ? ( {currentUser.name ? (
<Dropdown overlay={menu}> <Dropdown overlay={menu}>
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
transition: all .3s; transition: all .3s;
padding: 0 24px; padding: 0 24px;
&:hover { &:hover {
background: rgba(0, 0, 0, .04); background: @primary-1;
} }
} }
......
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