ComplaintAccountLgoin.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. function Login() {
  2. var telephone = $("#telephone").val();
  3. var password = $("#password").val();
  4. if (telephone.trim() == '') {
  5. mui.toast('请输入帐户', { duration: 'long', type: 'div' });
  6. $('#telephone').focus();
  7. return;
  8. }
  9. var re = /^1\d{10}$/;
  10. if (!re.test(telephone)) {
  11. mui.toast('手机号码格式不正确,必须为11位的手机号码', { duration: 'long', type: 'div' });
  12. $('#telephone').focus();
  13. return;
  14. }
  15. if (password.trim() == '') {
  16. mui.toast('请输入密码', { duration: 'long', type: 'div' });
  17. $('#password').focus();
  18. return;
  19. }
  20. var t = mui.showLoading("登陆中..", "div");
  21. $.post("/MobileAccount/UserLogin", { "Complainttelephone": telephone, "password": password }, function (data) {
  22. mui.hideLoading(t);
  23. if (data.code == 200) {
  24. mui.showLoading("登陆成功,正在跳转..", "div");
  25. window.location = "/Complaint/NewComplaint";
  26. } else {
  27. mui.toast(data.msg, { duration: 'long', type: 'div' });
  28. }
  29. })
  30. }