You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.7 KiB
84 lines
2.7 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>侦查者</title>
|
|
<link rel="stylesheet" href="/static/login.css">
|
|
<style>
|
|
body {
|
|
color: black; /* 字体颜色改为白色 */
|
|
font-size: 12px; /* 字体大小调小 */
|
|
}
|
|
.login h2, .login button {
|
|
color: white; /* 按钮和标题字体颜色也改为白色 */
|
|
font-size: 14px; /* 调整按钮和标题的字体大小 */
|
|
}
|
|
.notification-list {
|
|
list-style-type: none;
|
|
padding: 0;
|
|
}
|
|
.notification-list li {
|
|
padding: 10px;
|
|
margin: 10px 0;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
background-color: #f9f9f9;
|
|
word-wrap: break-word; /* 防止长单词溢出 */
|
|
}
|
|
.notification-list li strong {
|
|
margin-right: 10px;
|
|
}
|
|
.notification-list li span {
|
|
font-style: italic;
|
|
color: #777;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login">
|
|
<h2>侦查者</h2>
|
|
<button onclick="window.location.href='http://192.168.146.178:5000/'" class="register-button">控制小车</button>
|
|
<button onclick="window.location.href='{{ url_for('send_message') }}'" class="register-button">发送消息</button>
|
|
|
|
<h2>通知</h2>
|
|
<ul class="notification-list">
|
|
{% if notifications %}
|
|
{% for notification in notifications %}
|
|
<li>
|
|
消息ID: {{ notification.message_id }} - 操作: {{ notification.action }} - 时间: {{ notification.created_at }} - 内容: {{ notification.message }}
|
|
</li>
|
|
{% endfor %}
|
|
{% else %}
|
|
<li>没有通知。</li>
|
|
{% endif %}
|
|
</ul>
|
|
<button onclick="clearNotifications()" class="register-button">清空通知</button>
|
|
</div>
|
|
|
|
<script>
|
|
function clearNotifications() {
|
|
// 发送请求清空通知
|
|
fetch('/clear_notifications', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ user_id: {{ current_user.id }} })
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
location.reload(); // 刷新页面以显示更新后的通知列表
|
|
} else {
|
|
alert('清空通知失败');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error('Error:', error);
|
|
alert('清空通知失败');
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |