Forráskód Böngészése

qrcode scanner (LIFF測試)

Mike 3 éve
szülő
commit
a93dcf1179
1 módosított fájl, 54 hozzáadás és 0 törlés
  1. 54 0
      ArkCard-web/qrcode_scanner_liff.html

+ 54 - 0
ArkCard-web/qrcode_scanner_liff.html

@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>LIFF Starter</title>
+    <link rel="stylesheet" href="style.css">
+    <script charset="utf-8" src="https://static.line-scdn.net/liff/edge/2/sdk.js"></script>
+</head>
+<body>
+
+</body>
+<script>
+/**
+* Display data generated by invoking LIFF methods
+*/
+function displayLiffData() {
+    document.getElementById('browserLanguage').textContent = liff.getLanguage();
+    document.getElementById('sdkVersion').textContent = liff.getVersion();
+    document.getElementById('isInClient').textContent = liff.isInClient();
+    document.getElementById('isLoggedIn').textContent = liff.isLoggedIn();
+    document.getElementById('deviceOS').textContent = liff.getOS();
+    document.getElementById('lineVersion').textContent = liff.getLineVersion();
+}
+
+$(document).ready(function() {
+    liff.init({
+        liffId: "1656494344-JovNdOv0"
+    })
+    .then(() => {
+        alert('liff.init()'); // test
+
+        if (liff.isInClient()) {
+            if (liff.getOS() == "ios") {
+                window.location.replace("itms://itunes.apple.com/app/apple-store/id578186283?mt=8");              
+            } else if (liff.getOS() == "android") {
+                window.location.replace("market://details?id=com.nhiApp.v1");
+            }
+
+            setTimeout(function(){ liff.closeWindow(); }, 3000);
+        }
+    })
+    .catch((err) => {
+    });
+
+    // scanCodeV2 call
+    liff.scanCodeV2().then(result => {
+        // e.g. result = { value: "Hello LIFF app!" }
+        alert('scanCodeV2()'); // test
+    }).catch(err => {
+        console.log(err);
+    });
+});
+</script>
+</html>