消息优化

This commit is contained in:
yj 2024-07-15 10:55:16 +08:00
parent 3fb0907a68
commit 2b0e9f50f1
1 changed files with 20 additions and 17 deletions

View File

@ -285,6 +285,7 @@ const Meeting: React.FC = () => {
}
})
}
const handleCustomStorageChange = (e: any): void => {
if (e.key === 'isJoin') {
if (e.value) {
@ -303,6 +304,23 @@ const Meeting: React.FC = () => {
}, 1000)
}
};
// 聊天发送
const sendMsg = (): void => {
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('请输入内容!')
}
}
return (
<>
<div className={styles.meeting}>
@ -418,23 +436,8 @@ const Meeting: React.FC = () => {
<div className={`${styles.meetingUserChatInput} drag`}>
<Input.TextArea placeholder="请输入消息" value={textMsg} style={{ flexGrow: 1 }} onChange={(e) => {
setTextMsg(e.target.value)
}}></Input.TextArea>
<Button type="primary" className='m-ant-btn' style={{ flexShrink: 0, marginTop: '4px' }} onClick={() => {
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>
}} onPressEnter={sendMsg}></Input.TextArea>
<Button type="primary" className='m-ant-btn' style={{ flexShrink: 0, marginTop: '4px' }} onClick={sendMsg}></Button>
</div>
</div>
}