diff --git a/src/App.vue b/src/App.vue index b03e7062c..717a5dcdf 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,6 +20,11 @@ export default { mixins: [ WindowResizeHandler ], + computed: { + path() { + return window.location.pathname; + } + }, watch: { '$store.state.socket.roomInvite': function (val) { if (val.creatorId) { @@ -58,7 +63,7 @@ export default { } }); - this.subscribe(); + this.$nextTick(() => { this.subscribe(); }); }, methods: { resizeHandler() { @@ -76,13 +81,11 @@ export default { } }, subscribe() { - this.$nextTick(() => { - const token = getToken(); - if (token && this.$route.path != '/404') { - const header = { group: '', 'X-Token': token }; - this.$store.dispatch('subscribe', {header, type: getSessionStorage('project')}); - } - }); + const token = getToken(); + if (token && this.$route.path != '/404' && !this.path.endsWith('login')) { + const header = { group: '', 'X-Token': token }; + this.$store.dispatch('subscribe', {header, type: getSessionStorage('project')}); + } } } }; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 6c2a6548f..8bdbfdd27 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -166,10 +166,6 @@ export default { return loginInfo[this.$route.path.split('/')[1]].title; } }, - mounted() { - document.title = loginInfo[this.project].title; - this.loginRefresh(); - }, created() { this.computedAttribute(); if (Cookies.get(this.cookiesName) && Cookies.get(this.cookiesToken)) { @@ -189,6 +185,10 @@ export default { }); } }, + mounted() { + document.title = loginInfo[this.project].title; + this.loginRefresh(); + }, methods: { computedAttribute() { if (this.project.startsWith('design')) { @@ -198,12 +198,13 @@ export default { this.loginClient = 'Design'; this.path = UrlConfig.design.prefix; } + const nowLang = LangStorage.getLang('zh'); if (nowLang === 'zh') { this.lang = 'en'; this.language = 'English'; } - removeToken(); + removeToken(); setSessionStorage('project', this.project); },