From b947a268810dfc538be38267cd813a6e79fca050 Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Fri, 21 Oct 2022 11:20:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E8=81=8A=E5=A4=A9=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/charts/Wechat_session.js | 44 +++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 18 deletions(-) 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}] ) } }