<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
|
<title>修改密码</title>
|
<script src="../../js/vue/vue.js"></script>
|
<script src="../../js/vue/element-ui/lib/index.js"></script>
|
<!-- <script src="="../../"></script> -->
|
<script src="../../js/vue/page.js?v=20220425"></script>
|
<script src="../../js/myelement.js?v=20220425"></script>
|
|
<link href="../../js/vue/element-ui/lib/theme-chalk/index.css" rel="stylesheet">
|
<link href="../../css/myelement.css?v=20220425" rel="stylesheet">
|
<link href="../../css/iconfont.css" rel="stylesheet">
|
<link href="../../css/page.css?v=20220425" rel="stylesheet">
|
<link href="//at.alicdn.com/t/font_2374495_mkoo966o0uo.css" rel="stylesheet">
|
</head>
|
|
<body>
|
<div id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="width: 500px;">
|
<div class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{title}} </span>
|
</div>
|
</div>
|
|
<div class="el-dialog__body" style="padding: 0px 20px; height: 300px;">
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
<el-tab-pane label="账户密码修改" name="user_password"></el-tab-pane>
|
<el-tab-pane label="流程验证密码" name="act_password"></el-tab-pane>
|
</el-tabs>
|
<div v-show="activeName == 'user_password'">
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields_userp"
|
:form-data="formdata_userp"
|
|
v-on:form-change="formChange_userp"
|
>
|
</h-form>
|
</div>
|
<div v-show="activeName == 'act_password'">
|
<h-form
|
ref="form2"
|
:form-attr="formAttr"
|
:table-fields="formFields_actp"
|
:form-data="formdata_actp"
|
|
v-on:form-change="formChange_actp"
|
>
|
</h-form>
|
</div>
|
|
<span style="color: red;">{{error_txt}}</span>
|
|
</div>
|
<div class="el-dialog__footer">
|
<el-button type="primary" @click="saveFormData">保 存</el-button>
|
<el-button type="default" @click="closeDialog">取 消</el-button>
|
</div>
|
</div>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 100vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
</div>
|
|
<script type="text/javascript">
|
new Vue({
|
el: "#vbody",
|
data: {
|
popupParames: {},
|
title: "密码修改",
|
activeName: "user_password",
|
formAttr: {
|
columnnumber: 1,
|
labelwidth: "120px",
|
labelposition: "left",
|
size: "medium",
|
border: "0px solid #c6c6c600"
|
},
|
formFields_userp: [
|
{isshow: "T", field: "old_password", name: "原账号密码", type: "password", required: true},
|
{isshow: "T", field: "new_password", name: "新账号密码", type: "password", required: true},
|
{isshow: "T", field: "confirm_password", name: "确认账号密码", type: "password", required: true},
|
],
|
formFields_actp: [
|
{isshow: "T", field: "password", name: "账号密码", type: "password", required: true},
|
{isshow: "T", field: "act_password", name: "验证密码", type: "password", required: true},
|
{isshow: "T", field: "confirm_password", name: "确认验证密码", type: "password", required: true},
|
],
|
|
formdata_userp: {},
|
formdata_actp: {},
|
error_txt: "",
|
|
},
|
|
created() {
|
this.popupParames = clone(Root.popupParames);
|
},
|
|
mounted() {
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
document.getElementById('page_root').style.display = "block";
|
document.getElementById('page_loading').style.display = "none";
|
|
//重新设置弹窗宽高
|
this.$nextTick(function(){
|
let w_ = this.$refs.popup_body.offsetWidth + "px";
|
let h_ = this.$refs.popup_body.offsetHeight + "px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
},
|
|
methods:{
|
closeDialog() {
|
Root.hidePopup();
|
},
|
|
saveFormData() {
|
var me = this;
|
if (this.activeName == "user_password") {
|
var checkResults = this.$refs.form1.checkForm();
|
if (!checkResults) {
|
return
|
}
|
|
let param_ = {
|
isClientMode: false,
|
passWord: this.formdata_userp.old_password,
|
newPassWord: this.formdata_userp.new_password,
|
id: localStorage.getItem("id")
|
}
|
|
Server.call("root/client/changePassword", param_, function(result_) {
|
console.log(result_);
|
if (result_ && result_.success) {
|
var operatelogdataobj_ = {
|
businessid: localStorage.getItem("id"),
|
businessname: localStorage.getItem("username"),
|
dataname: "user",
|
operateremark: "账户密码调整"
|
};
|
var fieldobjlist_ = [
|
{
|
type: "update",
|
field: "password",
|
fieldname: "账号密码"
|
}
|
]
|
me.addlog("user", operatelogdataobj_, fieldobjlist_, function(){
|
Root.message({
|
type: 'success',
|
message: '密码修改成功'
|
});
|
|
me.closeDialog();
|
});
|
}
|
});
|
}
|
else if (this.activeName == "act_password") {
|
var checkResults = this.$refs.form2.checkForm();
|
if (!checkResults) {
|
return
|
}
|
|
let param_ = {
|
isClientMode: false,
|
dataname: "user",
|
act_password: this.formdata_actp.act_password,
|
id: localStorage.getItem("id")
|
}
|
|
Server.call("root/data/updateEntity", param_, function(result_) {
|
console.log(result_);
|
localStorage.setItem("actpassword", me.formdata_actp.act_password);
|
if (result_ && result_.success) {
|
var operatelogdataobj_ = {
|
businessid: localStorage.getItem("id"),
|
businessname: localStorage.getItem("username"),
|
dataname: "user",
|
operateremark: "流程验证密码调整"
|
};
|
var fieldobjlist_ = [
|
{
|
type: "update",
|
field: "act_password",
|
fieldname: "流程验证密码"
|
}
|
]
|
me.addlog("user", operatelogdataobj_, fieldobjlist_, function(){
|
Root.message({
|
type: 'success',
|
message: '验证密码修改成功'
|
});
|
me.closeDialog();
|
});
|
}
|
});
|
}
|
|
},
|
|
addlog(code, operatelogdataobj, fieldobjlist, callback) {
|
var id_ = uuid_short();
|
var fieldobjlist_ = [];
|
fieldobjlist.map(f=>{
|
var f_ = {
|
parentId: id_,
|
operateType: f.type,
|
field: f.field,
|
fieldName: f.fieldname,
|
pre: f.predata || "",
|
currentData: f.currentdata || ""
|
}
|
fieldobjlist_.push(f_);
|
});
|
|
var param = {
|
isClientMode: false,
|
id: id_,
|
type: code,
|
operateCode: localStorage.getItem("emp_code"),
|
operateName: localStorage.getItem("emp_name"),
|
userId: localStorage.getItem("id"),
|
businessId: operatelogdataobj.businessid,
|
businessName: operatelogdataobj.businessname,
|
dataName: operatelogdataobj.dataname,
|
operateRemark: operatelogdataobj.operateremark,
|
sourceType: "EC",
|
detailList: fieldobjlist_,
|
operateRemark: operatelogdataobj.operateremark,
|
}
|
Server.call("root/api/addCustomerLogs", param, function(result) {
|
if (result.success) {
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
logout() {
|
var param = {
|
userId: localStorage.getItem("id"),
|
isClientMode: false
|
}
|
window.onbeforeunload = function (e) {
|
var storage = window.localStorage;
|
storage.clear()
|
}
|
|
Server.call("root/client/logout?userId=" + localStorage.getItem("id"), param, function(result) {
|
if (result.success) {
|
console.log("delCache");
|
}
|
});
|
|
util.pageTo("../../login.html");
|
},
|
|
handleClick(tab) {
|
this.error_txt = "";
|
this.formdata_userp = {};
|
this.formdata_actp = {};
|
},
|
|
formChange_userp(obj) {
|
var field_ = obj.fieldobj.field;
|
var val_ = obj.data[field_];
|
if (field_ == "old_password") {
|
this.verificationByPassword(val_, "原账号密码错误");
|
}
|
else if (field_ == "new_password") {
|
var pwdRegex = new RegExp("(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}");
|
if (!pwdRegex.test(val_)){
|
this.error_txt = "需包含大小写及特殊符号";
|
this.formdata_userp[field_] = "";
|
}else{
|
this.error_txt = "";
|
}
|
}
|
else if (field_ == "confirm_password") {
|
var val_new = obj.data.new_password;
|
if (val_ != val_new) {
|
this.error_txt = "确认密码错误"
|
this.formdata_userp[field_] = "";
|
}
|
else {
|
this.error_txt = "";
|
}
|
}
|
},
|
|
formChange_actp(obj) {
|
var field_ = obj.fieldobj.field;
|
var val_ = obj.data[field_];
|
if (field_ == "password") {
|
this.verificationByPassword(val_, "账号密码错误");
|
}
|
else if (field_ == "confirm_password") {
|
var val_new = obj.data.act_password;
|
if (val_ != val_new) {
|
this.error_txt = "确认密码错误"
|
this.formdata_actp[field_] = "";
|
}
|
else {
|
this.error_txt = "";
|
}
|
}
|
},
|
|
verificationByPassword(val, error_txt) {
|
var password_ = localStorage.getItem("password");
|
if (password_ != val) {
|
this.error_txt = error_txt;//"原账号密码错误"
|
this.formdata_userp = {};
|
}
|
else {
|
this.error_txt = "";
|
}
|
|
}
|
|
}
|
});
|
</script>
|
</body>
|
</html>
|