diff --git a/src/views/home/account.vue b/src/views/home/account.vue index 58a6b5b..e36ec41 100644 --- a/src/views/home/account.vue +++ b/src/views/home/account.vue @@ -173,11 +173,14 @@ export default { submitForm(formName) { this.$refs[formName].validate(valid => { if (valid) { + let form = Object.assign({}, this.form); if (this.title == '修改密码') { - if (this.form.password !== this.password) + if (form.password !== this.password) return this.msgError('新旧密码不一致'); + form.password = this.md5(form.password); + form.oldPassword = this.md5(form.oldPassword); } - updateInfo(this.form).then(({ message }) => { + updateInfo(form).then(({ message }) => { this.msgSuccess(message); // store.commit('SET_NAME', this.form.username); // this.dialogVisible = false; diff --git a/src/views/login.vue b/src/views/login.vue index 32e2ca9..7d44a68 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -434,9 +434,10 @@ export default { Cookies.remove('rememberMe'); } if (this.mode) { - console.log(this.md5(this.loginForm.password)); + let loginForm = Object.assign({}, this.loginForm); + loginForm.password = this.md5(loginForm.password); this.$store - .dispatch('Login', this.loginForm) + .dispatch('Login', loginForm) .then(() => { // this.$router.go(-1); this.$router.push({ path: this.redirect || '/' });