Commit ce5dc8a1 by fengshuonan

修改密码页面重构

parent da03709b
......@@ -35,8 +35,8 @@
</nav>
</div>
<div class="sidebar-footer">
<a href="" class="link" data-toggle="tooltip" title="编辑资料"><i class="mdi mdi-account"></i></a>
<a href="" class="link" data-toggle="tooltip" title="修改密码"><i class="ti-settings"></i></a>
<a href="${ctxPath}/mgr/user_info" class="link" data-toggle="tooltip" title="编辑资料"><i class="mdi mdi-account"></i></a>
<a href="${ctxPath}/mgr/user_chpwd" class="link" data-toggle="tooltip" title="修改密码"><i class="ti-settings"></i></a>
<a href="${ctxPath}/logout" class="link" data-toggle="tooltip" title="退出登录"><i class="mdi mdi-power"></i></a>
</div>
</aside>
......@@ -54,13 +54,13 @@
<div class="u-img"><img src="${avatar}" alt="user"></div>
<div class="u-text">
<h4>${name!}</h4>
<p class="text-muted">${email!}</p><a href="profile.html" class="btn btn-rounded btn-danger btn-sm">个人信息</a></div>
<p class="text-muted">${email!}</p><a href="${ctxPath}/mgr/user_info" class="btn btn-rounded btn-danger btn-sm">个人信息</a></div>
</div>
</li>
<li role="separator" class="divider"></li>
<li><a href="#"><i class="ti-user"></i> 编辑资料</a></li>
<li><a href="${ctxPath}/mgr/user_info"><i class="ti-user"></i> 编辑资料</a></li>
<li role="separator" class="divider"></li>
<li><a href="#"><i class="ti-settings"></i> 修改密码</a></li>
<li><a href="${ctxPath}/mgr/user_chpwd"><i class="ti-settings"></i> 修改密码</a></li>
<li role="separator" class="divider"></li>
<li><a href="#"><i class="fa fa-power-off"></i> 退出</a></li>
</ul>
......
@layout("/common/_container.html",{plugins:["sweet-alert"],js:["/assets/modular/system/user/user_chpwd.js"]}){
<div class="col-sm-4 col-sm-offset-4">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>修改密码</h5>
</div>
<div class="ibox-content">
<div class="row row-lg">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content" style="border:none !important; ">
<div class="form-horizontal">
<div class="row">
<div class="col-sm-12">
<#input id="oldPwd" name="原密码" underline="true" type="password"/>
<#input id="newPwd" name="新密码" underline="true" type="password"/>
<#input id="rePwd" name="新密码验证" type="password"/>
<div class="row">
<div class="col-lg-12">
<div class="card card-outline-info">
<div class="card-header">
<h4 class="m-b-0 text-white">修改密码</h4>
</div>
<div class="card-block" style="padding: 100px;">
<div class="form-horizontal" id="passwordForm">
<div class="form-body">
<div class="row">
<div class="col-md-12">
<div class="form-group row m-b-15">
<label class="control-label text-left col-md-2 col-sm-5">旧密码</label>
<div class="col-md-10 col-sm-7">
<input type="password" v-model="oldPassword" class="form-control" autocomplete="false">
</div>
</div>
<div class="form-group row m-b-15">
<label class="control-label text-left col-md-2 col-sm-5">新密码</label>
<div class="col-md-10 col-sm-7">
<input type="password" v-model="newPassword" class="form-control" autocomplete="false">
</div>
</div>
<div class="row btn-group-m-t">
<div class="col-sm-10">
<#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.chPwd()"/>
<div class="form-group row m-b-5">
<label class="control-label text-left col-md-2 col-sm-5">确认新密码</label>
<div class="col-md-10 col-sm-7">
<input type="password" v-model="repeatPassword" class="form-control" autocomplete="false">
</div>
</div>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-12">
<button class="btn btn-info" type="button" id="saveButton" \@click="ensure">
<i class="ace-icon fa fa-check"></i> 保存
</button>
<button class="btn btn-danger m-l-10" type="button" id="closeButton" \@clic="reset">
<i class="ace-icon fa fa-close"></i> 关闭
</button>
</div>
</div>
</div>
</div>
</div>
......
......@@ -13,7 +13,7 @@ var MgrUser = {
* 初始化表格的列
*/
MgrUser.initColumn = function () {
var columns = [
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '账号', field: 'account', align: 'center', valign: 'middle', sortable: true},
......@@ -25,7 +25,6 @@ MgrUser.initColumn = function () {
{title: '电话', field: 'phone', align: 'center', valign: 'middle', sortable: true},
{title: '创建时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true},
{title: '状态', field: 'statusName', align: 'center', valign: 'middle', sortable: true}];
return columns;
};
/**
......
/**
* 用户详情对话框(可用于添加和修改对话框)
*/
var UserInfoDlg = {
var UserPwdPage = {
data: {
id: "",
account: "",
sex: "",
password: "",
rePassword: "",
avatar: "",
email: "",
name: "",
birthday: "",
deptid: "",
deptName: "",
phone: ""
oldPassword: "",
newPassword: "",
repeatPassword: ""
}
};
/**
* 关闭此对话
* 重置输入
*/
UserInfoDlg.close = function () {
parent.layer.close(window.parent.MgrUser.layerIndex);
UserPwdPage.reset = function () {
UserPwdPage.data.oldPassword = "";
UserPwdPage.data.newPassword = "";
UserPwdPage.data.repeatPassword = "";
};
/**
* 验证表单
*/
UserInfoDlg.validateForm = function () {
UserPwdPage.validateForm = function () {
var data = UserInfoDlg.data;
var data = UserPwdPage.data;
if (data.account && data.password && data.name && data.deptid) {
if (data.oldPassword && data.newPassword && data.repeatPassword) {
return true;
}
if (!data.account) {
return "请输入账号";
if (!data.oldPassword) {
return "请输入旧密码";
}
if (!(data.password === data.rePassword)) {
return "两次密码输入不一致";
}
if (!data.name) {
return "请输入姓名";
if (!data.newPassword) {
return "请输入新密码";
}
if (!data.deptid) {
return "请选择部门";
if (!(data.newPassword === data.repeatPassword)) {
return "两次密码输入不一致";
}
};
/**
* 修改密码
*/
UserInfoDlg.chPwd = function () {
UserPwdPage.chPwd = function () {
var ajax = new $ax(Feng.ctxPath + "/mgr/changePwd", function (data) {
Feng.success("修改成功!");
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set("oldPwd");
ajax.set("newPwd");
ajax.set("rePwd");
ajax.setData(UserPwdPage.data);
ajax.start();
};
$(function () {
UserInfoDlg.app = new Vue({
el: '#userForm',
data: UserInfoDlg.data,
UserPwdPage.app = new Vue({
el: '#passwordForm',
data: UserPwdPage.data,
methods: {
submitForm: function (e) {
var result = UserInfoDlg.validateForm();
if (result === true) {
UserInfoDlg.addSubmit();
} else {
Feng.alert(result);
e.preventDefault();
}
ensure: function () {
UserPwdPage.chPwd();
},
showDeptSelectTree: function () {
var formName = encodeURIComponent("parent.UserInfoDlg.app.deptName");
var formId = encodeURIComponent("parent.UserInfoDlg.app.deptid");
var treeUrl = encodeURIComponent(Feng.ctxPath + "/dept/tree");
layer.open({
type: 2,
title: '部门选择',
area: ['300px', '400px'],
content: Feng.ctxPath + '/system/commonTree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl
});
reset: function () {
UserPwdPage.reset();
}
}
});
......
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