diff --git a/src/page/Home/index.tsx b/src/page/Home/index.tsx index 6e25b8e..b0e1c3b 100644 --- a/src/page/Home/index.tsx +++ b/src/page/Home/index.tsx @@ -127,7 +127,8 @@ const Home: React.FC = () => { })}
- 版本号:{version} + 版本号:{version} + {/* new */}
{ const sendMsg = (text?: string): void => { let msg = text ? text : textMsg; if (msg) { - window.electron.onInvoke('sendChannelMsg', { - roomNum: state.channelId, - msg: msg, - }) - let item = { - uid: userInfo.uid, - userName: userInfo.userName, - message: msg, - timestamp: +new Date() - } - setChatList((newChatList: any) => [...newChatList, item]) - window.electron.windowHandleMessage({ - key: 'chatSmallWindow', - parmes: { - chatListIten: item, + setRoomUserItem((res: any) => { + let row = res.find((item: any) => item.uid === userInfo.uid) + window.electron.onInvoke('sendChannelMsg', { + roomNum: state.channelId, + msg: msg, + }) + let item = { + uid: userInfo.uid, + userName: row.userName, + message: msg, + timestamp: +new Date() } + setChatList((newChatList: any) => [...newChatList, item]) + window.electron.windowHandleMessage({ + key: 'chatSmallWindow', + parmes: { + chatListIten: item, + } + }) + chatScrollBotton() + return res }) - chatScrollBotton() } else { message.error('请输入内容!') }