loginuser.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {include file="../application/h5/view/wx_book_dinner/header.html"}
  2. <style>
  3. .weui_btn_primary{
  4. background-color: #6eb7ff;
  5. }
  6. .weui-vcode-btn {
  7. color: #6eb7ff;
  8. }
  9. </style>
  10. <div class="weui-header bg-blue">
  11. <div class="weui-header-left">
  12. </div>
  13. <h1 class="weui-header-title">登陆</h1>
  14. <div class="weui-header-right"></div>
  15. </div>
  16. <form action="loginuser" class="ajax-form" method="post">
  17. <div class="weui_cells weui_cells_form">
  18. <div class="weui_cell">
  19. <div class="weui_cell_hd">
  20. <label class="weui_label">手机号</label>
  21. </div>
  22. <div class="weui_cell_bd">
  23. <input class="weui_input" placeholder="请输入手机号" type="tel" name="TEL">
  24. </div>
  25. </div>
  26. <div class="weui_cell weui_vcode">
  27. <div class="weui_cell_hd"><label class="weui_label">验证码</label></div>
  28. <div class="weui_cell_bd weui_cell_primary">
  29. <input class="weui_input" placeholder="验证码" type="number" name="VCODE">
  30. </div>
  31. <div class="weui_cell_ft">
  32. <a href="javascript:;" class="weui-vcode-btn" onclick="settime(this);return false;">获取验证码</a>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="weui_btn_area">
  37. <button type="button" href="javascript:" class="weui_btn weui_btn_primary">确定</button>
  38. </div>
  39. </form>
  40. <div style="height: 30px;"></div>
  41. <script type="text/javascript">
  42. var countdown = 60;
  43. function settime(obj) {
  44. var code = $(obj);
  45. if (countdown == 0) {
  46. code.removeAttr('disabled');
  47. code.text("获取验证码");
  48. countdown = 60;
  49. return;
  50. } else {
  51. if(countdown==60){
  52. var mobile = $('input[name="TEL"]').val();
  53. if(mobile == undefined||mobile==''){
  54. $.toast('手机号不能为空', "cancel");
  55. return;
  56. }
  57. var url = 'sms?tel='+mobile;
  58. get_data(url,function(result){
  59. if(result.code ==1){
  60. $.toast(result.message,"cancel");
  61. countdown = 0;
  62. return;
  63. }
  64. });
  65. }
  66. }
  67. code.attr('disabled', true);
  68. countdown--;
  69. code.text("重新发送(" + countdown + ")");
  70. setTimeout(function() { settime(obj) }, 1000);
  71. }
  72. $('.weui_btn').click(function () {
  73. $.post('loginuser',$('.ajax-form').serialize(),function (result) {
  74. if(result.code ==1){
  75. $.toptips(result.message,'warning');
  76. }else{
  77. window.location.href = 'order';
  78. }
  79. },'json')
  80. })
  81. </script>