登陆逻辑修改

This commit is contained in:
program-walker 2019-10-22 19:47:36 +08:00
parent 5c5c2412fd
commit 6fa2b2e636

View File

@ -173,20 +173,8 @@ export default {
model.project = this.$route.params.project; model.project = this.$route.params.project;
removeSessionStorage('againEnter'); removeSessionStorage('againEnter');
this.$store.dispatch('Login', model).then(() => { this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('GetUserConfigInfo'); this.$store.dispatch('SetAccount', model.username);
this.$store.dispatch('SetAccount', model.username); this.handleLoginSucessRoute();
//
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 = 'zh';
Cookies.set('user_lang', 'zh');
});
this.$router.push({ path: path });
}).catch(error => { }).catch(error => {
this.tipsMsg = error.message; this.tipsMsg = error.message;
this.loading = false; this.loading = false;
@ -237,15 +225,7 @@ export default {
self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token }).then(() => { self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token }).then(() => {
// //
self.clearTimer(self.checkLogin); self.clearTimer(self.checkLogin);
let path = '/login'; this.handleLoginSucessRoute();
if (this.project) {
path = path + '/' + this.project;
}
self.$router.push({ path: path });
self.$nextTick(() => {
self.$i18n.locale = 'zh';
Cookies.set('user_lang', 'zh');
});
}); });
}).catch(error => { }).catch(error => {
if (error.data && error.data.status == '1') { if (error.data && error.data.status == '1') {
@ -278,20 +258,8 @@ export default {
} }
removeSessionStorage('againEnter'); removeSessionStorage('againEnter');
this.$store.dispatch('Login', model).then(() => { this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('GetUserConfigInfo'); this.$store.dispatch('SetAccount', model.username);
this.$store.dispatch('SetAccount', model.username); this.handleLoginSucessRoute();
//
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 = 'zh';
Cookies.set('user_lang', 'zh');
});
this.$router.push({ path: path });
}).catch(error => { }).catch(error => {
this.tipsMsg = error.message; this.tipsMsg = error.message;
this.loading = false; this.loading = false;
@ -302,7 +270,18 @@ export default {
return false; return false;
} }
}); });
} },
handleLoginSucessRoute() {
//
this.loading = false;
this.tipsMsg = '';
const path = UrlConfig.trainingPlatform.trainingPlatformHome;
this.$nextTick(() => {
this.$i18n.locale = 'zh';
Cookies.set('user_lang', 'zh');
});
this.$router.push({ path: path });
}
} }
}; };
</script> </script>