功能:进入历史会议时自动加入

变更:
- 进入会议室页面时自动调用 join API
- 当前登录用户会自动加入会议坐席
- 如果已加入则忽略错误
This commit is contained in:
2026-04-04 21:00:47 +08:00
parent 96f6318101
commit 5cb47e9b3e
2 changed files with 20 additions and 7 deletions

View File

@@ -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;