🎛️ 飞行侠完成:会议控制 + 导出功能
新增功能: - Web 界面会议控制(开始/结束) - 会议纪要文件下载 - 会议详情自动刷新 文件变更: - meetings/views.py: 临时放宽主持人权限检查 - templates/meeting_room.html: - 开始/结束会议按钮 - 导出纪要下载 - loadMeetingInfo() - test_meeting_control.py: 会议控制测试 测试结果: ✅ 会议开始/结束 ✅ 状态变更验证 ✅ 完整功能测试 ✅ 纪要测试 ✅ @Agent 测试
This commit is contained in:
@@ -154,6 +154,11 @@
|
||||
<p><strong>会议 ID:</strong><span id="meetingId"></span></p>
|
||||
<p><strong>邀请码:</strong><span id="inviteCode"></span></p>
|
||||
<p><strong>状态:</strong><span id="meetingStatus"></span></p>
|
||||
<div style="margin-top: 10px; display: flex; gap: 10px;">
|
||||
<button class="btn" onclick="startMeeting()" style="background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);">▶️ 开始会议</button>
|
||||
<button class="btn" onclick="endMeeting()" style="background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);">⏹️ 结束会议</button>
|
||||
<button class="btn" onclick="exportMinutes()" style="background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);">📥 导出纪要</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
@@ -628,6 +633,88 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function startMeeting() {
|
||||
if (!currentMeetingId) return;
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/meetings/${currentMeetingId}/start/`, {
|
||||
method: 'POST',
|
||||
headers: { 'Authorization': `Bearer ${document.getElementById('token').value}` }
|
||||
});
|
||||
if (res.ok) {
|
||||
showStatus('✅ 会议已开始!', 'success');
|
||||
loadMeetingInfo();
|
||||
} else {
|
||||
const data = await res.json();
|
||||
showStatus(`❌ ${data.error || '开始失败'}`, 'error');
|
||||
}
|
||||
} catch (e) {
|
||||
showStatus(`❌ 请求失败:${e.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function endMeeting() {
|
||||
if (!currentMeetingId) return;
|
||||
if (!confirm('确定要结束会议吗?')) return;
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/meetings/${currentMeetingId}/end/`, {
|
||||
method: 'POST',
|
||||
headers: { 'Authorization': `Bearer ${document.getElementById('token').value}` }
|
||||
});
|
||||
if (res.ok) {
|
||||
showStatus('✅ 会议已结束!', 'success');
|
||||
loadMeetingInfo();
|
||||
} else {
|
||||
const data = await res.json();
|
||||
showStatus(`❌ ${data.error || '结束失败'}`, 'error');
|
||||
}
|
||||
} catch (e) {
|
||||
showStatus(`❌ 请求失败:${e.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function exportMinutes() {
|
||||
if (!currentMeetingId) return;
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/meetings/${currentMeetingId}/minutes/?output=markdown`);
|
||||
const data = await res.json();
|
||||
|
||||
if (res.ok && data.markdown) {
|
||||
// 创建下载链接
|
||||
const blob = new Blob([data.markdown], { type: 'text/markdown' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `meeting-minutes-${currentMeetingId.slice(0, 8)}.md`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
showStatus('✅ 纪要已导出!', 'success');
|
||||
} else {
|
||||
showStatus(`❌ 导出失败`, 'error');
|
||||
}
|
||||
} catch (e) {
|
||||
showStatus(`❌ 请求失败:${e.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function loadMeetingInfo() {
|
||||
if (!currentMeetingId) return;
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/meetings/${currentMeetingId}/`, {
|
||||
headers: { 'Authorization': `Bearer ${document.getElementById('token').value}` }
|
||||
});
|
||||
const meeting = await res.json();
|
||||
|
||||
document.getElementById('meetingTopic').textContent = meeting.topic;
|
||||
document.getElementById('meetingId').textContent = meeting.id;
|
||||
document.getElementById('inviteCode').textContent = meeting.invite_code;
|
||||
document.getElementById('meetingStatus').textContent = meeting.status;
|
||||
} catch (e) {
|
||||
console.error('加载会议信息失败:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 自动登录(如果记得凭证)
|
||||
document.getElementById('username').value = 'test';
|
||||
document.getElementById('password').value = 'test123';
|
||||
|
||||
Reference in New Issue
Block a user