Ext.BLANK_IMAGE_URL = 'js/extjs/resources/images/default/s.gif';
var registerWin = null;
$(function(){
document.onkeydown = function(e){
var ev = document.all ? window.event : e;
if(ev.keyCode==13) {
$("#loginbtn2").click();//处理事件
}
}
});
function init() {
//判断cookie中是否存在radio的值
// var radioValue = getCookie("wingsoft_radio_value");
// if(radioValue.trim()!=""){
// document.getElementById(radioValue).checked="checked";
// }else{
// document.getElementById("userid").checked="checked";
// }
//系统正常登陆
$("#loginbtn2").click(function(){
// var radiobutton = $('input[name="radiobutton"]:checked').val();
var uid = $("#uid").val();
var pwd = $("#pwd").val();
var chkcode = $("#chkcode").val();
var dialogW=400,dialogH=240,cellW=80;
/* if ($.browser.msie){
cellW=120;
dialogW=440;
dialogH=350;
} */
if(uid == ""){
$("#msg").show();
$("#msg").html("用户号输入不正确!");
//alert("用户名输入不正确!");
changeRandom();
return
}
if(pwd == ""){
$("#msg").show();
$("#msg").html("密码输入不正确!");
//alert("用户名输入不正确!");
changeRandom();
return
}
if(chkcode==""||chkcode.length!=4){
$("#msg").show();
$("#msg").html("验证码输入不正确!");
changeRandom();
//alert("用户名输入不正确!");
return
}
if( (uid != "") && (pwd != "") && (chkcode != "") ){
$("#loginbtn2").hide();
$.ajax({
type:"POST",
url:"loginnewAction.action",
data:{uid:uid,pwd:digest(pwd+chkcode),chkcode:chkcode},
dataType:"text",
success:function(data,textStatus){
if(data=="ok"){
//$("#loading").hide();
$("#loginbtn2").show();
$("#msg").show();
$("#msg").css({fontSize:"12px",color:"#76EE00"}).html("登录成功!");
// $("#msg").css({fontSize:"12px",color:"#76EE00"}).html("系统正在升级!");
window.location.href = "./pay/payment.jsp";
/* $("#loginbtn2").hide("puff",{},1500,function(){
if($.browser.msie){
window.location.href = "./pay/payment.jsp";
}else if($.browser.mozilla){//firefox
window.location.href="./pay/payment.jsp";
}else if($.browser.opera){
alert("opera")
}else if($.browser.safari){//chrome
window.location.href="./pay/payment.jsp";
}
}); */
}else if(data=="needcheckmobile"){
if($("#mobilecheck")){
$("#mobilecheck").dialog('destroy');
}
$mobilecheck = $("
");
$("body").append($mobilecheck);
var $btn=$(".btPhoneCheck");
var intPhone=setInterval(function(){
var mobileno = $("#mobileno").val().trim();
if (mobileno.length==11){
$btn.addClass("ui-state-active");
$btn.css("cursor","hand");
$btn.attr("disabled","");
}else{
$btn.removeClass("ui-state-active");
$btn.css("cursor","");
$btn.attr("disabled","disabled");
}
},100);
$(".btPhoneCheck").hover(
function(){$(this).addClass("ui-state-hover")},
function(){$(this).removeClass("ui-state-hover ")})
.click(function(){
var mobileno = $("#mobileno").val();
if(mobileno.trim()==""){
alert("手机号不能为空!");
} else {
if(mobileno.trim().length!=11){
alert("请输入11位手机号!");
} else {
$.ajax({
type:"POST",
url:"checkMobileAction_sendMobileCode.action",
data:{uid:uid,mobileno:mobileno},
dataType:"text",
success:function(data,textStatus){
if(data=="ok"){
alert('验证码已发送!请检查手机短信!');
}else if(data == "unvalid"){
alert('该手机号码已存在!');
}
else{
alert('发送验证码失败!');
}
}
});
//按钮disable
clearInterval(intPhone);
$btn.removeClass("ui-state-active").removeClass("ui-state-hover");
$btn.css("cursor","");
$btn.attr("disabled","disabled");
$(".ui-dialog-buttonpane button:eq(0)").attr("disabled","disabled");
var waitSecs=60;
var intBtn=setInterval(function(){
$btn.text("请等待"+(waitSecs--)+"秒");
if (waitSecs==0){
clearInterval(intBtn);
//1.返回按钮先亮
$(".ui-dialog-buttonpane button").attr("disabled","");
$btn.addClass("ui-state-active");
$btn.css("cursor","hand");
$btn.attr("disabled","");
$btn.text("获取验证码");
//2.原来的按钮继续
intPhone=setInterval(function(){
var mobileno = $("#mobileno").val().trim();
var $btn=$(".btPhoneCheck");
if (mobileno.length==11){
$btn.addClass("ui-state-active");
$btn.css("cursor","hand");
$btn.attr("disabled","");
}else{
$btn.removeClass("ui-state-active");
$btn.css("cursor","");
$btn.attr("disabled","disabled");
}
});
}
},1000)
}
}
});
$mobilecheck.dialog({
bgiframe: false,
modal: true,
resizable: false,
zIndex:10001,
height:dialogH,
width:dialogW,
title:'《缴费平台》手机验证',
buttons: {
"取消": function() {
$(this).dialog('destroy');
$(this).remove();
$("#loginbtn2").show();
},
"确定":function(){
var mobilecheckcode = $("#mobilecheckcode").val();
$.ajax({
type:"POST",
url:"checkMobileAction_checkMobileCode.action",
data:{uid:uid,mobilechkcode:mobilecheckcode},
dataType:"text",
success:function(data,textStatus){
if(data=="ok"){
//$("#loginbtn2").click();
window.location.href = "./pay/payment.jsp";
//window.location.href = "waiting.html";
}else{
if(data == "error"){
alert("手机验证码输入不正确!");
}else {
alert(data);
}
$("#loginbtn2").show();
}
}
});
$(this).dialog('destroy');
$(this).remove();
}
}
});
}else{
changeRandom();
if(data == "chkcodeerror"){
//reloadCheckcode();
$("#msg").show();
$("#msg").html("验证码输入不正确!");
}else if(data=="uierror"){
//reloadCheckcode();
$("#msg").show();
$("#msg").html("用户名或密码不正确!");
}else if(data=="uierrors"){
//reloadCheckcode();
$("#msg").show();
$("#msg").html("该用户信息重复,请确认后重新登录!");
}else if(data=="overtimes"){
//reloadCheckcode();
$("#msg").show();
$("#msg").html("登录超过5次,请10分钟后再试");
}else {
//reloadCheckcode();
alert(data);
}
//$("#loading").hide();
$("#loginbtn2").show();
}
}
});
}
})
//统一身份认证登陆
$("#loginbtn3").click(function(){
var uid2 = $("#uid2").val();
var pwd2 = $("#pwd2").val();
var chkcode2 = $("#chkcode2").val();
var dialogW=400,dialogH=240,cellW=80;
/* if ($.browser.msie){
cellW=120;
dialogW=440;
dialogH=350;
} */
if(uid2 == ""){
$("#msg2").show();
$("#msg2").html("用户号输入不正确!");
//alert("用户名输入不正确!");
changeRandom();
return
}
if(pwd2 == ""){
$("#msg2").show();
$("#msg2").html("密码输入不正确!");
//alert("用户名输入不正确!");
changeRandom();
return
}
if(chkcode2 == ""|| chkcode2.length!=4){
$("#msg2").show();
$("#msg2").html("验证码输入不正确!");
//alert("用户名输入不正确!");
changeRandom();
return
}
if( (uid2 != "") && (pwd2 != "") && (chkcode2 != "") ){
$.ajax({
type:"POST",
url:"loginnewAction2.action",
data:{uid:uid2,pwd:pwd2,chkcode:chkcode2},
dataType:"text",
success:function(data,textStatus){
if(data=="ok"){
$("#msg2").show();
$("#msg2").css({fontSize:"12px",color:"#76EE00"}).html("登录成功!");
window.location.href = "./pay/payment.jsp";
}else{
changeRandom();
if(data == "chkcodeerror"){
//reloadCheckcode();
$("#msg2").show();
$("#msg2").html("验证码输入不正确!");
}else if(data=="useriderror"){
//reloadCheckcode();
$("#msg2").show();
$("#msg2").html("用户不存在!");
}else if(data=="useriderror"){
//reloadCheckcode();
$("#msg2").show();
$("#msg2").html("内部错误!");
}else if(data=="loginerror"){
//reloadCheckcode();
$("#msg2").show();
$("#msg2").html("登陆失败,用户名或密码错误!");
}else {
alert(data);
}
}
}
});
}
})
}
function setCookie(cookie_name,cookie_value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=cookie_name + "=" + cookie_value + ((expiredays==null) ? "" : "; expires="+exdate.toGMTString());
}
function getCookie(cookie_name){
var strCookie=document.cookie;
var arrCookie=strCookie.split(";");
var resultValue = "";
for(var i=0;i