2019-07-02 16:29:52 +08:00
|
|
|
<template>
|
|
|
|
<div id="app">
|
|
|
|
<router-view />
|
2019-09-02 10:38:10 +08:00
|
|
|
<deomon-topic ref="deomonTopic" />
|
2019-07-02 16:29:52 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-14 16:15:44 +08:00
|
|
|
import { handleToken } from '@/utils/auth';
|
2019-11-05 16:40:36 +08:00
|
|
|
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
|
2019-08-14 16:15:44 +08:00
|
|
|
import DeomonTopic from '@/views/demonstration/deomonTopic';
|
2019-09-02 10:38:10 +08:00
|
|
|
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
2019-11-06 10:42:08 +08:00
|
|
|
import { ProjectIcon } from '@/scripts/ConstDic';
|
2019-09-02 10:38:10 +08:00
|
|
|
|
2019-07-02 16:29:52 +08:00
|
|
|
export default {
|
2019-11-05 16:40:36 +08:00
|
|
|
name: 'App',
|
|
|
|
components: {
|
|
|
|
DeomonTopic
|
|
|
|
},
|
|
|
|
mixins: [
|
|
|
|
WindowResizeHandler
|
|
|
|
],
|
|
|
|
watch: {
|
|
|
|
'$store.state.socket.roomInvite': function (val) {
|
|
|
|
if (val.creatorId) {
|
|
|
|
this.subscribeMessage(val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.prohibitSystemContextMenu();
|
|
|
|
this.subscribe();
|
2019-11-06 10:42:08 +08:00
|
|
|
const project = window.sessionStorage.getItem('project');
|
|
|
|
document.querySelector("link[rel*='icon']").href = ProjectIcon[project];
|
2019-11-05 16:40:36 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
resizeHandler() {
|
|
|
|
this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight});
|
|
|
|
},
|
|
|
|
prohibitSystemContextMenu() {
|
|
|
|
window.document.oncontextmenu = function () {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
},
|
|
|
|
subscribe() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
if (!this.$route.path.includes('/login') && this.$route.path != '/404') {
|
|
|
|
const header = { group: '', 'X-Token': handleToken() };
|
|
|
|
creatSubscribe(perpetualTopic, header);
|
|
|
|
creatSubscribe(commonTopic, header);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
subscribeMessage(res) {
|
|
|
|
if (this.$refs.deomonTopic) {
|
|
|
|
this.$refs.deomonTopic.doShow(res);
|
|
|
|
this.$store.dispatch('socket/setRoomInvite');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-08 11:29:03 +08:00
|
|
|
};
|
|
|
|
|
2019-07-02 16:29:52 +08:00
|
|
|
</script>
|