|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- $(function () {
- $(".header_root").load("./comm/header.html");
- $(".footer_root").load("./comm/footer.html");
- $(".err_account").hide();
- $(".err_phone").hide();
- $(".err_mailbox").hide();
- //姓名
- $("#account").blur(() => {
- let name = $("#account").val();
- if (!name) {
- $(".err_account").show();
- }
- });
- $("#account").focus(() => {
- $(".err_account").hide();
- });
- //联系电话
- $("#phone").blur(() => {
- let phone = $("#phone").val();
- if (!phone) {
- $(".err_phone").show();
- }
- });
- $("#phone").focus(() => {
- $(".err_phone").hide();
- });
-
- //邮箱
- $("#mailbox").blur(() => {
- let mailbox = $("#mailbox").val();
- var filter =
- /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i;
- let blnTest = filter.test(mailbox);
- console.log(mailbox)
- if (mailbox && !blnTest) {
- $(".err_mailbox").show();
- }
- });
- $("#mailbox").focus(() => {
- $(".err_mailbox").hide();
- });
- $("#mailbox").bind("input propertychange change", function (event) {
- let mailbox = $("#mailbox").val();
- var filter =
- /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i;
- let blnTest = filter.test(mailbox);
- if (mailbox && !blnTest) {
- $(".err_mailbox").show();
- } else {
- $(".err_mailbox").hide();
- }
- });
- //提交
- var Loading = false;
-
- $(".btn").click(() => {
- if (Loading) {
- return;
- }
- let name = $("#account").val();
- if (!name) {
- $(".err_account").show();
- return;
- }
- let phone = $("#phone").val();
- if (!phone) {
- $(".err_phone").show();
- return;
- }
- var data = {
- account: $("#account").val(),
- phone: $("#phone").val(),
- mailbox: $("#mailbox").val(),
- commcomm: $("#comm").val()
- };
- Loading = true;
- //7.1.2 申请试用--添加
- $.ajax({
- type: "POST",
- url: $.baseUrl + "fc/add",
- dataType: "json",
- async: false,
- data: JSON.stringify(data),
- contentType: "application/json; charset=utf-8",
- success: function (data) {
- Loading = false;
- if (data.code === 0) {
- alert("申请成功");
- } else {
- alert(data.msg);
- }
- }
- });
- });
- });
|