NEZ-471 feat: account-box修改时增加改密功能
This commit is contained in:
@@ -17,19 +17,19 @@
|
||||
|
||||
<!-- begin--表单-->
|
||||
<div class="right-box-form-box">
|
||||
<el-form class="right-box-form right-box-form-left" :model="editUser" :rules="rules" ref="accountForm" label-position="right" label-width="120px">
|
||||
<el-form :model="editUser" :rules="editUser.userId ? rules2 : rules" class="right-box-form right-box-form-left" label-position="right" label-width="120px" ref="accountForm">
|
||||
<!--username-->
|
||||
<el-form-item :label="$t('config.account.account')" prop="username">
|
||||
<el-input autocomplete="new-password" type="text" placeholder=""
|
||||
v-model="editUser.username" maxlength="64" show-word-limit size="small" :disabled="editUser.username==='admin' && editUser.userId==1"></el-input>
|
||||
</el-form-item>
|
||||
<!--password-->
|
||||
<el-form-item :label="$t('config.account.password')" prop="password" v-if="!editUser.userId">
|
||||
<el-form-item :label="$t('config.account.password')" prop="password">
|
||||
<el-input autocomplete="new-password" type="password" placeholder="" v-model="editUser.password"
|
||||
maxlength="16" show-word-limit size="small" @blur="passwordBlur"></el-input>
|
||||
</el-form-item>
|
||||
<!--passwordChange-->
|
||||
<el-form-item :label="$t('config.account.confirmPwd')" prop="passwordChange" v-if="!editUser.userId" class="passwordChange" label-width="160px">
|
||||
<el-form-item :label="$t('config.account.confirmPwd')" class="passwordChange" label-width="160px" prop="passwordChange">
|
||||
<el-input autocomplete="new-password" type="password" placeholder="" v-model="editUser.passwordChange"
|
||||
maxlength="16" show-word-limit size="small"></el-input>
|
||||
</el-form-item>
|
||||
@@ -112,10 +112,7 @@
|
||||
},
|
||||
data() {
|
||||
let validatePassword = (rule, value, callback) => { // 确认密码的二次校验
|
||||
console.log(value);
|
||||
if (value === ''&& !this.editUser.password) {
|
||||
callback(new Error(this.$t('validate.required')));
|
||||
}else if(value === ''&&this.editUser.password){
|
||||
if(value === '' && this.editUser.password){
|
||||
callback(new Error(this.$t('config.account.inputConfirmPwd')));
|
||||
}else if (value !== this.editUser.password) {
|
||||
callback(new Error(this.$t('config.account.confirmPwdErr')));
|
||||
@@ -134,7 +131,21 @@
|
||||
],
|
||||
passwordChange: [
|
||||
{ validator: validatePassword, trigger: 'blur' },
|
||||
{required: true, message:'', trigger: 'blur'},
|
||||
{required: true, message: '', trigger: 'blur'},
|
||||
],
|
||||
roleIds: [
|
||||
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
||||
],
|
||||
email: [
|
||||
{type: 'email', message: this.$t('validate.email')}
|
||||
]
|
||||
},
|
||||
rules2: { //表单校验规则
|
||||
username: [
|
||||
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
||||
],
|
||||
passwordChange: [
|
||||
{ validator: validatePassword, trigger: 'blur' },
|
||||
],
|
||||
roleIds: [
|
||||
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
||||
|
||||
Reference in New Issue
Block a user