diff --git a/src/views/login/loginDesign.vue b/src/views/login/loginDesign.vue index 9fb58082e..519472729 100644 --- a/src/views/login/loginDesign.vue +++ b/src/views/login/loginDesign.vue @@ -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 }); + } } }; diff --git a/src/views/login/loginEn.vue b/src/views/login/loginEn.vue index 1236534bc..fbe084b77 100644 --- a/src/views/login/loginEn.vue +++ b/src/views/login/loginEn.vue @@ -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 }); + } } }; diff --git a/src/views/login/loginEnDesign.vue b/src/views/login/loginEnDesign.vue index df11a95fd..1d8ae5da0 100644 --- a/src/views/login/loginEnDesign.vue +++ b/src/views/login/loginEnDesign.vue @@ -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 }); + } } };