diff --git a/nezha-fronted/src/components/common/rightBox/accountBox.vue b/nezha-fronted/src/components/common/rightBox/accountBox.vue
index 5f6101cdf..86bfc5889 100644
--- a/nezha-fronted/src/components/common/rightBox/accountBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/accountBox.vue
@@ -26,6 +26,11 @@
+
+
+
+
@@ -106,6 +111,18 @@
this.getRoles();
},
data() {
+ let validatePassword = (rule, value, callback) => { // 确认密码的二次校验
+ console.log(value);
+ if (value === ''&& this.editUser.password) {
+ callback(new Error(this.$t('validate.required')));
+ }else if(!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')));
+ } else {
+ callback();
+ }
+ };
return {
scriptIds: [],
rules: { //表单校验规则
@@ -115,6 +132,10 @@
password: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
+ passwordChange: [
+ { validator: validatePassword, trigger: 'blur' },
+ {required: true, message:'', trigger: 'blur'},
+ ],
roleIds: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
@@ -126,6 +147,7 @@
scripts: [],
selectableScripts: [],
roles:[],
+ passwordChange:'',
}
},
methods: {
@@ -194,7 +216,12 @@
this.prevent_opt.save=false;
});
},
-
+ /*密码失去焦点 检验确认密码*/
+ passwordBlur(){
+ if(this.editUser.password&&this.editUser.passwordChange){
+ this.$refs.accountForm.validateField('passwordChange')
+ }
+ },
getScripts() {
this.$get("/alert/script?pageNo=1&pageSize=-1").then(response => {
this.scripts = response.data.list;
@@ -311,4 +338,8 @@
position: absolute;
left: -120px;
}
+ .passwordChange{
+ margin-left: 30px;
+ width: calc(100% - 30px);
+ }