я косяк, поправил веб. Капитан, работайте!
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Неавторизованное устройство</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; background:#111; color:#fff; display:flex; align-items:center; justify-content:center; min-height:100vh; margin:0; }
|
||||
.card { text-align:center; background:#1f1f1f; padding:28px; border-radius:12px; box-shadow:0 0 20px rgba(0,0,0,0.4); max-width:560px; width:92%; }
|
||||
h1 { margin-bottom:16px; font-size:26px; }
|
||||
p { margin-bottom:18px; line-height:1.5; }
|
||||
.btn { display:inline-block; margin-top:8px; padding:10px 16px; border-radius:8px; border:1px solid #4ea8ff; color:#fff; background:#1b66a8; cursor:pointer; font-size:15px; }
|
||||
.btn:disabled { opacity:0.6; cursor:not-allowed; }
|
||||
.hint { font-size:14px; color:#d1d1d1; margin-top:16px; text-align:left; line-height:1.5; }
|
||||
.hint ol { margin:10px 0 0 0; padding-left:22px; }
|
||||
.hint li { margin-bottom:8px; }
|
||||
.status { margin-top:14px; min-height:22px; font-size:14px; color:#d6e8ff; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<h1>Неавторизованное устройство</h1>
|
||||
<p>Этот планшет ещё не настроен для работы с весами.</p>
|
||||
<div class="hint">
|
||||
<strong>Что делать:</strong>
|
||||
<ol>
|
||||
<li>На весах нажмите "Привязать терминал".</li>
|
||||
<li>Отсканируйте QR-код на экране.</li>
|
||||
<li>Вставте полученную ссылку в поле <strong>Fully Kiosk Browser</strong> → <strong>Settings</strong> → <strong>Web Content Settings</strong> → <strong>Start URL</strong>.</li>
|
||||
<li>Перезапустите Fully Kiosk Browser.</li>
|
||||
</ol>
|
||||
<p style="margin:12px 0 0 0;font-size:13px;color:#a8a8a8">
|
||||
Ограничение доступа сделано для безопасности фермы. Вы можете получить доступ только с помощью QR-кода.
|
||||
</p>
|
||||
</div>
|
||||
<button class="btn" id="checkBtn" type="button">Проверить снова</button>
|
||||
<div class="status" id="statusText"></div>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var checkBtn = document.getElementById("checkBtn");
|
||||
var statusText = document.getElementById("statusText");
|
||||
var nextParam = new URLSearchParams(window.location.search).get("next") || "/scales";
|
||||
|
||||
function setStatus(text, isError) {
|
||||
statusText.textContent = text;
|
||||
statusText.style.color = isError ? "#ff9f9f" : "#d6e8ff";
|
||||
}
|
||||
|
||||
async function checkPairedStatus() {
|
||||
checkBtn.disabled = true;
|
||||
setStatus("Проверяем…");
|
||||
try {
|
||||
var response = await fetch("/api/kiosk/status");
|
||||
var payload = await response.json().catch(function () { return {}; });
|
||||
if (!response.ok) {
|
||||
setStatus("Не удалось проверить. Попробуйте ещё раз.", true);
|
||||
return false;
|
||||
}
|
||||
if (!payload.paired && payload.enforce_paired_only !== false) {
|
||||
setStatus("Терминал пока не настроен. Дождитесь администратора.", true);
|
||||
return false;
|
||||
}
|
||||
setStatus("Готово. Открываем экран весов…");
|
||||
window.setTimeout(function () {
|
||||
window.location.href = nextParam;
|
||||
}, 600);
|
||||
return true;
|
||||
} catch (_e) {
|
||||
setStatus("Нет связи с сервером. Проверьте Wi‑Fi фермы.", true);
|
||||
return false;
|
||||
} finally {
|
||||
checkBtn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
checkBtn.addEventListener("click", checkPairedStatus);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user