浏览代码

QRcode Scanner (LIFF)

Mike 3 年之前
父节点
当前提交
f785102907
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. 14 1
      ArkCard-web/collect.html

+ 14 - 1
ArkCard-web/collect.html

@@ -395,6 +395,7 @@ $(document).ready(function () {
         console.log('初始化失敗: ' + err.code + ", " + err.message);
     });
 
+    /*
     document.getElementById('qrcodeButton').addEventListener('click', function() {
         alert('啟動QRCode Scanner'); // test
         
@@ -408,10 +409,22 @@ $(document).ready(function () {
             console.log(JSON.stringify(err));
         });
     });
+    */
+
+    $(".qrcode").click(function () {
+        alert('QRCode Scanner Starting V1'); // test
+        
+        if (liff.scanCode) {
+            liff.scanCode().then(result => {
+                alert(JSON.stringify(result)); // test
+                $('#address').val(result.value);
+            });
+        }
+    });
 
     /*
     $(".qrcode").click(function () {
-        alert('QRCode Scanner Starting'); // test
+        alert('QRCode Scanner Starting V2'); // test
         
         // scanCodeV2 call
         liff.scanCodeV2().then(result => {