| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <html lang="zh-CN"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title></title> |
| | | <title>修改密码</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../static/vue/element/element.css"> |
| | | <style> |
| | | #password-div { |
| | | padding: 20px 20px 20px 13px; |
| | | [v-cloak] { |
| | | display: none; |
| | | } |
| | | .layui-form-item { |
| | | margin-bottom: 8px; |
| | | |
| | | html, |
| | | body { |
| | | margin: 0; |
| | | min-height: 100%; |
| | | background: #f6f8fb; |
| | | font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif; |
| | | } |
| | | .layui-form-item .layui-input-inline { |
| | | margin: 0 0 10px 100px |
| | | |
| | | .password-shell { |
| | | padding: 18px 16px 12px; |
| | | box-sizing: border-box; |
| | | } |
| | | .layui-form-label { |
| | | color: #999!important;; |
| | | padding: 9px 0; |
| | | |
| | | .password-card { |
| | | border-radius: 18px; |
| | | background: rgba(255, 255, 255, 0.98); |
| | | } |
| | | #password-btn { |
| | | padding-top: 5px; |
| | | margin-left: 40px; |
| | | |
| | | .password-form .el-form-item { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .password-form .el-input__inner, |
| | | .password-form .el-button { |
| | | height: 34px; |
| | | line-height: 34px; |
| | | } |
| | | |
| | | .password-form .el-form-item__label { |
| | | font-weight: 600; |
| | | color: #5c6f82; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .password-form .el-button { |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding: 0 18px; |
| | | vertical-align: middle; |
| | | } |
| | | |
| | | .footer-bar { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | gap: 12px; |
| | | padding-top: 4px; |
| | | } |
| | | #password-btn.layui-btn-container .layui-btn{ |
| | | margin-right: 30px; |
| | | |
| | | .footer-bar .el-button { |
| | | min-width: 120px; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body id="body"> |
| | | <div id="password-div"> |
| | | <div class="layui-form" lay-filter=""> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">当前密码</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="oldPassword" type="password" class="layui-input" lay-verify="checkPwd" lay-vertype="tips" autocomplete="off"> |
| | | <body> |
| | | <div id="passwordApp" class="password-shell" v-cloak> |
| | | <div class="password-card"> |
| | | <el-form |
| | | ref="passwordForm" |
| | | class="password-form" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="112px" |
| | | size="small" |
| | | @submit.native.prevent> |
| | | <el-form-item label="当前密码" prop="oldPassword"> |
| | | <el-input v-model="form.oldPassword" type="password" show-password autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="新密码" prop="password"> |
| | | <el-input v-model="form.password" type="password" show-password autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="确认新密码" prop="rePassword"> |
| | | <el-input v-model="form.rePassword" type="password" show-password autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <div class="footer-bar"> |
| | | <el-button @click="closeDialog">关闭</el-button> |
| | | <el-button type="primary" :loading="saving" @click="handleSave">保存</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">新密码</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="password" class="layui-input" id="password" lay-verify="newPwd" lay-vertype="tips" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">确认新密码</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="password" class="layui-input" id="rePassword" lay-verify="rePwd" lay-vertype="tips" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <hr class="layui-bg-gray"> |
| | | <div id="password-btn" class="layui-form-item layui-btn-container"> |
| | | <div id="password-submit" type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="savePwd">保存</div> |
| | | <div id="password-close" type="button" class="layui-btn" lay-submit lay-filter="close">关闭</div> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | </div> |
| | | </body> |
| | | <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../static/js/tools/md5.js"></script> |
| | | <script type="text/javascript" src="../static/js/common.js?v=20260309_i18n_fix1" charset="utf-8"></script> |
| | | <script src="../static/layui/layui.js"></script> |
| | | <script> |
| | | layui.use(['form'], function() { |
| | | var form = layui.form, |
| | | layer = layui.layer, |
| | | $ = layui.jquery; |
| | | |
| | | form.verify({ |
| | | checkPwd: function(val) { |
| | | if (val === ""){ |
| | | // return "当前密码不能为空"; |
| | | } |
| | | if (parent.$('#password').val() !== hex_md5(val)) { |
| | | return "密码不匹配"; |
| | | } |
| | | }, |
| | | newPwd: function (val) { |
| | | if (val === ""){ |
| | | return "新密码不能为空"; |
| | | } |
| | | if (val.length < 4) { |
| | | return "不能少于4个字符"; |
| | | } |
| | | if (parent.$('#password').val() === hex_md5(val)) { |
| | | return "与旧密码不能相同"; |
| | | } |
| | | }, |
| | | rePwd: function (val) { |
| | | if ($('#password').val() !== val){ |
| | | return "密码不一致"; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(savePwd)', function (data) { |
| | | var user = { |
| | | id: parent.$('#id').val(), |
| | | password: hex_md5($('#password').val()), |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/user/update/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: user, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | parent.layer.close(); |
| | | layer.confirm('密码修改成功,请重新登录',{ |
| | | btn: ['确定'], |
| | | btn1: function(){ |
| | | localStorage.removeItem("token"); |
| | | top.location.href = baseUrl+"/"; |
| | | }, |
| | | cancel: function(){ |
| | | localStorage.removeItem("token"); |
| | | top.location.href = baseUrl+"/"; |
| | | }, |
| | | closeBtn: 0, |
| | | shadeClose: false, |
| | | }) |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | } |
| | | }); |
| | | return false; |
| | | }); |
| | | |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#password-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | </script> |
| | | </html> |
| | | <script type="text/javascript" src="../static/js/common.js?v=20260309_i18n_fix1"></script> |
| | | <script type="text/javascript" src="../static/vue/js/vue.min.js"></script> |
| | | <script type="text/javascript" src="../static/vue/element/element.js"></script> |
| | | <script type="text/javascript" src="../static/js/password/password.js?v=20260310_password_vue"></script> |
| | | </html> |