2019-07-02 16:29:52 +08:00
|
|
|
<template>
|
|
|
|
<div id="app">
|
|
|
|
<router-view />
|
2019-08-14 16:15:44 +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';
|
|
|
|
import { creatSubscribe, perpetualTopic } from '@/utils/stomp';
|
|
|
|
import DeomonTopic from '@/views/demonstration/deomonTopic';
|
2019-07-02 16:29:52 +08:00
|
|
|
export default {
|
2019-08-14 16:15:44 +08:00
|
|
|
name: 'App',
|
|
|
|
components: {
|
|
|
|
DeomonTopic
|
|
|
|
// QuickMenu
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$store.state.socket.roomInvite': function (val) {
|
|
|
|
if (val.creatorId) {
|
|
|
|
this.subscribeMessage(val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.prohibitSystemContextMenu();
|
|
|
|
this.subscribe();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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>
|