消息完成

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