diff --git a/internal/web/ui/templates/console.html b/internal/web/ui/templates/console.html index d8243af..4b673ed 100644 --- a/internal/web/ui/templates/console.html +++ b/internal/web/ui/templates/console.html @@ -241,14 +241,30 @@ } }); if (visible.length === 0) { alert('暂无未分配视频源'); return; } - var html = '
为设备添加视频源
'; + var overlay = document.createElement('div'); + overlay.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);z-index:9999;display:flex;align-items:center;justify-content:center'; + overlay.addEventListener('click',function(){overlay.remove()}); + var box = document.createElement('div'); + box.style.cssText = 'background:var(--surface);border-radius:8px;padding:20px;min-width:300px;max-width:400px'; + box.addEventListener('click',function(e){e.stopPropagation()}); + box.innerHTML = '
为设备添加视频源 (' + visible.length + '路可用)
' + + '
'; visible.forEach(function(name) { - html += '
' + name + '
'; + var item = document.createElement('div'); + item.textContent = name; + item.style.cssText = 'padding:8px 12px;cursor:pointer;border-radius:4px;margin-bottom:2px;font-size:13px'; + item.addEventListener('mouseover',function(){item.style.background='var(--surface-soft)'}); + item.addEventListener('mouseout',function(){item.style.background='transparent'}); + item.addEventListener('click',function(){ + addSourceToDeviceForm(deviceID, name); + overlay.remove(); + }); + box.querySelector('div:last-child').appendChild(item); }); - html += '
'; - var div = document.createElement('div'); - div.innerHTML = html; - document.body.appendChild(div.firstElementChild); + box.innerHTML += '
'; + box.querySelector('button').addEventListener('click',function(){overlay.remove()}); + overlay.appendChild(box); + document.body.appendChild(overlay); }; function addSourceToDeviceForm(deviceID, sourceName) { diff --git a/safesightd-linux-arm64 b/safesightd-linux-arm64 index 624cd9e..7a314cd 100644 Binary files a/safesightd-linux-arm64 and b/safesightd-linux-arm64 differ