登录修改

This commit is contained in:
joylink_cuiweidong 2019-10-22 20:09:29 +08:00
parent 332fa22b81
commit 7550d82f2b
3 changed files with 89 additions and 46 deletions

View File

@ -206,12 +206,15 @@ export default {
//
self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKENDESIGN', value: response.data.token }).then(() => {
//
self.clearTimer(self.checkLogin);
self.$router.push({ path: '/design/login' });
self.clearTimer(self.checkLogin);
this.$router.push({ path: `${UrlConfig.design.prefix}` });
self.$nextTick(() => {
self.$i18n.locale = 'zh';
Cookies.set('user_lang', 'zh');
});
});
});
}).catch(error => {
if (error.data && error.data.status == '1') {
@ -244,16 +247,25 @@ export default {
model.type = 'design';
this.loading = true;
this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('GetUserConfigInfo');
//
this.loading = false;
this.tipsMsg = '';
this.$nextTick(() => {
this.$i18n.locale = 'zh';
Cookies.set('user_lang', 'zh');
});
this.$router.push({ path: `${UrlConfig.design.prefix}` });
// this.$store.dispatch('Login', model).then(() => {
// this.$store.dispatch('GetUserConfigInfo');
// //
// this.loading = false;
// this.tipsMsg = '';
// this.$nextTick(() => {
// this.$i18n.locale = 'zh';
// Cookies.set('user_lang', 'zh');
// });
// this.$router.push({ path: `${UrlConfig.design.prefix}` });
// }).catch(error => {
// this.tipsMsg = error.message;
// this.loading = false;
// setTimeout(() => { this.tipsMsg = ''; }, 5000);
// });
this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('SetAccount', model.username);
this.handleLoginSucessRoute();
}).catch(error => {
this.tipsMsg = error.message;
this.loading = false;
@ -265,7 +277,18 @@ export default {
return false;
}
});
}
},
handleLoginSucessRoute() {
//
this.loading = false;
this.tipsMsg = '';
const path = UrlConfig.design.prefix;
this.$nextTick(() => {
this.$i18n.locale = 'zh';
Cookies.set('user_lang', 'zh');
});
this.$router.push({ path: path });
}
}
};
</script>

View File

@ -167,15 +167,14 @@ export default {
model.project = this.$route.params.project;
removeSessionStorage('againEnter');
this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('GetUserConfigInfo');
this.$store.dispatch('SetAccount', model.username);
//
this.loading = false;
this.tipsMsg = '';
let path = localStore.get('trainingPlatformRoute'+model.username);
if (!path || !path.startsWith('/trainingPlatform')) {
// let path = localStore.get('trainingPlatformRoute'+model.username);
// if (!path || !path.startsWith('/trainingPlatform')) {
path = UrlConfig.trainingPlatform.trainingPlatformHome;
}
// }
this.$nextTick(() => {
this.$i18n.locale = 'en';
Cookies.set('user_lang', 'en');
@ -273,21 +272,10 @@ export default {
Cookies.set('UserToken', model.password, { expires: 1/48});
}
removeSessionStorage('againEnter');
this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('GetUserConfigInfo');
this.$store.dispatch('SetAccount', model.username);
//
this.loading = false;
this.tipsMsg = '';
let path = localStore.get('trainingPlatformRoute'+model.username);
if (!path || !path.startsWith('/trainingPlatform')) {
path = UrlConfig.trainingPlatform.trainingPlatformHome;
}
this.$nextTick(() => {
this.$i18n.locale = 'en';
Cookies.set('user_lang', 'en');
});
this.$router.push({ path: path });
this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('SetAccount', model.username);
this.handleLoginSucessRoute();
}).catch(error => {
this.tipsMsg = error.message;
this.loading = false;
@ -298,7 +286,18 @@ export default {
return false;
}
});
}
},
handleLoginSucessRoute() {
//
this.loading = false;
this.tipsMsg = '';
const path = UrlConfig.trainingPlatform.trainingPlatformHome;
this.$nextTick(() => {
this.$i18n.locale = 'en';
Cookies.set('user_lang', 'en');
});
this.$router.push({ path: path });
}
}
};
</script>

View File

@ -214,7 +214,8 @@ export default {
self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKENDESIGN', value: response.data.token }).then(() => {
//
self.clearTimer(self.checkLogin);
self.$router.push({ path: '/design/login' });
// self.$router.push({ path: '/design/login' });
this.$router.push({ path: `${UrlConfig.design.prefix}` });
self.$nextTick(() => {
self.$i18n.locale = 'en';
Cookies.set('user_lang', 'en');
@ -249,16 +250,25 @@ export default {
}
this.loading = true;
this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('GetUserConfigInfo');
//
this.loading = false;
this.tipsMsg = '';
this.$router.push({ path: `${UrlConfig.design.prefix}` });
this.$nextTick(() => {
this.$i18n.locale = 'en';
Cookies.set('user_lang', 'en');
});
// this.$store.dispatch('Login', model).then(() => {
// this.$store.dispatch('GetUserConfigInfo');
// //
// this.loading = false;
// this.tipsMsg = '';
// this.$router.push({ path: `${UrlConfig.design.prefix}` });
// this.$nextTick(() => {
// this.$i18n.locale = 'en';
// Cookies.set('user_lang', 'en');
// });
// }).catch(error => {
// this.tipsMsg = error.message;
// this.loading = false;
// setTimeout(() => { this.tipsMsg = ''; }, 5000);
// });
this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('SetAccount', model.username);
this.handleLoginSucessRoute();
}).catch(error => {
this.tipsMsg = error.message;
this.loading = false;
@ -270,7 +280,18 @@ export default {
return false;
}
});
}
},
handleLoginSucessRoute() {
//
this.loading = false;
this.tipsMsg = '';
const path = UrlConfig.design.prefix;
this.$nextTick(() => {
this.$i18n.locale = 'en';
Cookies.set('user_lang', 'en');
});
this.$router.push({ path: path });
}
}
};
</script>