|
@@ -22,8 +22,8 @@ $(document).on("click", ".close", function (event) {
|
|
|
var collectuserid = 'U176663ce100ebb1f4c404d48749decb1'; // test
|
|
|
|
|
|
// 收藏頁面
|
|
|
-function collection(collectuserid) {
|
|
|
- console.log('call collection(' + collectuserid + ')'); // test
|
|
|
+function collection(collectuserid='') {
|
|
|
+ console.log('Call collection(' + collectuserid + ')'); // test
|
|
|
|
|
|
$.ajax({
|
|
|
method: "GET",
|
|
@@ -74,9 +74,104 @@ function collection(collectuserid) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+// 購買頁面
|
|
|
+function shop(collectuserid='') {
|
|
|
+ console.log('Call shop(' + collectuserid + ')'); // test
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ method: "GET",
|
|
|
+ url: "https://ark.cards:8228/shop/" + collectuserid + "",
|
|
|
+ // url: "https://ark.cards:8228/shop/Uf161c92b16f84357987a78c2b4b47719",
|
|
|
+ dataType: "json",
|
|
|
+ })
|
|
|
+ .done(function (msg) {
|
|
|
+ console.log(msg);
|
|
|
+ // console.log(Object.keys(msg).length);
|
|
|
+ let msgLen = Object.keys(msg).length;
|
|
|
+ console.log(msgLen);
|
|
|
+ var nftmall = '';
|
|
|
+ var buybox = "";
|
|
|
+ for (var i = 0; i < msgLen; i++) {
|
|
|
+ nftmall += '\
|
|
|
+ <div class="nftmall col">\
|
|
|
+ <input style="display:none" type="checkbox" value="'+ msg[i].id + '" name="nftid" class="nftname" 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>';
|
|
|
+ }
|
|
|
+ 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">\
|
|
|
+ <p class="text-start text-white mb-2">※一次只能購買一則NFT收藏品</p>\
|
|
|
+ <button type="button" style="border:1px solid #fff; border-radius: 30px;" class="close btn text-white px-3">取消</button>\
|
|
|
+ <input style="border-radius: 30px; background:#fff; border: none;" class="send-btn px-3 ms-1 py-2" type="submit" value="購買">\
|
|
|
+ </div>\
|
|
|
+ </div>\
|
|
|
+</div>';
|
|
|
+
|
|
|
+ $('.sec06-nft-mall').html(nftmall);
|
|
|
+ $('.buybox').html(buybox);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// Qrcode頁面
|
|
|
+function get_data(collectuserid='') {
|
|
|
+ console.log('Call get_data(' + collectuserid + ')'); // test
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ method: "GET",
|
|
|
+ url: "https://ark.cards:8228/receive/" + collectuserid + "",
|
|
|
+ // 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="'+ msg.base + '" alt="">\
|
|
|
+ ';
|
|
|
+ useraddress += '\
|
|
|
+ '+ msg.useraddress + '\
|
|
|
+ ';
|
|
|
+
|
|
|
+ $('#Qrcode').html(Qrcodeimg);
|
|
|
+ $('#copy').html(useraddress);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
$(document).ready(function () {
|
|
|
// 收藏頁面
|
|
|
collection(collectuserid);
|
|
|
+
|
|
|
+ // 購買頁面
|
|
|
+ shop(collectuserid);
|
|
|
+
|
|
|
+ // Qrcode頁面
|
|
|
+ get_data(collectuserid);
|
|
|
});
|
|
|
|
|
|
$(".buybox").hide();
|
|
@@ -178,105 +273,6 @@ $(".nft-buy").submit(function (e) {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
-// 購買頁面
|
|
|
-$(document).ready(function () {
|
|
|
- // collecturl = location.search;
|
|
|
- // collecturl = collecturl.split("&")[0];
|
|
|
- // console.log("collecturl = " + collecturl); // test
|
|
|
- // getcollect = collecturl.split("?")
|
|
|
- // var collectuserid = getcollect[1];
|
|
|
- $.ajax({
|
|
|
- method: "GET",
|
|
|
- url: "https://ark.cards:8228/shop/" + collectuserid + "",
|
|
|
- // url: "https://ark.cards:8228/shop/Uf161c92b16f84357987a78c2b4b47719",
|
|
|
- dataType: "json",
|
|
|
- })
|
|
|
- .done(function (msg) {
|
|
|
- console.log(msg);
|
|
|
- // console.log(Object.keys(msg).length);
|
|
|
- let msgLen = Object.keys(msg).length;
|
|
|
- console.log(msgLen);
|
|
|
- var nftmall = '';
|
|
|
- var buybox = "";
|
|
|
- for (var i = 0; i < msgLen; i++) {
|
|
|
- nftmall += '\
|
|
|
- <div class="nftmall col">\
|
|
|
- <input style="display:none" type="checkbox" value="'+ msg[i].id + '" name="nftid" class="nftname" 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>';
|
|
|
- }
|
|
|
- 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">\
|
|
|
- <p class="text-start text-white mb-2">※一次只能購買一則NFT收藏品</p>\
|
|
|
- <button type="button" style="border:1px solid #fff; border-radius: 30px;" class="close btn text-white px-3">取消</button>\
|
|
|
- <input style="border-radius: 30px; background:#fff; border: none;" class="send-btn px-3 ms-1 py-2" type="submit" value="購買">\
|
|
|
- </div>\
|
|
|
- </div>\
|
|
|
- </div>';
|
|
|
-
|
|
|
- $('.sec06-nft-mall').html(nftmall);
|
|
|
- $('.buybox').html(buybox);
|
|
|
- });
|
|
|
-
|
|
|
-});
|
|
|
-
|
|
|
-// Qrcode頁面
|
|
|
-$(document).ready(function () {
|
|
|
- // collecturl = location.search;
|
|
|
- // collecturl = collecturl.split("&")[0];
|
|
|
- // console.log("collecturl = " + collecturl); // test
|
|
|
- // getcollect = collecturl.split("?")
|
|
|
- // var collectuserid = getcollect[1];
|
|
|
- function get_data() {
|
|
|
- $.ajax({
|
|
|
- method: "GET",
|
|
|
- url: "https://ark.cards:8228/receive/" + collectuserid + "",
|
|
|
- // 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="'+ 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);
|