【m】界面分为3个页面
This commit is contained in:
@@ -325,8 +325,39 @@ function initWebRTC() {
|
||||
console.log('Initializing WebRTC...');
|
||||
}
|
||||
|
||||
// 页面加载完成后初始化应用
|
||||
document.addEventListener('DOMContentLoaded', initApp);
|
||||
// 页面加载完成后初始化
|
||||
window.addEventListener('DOMContentLoaded', async () => {
|
||||
try {
|
||||
// 检查本地存储中是否有连接ID
|
||||
const connectionId = localStorage.getItem('connectionId');
|
||||
|
||||
if (!connectionId) {
|
||||
// 如果没有连接ID,跳转到连接界面
|
||||
window.location.href = './connect/connect.html';
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化 store
|
||||
store.init();
|
||||
|
||||
// 加入通话
|
||||
store.joinCall(connectionId);
|
||||
|
||||
// 初始化渲染器
|
||||
const renderer = new UIRenderer(store);
|
||||
|
||||
// 绑定DOM事件
|
||||
bindDomEvents();
|
||||
|
||||
// 绑定WebSocket事件
|
||||
bindWebSocketEvents();
|
||||
|
||||
console.log('Video call app initialized successfully');
|
||||
} catch (error) {
|
||||
console.error('Error initializing app:', error);
|
||||
showNotification('初始化失败,请刷新页面重试', 'error');
|
||||
}
|
||||
});
|
||||
|
||||
// 导出全局变量
|
||||
export { store, renderer, apiClient, wsManager };
|
||||
|
||||
Reference in New Issue
Block a user