消息完成

This commit is contained in:
yj 2024-07-15 10:49:36 +08:00
parent 961a64ef6c
commit 3fb0907a68
1 changed files with 15 additions and 9 deletions

View File

@ -148,10 +148,7 @@ const Meeting: React.FC = () => {
useEffect(() => {
onSignalr((item: any) => {
console.log(item);
const newChatList = [...chatList]
newChatList.push(item)
setChatList(newChatList)
setChatList((newChatList: any) => [...newChatList, item])
})
}, [])
// 操作按钮
@ -423,11 +420,20 @@ const Meeting: React.FC = () => {
setTextMsg(e.target.value)
}}></Input.TextArea>
<Button type="primary" className='m-ant-btn' style={{ flexShrink: 0, marginTop: '4px' }} onClick={() => {
onInvoke('sendChannelMsg', {
roomNum: state.channelId,
msg: textMsg,
})
setTextMsg('')
if (textMsg) {
onInvoke('sendChannelMsg', {
roomNum: state.channelId,
msg: textMsg,
})
setChatList((newChatList: any) => [...newChatList, {
uid: state.uid,
userName: state.userName,
message: textMsg,
}])
setTextMsg('')
} else {
message.success('请输入内容!')
}
}}></Button>
</div>
</div>