...
|
...
|
@@ -28,6 +28,8 @@ export default { |
|
|
const validatePass = (rule, value, callback) => {
|
|
|
if (value === '') {
|
|
|
return callback(new Error('请输入密码'));
|
|
|
} else if (!/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])[a-zA-Z\d\W_]{8,}$/.test(value)) {
|
|
|
return callback(new Error('密码长度必须大于八位,且包含大写字母,小写字母,数字和特殊字符'));
|
|
|
} else {
|
|
|
if (this.formInline.passwdCheck !== '') {
|
|
|
// 对第二个密码框单独验证
|
...
|
...
|
@@ -54,10 +56,10 @@ export default { |
|
|
},
|
|
|
ruleInline: {
|
|
|
passwd: [
|
|
|
{ validator: validatePass, trigger: 'blur' }
|
|
|
{ validator: validatePass, trigger: 'change' }
|
|
|
],
|
|
|
passwdCheck: [
|
|
|
{ validator: validatePassCheck, trigger: 'blur' }
|
|
|
{ validator: validatePassCheck, trigger: 'change' }
|
|
|
]
|
|
|
}
|
|
|
};
|
...
|
...
|
@@ -71,7 +73,7 @@ export default { |
|
|
if (valid) {
|
|
|
this.update(this.formInline.passwdCheck);
|
|
|
} else {
|
|
|
this.$Message.error('表单验证失败!');
|
|
|
this.$Message.error('请按照规则输入密码!');
|
|
|
}
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -79,15 +81,13 @@ export default { |
|
|
this.loading = true;
|
|
|
|
|
|
this.UserService.update({
|
|
|
account: '123',
|
|
|
password: passwdCheck
|
|
|
}).then(ret => {
|
|
|
if (ret.code === 200) {
|
|
|
this.loading = false;
|
|
|
if (ret.code === 200) {
|
|
|
Vue.$store.remove('needUpdate');
|
|
|
this.$router.push('/');
|
|
|
} else {
|
|
|
this.loading = false;
|
|
|
this.$Message.error(ret.message);
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -98,6 +98,6 @@ export default { |
|
|
|
|
|
<style lang="scss">
|
|
|
.password {
|
|
|
width: 400px;
|
|
|
width: 500px;
|
|
|
}
|
|
|
</style> |
...
|
...
|
|