|
@@ -51,7 +51,7 @@
|
|
|
</div>
|
|
|
<div class="card-body text-center">
|
|
|
<div class="mb-3">
|
|
|
- <input type="email" class="mb-1 form-control" id="exampleFormControlInput1" placeholder="請輸入您的Email">
|
|
|
+ <input type="email" class="mb-1 form-control" id="email" placeholder="請輸入您的Email" required="required">
|
|
|
<div class="text-danger small" style="text-align: left;">* 會發送合約地址至您指定的Email</div>
|
|
|
</div>
|
|
|
<div class="" id="userId"></div>
|
|
@@ -104,84 +104,89 @@ function nft_sent_message() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-// 取得liff_id
|
|
|
-liff.init({
|
|
|
- liffId: "1656404434-DoEqYOad"
|
|
|
-})
|
|
|
-.then(() => {
|
|
|
- var context = liff.getContext();
|
|
|
- console.log(context);
|
|
|
-
|
|
|
- var profile = liff.getProfile();
|
|
|
- console.log(profile);
|
|
|
-
|
|
|
- $('#userId').text(context.userId);
|
|
|
-
|
|
|
- // login
|
|
|
- if (!liff.isLoggedIn()) {
|
|
|
- console.log("您未登入");
|
|
|
- console.log('context.userId = ' + context.userId); // test
|
|
|
- } else {
|
|
|
- console.log("您已登入");
|
|
|
- }
|
|
|
-})
|
|
|
-.catch((err) => {
|
|
|
- console.log('初始化失敗: ' + err.code + ", " + err.message);
|
|
|
-});
|
|
|
-
|
|
|
-// 點擊「同意接收」按鈕
|
|
|
-$(".event-nft-send").click(function (e) {
|
|
|
- alert('.event-nft-send click'); // test
|
|
|
-
|
|
|
- var email = $('#email').val();
|
|
|
+// 活動頁送出
|
|
|
+function nft_event() {
|
|
|
+ alert('call nft_event()'); // test
|
|
|
+
|
|
|
+ var jsonInfo = $('.nft-event').serializeObject();
|
|
|
+ var jsonString = JSON.stringify(jsonInfo);
|
|
|
+ console.log(jsonString);
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: 'https://ark.cards:8228/event',
|
|
|
+ data: jsonString,
|
|
|
+ dataType: 'json',
|
|
|
+ async: false,
|
|
|
+ success: function (data) {
|
|
|
+ console.log('送出成功: ' + JSON.stringify(data));
|
|
|
+ alert("送出成功");
|
|
|
+
|
|
|
+ // 呼叫fastAPI,贈送「風」通行證 + 「港記酥皇」
|
|
|
+ nft_sent_message();
|
|
|
+ },
|
|
|
+ beforeSend: function () {
|
|
|
+ console.log('beforeSend');
|
|
|
+ },
|
|
|
+ complete: function () {
|
|
|
+ console.log('complete');
|
|
|
+ },
|
|
|
+ error: function (jqXHR, textStatus, errorThrown) {
|
|
|
+ console.log(JSON.stringify(jqXHR));
|
|
|
+ console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
|
|
|
+ console.log('送出失敗: ' + jqXHR.responseText);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
- // Email欄位必填檢查
|
|
|
- if (email == "") { // 未輸入Email
|
|
|
- Swal.fire({
|
|
|
- title: '注意!',
|
|
|
- icon: 'error',
|
|
|
- confirmButtonColor: '#3085d6',
|
|
|
- text: '請先輸入要查詢的手機號碼',
|
|
|
- });
|
|
|
- }
|
|
|
+$(document).ready(function () {
|
|
|
+ var userId = "";
|
|
|
+
|
|
|
+ // 取得liff_id
|
|
|
+ liff.init({
|
|
|
+ liffId: "1656404434-DoEqYOad"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ var context = liff.getContext();
|
|
|
+ console.log(context);
|
|
|
+
|
|
|
+ var profile = liff.getProfile();
|
|
|
+ console.log(profile);
|
|
|
+
|
|
|
+ userId = context.userId;
|
|
|
+ $('#userId').text(context.userId);
|
|
|
+
|
|
|
+ // login
|
|
|
+ if (!liff.isLoggedIn()) {
|
|
|
+ console.log("您未登入");
|
|
|
+ console.log('context.userId = ' + context.userId); // test
|
|
|
+ } else {
|
|
|
+ console.log("您已登入");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log('初始化失敗: ' + err.code + ", " + err.message);
|
|
|
+ });
|
|
|
|
|
|
- $(".nft-event").submit();
|
|
|
-});
|
|
|
+ // 點擊「同意接收」按鈕
|
|
|
+ $(".event-nft-send").click(function (e) {
|
|
|
+ alert('.event-nft-send click'); // test
|
|
|
+
|
|
|
+ var email = $('#email').val();
|
|
|
+
|
|
|
+ // Email欄位必填檢查
|
|
|
+ if (email == "") { // 未輸入Email
|
|
|
+ Swal.fire({
|
|
|
+ title: '注意!',
|
|
|
+ icon: 'error',
|
|
|
+ confirmButtonColor: '#3085d6',
|
|
|
+ html: '請先輸入Email<p><p>我們會發送合約地址至您指定的Email',
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
-// 活動頁送出
|
|
|
-$(".nft-event").submit(function (e) {
|
|
|
- alert('.nft-event submit'); // test
|
|
|
-
|
|
|
- var jsonInfo = $('.nft-event').serializeObject();
|
|
|
- var jsonString = JSON.stringify(jsonInfo);
|
|
|
- console.log(jsonString);
|
|
|
-
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- url: 'https://ark.cards:8228/event',
|
|
|
- data: jsonString,
|
|
|
- dataType: 'json',
|
|
|
- async: false,
|
|
|
- success: function (data) {
|
|
|
- console.log('送出成功: ' + JSON.stringify(data));
|
|
|
- alert("送出成功");
|
|
|
-
|
|
|
- // 呼叫fastAPI,贈送「風」通行證 + 「港記酥皇」
|
|
|
- nft_sent_message();
|
|
|
- },
|
|
|
- beforeSend: function () {
|
|
|
- console.log('beforeSend');
|
|
|
- },
|
|
|
- complete: function () {
|
|
|
- console.log('complete');
|
|
|
- },
|
|
|
- error: function (jqXHR, textStatus, errorThrown) {
|
|
|
- console.log(JSON.stringify(jqXHR));
|
|
|
- console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
|
|
|
- console.log('送出失敗: ' + jqXHR.responseText);
|
|
|
- }
|
|
|
- });
|
|
|
- return false;
|
|
|
+ nft_event();
|
|
|
+ });
|
|
|
});
|
|
|
</script>
|
|
|
</html>
|