diff --git a/web/src/App.svelte b/web/src/App.svelte index 17377e7..52328ac 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -8,6 +8,7 @@ let [error, loading, done, edit] = ["", false, false, false] function scan(uid: string) { + if (loading) return loading = true post('/scan', { uid }) .then(() => done = true) @@ -24,7 +25,7 @@ // Card must match either \d{20} or [0-9A-Fa-f]{16} if (!/^\d{20}$/.test(inputCard) && !/^[0-9A-Fa-f]{16}$/.test(inputCard)) - return error = "Invalid card ID" + return error = "卡号格式不对" cards.push({ id: inputCard, name: inputName }) cards = cards @@ -44,12 +45,12 @@

点击一个卡就可以刷了,没有卡的话请先添加卡片。如果不知道卡号的话可以去 NFC Tools 扫

{error}
-
+
{#each cards as card}
{#if edit} - + {/if}
{/each} @@ -62,7 +63,14 @@
- + { + // Ignore special keys + if (e.key.length > 1) return + + // Prevent every key except 0-9 and A-F + if (!/^[0-9A-Fa-f]$/.test(e.key)) e.preventDefault() + }}>