forgetpwd.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. function send2Server(url, phone, func) {
  2. mui.ajax(url, {
  3. data: {
  4. moblie: phone,
  5. type: 3
  6. },
  7. dataType: 'json', //服务器返回json格式数据
  8. type: 'post', //HTTP请求类型
  9. timeout: 10000, //超时时间设置为10秒;
  10. success: function(data) {
  11. var status = data.status;
  12. // if (status == 200) {
  13. // mui.openWindow({
  14. // url: "forget-2vertify.html",
  15. // id: "forget-2vertify",
  16. // waiting: {
  17. // autoShow: false
  18. // },
  19. // extras: {
  20. // mobile: phone
  21. // }
  22. // });
  23. func;
  24. // } else {
  25. mui.toast(data.msg);
  26. // }
  27. },
  28. error: function(xhr, type, errorThrown) {
  29. mui.toast(type);
  30. }
  31. });
  32. }
  33. /*
  34. * 计时
  35. */
  36. function countTime() {
  37. var timer = "";
  38. timer = setInterval(function() {
  39. time--;
  40. if (time < 10) {
  41. time = "0" + time;
  42. }
  43. var oBtn = document.getElementById("time");
  44. oBtn.innerText = time + " 秒";
  45. if (time <= 0) {
  46. clearInterval(timer);
  47. oBtn.disabled = false;
  48. oBtn.innerText = "重新发送";
  49. }
  50. }, 1000)
  51. }
  52. /*
  53. * 验证完成后,跳转
  54. */
  55. var verifiedToNext = function(phone,verify) {
  56. mui.openWindow('forget-3newpwd.html', 'forget-3newpwd', {
  57. extras: {
  58. mobile: phone,
  59. verifycode: verify
  60. }
  61. });
  62. // if (timer==null) {
  63. // clearInterval(timer);
  64. // }
  65. }
  66. function resetPwd(url, phone, verifyCode, pwd) {
  67. mui.ajax(url, {
  68. data: {
  69. type: 2,
  70. mobile: phone,
  71. captcha: verifyCode,
  72. newpwd: pwd
  73. },
  74. dataType: 'json', //服务器返回json格式数据
  75. type: 'post', //HTTP请求类型
  76. timeout: 10000, //超时时间设置为10秒;
  77. success: function(data) {
  78. // if (data.status == 200) {
  79. mui.toast(data.msg);
  80. setTimeout(function() {
  81. mui.back();
  82. }, 1500);
  83. // } else {
  84. // mui.toast(data.msg);
  85. // }
  86. },
  87. error: function(xhr, type, errorThrown) {
  88. mui.toast(err.message);
  89. }
  90. });
  91. }