safesight-control/internal/web/ui/templates/face_gallery.html

82 lines
3.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{define "face_gallery"}}
<div class="card">
<div class="section-title">
<div>
<h2 class="title-with-icon">{{icon "profile"}}<span>人脸库管理</span></h2>
<div class="form-hint">批量导入或逐个添加人员照片,然后重新生成人脸库并下发到设备。</div>
</div>
</div>
</div>
{{if .Message}}
<div class="card"><pre class="muted small" style="white-space:pre-wrap;margin:0">{{.Message}}</pre></div>
{{end}}
<div class="detail-grid">
<div class="card">
<h3 class="title-with-icon">{{icon "overview"}}<span>批量导入</span></h3>
<div class="form-hint" style="margin-bottom:12px">选择按姓名分目录的照片根目录,系统自动识别子目录名作为人员姓名。</div>
<form method="post" action="/ui/face-gallery/import" enctype="multipart/form-data">
<div class="field-grid">
<label class="full"><span>选择照片目录</span><input type="file" name="photos" webkitdirectory multiple required /></label>
</div>
<div class="actions" style="margin-top:12px">
<button class="btn" type="submit">批量导入</button>
</div>
</form>
</div>
<div class="card">
<h3 class="title-with-icon">{{icon "edit"}}<span>新增人员</span></h3>
<div class="form-hint" style="margin-bottom:12px">添加单个人员并上传照片。</div>
<form method="post" action="/ui/face-gallery/add" enctype="multipart/form-data">
<div class="field-grid">
<label><span>姓名</span><input type="text" name="name" placeholder="例如:张三" required /></label>
<label><span>照片</span><input type="file" name="photo" accept="image/*" required /></label>
</div>
<div class="actions" style="margin-top:12px">
<button class="btn" type="submit">新增</button>
</div>
</form>
</div>
</div>
<div class="card">
<div class="section-title">
<div>
<h3 class="title-with-icon">{{icon "profile"}}<span>人员列表</span></h3>
</div>
<div class="actions">
</div>
</div>
<div class="table-wrap">
{{if .FaceGalleryPersons}}
<table>
<thead>
<tr><th>ID</th><th>姓名</th><th>操作</th></tr>
</thead>
<tbody>
{{range .FaceGalleryPersons}}
<tr>
<td class="mono">{{.ID}}</td>
<td style="font-weight:500">{{.Name}}</td>
<td>
<form method="post" action="/ui/face-gallery/delete" style="display:inline" onsubmit="return confirm('确定删除 {{.Name}}')">
<input type="hidden" name="id" value="{{.ID}}">
<button class="btn ghost" type="submit" style="color:var(--danger-soft-text)">删除</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<div class="empty-state">
<div class="empty-title">人脸库为空</div>
<div class="muted">请先批量导入或新增人员,然后点击"重新生成人脸库"。</div>
</div>
{{end}}
</div>
</div>
{{end}}