10 changed files with 178 additions and 59 deletions
@ -0,0 +1,85 @@ |
|||
var EditPasswordDialog = function (parent) { |
|||
this.Parent = parent; |
|||
this.User = {}; |
|||
|
|||
this.Setup = function () { |
|||
$("#edit-password-sure-btn").on("click", this.OnSureButtonClick.bind(this)); |
|||
$("#edit-password-cancel-btn").on("click", this.HideDialog.bind(this)); |
|||
$("#edit-password-close").on("click", this.HideDialog.bind(this)); |
|||
}; |
|||
|
|||
this.Show = function (data) { |
|||
this.User = data; |
|||
this.InitOrgList(); |
|||
$('#edit-password-dialog').show(); |
|||
$("#username").textbox('setValue', data.RealName); |
|||
$("#account").textbox('setValue', data.LoginName); |
|||
//$("#password").textbox('setValue', data.LoginPassword);
|
|||
parseInt($('#sex span').eq(0).attr('gender')) === data.Gender ? $('#sex span').eq(0).addClass('active') : $('#sex span').eq(0).removeClass('active'); |
|||
parseInt($('#sex span').eq(1).attr('gender')) === data.Gender ? $('#sex span').eq(1).addClass('active') : $('#sex span').eq(1).removeClass('active'); |
|||
}; |
|||
|
|||
this.InitOrgList = function () { |
|||
$.ajax({ |
|||
type: "POST", |
|||
dataType: 'text', |
|||
url: '/OrgManagement/Query', |
|||
data: { |
|||
page: 1, |
|||
rows: 10000 |
|||
}, |
|||
success: function (result) { |
|||
console.log(this.User.OrgId) |
|||
}.bind(this) |
|||
}); |
|||
}; |
|||
|
|||
this.OnSureButtonClick = function () { |
|||
this.validation(); |
|||
}; |
|||
|
|||
this.validation = function () { |
|||
if ($("#password").textbox('getValue').trim() === '' || $("#password").textbox('getValue').trim === null) { |
|||
alert('请输入新密码'); |
|||
return |
|||
} else if ($("#confirm-password").textbox('getValue').trim() === '' || $("#confirm-password").textbox('getValue').trim === null) { |
|||
alert('请输入确认密码'); |
|||
return |
|||
} else if ($("#password").textbox('getValue') !== $("#confirm-password").textbox('getValue')) { |
|||
alert('两次输入的密码不一致'); |
|||
return; |
|||
} else { |
|||
//this.User.OrgId = $('#edit-dialog-org-list').combobox('getValue');
|
|||
//this.User.Gender = parseInt($('#sex span.active').attr('gender'));
|
|||
//this.User.RealName = $("#username").textbox('getValue');
|
|||
//this.User.LoginName = $('#account').textbox('getValue');
|
|||
//this.User.LoginPassword = $('#password').textbox('getValue');
|
|||
|
|||
this.EditUser(); |
|||
this.HideDialog(); |
|||
} |
|||
}; |
|||
|
|||
this.HideDialog = function () { |
|||
$('#edit-password-dialog').hide(); |
|||
|
|||
this.clearInput(); |
|||
}; |
|||
|
|||
this.EditUser = function () { |
|||
$.ajax({ |
|||
type: "POST", |
|||
dataType: 'text', |
|||
url: '/UserManagement/Update', |
|||
data: this.User, |
|||
success: function () { |
|||
this.Parent.ReLoadTableData($('#org-list').combobox('getValue')); |
|||
}.bind(this) |
|||
}); |
|||
}; |
|||
|
|||
this.clearInput = function () { |
|||
$('#password').textbox('setValue', ''), |
|||
$('#confirm-password').textbox('setValue', '') |
|||
}; |
|||
}; |
@ -0,0 +1,30 @@ |
|||
<div class="dialog manage-dialog" id="edit-password-dialog"> |
|||
<div class="modal-dialog user-dialog"> |
|||
<form class="form"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h4 class="modal-title">修改密码</h4> |
|||
<span class="close" id="edit-password-close"><img src="~/Content/images/close-dialog.png" /></span> |
|||
</div> |
|||
|
|||
<div class="modal-body"> |
|||
<div class="row"> |
|||
<div class="col"> |
|||
<label>新密码 <span class="star">*</span></label> |
|||
<input id="password" class="easyui-passwordbox" prompt="密码长度至少为6位" /> |
|||
</div> |
|||
<div class="col"> |
|||
<label>确认密码 <span class="star">*</span></label> |
|||
<input id="confirm-password" class="easyui-passwordbox" prompt="密码长度至少为6位" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="modal-footer"> |
|||
<button type="button" class="btn sure-btn" id="edit-password-sure-btn">确定</button> |
|||
<button type="button" class="btn cancel-btn" id="edit-password-cancel-btn">取消</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
Loading…
Reference in new issue