Commit a3dd67c6 by fsn

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

parent d8e23d08
...@@ -10,7 +10,7 @@ var UserInfoDlg = { ...@@ -10,7 +10,7 @@ var UserInfoDlg = {
*/ */
UserInfoDlg.clearData = function() { UserInfoDlg.clearData = function() {
this.userInfoData = {}; this.userInfoData = {};
} };
/** /**
* 设置对话框中的数据 * 设置对话框中的数据
...@@ -21,7 +21,7 @@ UserInfoDlg.clearData = function() { ...@@ -21,7 +21,7 @@ UserInfoDlg.clearData = function() {
UserInfoDlg.set = function(key, val) { UserInfoDlg.set = function(key, val) {
this.userInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value; this.userInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this; return this;
} };
/** /**
* 设置对话框中的数据 * 设置对话框中的数据
...@@ -31,14 +31,14 @@ UserInfoDlg.set = function(key, val) { ...@@ -31,14 +31,14 @@ UserInfoDlg.set = function(key, val) {
*/ */
UserInfoDlg.get = function(key) { UserInfoDlg.get = function(key) {
return $("#" + key).val(); return $("#" + key).val();
} };
/** /**
* 关闭此对话框 * 关闭此对话框
*/ */
UserInfoDlg.close = function() { UserInfoDlg.close = function() {
parent.layer.close(window.parent.MgrUser.layerIndex); parent.layer.close(window.parent.MgrUser.layerIndex);
} };
/** /**
* 点击部门input框时 * 点击部门input框时
...@@ -51,7 +51,7 @@ UserInfoDlg.close = function() { ...@@ -51,7 +51,7 @@ UserInfoDlg.close = function() {
UserInfoDlg.onClickDept = function(e, treeId, treeNode) { UserInfoDlg.onClickDept = function(e, treeId, treeNode) {
$("#citySel").attr("value", instance.getSelectedVal()); $("#citySel").attr("value", instance.getSelectedVal());
$("#deptid").attr("value", treeNode.id); $("#deptid").attr("value", treeNode.id);
} };
/** /**
* 显示部门选择的树 * 显示部门选择的树
...@@ -67,7 +67,7 @@ UserInfoDlg.showDeptSelectTree = function() { ...@@ -67,7 +67,7 @@ UserInfoDlg.showDeptSelectTree = function() {
}).slideDown("fast"); }).slideDown("fast");
$("body").bind("mousedown", onBodyDown); $("body").bind("mousedown", onBodyDown);
} };
/** /**
* 隐藏部门选择的树 * 隐藏部门选择的树
...@@ -75,7 +75,7 @@ UserInfoDlg.showDeptSelectTree = function() { ...@@ -75,7 +75,7 @@ UserInfoDlg.showDeptSelectTree = function() {
UserInfoDlg.hideDeptSelectTree = function() { UserInfoDlg.hideDeptSelectTree = function() {
$("#menuContent").fadeOut("fast"); $("#menuContent").fadeOut("fast");
$("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起 $("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起
} };
/** /**
* 收集数据 * 收集数据
...@@ -83,7 +83,20 @@ UserInfoDlg.hideDeptSelectTree = function() { ...@@ -83,7 +83,20 @@ UserInfoDlg.hideDeptSelectTree = function() {
UserInfoDlg.collectData = function() { UserInfoDlg.collectData = function() {
this.set('id').set('account').set('sex').set('password') this.set('id').set('account').set('sex').set('password')
.set('email').set('name').set('birthday').set('rePassword').set('deptid').set('phone'); .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;
}
};
/** /**
* 提交添加用户 * 提交添加用户
...@@ -92,6 +105,11 @@ UserInfoDlg.addSubmit = function() { ...@@ -92,6 +105,11 @@ UserInfoDlg.addSubmit = function() {
this.clearData(); this.clearData();
this.collectData(); this.collectData();
if(!this.validatePwd()){
Feng.error("两次密码输入不一致");
return;
}
//提交信息 //提交信息
var ajax = new $ax(Feng.ctxPath + "/mgr/add", function(data){ var ajax = new $ax(Feng.ctxPath + "/mgr/add", function(data){
...@@ -103,7 +121,7 @@ UserInfoDlg.addSubmit = function() { ...@@ -103,7 +121,7 @@ UserInfoDlg.addSubmit = function() {
}); });
ajax.set(this.userInfoData); ajax.set(this.userInfoData);
ajax.start(); ajax.start();
} };
/** /**
* 提交修改 * 提交修改
...@@ -123,7 +141,7 @@ UserInfoDlg.editSubmit = function() { ...@@ -123,7 +141,7 @@ UserInfoDlg.editSubmit = function() {
}); });
ajax.set(this.userInfoData); ajax.set(this.userInfoData);
ajax.start(); ajax.start();
} };
function onBodyDown(event) { function onBodyDown(event) {
if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $( 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