From c4f827bc5f87f56836e7352ebe1a51a22cb994c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=90=91=E5=A4=9C?= Date: Tue, 21 May 2024 13:43:10 +0800 Subject: [PATCH] feat(upload): add random seconds --- src/components/Upload.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/Upload.vue b/src/components/Upload.vue index 40fb6f9..6262e44 100644 --- a/src/components/Upload.vue +++ b/src/components/Upload.vue @@ -11,6 +11,9 @@ const msg = ref(null); const status = ref(null); const account = accountStore.account; +// Generate random number between min and max +const random = (min: any, max: any) => Math.floor(Math.random() * (max - min + 1) + min) + async function upload() { status.value = null; if (!mileage.value || !datetime.value) { @@ -18,6 +21,7 @@ async function upload() { msg.value = 'Please fill in all fields'; return; } + datetime.value.setSeconds(random(0, 59)) const result: { status: boolean; msg: string } = await invoke("upload", { account: accountStore.account, mileage: mileage.value, @@ -53,13 +57,14 @@ const datetime = ref(null); - + {{ msg }}
- +