调整订阅

This commit is contained in:
fan 2020-07-23 19:25:40 +08:00
parent e7ee0344b0
commit 5d413dba8c

View File

@ -20,36 +20,34 @@ export default {
return {
topic: '/user/queue/training',
stomp: null,
currentMap: null,
ierval: null,
checkLine: null,
mouseNum: 1,
mouseNumTime: 0,
mapBoxP: null,
currentMap: null,
ierval: null,
checkLine: null,
mouseNum: 1,
mouseNumTime: 0,
mapBoxP: null,
mode: '',
group: ''
};
},
computed: {
...mapGetters('config', [
},
computed: {
...mapGetters('config', [
'canvasId'
]),
},
])
},
watch: {
'$store.state.map.mapViewLoadedCount': function (val) {
this.subscribe();
},
'$store.state.socket.equipmentStatus': function (val) {
if (val.length) {
this.statusMessage(val);
}
},
'$store.state.map.mousemove': function (val) {
},
'$store.state.map.mousemove': function (val) {
this.mousemove();
},
'$store.state.map.mapViewLoadedCount': function (val) { //
this.mapBoxP = document.getElementById(this.canvasId).children[0];
},
'$store.state.map.mapViewLoadedCount': function (val) { //
this.mapBoxP = document.getElementById(this.canvasId).children[0];
this.mapBoxP.style.cursor = '';
this.subscribe();
},
'$store.state.socket.trainStationList': function (val) {
if (val.length) {
@ -66,9 +64,9 @@ export default {
window.onbeforeunload = this.clearSubscribe;
this.mode = this.$route.params.mode || '';
this.group = this.$route.query.group || '';
this.currentMap = this.$refs.mapCommon;
this.checkLoginLineTimer(); //
this.checkMouseStatusTimer(); //
this.currentMap = this.$refs.mapCommon;
this.checkLoginLineTimer(); //
this.checkMouseStatusTimer(); //
this.$nextTick(() => {
setTimeout(() => {
this.$store.dispatch('config/resetCanvasOffset');
@ -76,8 +74,8 @@ export default {
});
},
beforeDestroy() {
this.clearSubscribe();
this.clearAllTimer();
this.clearSubscribe();
this.clearAllTimer();
},
methods: {
async mapViewLoaded(loading) {
@ -117,11 +115,11 @@ export default {
},
setCenter(code) {
this.$refs.mapCommon && this.$refs.mapCommon.setCenter(code);
},
mousemove() {
},
mousemove() {
this.mouseNum = 1;
},
// 线
// 线
clearAllTimer() {
if (this.ierval) {
clearTimeout(this.ierval);
@ -131,7 +129,7 @@ export default {
clearTimeout(this.checkLine);
this.checkLine = null;
}
},
},
// 线
checkLoginLineTimer() {
if (this.checkLine) {
@ -141,7 +139,7 @@ export default {
checkLoginLine();
}, 5000 * 60);
},
//
//
checkMouseStatusTimer() {
if (this.ierval) {
clearInterval(this.ierval);
@ -158,11 +156,11 @@ export default {
}
if (this.mapBoxP) {
if (this.mouseNumTime >= 12) {
this.mapBoxP.style.cursor = 'none';
this.mapBoxP.style.cursor = 'none';
}
}
}, 1000);
},
}
}
};
</script>