match_face/templates/index.html

78 lines
2.3 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>Face Match Logs</title>
<script src="https://cdn.socket.io/4.0.0/socket.io.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
text-align: center;
}
h1 {
color: #333;
padding: 20px;
margin: 0;
background-color: #007bff;
color: white;
}
table {
width: 80%;
margin: 20px auto;
border-collapse: collapse;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #007bff;
color: white;
}
tr:hover {
background-color: #f5f5f5;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
// 连接到 Socket.IO 服务器
var socket = io.connect('http://' + document.domain + ':' + location.port);
// 监听 'update' 事件
socket.on('update', function(data) {
var tableBody = document.getElementById('log-table-body');
tableBody.innerHTML = ''; // 清空现有的表格行
// 遍历日志数据并更新表格
data.logs.forEach(function(log) {
var row = document.createElement('tr');
row.innerHTML = '<td>' + log[0] + '</td>' +
'<td>' + log[1] + '</td>' +
'<td>' + log[3] + '</td>';
// '<td>' + log[3] + '</td>'; // 仅显示姓名、身份和进入时间
tableBody.appendChild(row);
});
});
});
</script>
</head>
<body>
<h1>进入记录</h1>
<table border="0">
<thead>
<tr>
<th>姓名</th>
<th>身份</th>
<th>进入时间</th>
</tr>
</thead>
<tbody id="log-table-body">
<!-- 日志行将在 JavaScript 中插入 -->
</tbody>
</table>
</body>
</html>