diff --git a/src/charts/Wechat_session.js b/src/charts/Wechat_session.js index 6e9cf13..4c62d6e 100644 --- a/src/charts/Wechat_session.js +++ b/src/charts/Wechat_session.js @@ -31,26 +31,34 @@ class Wechat_session extends Component { } renderMsgItem(chatMsg) { - if (chatMsg.msgtype === 'image') { + return ( + + } + title={chatMsg.from_name} + description={chatMsg.msgtime} + /> + {this.renderMsgContent(chatMsg)} + + ) + } + + renderMsgContent(chatMsg) { + if (chatMsg.msgtype === 'file') { return ( - - } - title={chatMsg.from_name} - description={chatMsg.msgtime} - /> - {chatMsg.msgid} - - )} else { + {chatMsg.content.filename} + ) + } else if (chatMsg.msgtype === 'image') { return ( - - } - title={chatMsg.from_name} - description={chatMsg.msgtime} - /> - {chatMsg.content.text} - + {chatMsg.msgid} + ) + } else if (chatMsg.msgtype === 'text') { + return ( + <>{chatMsg.content.text} + ) + } else { + return ( + <>未知消息[{chatMsg.msgtype}] ) } }