message.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!DOCTYPE html>
  2. <html>
  3. <head lang="en">
  4. <include file="./Application/M/View/Common/head_include.html"/>
  5. <title>在线留言-联系我们-厦门欣富地智能科技</title>
  6. <link rel="stylesheet" type="text/css" href="/Public/static/home/m/css/join.css"/><style>
  7. *{
  8. box-sizing: border-box;
  9. }
  10. .message h3{
  11. text-align: left;
  12. margin-top: 1.04rem;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <include file="./Application/M/View/Common/head.html"/>
  18. <div class="content">
  19. <div class="col"><img src="https://img.x-motion.cn/home/m/image/join/message.jpg" /></div>
  20. <div class="message">
  21. <h3>请填写以下信息,我们将安排专业的客服与您联系</h3>
  22. <form action="javascript:void(0);" method="post">
  23. <p><label for="name">*<span>姓&emsp;&emsp;名:</span></label><input type="text" name="name" id="name" value="" placeholder="请输入您的姓名" /><span class="error"></span></p>
  24. <p><label for="tel">*<span>电&emsp;&emsp;话:</span></label><input type="text" name="tel" id="tel" value="" placeholder="请输入您的真实电话号码" /><span class="error"></span></p>
  25. <p><label for="address">*<span>地&emsp;&emsp;址:</span></label><input type="text" name="address" id="address" value="" placeholder="请输入您所在的地址" /><span class="error"></span></p>
  26. <p class="content1"><label for="message">*<span>留&emsp;&emsp;言:</span></label><textarea id="message" name="message" rows="" cols="" placeholder="您有什么想告诉我们的?"></textarea><span class="error"></span></p>
  27. <input type="submit" id="submit" value="确定" />
  28. </form>
  29. </div>
  30. <include file="./Application/M/View/Common/footer.html"/>
  31. </div>
  32. <include file="./Application/M/View/Common/footer_include.html"/>
  33. <script type="text/javascript">
  34. $(document).ready(function() {
  35. $('form input,form textarea').on('input', function(){
  36. $(this).siblings('span.error').html('');
  37. });
  38. $('#submit').on('click', function(){
  39. $("#submit").attr('disabled', true);
  40. var check_key = {
  41. name:'',
  42. tel:'',
  43. address:'',
  44. message:''
  45. };
  46. var data = {
  47. name: $('#name').val(),
  48. tel: $('#tel').val(),
  49. address: $('#address').val(),
  50. message: $('#message').val()
  51. };
  52. var status = true;
  53. if(!isPoneAvailable(data["tel"])){
  54. error = $('#tel').siblings('.error');
  55. $(error).html('号码错误');
  56. status = false;
  57. }
  58. for (var Key in check_key){
  59. if(data[Key] == ''){
  60. error = $('#' + Key).siblings('.error');
  61. $(error).html('请填写');
  62. status = false;
  63. }
  64. }
  65. if(status == false){
  66. $("#submit").removeAttr('disabled');
  67. return false;
  68. }
  69. $.ajax({
  70. type: "post",
  71. url: "{:U(CONTROLLER_NAME . '/' . ACTION_NAME)}",
  72. data: {data: data},
  73. success: function (data) {
  74. if (data.status == '1') {
  75. layer.msg('提交成功!');
  76. setTimeout( function(){
  77. window.location.href = location.href;
  78. }, 2 * 1000 );
  79. } else if (data.status == '0') {
  80. parent.layer.msg(data.info, {icon: 5});
  81. }
  82. $("#submit").removeAttr('disabled');
  83. }
  84. });
  85. });
  86. $('.message_input input').on('focus', function(){
  87. $(this).siblings('.error').html('');
  88. });
  89. $('.message_input textarea').on('focus', function(){
  90. $(this).siblings('.error').html('');
  91. });
  92. });
  93. function isPoneAvailable(phone) {
  94. var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
  95. if (!myreg.test(phone)) {
  96. return false;
  97. } else {
  98. return true;
  99. }
  100. }
  101. </script>
  102. </body>
  103. </html>