feat: 刷新间隔增加随机分钟并使用广电图标
This commit is contained in:
+25
-7
@@ -4,6 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>广电账户</title>
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<style>
|
||||
:root {
|
||||
--bg: #eef1f6;
|
||||
@@ -202,6 +203,7 @@
|
||||
#smsBtn { flex: none; height: 32px; padding: 0 8px; }
|
||||
#loginMsg { min-height: 18px; margin: 8px 0 0; font-size: 12px; color: var(--danger); }
|
||||
#loginMsg.ok { color: var(--ok); }
|
||||
.unit { flex: none; color: var(--muted); font-size: 12px; }
|
||||
.hero { display: grid; grid-template-columns: 220px 1fr; overflow: hidden; margin-bottom: 10px; }
|
||||
.identity { padding: 16px 18px; background: #173a6b; color: #fff; }
|
||||
.brand { font-size: 12px; letter-spacing: 0.06em; opacity: 0.85; }
|
||||
@@ -394,9 +396,19 @@
|
||||
<div id="settings" class="mask" hidden>
|
||||
<div class="dialog card" role="dialog" aria-labelledby="settingsTitle">
|
||||
<h2 id="settingsTitle">同步间隔</h2>
|
||||
<div class="field">
|
||||
<label for="pollMinutes">分钟</label>
|
||||
<input id="pollMinutes" type="number" min="1" max="1440" inputmode="numeric" value="30">
|
||||
<div class="login-row">
|
||||
<label for="pollMinutes">间隔</label>
|
||||
<div class="control">
|
||||
<input id="pollMinutes" type="number" min="1" max="1440" inputmode="numeric" value="30">
|
||||
<span class="unit">分钟</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="login-row">
|
||||
<label for="jitterMinutes">随机</label>
|
||||
<div class="control">
|
||||
<input id="jitterMinutes" type="number" min="0" max="1440" inputmode="numeric" value="0">
|
||||
<span class="unit">分钟</span>
|
||||
</div>
|
||||
</div>
|
||||
<p id="settingsMsg"></p>
|
||||
<div class="dialog-actions">
|
||||
@@ -455,8 +467,9 @@
|
||||
$("dash").classList.toggle("stale", !!(data.stale && data.hasData && !data.loggedIn));
|
||||
$("error").hidden = !data.error;
|
||||
$("error").textContent = data.error || "";
|
||||
if ($("settings").hidden && data.pollMinutes) {
|
||||
$("pollMinutes").value = data.pollMinutes;
|
||||
if ($("settings").hidden) {
|
||||
if (data.pollMinutes) $("pollMinutes").value = data.pollMinutes;
|
||||
if (Number.isInteger(data.jitterMinutes)) $("jitterMinutes").value = data.jitterMinutes;
|
||||
}
|
||||
|
||||
canResume = !!data.canResume;
|
||||
@@ -573,14 +586,19 @@
|
||||
|
||||
async function saveInterval() {
|
||||
const minutes = Number($("pollMinutes").value);
|
||||
const jitter = Number($("jitterMinutes").value);
|
||||
if (!Number.isInteger(minutes) || minutes < 1 || minutes > 1440) {
|
||||
$("settingsMsg").textContent = "需在 1 到 1440 之间";
|
||||
$("settingsMsg").textContent = "间隔需在 1 到 1440 之间";
|
||||
return;
|
||||
}
|
||||
if (!Number.isInteger(jitter) || jitter < 0 || jitter > 1440) {
|
||||
$("settingsMsg").textContent = "随机需在 0 到 1440 之间";
|
||||
return;
|
||||
}
|
||||
const res = await fetch("/api/interval", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ minutes })
|
||||
body: JSON.stringify({ minutes, jitter })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user