|
|
@@ -81,25 +81,38 @@ export default {
|
|
|
methods: {
|
|
|
codeSend() {
|
|
|
this.$refs.form.validate(valid => {
|
|
|
- if (valid) {
|
|
|
- this.$http
|
|
|
- .post('/user/changePw', {
|
|
|
- newPassword: this.ruleForm.pass,
|
|
|
- password: this.ruleForm.password
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$message.warning('修改成功,请重新登录');
|
|
|
- localStorage.removeItem('webToken');
|
|
|
- this.$store.commit('updateUserInfo', null);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$router.push('/');
|
|
|
- eventBus.$emit('login');
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- this.$message.error(e.error);
|
|
|
- });
|
|
|
- }
|
|
|
+ this.$http
|
|
|
+ .post(`/user/changePassword?password=${this.ruleForm.password}&code=${this.ruleForm.code}`)
|
|
|
+ .then(res => {
|
|
|
+ this.$toast.success('修改成功');
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$router.back();
|
|
|
+ }, 1500);
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ if (e) {
|
|
|
+ this.$toast(e.error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // if (valid) {
|
|
|
+ // this.$http
|
|
|
+ // .post('/user/changePw', {
|
|
|
+ // newPassword: this.ruleForm.pass,
|
|
|
+ // password: this.ruleForm.password
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // this.$message.warning('修改成功,请重新登录');
|
|
|
+ // localStorage.removeItem('webToken');
|
|
|
+ // this.$store.commit('updateUserInfo', null);
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // this.$router.push('/');
|
|
|
+ // eventBus.$emit('login');
|
|
|
+ // })
|
|
|
+ // .catch(e => {
|
|
|
+ // this.$message.error(e.error);
|
|
|
+ // });
|
|
|
+ // }
|
|
|
});
|
|
|
}
|
|
|
}
|