登录修改

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

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

View File

@ -167,15 +167,14 @@ 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.loading = false; this.loading = false;
this.tipsMsg = ''; this.tipsMsg = '';
let path = localStore.get('trainingPlatformRoute'+model.username); // let path = localStore.get('trainingPlatformRoute'+model.username);
if (!path || !path.startsWith('/trainingPlatform')) { // if (!path || !path.startsWith('/trainingPlatform')) {
path = UrlConfig.trainingPlatform.trainingPlatformHome; path = UrlConfig.trainingPlatform.trainingPlatformHome;
} // }
this.$nextTick(() => { this.$nextTick(() => {
this.$i18n.locale = 'en'; this.$i18n.locale = 'en';
Cookies.set('user_lang', 'en'); Cookies.set('user_lang', 'en');
@ -273,21 +272,10 @@ export default {
Cookies.set('UserToken', model.password, { expires: 1/48}); Cookies.set('UserToken', model.password, { expires: 1/48});
} }
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 = 'en';
Cookies.set('user_lang', 'en');
});
this.$router.push({ path: path });
}).catch(error => { }).catch(error => {
this.tipsMsg = error.message; this.tipsMsg = error.message;
this.loading = false; this.loading = false;
@ -298,6 +286,17 @@ export default {
return false; 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 });
} }
} }
}; };

View File

@ -214,7 +214,8 @@ export default {
self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKENDESIGN', value: response.data.token }).then(() => { self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKENDESIGN', value: response.data.token }).then(() => {
// //
self.clearTimer(self.checkLogin); 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.$nextTick(() => {
self.$i18n.locale = 'en'; self.$i18n.locale = 'en';
Cookies.set('user_lang', 'en'); Cookies.set('user_lang', 'en');
@ -249,16 +250,25 @@ export default {
} }
this.loading = true; 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');
// });
// }).catch(error => {
// this.tipsMsg = error.message;
// this.loading = false;
// setTimeout(() => { this.tipsMsg = ''; }, 5000);
// });
this.$store.dispatch('Login', model).then(() => { this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('GetUserConfigInfo'); this.$store.dispatch('SetAccount', model.username);
// this.handleLoginSucessRoute();
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 => { }).catch(error => {
this.tipsMsg = error.message; this.tipsMsg = error.message;
this.loading = false; this.loading = false;
@ -270,6 +280,17 @@ export default {
return false; 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 });
} }
} }
}; };