|
|
|
@ -31,12 +31,14 @@ class Wechat_session extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
renderMsgItem(chatMsg) {
|
|
|
|
|
const msgDate = new Date(chatMsg.msgtime);
|
|
|
|
|
const msgDateText = msgDate.toLocaleDateString() + ' ' + msgDate.toLocaleTimeString();
|
|
|
|
|
return (
|
|
|
|
|
<List.Item className='ant-list-item-no-flex'>
|
|
|
|
|
<List.Item.Meta
|
|
|
|
|
avatar={<Avatar src={chatMsg.from_avatar} />}
|
|
|
|
|
title={chatMsg.from_name}
|
|
|
|
|
description={chatMsg.msgtime}
|
|
|
|
|
description={msgDateText}
|
|
|
|
|
/>
|
|
|
|
|
{this.renderMsgContent(chatMsg)}
|
|
|
|
|
</List.Item>
|
|
|
|
@ -46,7 +48,7 @@ class Wechat_session extends Component {
|
|
|
|
|
renderMsgContent(chatMsg) {
|
|
|
|
|
if (chatMsg.msgtype === 'file') {
|
|
|
|
|
return (
|
|
|
|
|
<a href={chatMsg.content.fileurl}>{chatMsg.content.filename}</a>
|
|
|
|
|
<a href={chatMsg.content.fileurl}>{chatMsg.content.filename}</a>
|
|
|
|
|
)
|
|
|
|
|
} else if (chatMsg.msgtype === 'image') {
|
|
|
|
|
return (
|
|
|
|
@ -56,6 +58,10 @@ class Wechat_session extends Component {
|
|
|
|
|
return (
|
|
|
|
|
<>{chatMsg.content.text}</>
|
|
|
|
|
)
|
|
|
|
|
} else if (chatMsg.msgtype === 'link') {
|
|
|
|
|
return (
|
|
|
|
|
<a href={chatMsg.content.link_url}>{chatMsg.content.title}</a>
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
return (
|
|
|
|
|
<>未知消息[{chatMsg.msgtype}]</>
|
|
|
|
|