From a3b869e8069d4889ed554d0d48bf4914f648363e Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 31 Aug 2025 20:21:19 +0900 Subject: [PATCH] =?UTF-8?q?=E7=AB=AF=E6=9C=AB=E3=81=AEQR=E3=82=92=E3=82=B9?= =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=83=B3=E3=81=99=E3=82=8B=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/index.d.ts | 8 +++++++ locales/ja-JP.yml | 2 ++ packages/frontend/src/pages/qr.read.vue | 32 +++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index 28d843535e..4b38d9a515 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -12593,6 +12593,14 @@ export interface Locale extends ILocale { * コードリーダーを停止 */ "stopQr": string; + /** + * QRコードが見つかりません + */ + "noQrCodeFound": string; + /** + * 端末の画像をスキャン + */ + "scanFile": string; }; } declare const locales: { diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index a80d4a0b7a..88b8e6a6a3 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -3372,3 +3372,5 @@ _qr: turnOffFlash: "ライトをオフにする" startQr: "コードリーダーを再開" stopQr: "コードリーダーを停止" + noQrCodeFound: "QRコードが見つかりません" + scanFile: "端末の画像をスキャン" diff --git a/packages/frontend/src/pages/qr.read.vue b/packages/frontend/src/pages/qr.read.vue index a9130f01d1..20f9e82c93 100644 --- a/packages/frontend/src/pages/qr.read.vue +++ b/packages/frontend/src/pages/qr.read.vue @@ -18,7 +18,9 @@ SPDX-License-Identifier: AGPL-3.0-only
-
+
+ + @@ -173,7 +175,7 @@ async function processResult(result: QrScanner.ScanResult) { updateLists(); }) .catch(err => { - console.error(err); + return err; }); } @@ -181,6 +183,32 @@ const qrStarted = ref(true); const flashCanToggle = ref(false); const flash = ref(false); +async function upload() { + os.chooseFileFromPc({ multiple: true }).then(files => { + if (files.length === 0) return; + for (const file of files) { + QrScanner.scanImage(file, { returnDetailedScanResult: true }) + .then(result => { + processResult(result); + }) + .catch(err => { + if (err.toString().includes('No QR code found')) { + os.alert({ + type: 'info', + text: i18n.ts._qr.noQrCodeFound, + }); + } else { + os.alert({ + type: 'error', + text: err.toString(), + }); + console.error(err); + } + }); + } + }); +} + async function chooseCamera() { if (!scannerInstance.value) return; const cameras = await QrScanner.listCameras(true);