Browse Source

修改密码

lisu
李素 1 year ago
parent
commit
734123d37e
  1. 4
      src/config/env.development.js
  2. 2
      src/plugins/vant.js
  3. 23
      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)

23
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),
confirmPassword: encryptedData(this.pubKey, this.dataForm.confirmPassword), confirmNewPassword: encryptedData(this.pubKey, this.dataForm.confirmPassword),
} }
let { code, data, msg } = changePassword(parms); changePassword(parms).then(response => {
console.log(code, data, msg); let { data, code, msg } = response;
if(code === 0){ if(code === 0){
localStorage.setItem("token", data.token); console.log('data111');
this.$router.replace({ name: 'mine' }); this.$toast('修改成功!请重新登录');
} else { this.$router.replace({name:'login'})
throw new Error(msg);
}
} catch (error) {
console.log(error.message);
} }
}).catch(error => {
console.error('Error:', error);
});
} }
} }
}; };
</script> </script>
<style scoped> <style scoped></style>
</style>
Loading…
Cancel
Save