修改代码

This commit is contained in:
ival 2019-11-19 10:54:52 +08:00
parent fb71e4cbe8
commit 306d8b305f
2 changed files with 17 additions and 13 deletions

View File

@ -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')});
}
}
}
};

View File

@ -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);
},