2025-11-27 16:55:35 +08:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
|
<html>
|
|
|
|
|
|
<head>
|
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
|
|
|
|
|
<form class="form-horizontal" onsubmit="return false" id="form">
|
|
|
|
|
|
<fieldset>
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-md-2 control-label">用户名</label>
|
|
|
|
|
|
<div class="col-md-10">
|
|
|
|
|
|
<input class="form-control" placeholder="用户名" type="text" id="username" readonly="readonly" name="username"
|
|
|
|
|
|
data-bv-notempty="true"
|
|
|
|
|
|
data-bv-notempty-message="用户名 不能为空">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-md-2 control-label">旧密码</label>
|
|
|
|
|
|
<div class="col-md-10">
|
|
|
|
|
|
<input class="form-control" placeholder="旧密码" type="text" name="oldPassword"
|
|
|
|
|
|
data-bv-notempty="true"
|
|
|
|
|
|
data-bv-notempty-message="旧密码 不能为空">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-md-2 control-label">新密码</label>
|
|
|
|
|
|
<div class="col-md-10">
|
|
|
|
|
|
<input class="form-control" placeholder="新密码" type="text" name="newPassword" id="newPassword"
|
|
|
|
|
|
data-bv-notempty="true"
|
|
|
|
|
|
data-bv-notempty-message="新密码 不能为空"
|
2025-12-15 18:16:05 +08:00
|
|
|
|
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data-bv-identical="true"
|
|
|
|
|
|
data-bv-identical-field="newPassword2"
|
|
|
|
|
|
data-bv-identical-message="两次密码不一致">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label class="col-md-2 control-label">再次输入新密码</label>
|
|
|
|
|
|
<div class="col-md-10">
|
|
|
|
|
|
<input class="form-control" placeholder="再次输入新密码" type="text" name="newPassword2" id="newPassword2"
|
|
|
|
|
|
data-bv-notempty="true"
|
|
|
|
|
|
data-bv-notempty-message="再次输入新密码"
|
|
|
|
|
|
data-bv-identical="true"
|
|
|
|
|
|
data-bv-identical-field="newPassword"
|
|
|
|
|
|
data-bv-identical-message="两次密码不一致">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-actions">
|
|
|
|
|
|
<div class="row" align="center">
|
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
|
|
<button class="btn btn-primary" type="button" onclick="update()">
|
|
|
|
|
|
<i class="fa fa-save"></i> 保存
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</fieldset>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript" src="../../js/libs/jquery-3.7.1.min.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="../../js/jq.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="../../layui/layui.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
|
2025-12-09 18:44:29 +08:00
|
|
|
|
<script type="text/javascript" src="../../../public/public.js"></script>
|
2025-12-15 18:16:05 +08:00
|
|
|
|
<!-- <script type="text/javascript" src="../../js/publicJs.js"></script>-->
|
2025-11-27 16:55:35 +08:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
layui.use('layer', function(){
|
|
|
|
|
|
var layer = layui.layer;
|
|
|
|
|
|
init();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function init(){
|
|
|
|
|
|
console.log("init执行");
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type : 'post',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url : smz_ht_url + '/users/current',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data : $("#form").serialize(),
|
|
|
|
|
|
success : function(data) {
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
$("#username").val(data.phone);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-12-15 18:16:05 +08:00
|
|
|
|
|
2025-11-27 16:55:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
|
|
console.log("update执行");
|
|
|
|
|
|
$('#form').bootstrapValidator();
|
|
|
|
|
|
var bootstrapValidator = $("#form").data('bootstrapValidator');
|
|
|
|
|
|
let aaa = bootstrapValidator.validate();
|
|
|
|
|
|
if(!bootstrapValidator.isValid()){
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
//密码
|
|
|
|
|
|
let pattern = /^^(?![0-9]+$)(?![0-9\W]+$)(?![0-9A-Z]+$)(?![0-9a-z]+$)(?![a-z\W]+$)(?![A-Z\W]+$)[0-9A-Za-z\W]{8,16}$$/;
|
|
|
|
|
|
let password = $("#newPassword").val();
|
|
|
|
|
|
if(!pattern.test(password)) {
|
|
|
|
|
|
layer.alert("密码复杂度过低,密码需由大写字母、小写字母、数字、特殊符号,符合三种,8~16位");
|
|
|
|
|
|
return ;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type : 'put',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url : smz_ht_url + '/users/'+$("#username").val(),
|
2025-11-27 16:55:35 +08:00
|
|
|
|
data : $("#form").serialize(),
|
|
|
|
|
|
success : function(data) {
|
|
|
|
|
|
layer.msg(data.resMsg, {shift: -1, time: 1000}, function(){
|
|
|
|
|
|
// deleteCurrentTab();
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
|
logout()
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function logout(){
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type : 'get',
|
2025-12-09 18:44:29 +08:00
|
|
|
|
url : smz_ht_url + '/logout',
|
2025-11-27 16:55:35 +08:00
|
|
|
|
success : function(data) {
|
2025-12-15 18:16:05 +08:00
|
|
|
|
localStorage.removeItem("public_token");
|
|
|
|
|
|
top.location.href= contentPath + '/login.html';
|
2025-11-27 16:55:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-12-15 18:16:05 +08:00
|
|
|
|
|
2025-11-27 16:55:35 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
2025-12-15 18:16:05 +08:00
|
|
|
|
</html>
|