From 04caf21f2fab3490a4e9c1e96d570c7c3c0ae8b2 Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Tue, 8 Oct 2024 18:04:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=90=8C=E7=94=A8=E6=88=B7=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=88=A4=E6=96=AD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 25 ++++++++++++++++++++++++- src/drawApp/iscsApp.ts | 6 ++++++ src/layouts/IscsDrawLayout.vue | 4 +++- src/layouts/MainLayout.vue | 28 ++++++++++++++-------------- src/stores/auth-store.ts | 1 + 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/src/App.vue b/src/App.vue index 1325c29..b42526e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,7 +3,30 @@ diff --git a/src/drawApp/iscsApp.ts b/src/drawApp/iscsApp.ts index bf787ff..94bc930 100644 --- a/src/drawApp/iscsApp.ts +++ b/src/drawApp/iscsApp.ts @@ -25,6 +25,7 @@ import { getJwt } from 'src/api/UserApi'; import { fromUint8Array, toUint8Array } from 'js-base64'; import { getWebsocketUrl } from 'src/configs/UrlManage'; import { sync_data_message } from 'src/protos/sync_data_message'; +import { useAuthStore } from 'src/stores/auth-store'; // import { getOnlyToken } from 'src/configs/TokenManage'; let drawApp: IDrawApp | null = null; @@ -87,6 +88,11 @@ function handleSubscribe(app: IDrawApp) { destination: `/rtss_simulation/draft/iscs/${drawStore.draftId}`, messageHandle: (message: Uint8Array) => { const syncData = sync_data_message.SyncData.deserialize(message); + console.log(syncData.userId, useAuthStore().userId, 'userID'); + if (syncData.userId === useAuthStore().userId) { + console.info('当前用户操作'); + return; + } if ( syncData.submenu === drawStore.selectSubmenuAndStation.submenu && syncData.station === drawStore.selectSubmenuAndStation.station diff --git a/src/layouts/IscsDrawLayout.vue b/src/layouts/IscsDrawLayout.vue index 242786e..d8786f1 100644 --- a/src/layouts/IscsDrawLayout.vue +++ b/src/layouts/IscsDrawLayout.vue @@ -257,6 +257,7 @@ import { successNotify } from 'src/utils/CommonNotify'; import { saveDrawDatas } from 'src/drawApp/iscsApp'; import { saveDrawToServer } from 'src/drawApp/commonApp'; import { sync_data_message } from 'src/protos/sync_data_message'; +import { useAuthStore } from 'src/stores/auth-store'; const $q = useQuasar(); const route = useRoute(); @@ -533,6 +534,7 @@ function handleRecordData(op) { datas: [], submenu: drawStore.selectSubmenuAndStation.submenu, station: drawStore.selectSubmenuAndStation.station, + userId: useAuthStore().userId, }; op.obj.forEach((g) => { const gData = g.saveData(); @@ -545,7 +547,7 @@ function handleRecordData(op) { ); }); drawApp.publishMessage( - '/rtss_simulation/draft/iscs/7', + `/rtss_simulation/draft/iscs/${drawStore.draftId}`, new sync_data_message.SyncData({ ...syncData }).serialize() ); } diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 937e408..d87dc03 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -121,24 +121,24 @@