From f8fba79d550988ee6489840eef44171bdfebe37c Mon Sep 17 00:00:00 2001 From: Miao_Spring <539943419@qq.com> Date: Tue, 21 Jan 2025 19:14:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=B7=E8=B5=9E=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=AF=86=E5=88=AB=E4=BA=8C=E7=BB=B4=E7=A0=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +- components/miaoQRScanner.vue | 23 ++++---- pages/tools/fucksq.vue | 69 ++++++++++++++++------- utils/filePicker.ts | 105 +++++++++++++++++++++++++++++++++++ 4 files changed, 169 insertions(+), 32 deletions(-) create mode 100644 utils/filePicker.ts diff --git a/.gitignore b/.gitignore index ea8ee76..fd3777d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,6 @@ logs .pnpm-lock.yaml -userData \ No newline at end of file +userData + +test/* \ No newline at end of file diff --git a/components/miaoQRScanner.vue b/components/miaoQRScanner.vue index 858bdce..bd60dc0 100644 --- a/components/miaoQRScanner.vue +++ b/components/miaoQRScanner.vue @@ -42,18 +42,17 @@ const handleVideoTrack = (track: MediaStreamTrack) => { let errCount = 0 // @ts-ignore const imageCapture = new ImageCapture(track) - timer = setInterval(() => { + timer = setInterval(async () => { try { - imageCapture.grabFrame().then((videoFrame: VideoFrame) => { - const data = getQRData(videoFrame) - if (data &&!scannerResult.has(data)) { - console.log(data) - scannerResult.add(data) - result.push(data) - emit('onResult', data) - } - videoFrame.close() - }) + const videoFrame = await imageCapture.grabFrame() + const data = getQRData(videoFrame) + if (data && !scannerResult.has(data)) { + console.log(data) + scannerResult.add(data) + result.push(data) + emit('onResult', data) + } + videoFrame.close() } catch (e) { errCount++ if (errCount > 10) { @@ -96,6 +95,8 @@ onBeforeUnmount(() => { video { height: inherit; width: inherit; + max-height: inherit; + max-width: inherit; object-fit: contain; } } diff --git a/pages/tools/fucksq.vue b/pages/tools/fucksq.vue index 6dd13b4..faf7c60 100644 --- a/pages/tools/fucksq.vue +++ b/pages/tools/fucksq.vue @@ -4,14 +4,14 @@
- + - + 扫码 @@ -22,11 +22,12 @@ - 开始 + 开始 - 清空输出 + 清空输出
@@ -48,8 +49,11 @@