jeter20131220 3 years ago
parent
commit
eb40cce30b
1 changed files with 44 additions and 39 deletions
  1. 44 39
      ArkCard-web/goto.js

+ 44 - 39
ArkCard-web/goto.js

@@ -27,50 +27,55 @@ $(document).ready(function () {
   console.log(collecturl);
   $.ajax({
     method: "GET",
-    url: "https://ark.cards:8228/collection/" + collectuserid + "",
-    //  url: "https://ark.cards:8228/collection/U09a0698f2a5d41bccbbd03ca988a1d15",
+    // url: "https://ark.cards:8228/collection/" + collectuserid + "",
+     url: "https://ark.cards:8228/collection/U09a0698f2a5d41bccbbd03ca988a1d15",
+     url: "https://ark.cards:8228/collection/Uf161c92b16f84357987a78c2b4b47719",
+
     dataType: "json",
   })
     .done(function (msg) {
       console.log(msg);
       // console.log(Object.keys(msg).length);
       let msgLen = Object.keys(msg).length;
-      console.log(msgLen)
+      console.log(msgLen);
       var collectcontent = '';
-     
-      for (var i = 0; i < msgLen; i++) {
-        collectcontent += '\
-          <div class="collectcontent col">\
-          <input style="display: none;" type="checkbox" value="'+ msg[i].id + '" name="nftid" id="' + msg[i].id + '">\
-          <label for="'+ msg[i].id + '">\
-          <div class="collectcard card h-100">\
-              <a target="_blank">\
-                  <img src="'+ msg[i].imgurl + '"class="card-img-top" alt="...">\
-              </a>\
-              <div class="card-body p-2">\
-                  <a target="_blank">\
-                      <h5 class="card-title pt-3">'+ msg[i].title + '</h5>\
-                  </a>\
-                  <p class="card-text">\
-                     '+ msg[i].context + ' \
-                  </p>\
-                  <p class="card-text row">\
-                      <small class="text-muted col-6 px-1">\
-                          <img class="mb-1 mx-1 d-inline" style="width: 10px; object-fit: cover; "\
-                              src="./img/sec05/Icon awesome-ethereum.png" alt=""><span>'+ msg[i].cost + '</span>\
-                      </small>\
-                      <small class="price col-6 px-0 text-center">\
-                          <img class="mb-1 mx-1 d-inline" style="width: 12px; object-fit: cover; " src="./img/sec05/like.png" alt=""><span>'+ msg[i].likes + '</span></small>\
-                      </p>\
-              </div>\
-          </div>\
-          </label>\
-        </div>';
+      if (msg[0].id == undefined) {
+        collectcontent += '<p>' + msg + '</p>';
+      } else {
+          for (var i = 0; i < msgLen; i++) {
+          collectcontent += '\
+            <div class="collectcontent col">\
+            <input style="display: none;" type="checkbox" value="'+ msg[i].id + '" name="nftid" id="' + msg[i].id + '">\
+            <label for="'+ msg[i].id + '">\
+            <div class="collectcard card h-100">\
+                <a target="_blank">\
+                    <img src="'+ msg[i].imgurl + '"class="card-img-top" alt="...">\
+                </a>\
+                <div class="card-body p-2">\
+                    <a target="_blank">\
+                        <h5 class="card-title pt-3">'+ msg[i].title + '</h5>\
+                    </a>\
+                    <p class="card-text">\
+                       '+ msg[i].context + ' \
+                    </p>\
+                    <p class="card-text row">\
+                        <small class="text-muted col-6 px-1">\
+                            <img class="mb-1 mx-1 d-inline" style="width: 10px; object-fit: cover; "\
+                                src="./img/sec05/Icon awesome-ethereum.png" alt=""><span>'+ msg[i].cost + '</span>\
+                        </small>\
+                        <small class="price col-6 px-0 text-center">\
+                            <img class="mb-1 mx-1 d-inline" style="width: 12px; object-fit: cover; " src="./img/sec05/like.png" alt=""><span>'+ msg[i].likes + '</span></small>\
+                        </p>\
+                </div>\
+            </div>\
+            </label>\
+          </div>';
+        }
       }
-      
-    
+
+
       $('.sec05-moblie-container').html(collectcontent);
-    
+
 
     });
 
@@ -89,7 +94,7 @@ $(document).on("click", ".close", function (event) {
   $(".buybox").hide(500);
   $(".nftmall").removeClass("select");
 
-  $(".nftname").prop( "checked", false );
+  $(".nftname").prop("checked", false);
 });
 
 $.fn.serializeObject = function () {
@@ -192,7 +197,7 @@ $(document).ready(function () {
       let msgLen = Object.keys(msg).length;
       console.log(msgLen);
       var nftmall = '';
-      var buybox="";
+      var buybox = "";
       for (var i = 0; i < msgLen; i++) {
         nftmall += '\
           <div class="nftmall col">\
@@ -222,7 +227,7 @@ $(document).ready(function () {
           </label>\
         </div>';
       }
-      buybox+='\
+      buybox += '\
       <div class="p-2">\
       <input style="border-radius: 10px; border:none; display: none;" class="p-2 w-100 mb-3" type="text" name="userid" value="' + collectuserid + '" placeholder="請輸入您的userid" required>\
           <div class="text-end px-2">\
@@ -250,7 +255,7 @@ $(document).ready(function () {
 //   let k = jsonInfo;
 //   let nftproduct = k.nftidval;
 //   console.log(nftproduct);
- 
+
 //   $.ajax({
 //     type: 'GET',
 //     url: "https://api.ptt.cx:8228/buy/" + collectuserid + "/" + nftproduct + "",