Mike преди 3 години
родител
ревизия
faa3af1454
променени са 1 файла, в които са добавени 32 реда и са изтрити 16 реда
  1. 32 16
      ArkCard-web/goto.js

+ 32 - 16
ArkCard-web/goto.js

@@ -21,12 +21,28 @@ $(document).on("click", ".close", function (event) {
 
 // 收藏頁面
 $(document).ready(function () {
-  collecturl = location.search;
-  collecturl = collecturl.split("&")[0];
-  console.log("collecturl = " + collecturl); // test
-  getcollect = collecturl.split("?");
-  var collectuserid = getcollect[1];
-  console.log(collecturl);
+  // collecturl = location.search;
+  // collecturl = collecturl.split("&")[0];
+  // console.log("collecturl = " + collecturl); // test
+  // getcollect = collecturl.split("?");
+  // var collectuserid = getcollect[1];
+  // console.log(collecturl);
+
+  var collectuserid = "";
+
+  // 取得userid
+  liff.init({
+    liffId: "1656404434-gJ0Nzy1Y"
+  })
+  .then(() => {
+      var context = liff.getContext();
+      console.log(context);
+      collectuserid = context.context.userId;
+  })
+  .catch((err) => {
+      console.log('初始化失敗: ' + err.code + ", " + err.message);
+  });
+
   $.ajax({
     method: "GET",
     url: "https://ark.cards:8228/collection/" + collectuserid + "",
@@ -184,11 +200,11 @@ $(".nft-buy").submit(function (e) {
 
 // 購買頁面
 $(document).ready(function () {
-  collecturl = location.search;
-  collecturl = collecturl.split("&")[0];
-  console.log("collecturl = " + collecturl); // test
-  getcollect = collecturl.split("?")
-  var collectuserid = getcollect[1];
+  // 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 + "",
@@ -303,11 +319,11 @@ $(document).ready(function () {
 
 // Qrcode頁面
 $(document).ready(function () {
-  collecturl = location.search;
-  collecturl = collecturl.split("&")[0];
-  console.log("collecturl = " + collecturl); // test
-  getcollect = collecturl.split("?")
-  var collectuserid = getcollect[1];
+  // 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",