|
|
@ -97,27 +97,24 @@ export default { |
|
|
|
if (this.errorMessages.oldPasswordError || this.errorMessages.newPasswordError || this.errorMessages.confirmPasswordError) { |
|
|
|
return; |
|
|
|
} |
|
|
|
try { |
|
|
|
let parms = { |
|
|
|
oldPassword: encryptedData(this.pubKey, this.dataForm.oldPassword), |
|
|
|
newPassword: encryptedData(this.pubKey, this.dataForm.newPassword), |
|
|
|
confirmPassword: encryptedData(this.pubKey, this.dataForm.confirmPassword), |
|
|
|
} |
|
|
|
let { code, data, msg } = changePassword(parms); |
|
|
|
console.log(code, data, msg); |
|
|
|
if (code === 0) { |
|
|
|
localStorage.setItem("token", data.token); |
|
|
|
this.$router.replace({ name: 'mine' }); |
|
|
|
} else { |
|
|
|
throw new Error(msg); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.log(error.message); |
|
|
|
let parms = { |
|
|
|
oldPassword: encryptedData(this.pubKey, this.dataForm.oldPassword), |
|
|
|
newPassword: encryptedData(this.pubKey, this.dataForm.newPassword), |
|
|
|
confirmNewPassword: encryptedData(this.pubKey, this.dataForm.confirmPassword), |
|
|
|
} |
|
|
|
changePassword(parms).then(response => { |
|
|
|
let { data, code, msg } = response; |
|
|
|
if(code === 0){ |
|
|
|
console.log('data111'); |
|
|
|
this.$toast('修改成功!请重新登录'); |
|
|
|
this.$router.replace({name:'login'}) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error('Error:', error); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped> |
|
|
|
</style> |
|
|
|
<style scoped></style> |