✨ 功能:进入历史会议时自动加入
变更: - 进入会议室页面时自动调用 join API - 当前登录用户会自动加入会议坐席 - 如果已加入则忽略错误
This commit is contained in:
@@ -242,6 +242,7 @@ function MeetingRoom() {
|
||||
fetchMeeting();
|
||||
fetchParticipants();
|
||||
fetchMessages();
|
||||
joinMeeting(); // 自动加入会议
|
||||
const interval = setInterval(fetchMessages, 1000);
|
||||
return () => clearInterval(interval);
|
||||
}, [id]);
|
||||
@@ -267,6 +268,18 @@ function MeetingRoom() {
|
||||
} catch (error) { console.error(error); }
|
||||
};
|
||||
|
||||
const joinMeeting = async () => {
|
||||
try {
|
||||
// 尝试加入会议(如果还没加入)
|
||||
await axios.post(`${API_BASE}/meetings/${id}/join/`, {
|
||||
invite_code: meeting?.invite_code
|
||||
});
|
||||
} catch (error) {
|
||||
// 可能已经加入了,忽略错误
|
||||
console.log('加入会议:', error?.response?.data?.error || '已加入');
|
||||
}
|
||||
};
|
||||
|
||||
const sendMessage = async (e) => {
|
||||
e.preventDefault();
|
||||
if (!content.trim()) return;
|
||||
|
||||
Reference in New Issue
Block a user