commonInput.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. var laveTime=20;
  2. function getCarCylinderInfo(){
  3. var carNo = $("#carNo").textbox('getValue');
  4. var regNo = $("#regNo").textbox('getValue');
  5. if(carNo){
  6. carCylinderInfo(carNo,regNo);
  7. }else{
  8. showMsg('提示', '车牌号必填!',5*1000);
  9. }
  10. }
  11. function carCylinderInfo(carNo,regNo){
  12. showProgress('提示','请稍等','查询加载中……');
  13. $.ajax({
  14. type:"POST",
  15. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16. data:{
  17. "carNo":carNo,
  18. "regNo":regNo
  19. },
  20. url:"ajax/getCarCylinderInfo",
  21. success:function (data){
  22. $.messager.progress('close');
  23. var vData = $.parseJSON(data);
  24. if(vData.result==1){
  25. //window.open("jsp/carCylinderResult.jsp","_blank");
  26. window.location.href = 'jsp/carCylinderResult.jsp';
  27. //IE6
  28. window.event.returnValue = false;
  29. }
  30. }
  31. });
  32. }
  33. function getVCode(){
  34. var phone = $("#phone").textbox('getValue');
  35. if(phone){
  36. $("#vCode").linkbutton("disable");
  37. setInterval('setlaveTime(laveTime)',1000);
  38. $.ajax({
  39. type:"POST",
  40. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  41. data:{
  42. "phone":phone
  43. },
  44. url:"ajax/getVCode",
  45. success:function (data){
  46. $.messager.progress('close');
  47. var vData = $.parseJSON(data);
  48. showMsg('验证码', '您的验证码是:'+vData.code, 20*1000);
  49. document.getElementById("gettedCode").innerHTML="您获得的验证码是:"+vData.code;
  50. }
  51. });
  52. }else{
  53. showMsg('提示', '请输入手机号!', 5000);
  54. }
  55. }
  56. function setlaveTime(time){
  57. if(time>0){
  58. laveTime=time-1;
  59. document.getElementById("atext").innerHTML=laveTime+"秒后,可再次获取";
  60. }else{
  61. $("#vCode").linkbutton("enable");
  62. document.getElementById("atext").innerHTML="获取验证码";
  63. }
  64. }
  65. function testVCode(){
  66. if($("#codeform").form('validate')){
  67. showProgress('提示','请稍等','验证中……');
  68. $("#codeform").form("submit",{
  69. url: "ajax/testVCode",
  70. onsubmit: function () {
  71. return $(this).form("validate");
  72. },
  73. success: function (data) {
  74. $.messager.progress('close');
  75. var pData = $.parseJSON(data);
  76. switch(pData.result){
  77. case 0:{
  78. document.getElementById("errorInfo").innerHTML="验证码验证成功:跳转中……,请稍等!";
  79. showMsg('成功提示', '验证码验证成功:跳转中……,请稍等!', 2000);
  80. //window.open("jsp/peoplePage.jsp","_self");
  81. window.location.href = 'jsp/peoplePage.jsp';
  82. //IE6
  83. window.event.returnValue = false;
  84. }
  85. break;
  86. case -1:{
  87. document.getElementById("errorInfo").innerHTML="获取验证码失败:请刷新重试!";
  88. showMsg('异常提示', '获取验证码失败:请刷新重试!', 2000);
  89. }
  90. break;
  91. case -2:{
  92. document.getElementById("errorInfo").innerHTML="验证码不符:请检查验证码!";
  93. showMsg('异常提示', '验证码不符:请检查验证码!', 2000);
  94. }
  95. break;
  96. default:{
  97. document.getElementById("errorInfo").innerHTML="其他异常:请联系管理员!";
  98. showMsg('异常提示', '其他异常:请联系管理员!', 2000);
  99. };
  100. }
  101. },
  102. error:function(e){
  103. cancelAppend(index);
  104. $.messager.progress('close');
  105. console.log(e);
  106. },
  107. xhrFields: {
  108. withCredentials: true
  109. }
  110. });
  111. }else{
  112. showMsg('提示', '请输入手机号/验证码', 5000);
  113. }
  114. }