初始化
This commit is contained in:
50
client/public/onebyone/endcall/endcall.html
Normal file
50
client/public/onebyone/endcall/endcall.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>VideoCall - 通话结束</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="../css/style.css">
|
||||
</head>
|
||||
<body class="h-screen w-screen flex flex-col text-white bg-grid relative">
|
||||
<!--
|
||||
============================================================
|
||||
结束通话界面
|
||||
============================================================
|
||||
-->
|
||||
<div class="h-full w-full flex items-center justify-center bg-black/80">
|
||||
<div class="text-center max-w-md px-8">
|
||||
<div class="w-20 h-20 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-full flex items-center justify-center mx-auto mb-6 shadow-lg">
|
||||
<i class="fas fa-video-slash text-white text-3xl"></i>
|
||||
</div>
|
||||
<h2 class="text-2xl font-bold text-white mb-4">通话已结束</h2>
|
||||
<p class="text-gray-400 mb-8" id="disconnectReason">连接已断开,请检查网络连接后重试</p>
|
||||
<div class="flex flex-col sm:flex-row gap-3 justify-center">
|
||||
<button id="reconnectBtn" class="px-6 py-3 bg-indigo-600 hover:bg-indigo-700 rounded-xl transition-colors flex items-center justify-center gap-2">
|
||||
<i class="fas fa-redo"></i>
|
||||
<span>重新连接</span>
|
||||
</button>
|
||||
<button id="leaveBtn" class="px-6 py-3 glass hover:bg-white/10 rounded-xl transition-colors flex items-center justify-center gap-2">
|
||||
<i class="fas fa-sign-out-alt"></i>
|
||||
<span>返回</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="mt-8 text-xs text-gray-500">
|
||||
<p>连接ID: <span id="disconnectConnectionId">--</span></p>
|
||||
<p>断开时间: <span id="disconnectTime">--</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 通知组件 -->
|
||||
<div id="notification" class="fixed top-20 left-1/2 transform -translate-x-1/2 glass px-6 py-3 rounded-full flex items-center gap-3 opacity-0 pointer-events-none transition-all duration-300 z-50 translate-y-[-20px]">
|
||||
<i class="fas fa-info-circle text-indigo-400"></i>
|
||||
<span class="text-sm" id="notificationText">通知内容</span>
|
||||
</div>
|
||||
|
||||
<!-- 引入模块化JavaScript文件 -->
|
||||
<script type="module" src="endcall.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
59
client/public/onebyone/endcall/endcall.js
Normal file
59
client/public/onebyone/endcall/endcall.js
Normal 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;
|
||||
Reference in New Issue
Block a user