Commit a3dd67c6 by fsn

修复添加用户没有判断两次密码是否一致的bug

parent d8e23d08
......@@ -10,7 +10,7 @@ var UserInfoDlg = {
*/
UserInfoDlg.clearData = function() {
this.userInfoData = {};
}
};
/**
* 设置对话框中的数据
......@@ -21,7 +21,7 @@ UserInfoDlg.clearData = function() {
UserInfoDlg.set = function(key, val) {
this.userInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
}
};
/**
* 设置对话框中的数据
......@@ -31,14 +31,14 @@ UserInfoDlg.set = function(key, val) {
*/
UserInfoDlg.get = function(key) {
return $("#" + key).val();
}
};
/**
* 关闭此对话框
*/
UserInfoDlg.close = function() {
parent.layer.close(window.parent.MgrUser.layerIndex);
}
};
/**
* 点击部门input框时
......@@ -51,7 +51,7 @@ UserInfoDlg.close = function() {
UserInfoDlg.onClickDept = function(e, treeId, treeNode) {
$("#citySel").attr("value", instance.getSelectedVal());
$("#deptid").attr("value", treeNode.id);
}
};
/**
* 显示部门选择的树
......@@ -67,7 +67,7 @@ UserInfoDlg.showDeptSelectTree = function() {
}).slideDown("fast");
$("body").bind("mousedown", onBodyDown);
}
};
/**
* 隐藏部门选择的树
......@@ -75,7 +75,7 @@ UserInfoDlg.showDeptSelectTree = function() {
UserInfoDlg.hideDeptSelectTree = function() {
$("#menuContent").fadeOut("fast");
$("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起
}
};
/**
* 收集数据
......@@ -83,7 +83,20 @@ UserInfoDlg.hideDeptSelectTree = function() {
UserInfoDlg.collectData = function() {
this.set('id').set('account').set('sex').set('password')
.set('email').set('name').set('birthday').set('rePassword').set('deptid').set('phone');
}
};
/**
* 验证两个密码是否一致
*/
UserInfoDlg.validatePwd = function(){
var password = this.get("password");
var rePassword = this.get("rePassword");
if(password == rePassword){
return true;
}else{
return false;
}
};
/**
* 提交添加用户
......@@ -93,6 +106,11 @@ UserInfoDlg.addSubmit = function() {
this.clearData();
this.collectData();
if(!this.validatePwd()){
Feng.error("两次密码输入不一致");
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/mgr/add", function(data){
Feng.success("添加成功!");
......@@ -103,7 +121,7 @@ UserInfoDlg.addSubmit = function() {
});
ajax.set(this.userInfoData);
ajax.start();
}
};
/**
* 提交修改
......@@ -123,7 +141,7 @@ UserInfoDlg.editSubmit = function() {
});
ajax.set(this.userInfoData);
ajax.start();
}
};
function onBodyDown(event) {
if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment