消息优化
This commit is contained in:
parent
3fb0907a68
commit
2b0e9f50f1
|
|
@ -285,6 +285,7 @@ const Meeting: React.FC = () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCustomStorageChange = (e: any): void => {
|
const handleCustomStorageChange = (e: any): void => {
|
||||||
if (e.key === 'isJoin') {
|
if (e.key === 'isJoin') {
|
||||||
if (e.value) {
|
if (e.value) {
|
||||||
|
|
@ -303,6 +304,23 @@ const Meeting: React.FC = () => {
|
||||||
}, 1000)
|
}, 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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.meeting}>
|
<div className={styles.meeting}>
|
||||||
|
|
@ -418,23 +436,8 @@ const Meeting: React.FC = () => {
|
||||||
<div className={`${styles.meetingUserChatInput} drag`}>
|
<div className={`${styles.meetingUserChatInput} drag`}>
|
||||||
<Input.TextArea placeholder="请输入消息" value={textMsg} style={{ flexGrow: 1 }} onChange={(e) => {
|
<Input.TextArea placeholder="请输入消息" value={textMsg} style={{ flexGrow: 1 }} onChange={(e) => {
|
||||||
setTextMsg(e.target.value)
|
setTextMsg(e.target.value)
|
||||||
}}></Input.TextArea>
|
}} onPressEnter={sendMsg}></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={sendMsg}>发送</Button>
|
||||||
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>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue