Browse Source

修改密码

lisu
李素 1 year ago
parent
commit
734123d37e
  1. 4
      src/config/env.development.js
  2. 2
      src/plugins/vant.js
  3. 33
      src/views/mine/changePassword.vue

4
src/config/env.development.js

@ -3,8 +3,8 @@ module.exports = {
env: 'development', env: 'development',
title: 'e联社区', title: 'e联社区',
baseUrl: 'http://192.168.1.144/', // 项目地址 baseUrl: 'http://192.168.1.144/', // 项目地址
// baseApi: 'http://192.168.1.144/api', // 本地api请求地址,注意:如果你使用了代理,请设置成'/' baseApi: 'http://192.168.1.144/api', // 本地api请求地址,注意:如果你使用了代理,请设置成'/'
baseApi: 'http://219.146.91.110:30801/api', // 本地api请求地址,注意:如果你使用了代理,请设置成'/' // baseApi: 'http://219.146.91.110:30801/api', // 本地api请求地址,注意:如果你使用了代理,请设置成'/'
APPID: 'xxx', APPID: 'xxx',
APPSECRET: 'xxx', APPSECRET: 'xxx',
} }

2
src/plugins/vant.js

@ -25,7 +25,7 @@ import {
ActionSheet, ActionSheet,
Checkbox, Checkbox,
CellGroup, CellGroup,
Form Form,
} from 'vant' } from 'vant'
Vue.use(Button) Vue.use(Button)

33
src/views/mine/changePassword.vue

@ -97,27 +97,24 @@ export default {
if (this.errorMessages.oldPasswordError || this.errorMessages.newPasswordError || this.errorMessages.confirmPasswordError) { if (this.errorMessages.oldPasswordError || this.errorMessages.newPasswordError || this.errorMessages.confirmPasswordError) {
return; return;
} }
try { let parms = {
let parms = { oldPassword: encryptedData(this.pubKey, this.dataForm.oldPassword),
oldPassword: encryptedData(this.pubKey, this.dataForm.oldPassword), newPassword: encryptedData(this.pubKey, this.dataForm.newPassword),
newPassword: encryptedData(this.pubKey, this.dataForm.newPassword), confirmNewPassword: encryptedData(this.pubKey, this.dataForm.confirmPassword),
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);
} }
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> </script>
<style scoped> <style scoped></style>
</style>
Loading…
Cancel
Save