瀏覽代碼

更新表單欄位

SyuanYu 1 年之前
父節點
當前提交
defeceefd2
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      layouts/shortcodes/form.html

+ 9 - 1
layouts/shortcodes/form.html

@@ -203,6 +203,13 @@
     let budget = document.querySelector('#budgetValue').value; // 預算限制
     let date = document.querySelector('#dateValue').value; // 預計活動需求日
     let agree; // 搜集資料
+    let time; // 填單時間
+
+    // 取得當下時間
+    const now = new Date();
+    const options = { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' };
+    time = now.toLocaleString('zh-TW', options);
+    console.log('time', time);
 
     if (document.querySelector('input[id="agreeValue"]:checked')) {
       agree = "同意";
@@ -235,7 +242,8 @@
         "caption": caption,
         "budget": budget,
         "date": date,
-        "agree": agree
+        "agree": agree,
+        "time": time
       },
       success: function (response) {
         if (response == "成功") {