修改三维客流退出页面取消订阅

This commit is contained in:
sunzhenyu 2020-11-27 17:24:52 +08:00
parent c3a8ab7929
commit c8cdf34397
4 changed files with 36 additions and 26 deletions

View File

@ -32,7 +32,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
const data = JSON.parse(Response.body);
if(data.type == "PFV"){
console.log(data);
for(let i=0;i<passerStation.stationlist.length;i++){
if(passerStation.stationlist[i].code == data.body){
jl3d.changestation(passerStation.stationlist[i].name);

View File

@ -47,6 +47,8 @@ export default {
},
data() {
return {
beforeUnloadTime: '',
gapTime: '',
initCode:null,
localStatic:JL3D_LOCAL_STATIC,
jl3d: null,
@ -59,8 +61,6 @@ export default {
mapId:'',
lineCode:'',
deviceCode:'',
beforeUnloadTime:'',
gapTime:'',
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts','bjd']
};
},
@ -79,11 +79,12 @@ export default {
if (this.loadingProjectList.includes(this.$route.query.project)) {
this.$store.dispatch('app/transitionAnimations');
}
window.addEventListener('beforeunload', this.updateHandler);
window.addEventListener('unload', e => this.unloadHandler(e));
document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
},
mounted() {
window.addEventListener('beforeunload', e => this.beforeunloadHandler(e));
window.addEventListener('unload', e => this.unloadHandler(e));
this.group = this.$route.query.group;
this.mapId = this.$route.query.mapId;
this.lineCode = this.$route.query.lineCode;
@ -95,26 +96,26 @@ export default {
this.isCctv = false;
}
},
beforeDestroy() {
destroyed() {
window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
window.removeEventListener('unload', e => this.unloadHandler(e))
},
destroyed() {
window.removeEventListener('beforeunload', this.updateHandler);
},
methods: {
updateHandler() {
beforeunloadHandler(){
this.beforeUnloadTime=new Date().getTime();
  },
unloadHandler(){
},
async unloadHandler(e){
this.gapTime=new Date().getTime()-this.beforeUnloadTime;
//
if(this.gapTime<=5){
deletePassenger(this.$route.query.group,this.initCode).then(netdata => {
console.log(netdata);
console.log( this.gapTime);
console.log( this.$route.query.group,this.$route.query.deviceCode);
if(this.gapTime<=5){//
//
await deletePassenger(this.$route.query.group,this.$route.query.deviceCode).then(netdata => {
});
}
},
init: function (code) {
// let mapdata = this.$store.state.socket.device;
const dom = document.getElementById('jl3d');
@ -153,7 +154,11 @@ export default {
this.value = selVal;
},
back() {
window.close();
deletePassenger(this.$route.query.group,this.$route.query.deviceCode).then(netdata => {
// console.log(netdata);
window.close();
});
}
}
};

View File

@ -177,10 +177,11 @@ export default {
},
beforeDestroy() {
window.removeEventListener('unload', e => this.unloadHandler(e))
window.removeEventListener('beforeunload', this.updateHandler);
},
destroyed() {
window.removeEventListener('beforeunload', this.updateHandler);
window.removeEventListener('unload', e => this.unloadHandler(e))
},
methods: {
updateHandler() {
@ -189,10 +190,10 @@ export default {
unloadHandler(){
this.gapTime=new Date().getTime()-this.beforeUnloadTime;
//
alert("netdata");
if(this.gapTime<=5){
deletePassenger(this.$route.query.group,this.initCode).then(netdata => {
console.log(netdata);
alert(netdata);
});
}
},
@ -274,7 +275,10 @@ export default {
return re;
},
back() {
deletePassenger(this.$route.query.group,this.$route.query.deviceCode).then(netdata => {
// console.log(netdata);
window.close();
});
}
}
};

View File

@ -382,11 +382,12 @@ export default {
}
this.$store.dispatch('training/emitTipFresh');
},
unConnect3d(code){
},
//
onSelected(em) {
console.log(em);
const path = window.location.href;
if (path.includes('/practiceDisplay')) {
@ -395,7 +396,7 @@ export default {
if (em.deviceType == 'StationStand') {
runPassenger(this.$route.query.group,em.deviceCode).then(netdata => {
console.log(netdata);
if(netdata.data){
const routeData = this.$router.resolve({
path:'/jlmap3d/trafficplan',
@ -416,9 +417,9 @@ export default {
}
if (em.deviceType == 'Train') {
// console.log(em.deviceType );
runPassenger(this.$route.query.group,em.deviceCode).then(netdata => {
console.log(netdata);
if(netdata.data){
const routeData = this.$router.resolve({
path:'/jlmap3d/traffictrain',