$("#login_submit").on("click", function(){
  var username = $("#login_form").find("input[name='username']");
  var password = $("#login_form").find("input[name='password']");
  var verifycode = $("#login_form").find("input[name='verifycode']");
  if($(username).val()==""){
    $.toast("请填写用户名");
    return false;
  }
  if($(password).val()==""){
    $.toast("请填写密码");
    return false;
  }
  if($(verifycode).val()==""){
    $.toast("请填写验证码");
    return false;
  }
  $.ajax({
    url: '/login/loginok', 
    type: 'POST',
    dataType: "json", 
    data: $("#login_form").serialize(),
    beforeSend: function(){
      $.showIndicator();
    },
    success: function(data){
      if(data.code=="success"){
        $.toast("登录成功");
        setTimeout(function(){top.location = "/yidong/default/index";}, 2000);
      }else{
        $.toast(data.msg);
      }
    },
    error: function(){
      $.toast("系统错误，请联系管理员");
    },
    complete: function(){
      $.hideIndicator();
    }
  });
  return false;
});