fix: 新增修改密码操作,修复系统字典报错问题!

pull/166/head
Brian Lee 10 months ago
parent ffe46fe494
commit 46325595bf

@ -78,9 +78,52 @@
<!-- End Panel Other -->
</div>
<div id="updatePasswordModal" class="modal fade" tabindex="-1" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">修改密码</h4>
</div>
<div class="modal-body" style=" padding: 15px 50px; ">
<form name="userform" method="post" id="userform" class="form-horizontal">
<div class="row">
<div class="col-sm-12">
<div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">* 密码:</label>
<div class="col-sm-9">
<input name="password" id="password" placeholder="密码" class="form-control" type="password" maxlength="30" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">* 确认密码:</label>
<div class="col-sm-9">
<input name="confirm_password" id="confirm_password" placeholder="确认密码" class="form-control" type="password" maxlength="30" required>
<input name="update_user_id" id="update_user_id" placeholder="确认密码" class="form-control" type="password" maxlength="30" required style="display:none">
</div>
</div>
</div>
</div>
</div>
</form>
<!-- <ul id="departZtreeUl" class="ztree"></ul>-->
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-white">取消</button>
<button type="button" onclick="closeUpdatePassword()" class="btn btn-primary">确认</button>
</div>
</div>
</div>
</div>
<#include "/head/footlist.html" />
<script >
var _userlisttable;
$(function(){
@ -171,6 +214,10 @@
$(jspOperation).each(function (i, toolbar) {
listOperation = listOperation + "<a href=\"javascript:" + toolbar.actionmethod + "('${resourceid}','" + oData.id + "');\" class=\"btn " + toolbar.img + " btn-xs\")><i class=\"fa " + toolbar.methodkey + "\"></i> " + toolbar.text + " </a>&nbsp;&nbsp;";
});
//修改密码
listOperation = listOperation+ "<a href=\"javascript: updatePasswordShow('${resourceid}','" + oData.id + "');\" class=\"btn " + "btn-primary" + " btn-xs\")><i class=\"fa fa-pencil \"></i> 修改密码 </a>";
return [listOperation].join('&nbsp;&nbsp;');
}
}
@ -348,6 +395,63 @@
function refreshTable(){
_userlisttable.bootstrapTable('refreshOptions',{pageNumber:1});
}
var $updatePasswordModal = $('#updatePasswordModal');
function updatePasswordShow(sourceid,userid){
$updatePasswordModal.modal();
$updatePasswordModal.css("z-index",(parent.getMaxZIndex() + 1));
$('#update_user_id').val(userid);
}
function closeUpdatePassword(){
// alert("aaa");
var password = $('#password').val();
var confirm_password = $('#confirm_password').val();
var userId= $('#update_user_id').val();
console.info(password);
console.info(confirm_password);
if (userId === undefined || userId ===""){
swal("无法获取修改用户!", "", "error");
return;
}
if (password === undefined || password ===""){
swal("请输入密码!", "", "warning");
return;
}
if (password.len < 6){
swal("密码不能低于6位数字或字母", "", "warning");
}
if (confirm_password === undefined || confirm_password ===""){
swal("请输入确认密码!", "", "warning");
return;
}
if (confirm_password !== password){
swal("确认密码与密码不符!", "", "warning");
return;
}
parent.layer.load();
parent.axgetXiaoyao('${ctx}/backstage/admin/user/editUserPassword', {userid:userId,password},false, function(data){
parent.layer.closeAll('loading');
if(data.code == "OK"){
swal(data.message, "密码修改成功。", "success");
$updatePasswordModal.modal('hide');
}else{
swal(data.message, "遇到未知错误!", "error");
}
});
}
</script>

@ -466,6 +466,26 @@ public class UserController extends BaseController{
return ResultVoUtil.error();
}
}
/**
* 123456
* @param request
* @param userid
* @return
*/
@GetMapping("/editUserPassword")
public @ResponseBody ResultVo editUserPassword(HttpServletRequest request,@RequestParam("userid") Long userid,@RequestParam("password") String password){
int isok = this.userService.editUserPasswordAdmin(userid,password);
if(isok > 0){
return ResultVoUtil.success();
}else {
return ResultVoUtil.error();
}
}
/**
*

@ -221,4 +221,6 @@ public interface UserService extends BaseService<User> {
* @return
*/
public boolean enabledInvertUser(Long userid);
int editUserPasswordAdmin(Long userid, String password);
}

@ -50,10 +50,10 @@ public class DistionarytypeServiceImpl extends BaseServiceImpl<DistionarytypeMyb
@Override
public Distionarytype selectById(Long id) {
Distionarytype dto = this.selectDtoById(id);
List<Distionarygroup> list = distionarygroupMybatisDao.listByTypeId(dto.getId());
dto.setDistionarygroupList(list);
if (dto!=null){
List<Distionarygroup> list = distionarygroupMybatisDao.listByTypeId(dto.getId());
dto.setDistionarygroupList(list);
}
return dto;
}
public Distionarytype selectByCodeNo(String codeno){

@ -765,4 +765,21 @@ public class UserServiceImpl extends BaseServiceImpl<UserMybatisDao,User> imple
return this.updateById(user);
}
@Override
public int editUserPasswordAdmin(Long userid, String password) {
//判断原始密码输入是否正确
int isok = 0;
User old = this.selectDtoById(userid);
if (old != null){
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
User userps = new User();
userps.setId(old.getId());
//新密码
userps.setPassword(bCryptPasswordEncoder.encode(password));
//持久化用户新密码
isok = this.usermybatisdao.updateById(userps);
}
return isok;
}
}

@ -160,15 +160,15 @@ mybatis-plus:
xiaoyao:
web:
#上传文件路径
uploadPath: /Users/sunchenliang/IdeaProjects/ocr/htmlweb/upload
uploadPath: D:\work\java\gitlab\ocr\htmlweb/upload
#页面根路径
frontPath: /Users/sunchenliang/IdeaProjects/ocr/htmlweb
frontPath: D:\work\java\gitlab\ocr\htmlweb
#js、css、图片存放路径
staticPath: /Users/sunchenliang/IdeaProjects/ocr/htmlweb/static
staticPath: D:\work\java\gitlab\ocr\htmlweb/static
#页面模版路径
webPath: /Users/sunchenliang/IdeaProjects/ocr/htmlweb/web
webPath: D:\work\java\gitlab\ocr\htmlweb/web
#Lucene索引路径
lucenePath: /Users/sunchenliang/IdeaProjects/ocr/htmlweb/lucene/indexDir
lucenePath: D:\work\java\gitlab\ocr\htmlweb/lucene/indexDir
#是否开启flowable
haveFlowable: true
webconfig:

Loading…
Cancel
Save