jeter20131220 3 лет назад
Родитель
Сommit
42e421cda8
2 измененных файлов с 75 добавлено и 8 удалено
  1. 59 2
      ArkCard-web/goto.js
  2. 16 6
      ArkCard-web/qr-code.html

+ 59 - 2
ArkCard-web/goto.js

@@ -6,18 +6,75 @@ $('.sec05-moblie-container').slick({
     centerMode: true,
   });
 
+
 console.log(1);
+
+  // $(document).ready(function () {
+  //   function get_data(){
+  //     $.ajax({
+  //       method: "GET",
+  //       // url:"https://api.ptt.cx:8228/collection/""+userid+",
+  //       url:"https://api.ptt.cx:8228/collection/U176663ce100ebb1f4c404d48749decb1_test_000_000_000",
+  //       dataType: "json",
+  //   })
+  //   .done(function (msg) {
+  //     console.log(msg);
+  //   });
+  //   }
+  //   get_data();
+  //  });
+  //  console.log(location.href);
+
+
+
   $(document).ready(function () {
     function get_data(){
       $.ajax({
         method: "GET",
-        // url:"https://api.ptt.cx:8228/collection/"+userid+"",
-        url:"https://api.ptt.cx:8228/collection/U176663ce100ebb1f4c404d48749decb1_test_000_000_000",
+        url:"https://api.ptt.cx:8228/receive/Uf161c92b16f84357987a78c2b4b47719",
         dataType: "json",
     })
     .done(function (msg) {
       console.log(msg);
+      console.log(msg.base)
+      var Qrcodeimg='';
+      var useraddress='';
+      Qrcodeimg +='\
+      <img src="data:image/png;base64,'+msg.base+'" alt="">\
+      ';
+      useraddress +='\
+      '+msg.useraddress+'\
+      ';
+
+      $('#Qrcode').html(Qrcodeimg);
+      $('#copy').html(useraddress);
     });
     }
     get_data();
    });
+
+   function copyEvent(id)
+   {
+       var str = document.getElementById(id);
+       window.getSelection().selectAllChildren(str);
+       document.execCommand("Copy")
+       toastr.options = {
+        // 參數設定[註1]
+        "closeButton": false, // 顯示關閉按鈕
+        "debug": false, // 除錯
+        "newestOnTop": false,  // 最新一筆顯示在最上面
+        "progressBar": false, // 顯示隱藏時間進度條
+        "positionClass": "toast-top-center", // 位置的類別
+        "preventDuplicates": false, // 隱藏重覆訊息
+        "onclick": null, // 當點選提示訊息時,則執行此函式
+        "showDuration": "300", // 顯示時間(單位: 毫秒)
+        "hideDuration": "1000", // 隱藏時間(單位: 毫秒)
+        "timeOut": "1000", // 當超過此設定時間時,則隱藏提示訊息(單位: 毫秒)
+        "extendedTimeOut": "1000", // 當使用者觸碰到提示訊息時,離開後超過此設定時間則隱藏提示訊息(單位: 毫秒)
+        "showEasing": "swing", // 顯示動畫時間曲線
+        "hideEasing": "linear", // 隱藏動畫時間曲線
+        "showMethod": "fadeIn", // 顯示動畫效果
+        "hideMethod": "fadeOut" // 隱藏動畫效果
+      }
+      toastr.success( "複製成功" );
+   }

+ 16 - 6
ArkCard-web/qr-code.html

@@ -7,11 +7,13 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>ARK.Cards</title>
 
+  
     <link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"
         integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
     <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css" />
     <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick-theme.css" />
+    <link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css" rel="stylesheet"  />
     <link rel="stylesheet" href="./style.css">
 </head>
 
@@ -25,20 +27,28 @@
         </div>
     </section>
     <section class="sec02-qrcode container-fluid px-0 mx-0 text-center">
-        <img class="img-fluid" src="./img/qrcode.png" alt="">
-        <img class="m-3" src="./img/copy.png" alt="">
+        <div id="Qrcode">
+            <!-- <img class="img-fluid" src="./img/qrcode.png" alt=""> -->
+            
+        </div>
+        <button  style="margin: 0; padding: 0; border:none; outline: none; background: none;" type="button" onclick="copyEvent('copy')">
+            <img src="./img/copy.png" alt="">
+        </button>
         <img class="m-3" src="./img/share.png" alt="">
-        <p style="font-size: 14px;" class="mt- text-white">我接收的地址: edit#slide=id.ge5de583e5f_0_42</p>
+        <div>
+            <p style="font-size: 14px;" class="mt-1 text-white">我接收的地址:</p>
+            <p id="copy" style="font-size: 14px;" class="mt-1 text-white"></p>
+        </div>
     </section>
 
-    <footer style="background: #484848;" class="py-4 w-100 px-0 mx-0">
+    <footer style="background: #484848;" class="pb-4 w-100 px-0 mx-0">
         <p class="text-white text-center mb-0">Copyright 2021 版權所有 © Ark.Cards</p>
     </footer>
 
 
 
-
-
+    <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js"></script>
     <script src="https://unpkg.com/aos@next/dist/aos.js"></script>
     <script>
         AOS.init();