PanDuWeb/userpassword.html

122 lines
4.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户管理</title>
<link rel="shortcut icon" href="favicon.ico">
<link href="css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
<link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link rel="shortcut icon" href="favicon.ico">
<link href="css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
<!-- jqgrid-->
<link href="css/plugins/blueimp/css/blueimp-gallery.min.css" rel="stylesheet">
<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<link href="css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
<link href="css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css?v=4.1.0" rel="stylesheet">
<style>
</style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox-content">
<div class="row">
<div class="col-sm-6 b-r">
<h3 class="m-t-none m-b">修改密码</h3>
<form role="form">
<div class="form-group">
<label>用户名:</label>
<span id="account"></span>
</div>
<div class="form-group">
<label>新密码</label>
<input type="password" name="password" placeholder="请输入密码" class="form-control">
</div>
<div class="form-group">
<label>确认密码</label>
<input type="password" name="repassword" placeholder="请输入密码" class="form-control">
</div>
<div>
<button class="btn btn-sm btn-primary pull-right m-t-n-xs" id="submitBtn"
type="button"><strong>确认</strong>
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 全局js -->
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.7"></script>
<link href="css/plugins/toastr/toastr.min.css" rel="stylesheet">
<!-- Peity -->
<script src="js/plugins/peity/jquery.peity.min.js"></script>
<!-- jqGrid -->
<script src="js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
<script src="js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="js/plugins/toastr/toastr.min.js"></script>
<!-- 自定义js -->
<script src="js/plugins/iCheck/icheck.min.js"></script>
<script src="js/content.js?v=1.0.0"></script>
<script src="js/request.js"></script>
<script src="js/plugins/blueimp/jquery.blueimp-gallery.min.js"></script>
<script src="js/index.js"></script>
<script>
function changePassword() {
let password = $('input[name="password"]').val()
let repassword = $('input[name="repassword"]').val()
if (password !== repassword) {
swal('密码不一致', {
icon: "error",
})
return false;
}
if (password.length < 6) {
swal('密码长度不能小于6位', {
icon: "error",
})
return false;
}
// /api/Users/ChangePassword
let data = {
account: localStorage.getItem('account'),
password: password
}
postAjaxRequst('/api/Users/ChangePassword', data, function (data) {
if (data.code == 200) {
swal({
title: "修改成功",
icon: "success",
})
} else {
swal(data.msg, {
icon: "error",
})
}
})
}
$(document).ready(function () {
let userAcccount = localStorage.getItem('account')
$('#account').text(userAcccount)
$('#submitBtn').click(function () { changePassword() })
})
</script>
</body>
</html>