From 1c7b1df5880639e0546f3c6f7ace515b833b5d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E4=B8=BD=E5=90=9B?= <664953382@qq.com> Date: Wed, 13 Oct 2021 14:34:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0md5=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/account.vue | 7 +++++-- src/views/login.vue | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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 || '/' });