From aacf5c80f6effe742dec98c15ab51344856db068 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Fri, 8 May 2026 11:21:58 +0800 Subject: [PATCH] feat: photo count + smart nav button visibility --- internal/web/ui/templates/face_gallery.html | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/internal/web/ui/templates/face_gallery.html b/internal/web/ui/templates/face_gallery.html index e99a454..33d14c4 100644 --- a/internal/web/ui/templates/face_gallery.html +++ b/internal/web/ui/templates/face_gallery.html @@ -53,16 +53,16 @@ {{if .Photos}} {{if gt .PhotoCount 1}} - - + + {{end}} {{else}}
无照片
{{end}} -
- {{.Name}} -
+
+
{{.Name}} {{.PhotoCount}}张
+
@@ -103,15 +103,12 @@ document.querySelectorAll('.photo-viewer').forEach(function(el) { var id = el.querySelector('img') ? el.querySelector('img').id.replace('img-','') : ''; if (id) photoData[id] = {photos: photos, idx: 0}; }); -function prevPhoto(id) { +function navPhoto(id, dir) { var d = photoData[id]; if (!d || d.photos.length<2) return; - d.idx = (d.idx - 1 + d.photos.length) % d.photos.length; - document.getElementById('img-'+id).src = d.photos[d.idx]; -} -function nextPhoto(id) { - var d = photoData[id]; if (!d || d.photos.length<2) return; - d.idx = (d.idx + 1) % d.photos.length; + d.idx = (d.idx + dir + d.photos.length) % d.photos.length; document.getElementById('img-'+id).src = d.photos[d.idx]; + document.getElementById('prev-'+id).style.display = d.idx === 0 ? 'none' : ''; + document.getElementById('next-'+id).style.display = d.idx === d.photos.length-1 ? 'none' : ''; } function editPerson(id, name, photos) { document.getElementById('edit-id').value = id;