初始化

This commit is contained in:
2026-04-29 15:18:30 +08:00
commit e47eee39ed
111 changed files with 44168 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
/**
* 结束通话界面逻辑
* 处理通话结束后的操作,如重新连接或返回连接界面
*/
import { showNotification } from '../utils.js';
// 重新连接
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;