2026-03-04 18:40:19 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 结束通话界面逻辑
|
|
|
|
|
|
* 处理通话结束后的操作,如重新连接或返回连接界面
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2026-04-25 21:09:45 +08:00
|
|
|
|
import { showNotification } from '../utils.js';
|
2026-03-04 18:40:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 重新连接
|
|
|
|
|
|
function reconnectCall() {
|
|
|
|
|
|
showNotification('正在重新连接...');
|
|
|
|
|
|
|
|
|
|
|
|
// 跳转到通话界面
|
|
|
|
|
|
window.location.href = '../index.html';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 离开
|
|
|
|
|
|
function leaveCall() {
|
|
|
|
|
|
// 清除本地存储中的连接ID
|
|
|
|
|
|
localStorage.removeItem('connectionId');
|
|
|
|
|
|
|
|
|
|
|
|
// 跳转到连接界面
|
|
|
|
|
|
window.location.href = '../connect/connect.html';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 绑定事件监听器
|
|
|
|
|
|
function bindEvents() {
|
|
|
|
|
|
// 重新连接按钮
|
|
|
|
|
|
const reconnectBtn = document.getElementById('reconnectBtn');
|
|
|
|
|
|
if (reconnectBtn) {
|
|
|
|
|
|
reconnectBtn.addEventListener('click', reconnectCall);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 离开按钮
|
|
|
|
|
|
const leaveBtn = document.getElementById('leaveBtn');
|
|
|
|
|
|
if (leaveBtn) {
|
|
|
|
|
|
leaveBtn.addEventListener('click', leaveCall);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 页面加载完成后初始化
|
|
|
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
|
|
|
|
bindEvents();
|
|
|
|
|
|
|
|
|
|
|
|
// 更新断开连接信息
|
|
|
|
|
|
const disconnectConnectionId = document.getElementById('disconnectConnectionId');
|
|
|
|
|
|
const disconnectTime = document.getElementById('disconnectTime');
|
|
|
|
|
|
|
|
|
|
|
|
if (disconnectConnectionId) {
|
|
|
|
|
|
disconnectConnectionId.textContent = localStorage.getItem('connectionId') || '--';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (disconnectTime) {
|
|
|
|
|
|
disconnectTime.textContent = new Date().toLocaleString();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 导出全局函数
|
|
|
|
|
|
window.reconnectCall = reconnectCall;
|
|
|
|
|
|
window.leaveCall = leaveCall;
|