星火官网,前端页面(前台)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

trial.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. $(".err_account").hide();
  2. $(".err_phone").hide();
  3. $(".err_mailbox").hide();
  4. //姓名
  5. $("#account").blur(() => {
  6. let name = $("#account").val();
  7. if (!name) {
  8. $(".err_account").show();
  9. }
  10. });
  11. $("#account").focus(() => {
  12. $(".err_account").hide();
  13. });
  14. //联系电话
  15. $("#phone").blur(() => {
  16. let phone = $("#phone").val();
  17. if (!phone) {
  18. $(".err_phone").show();
  19. }
  20. });
  21. $("#phone").focus(() => {
  22. $(".err_phone").hide();
  23. });
  24. //邮箱
  25. $("#mailbox").blur(() => {
  26. let mailbox = $("#mailbox").val();
  27. var filter =
  28. /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i;
  29. let blnTest = filter.test(mailbox);
  30. if (!blnTest) {
  31. $(".err_mailbox").show();
  32. }
  33. });
  34. $("#mailbox").focus(() => {
  35. $(".err_mailbox").hide();
  36. });
  37. $("#mailbox").bind("input propertychange change", function (event) {
  38. let mailbox = $("#mailbox").val();
  39. var filter =
  40. /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i;
  41. let blnTest = filter.test(mailbox);
  42. if (!blnTest) {
  43. $(".err_mailbox").show();
  44. } else {
  45. $(".err_mailbox").hide();
  46. }
  47. });
  48. //提交
  49. var Loading = false;
  50. $(".btn").click(() => {
  51. if (Loading) {
  52. return;
  53. }
  54. let name = $("#account").val();
  55. if (!name) {
  56. $(".err_account").show();
  57. return;
  58. }
  59. let phone = $("#phone").val();
  60. if (!phone) {
  61. $(".err_phone").show();
  62. return;
  63. }
  64. var data = {
  65. account: $("#account").val(),
  66. phone: $("#phone").val(),
  67. mailbox: $("#mailbox").val(),
  68. commcomm: $("#comm").val()
  69. };
  70. Loading = true;
  71. //7.1.2 申请试用--添加
  72. $.ajax({
  73. type: "POST",
  74. url: $.baseUrl + "fc/add",
  75. dataType: "json",
  76. async: false,
  77. data: JSON.stringify(data),
  78. contentType: "application/json; charset=utf-8",
  79. success: function (data) {
  80. Loading = false;
  81. if (data.code === 0) {
  82. alert("申请成功");
  83. } else {
  84. alert(data.msg);
  85. }
  86. }
  87. });
  88. });