Browse Source

refactor(contact-form): 移除多余的js脚本逻辑

master
peijunlei 2 weeks ago
parent
commit
4c2a624adf
  1. 50
      public/themes/dist_static/static/js/common.js

50
public/themes/dist_static/static/js/common.js

@ -102,31 +102,31 @@ $(function() {
$item.attr("data-expanded", !isExpanded);
$(this).attr("aria-expanded", !isExpanded);
});
$(".section-contact-form").on("submit", function(e) {
e.preventDefault();
const $form = $(this);
const $name = $form.find("[name=\"name\"]");
const $phone = $form.find("[name=\"phone\"]");
const name = $.trim($name.val());
const phone = $.trim($phone.val());
const agreed = $form.find("[name=\"agree\"]").is(":checked");
if (!name) {
alert("请输入姓名");
$name.focus();
return;
}
if (!phone) {
alert("请输入联系方式");
$phone.focus();
return;
}
if (!agreed) {
alert("请阅读并同意隐私政策");
return;
}
alert("提交成功,我们将尽快与您联系");
$form[0].reset();
});
// $(".section-contact-form").on("submit", function(e) {
// e.preventDefault();
// const $form = $(this);
// const $name = $form.find("[name=\"name\"]");
// const $phone = $form.find("[name=\"phone\"]");
// const name = $.trim($name.val());
// const phone = $.trim($phone.val());
// const agreed = $form.find("[name=\"agree\"]").is(":checked");
// if (!name) {
// alert("请输入姓名");
// $name.focus();
// return;
// }
// if (!phone) {
// alert("请输入联系方式");
// $phone.focus();
// return;
// }
// if (!agreed) {
// alert("请阅读并同意隐私政策");
// return;
// }
// alert("提交成功,我们将尽快与您联系");
// $form[0].reset();
// });
$("#nav-mega-product").on("mouseenter", "[data-mega-cat]", function() {
const $mega = $("#nav-mega-product");
const cat = $(this).attr("data-mega-cat");

Loading…
Cancel
Save