var toast = new auiToast();

function login() {
  var account = document.getElementById("login_account").value;
  var password = document.getElementById("login_password").value;

  if (!account) {
	toast.fail({
		title:"请输入手机号",
		duration:2000
	});
    return;
  }
  if (account.length < 6) {
	toast.fail({
		title:"手机号长度不得少于6位",
		duration:2000
	});
    return;
  }
  if (!password) {
	toast.fail({
		title:"请输入密码",
		duration:2000
	});
    return;
  }
	
  var str = "phone=" + account + "&password=" + password;//hex_md5(password);

  shoeWatingLoad();
  $.ajax({
    type: "POST",
    url: "../FrontCommon/login",
    data: str,
    async: true,
    success: function(json) {
      CloseWatingLoad();
      console.log(json);
      if (json.status == 2001) {
        //需要登录
        top.location.href = "login.html";
        return;
      } else if (json.status == 1) {
        //显示的状态名称
        test("index.html");
      } else {
        toast.fail({
          title:json.msg,
          duration:2000
        });
      }
    }
  });
  return false;
}

