Commit cce83c4f authored by Bill's avatar Bill

修改消息中心数据问题

parent 75881666
import { Tooltip } from 'antd'; import { Tooltip, Badge } from 'antd';
import { BellOutlined, CustomerServiceOutlined } from '@ant-design/icons'; import { BellOutlined, CustomerServiceOutlined } from '@ant-design/icons';
import React, { useCallback, useRef, useLayoutEffect } from 'react'; import React, { useCallback, useRef, useLayoutEffect } from 'react';
// import { connect, ConnectProps } from 'umi';
// import { ConnectState } from '@/models/connect';
import Avatar from './AvatarDropdown'; import Avatar from './AvatarDropdown';
import SelectLang from './SelectLang'; import SelectLang from './SelectLang';
import Location from './Location'; import Location from './Location';
...@@ -18,7 +16,7 @@ import { getAuth } from '@/utils/auth' ...@@ -18,7 +16,7 @@ import { getAuth } from '@/utils/auth'
// } // }
const GlobalHeaderRight: React.SFC<{}> = (props) => { const GlobalHeaderRight: React.FC<{}> = (props) => {
// const { theme, layout } = props; // const { theme, layout } = props;
let className = styles.right; let className = styles.right;
...@@ -63,12 +61,12 @@ const GlobalHeaderRight: React.SFC<{}> = (props) => { ...@@ -63,12 +61,12 @@ const GlobalHeaderRight: React.SFC<{}> = (props) => {
<SelectLang /> <SelectLang />
<Tooltip title="消息"> <Tooltip title="消息">
<a <a
target="_blank" href="/memberCenter/systemSetting/message"
href=""
rel="noopener noreferrer"
className={styles.action} className={styles.action}
> >
<Badge count={5} size={"small"}>
<BellOutlined /> <BellOutlined />
</Badge>
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title="服务"> <Tooltip title="服务">
......
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
color: #606266; color: #606266;
cursor: pointer;
} }
.messageTitle{ .messageTitle{
margin: 0 30px; margin: 0px 0px 0px 30px;
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
color: #303133; color: #303133;
display: inline-block;
} }
} }
\ No newline at end of file
...@@ -8,7 +8,8 @@ import StatusTag from '@/components/StatusTag'; ...@@ -8,7 +8,8 @@ import StatusTag from '@/components/StatusTag';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import moment from 'moment'; import moment from 'moment';
import msg_system from '@/assets/imgs/msg_system.png' import msg_system from '@/assets/imgs/msg_system.png'
import msg_platform from '@/assets/imgs/msg_platform.png' import msg_platform from '@/assets/imgs/msg_platform.png';
import cx from 'classnames';
const Message: React.FC<{}> = () => { const Message: React.FC<{}> = () => {
const [dataSource, setDataSource] = useState<any>([]) const [dataSource, setDataSource] = useState<any>([])
...@@ -40,19 +41,35 @@ const Message: React.FC<{}> = () => { ...@@ -40,19 +41,35 @@ const Message: React.FC<{}> = () => {
} }
const handlePaginationChange = (page, pageSize) => { const handlePaginationChange = (page, pageSize) => {
console.log(page,pageSize);
getList({page, pageSize}) getList({page, pageSize})
.then((data) => { .then((data) => {
console.log(data);
setDataSource(data); setDataSource(data);
}) })
} }
const renderMessage = (data) => { const handleRead = (id, url: string) => {
console.log(url);
// /report/message/member/read
PublicApi.getReportMessageMemberRead({id: id})
.then((data) => {
if(url) {
history.push(url);
}
})
}
const renderMessage = (data) => {
const isRead = cx({
[styles.messageTitle]: !data.status,
[styles.messageText]: data.status
})
return ( return (
<> <>
<StatusTag type={data.status} title={data.type} /> <StatusTag type={data.type == 1 ? 'primary' : 'success'} title={data.type == 1 ? '系统消息': '平台消息'} />
<span className={styles.messageTitle}>{data.title}</span> <span className={isRead} style={{minWidth: '100px'}}>{data.title}</span>
<span className={styles.messageText}>{data.message}</span> <span className={isRead} onClick={() => handleRead(data.id, data.url)}>{data.content}</span>
</> </>
) )
} }
...@@ -78,13 +95,13 @@ const Message: React.FC<{}> = () => { ...@@ -78,13 +95,13 @@ const Message: React.FC<{}> = () => {
total: dataSource.totalCount, total: dataSource.totalCount,
showTotal: showTotal showTotal: showTotal
}} }}
renderItem={item => ( renderItem={(item: any) => (
<List.Item> <List.Item>
<List.Item.Meta <List.Item.Meta
avatar={<Avatar src={msg_system} />} avatar={<Avatar src={item.type == 1 ? msg_system : msg_platform} />}
title={renderMessage(item)} title={renderMessage(item)}
/> />
<div>{moment(item.createTime).format('YYYY-MM-DD HH:mm:ss')}</div> <div>{moment(item.sendTime).format('YYYY-MM-DD HH:mm:ss')}</div>
</List.Item> </List.Item>
)} )}
/> />
......
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