|
@@ -24,6 +24,7 @@
|
|
|
import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: personal } = createNamespacedHelpers('personal');
|
|
|
+const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
|
|
|
export default {
|
|
|
name: 'login',
|
|
|
props: {},
|
|
@@ -38,18 +39,34 @@ export default {
|
|
|
async created() {},
|
|
|
methods: {
|
|
|
...personal(['updatePassword']),
|
|
|
+ ...adminLogin(['updatePwd']),
|
|
|
async onSubmit(values) {
|
|
|
- let data = { id: this.user.id, password: values.password };
|
|
|
- let res = await this.updatePassword(data);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- let token = localStorage.removeItem('token');
|
|
|
- let openid = sessionStorage.removeItem('openid');
|
|
|
- if (token == undefined && openid == undefined) {
|
|
|
- this.$toast({ type: 'fail', message: '退出登录成功' });
|
|
|
- this.$router.push({ path: '/login', query: { path: '/account/index', type: '1' } });
|
|
|
+ if (this.user.role == '1' || this.user.role == '2') {
|
|
|
+ let data = { id: this.user.id, passwd: values.password };
|
|
|
+ let res = await this.updatePwd(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let token = localStorage.removeItem('token');
|
|
|
+ let openid = sessionStorage.removeItem('openid');
|
|
|
+ if (token == undefined && openid == undefined) {
|
|
|
+ this.$toast({ type: 'fail', message: '退出登录成功' });
|
|
|
+ this.$router.push({ path: '/login', query: { path: '/account/index', type: '1' } });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast({ type: `fail`, message: `${res.errmsg}` });
|
|
|
+ }
|
|
|
+ } else if (this.user.role == '3') {
|
|
|
+ let data = { id: this.user.id, password: values.password };
|
|
|
+ let res = await this.updatePassword(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let token = localStorage.removeItem('token');
|
|
|
+ let openid = sessionStorage.removeItem('openid');
|
|
|
+ if (token == undefined && openid == undefined) {
|
|
|
+ this.$toast({ type: 'fail', message: '退出登录成功' });
|
|
|
+ this.$router.push({ path: '/login', query: { path: '/account/index', type: '1' } });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast({ type: `fail`, message: `${res.errmsg}` });
|
|
|
}
|
|
|
- } else {
|
|
|
- this.$toast({ type: `fail`, message: `${res.errmsg}` });
|
|
|
}
|
|
|
},
|
|
|
back() {
|