photo/templates/user_management.html

72 lines
3.0 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户管理</title>
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
<body>
<div class="container">
<h1>用户管理</h1>
<!-- 添加用户表单 -->
<div class="form-section">
<h2>添加用户</h2>
<form action="{{ url_for('add_new_user') }}" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required placeholder="请输入用户名">
</div>
<div class="form-group">
<label for="userphoto">用户照片:</label>
<input type="file" id="userphoto" name="userphoto" accept="image/*" required>
</div>
<button type="submit" class="btn">添加用户</button>
</form>
</div>
<div class="user-list">
<h2>用户列表</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>用户名</th>
<th>照片</th>
<th>面部编码</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.username }}</td>
<td>
<img src="{{ url_for('static', filename='uploads/users/' + user.username + '/photo.jpg') }}"
alt="用户照片" class="user-photo">
</td>
<td>
{% if user.encoding is not none and user.encoding | length > 0 %}
<pre>{{ user.encoding[:5] }} ...</pre>
{% else %}
无数据
{% endif %}
</td>
<td>
<a href="{{ url_for('edit_existing_user', user_id=user.id) }}" class="btn-edit">编辑</a>
<form action="{{ url_for('delete_existing_user', user_id=user.id) }}" method="POST" style="display:inline;">
<button type="submit" class="btn-delete" onclick="return confirm('确定要删除这个用户吗?')">删除</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</body>
</html>