|
@@ -25,6 +25,8 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
+const { mapActions: login } = createNamespacedHelpers('login');
|
|
export default {
|
|
export default {
|
|
name: 'uppasswd',
|
|
name: 'uppasswd',
|
|
props: {},
|
|
props: {},
|
|
@@ -38,15 +40,41 @@ export default {
|
|
display: false,
|
|
display: false,
|
|
}),
|
|
}),
|
|
created() {},
|
|
created() {},
|
|
- computed: {},
|
|
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState(['user']),
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
|
|
+ ...login(['logout', 'uppasswd']),
|
|
insurePasswd() {
|
|
insurePasswd() {
|
|
let newpasswd = this.form.newpasswd;
|
|
let newpasswd = this.form.newpasswd;
|
|
let _newpasswd = this.form._newpasswd;
|
|
let _newpasswd = this.form._newpasswd;
|
|
- if (newpasswd != _newpasswd) {
|
|
|
|
|
|
+ if (newpasswd === _newpasswd) {
|
|
|
|
+ this.display = false;
|
|
|
|
+ } else {
|
|
this.display = true;
|
|
this.display = true;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ async onSubmit() {
|
|
|
|
+ let res = {};
|
|
|
|
+ let data = JSON.parse(JSON.stringify(this.form));
|
|
|
|
+ data.userid = this.user.uid;
|
|
|
|
+ delete data._newpasswd;
|
|
|
|
+ res = await this.uppasswd(data);
|
|
|
|
+ if (res.errcode === 0) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '密码修改成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ this.logoutBtn();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('密码修改失败');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 退出登录
|
|
|
|
+ logoutBtn() {
|
|
|
|
+ this.logout();
|
|
|
|
+ this.$router.push({ path: '/' });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|