From 62896d9fc6cd97853b18497420e0804c07caf4ae Mon Sep 17 00:00:00 2001 From: sudomarcma <1040211836@qq.com> Date: Mon, 30 Jun 2025 17:03:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor(WorkerDashboardView):=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4QR=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除QR图片上传按钮 --- src/views/WorkerDashboardView.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/views/WorkerDashboardView.vue b/src/views/WorkerDashboardView.vue index e6fba47..d181889 100644 --- a/src/views/WorkerDashboardView.vue +++ b/src/views/WorkerDashboardView.vue @@ -32,13 +32,13 @@ 📷 Scan to Clock {{ isClockedIn ? 'Out' : 'In' }} - + --> @@ -166,8 +166,8 @@ const startScanner = () => { html5QrCode = new Html5Qrcode('qr-reader') const config = { fps: 10, qrbox: { width: 250, height: 250 } } html5QrCode.start({ facingMode: 'environment' }, config, onScanSuccess, onScanFailure) - } catch (err) { - errorMessage.value = `Unable to start camera. Try uploading an image instead. Error: ${err.message}` + } catch { + errorMessage.value = `Unable to start camera. ` isScannerActive.value = false } }, 300) @@ -179,7 +179,7 @@ const stopScanner = () => { } isScannerActive.value = false } -const triggerFileUpload = () => fileInput.value.click() +// const triggerFileUpload = () => fileInput.value.click() const handleFileUpload = (event) => { const file = event.target.files[0] if (!file) return @@ -190,8 +190,8 @@ const handleFileUpload = (event) => { html5QrCode .scanFile(file, true) .then(onScanSuccess) - .catch((err) => { - onScanFailure(`Error scanning file: ${err}`) + .catch(() => { + onScanFailure(`Try Again`) }) } const onScanSuccess = (decodedText) => { @@ -207,8 +207,8 @@ const onScanSuccess = (decodedText) => { (errorMessage.value = `Unable to retrieve your location: ${geoError.message}. Please enable location services.`), ) } -const onScanFailure = (message = 'Could not detect a QR code. Please try again.') => { - errorMessage.value = message +const onScanFailure = () => { + errorMessage.value = 'Could not detect a QR code. Please try again.' }