From a5df03f7c72d7a1d56b2a6b2d17e7e7b1bd8ff36 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 16 Jul 2020 13:22:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=87=BA=E7=99=BB=E9=99=86=20?= =?UTF-8?q?=E6=96=AD=E5=BC=80socket=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jlmap3d/jl3ddevice/jl3ddeviceNew.js | 11 ++--------- src/jlmap3d/jl3dpassflow/connect/passflowconnect.js | 11 +++-------- src/store/modules/user.js | 12 +++++++----- src/views/jlmap3d/drive/jl3ddrive.vue | 10 ++-------- 4 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/jlmap3d/jl3ddevice/jl3ddeviceNew.js b/src/jlmap3d/jl3ddevice/jl3ddeviceNew.js index e08a6f4ef..a6ba5529d 100644 --- a/src/jlmap3d/jl3ddevice/jl3ddeviceNew.js +++ b/src/jlmap3d/jl3ddevice/jl3ddeviceNew.js @@ -14,9 +14,6 @@ import { getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; import StompClient from '@/utils/sock'; -import { getToken } from '@/utils/auth'; -import { logout } from '@/api/login'; - var clock = new THREE.Clock(); export function Jl3ddeviceNew(dom,group,token,skinCode) { var scope = this; @@ -129,12 +126,8 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) { } if(data.type == 'Simulation_Over'){ - logout(getToken()).then(() => { - this.$store.dispatch('LogOut').then(() => { - location.reload(); - }); - }).catch(error => { - + this.$store.dispatch('LogOut').then(() => { + location.reload(); }); } diff --git a/src/jlmap3d/jl3dpassflow/connect/passflowconnect.js b/src/jlmap3d/jl3dpassflow/connect/passflowconnect.js index fc4977197..ca7663bd5 100644 --- a/src/jlmap3d/jl3dpassflow/connect/passflowconnect.js +++ b/src/jlmap3d/jl3dpassflow/connect/passflowconnect.js @@ -1,7 +1,6 @@ import StompClient from '@/utils/sock'; import { getBaseUrl } from '@/utils/baseUrl' import { getToken } from '@/utils/auth'; -import { logout } from '@/api/login'; // 定于仿真socket接口 export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegroup) { @@ -122,13 +121,9 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr } } } - if(data.type == 'Simulation_Over'){ - logout(getToken()).then(() => { - this.$store.dispatch('LogOut').then(() => { - location.reload(); - }); - }).catch(error => { - + if(data.type == 'Simulation_Over') { + this.$store.dispatch('LogOut').then(() => { + location.reload(); }); } } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 94dd5798c..1ad306437 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -161,11 +161,13 @@ const user = { commit('CLEAR_AUTO_PARAMS'); const token = getToken(); return new Promise((resolve, reject) => { - dispatch('FedLogOut').then(resp => { - logout(token).then(() => { - resolve(); - }).catch(error => { - reject(error); + dispatch('disconnect').then(()=>{ + dispatch('FedLogOut').then(resp => { + logout(token).then(() => { + resolve(); + }).catch(error => { + reject(error); + }); }); }); }); diff --git a/src/views/jlmap3d/drive/jl3ddrive.vue b/src/views/jlmap3d/drive/jl3ddrive.vue index a2c0711e6..29ce2786f 100644 --- a/src/views/jlmap3d/drive/jl3ddrive.vue +++ b/src/views/jlmap3d/drive/jl3ddrive.vue @@ -60,8 +60,6 @@ import DriveMmi from '@/views/jlmap3d/drive/sceneview/mmiview'; import DriveTms from '@/views/jlmap3d/drive/sceneview/tmsview'; import DriveControl from '@/views/jlmap3d/drive/drivecontrol/drivecontrol'; -import { getToken } from '@/utils/auth'; -import { logout } from '@/api/login'; var train; export default { name: 'Jl3dDrive', @@ -246,12 +244,8 @@ export default { back() { if(this.$route.query.type == "DRIVE"){ - logout(getToken()).then(() => { - this.$store.dispatch('LogOut').then(() => { - location.reload(); - }); - }).catch(error => { - + this.$store.dispatch('LogOut').then(() => { + location.reload(); }); }else{ this.$emit('showdriving');