From 3c41293f0b91fc4e62cdbb11b1e9a227b2d3b772 Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Tue, 12 Nov 2024 13:41:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7id=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 20 ++++++-------------- src/api/UserApi.ts | 28 ++++++++++++++-------------- src/drawApp/iscsApp.ts | 12 +++++------- src/pages/UserLogin.vue | 11 ++++++++++- 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/App.vue b/src/App.vue index 85297cc..4f4e0d3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,28 +3,20 @@ diff --git a/src/api/UserApi.ts b/src/api/UserApi.ts index a485557..6014449 100644 --- a/src/api/UserApi.ts +++ b/src/api/UserApi.ts @@ -181,20 +181,20 @@ export async function getLoginUserInfo() { return response.data.data; } -/** - * 获取jwt令牌(mqtt验证) - */ -export async function getJwt() { - const query = ` - query getJwt { - getJwt - } -`; - const response = await api.post('', { - query: query, - }); - return response.data.data; -} +// /** +// * 获取jwt令牌(mqtt验证) +// */ +// export async function getJwt() { +// const query = ` +// query getJwt { +// getJwt +// } +// `; +// const response = await api.post('', { +// query: query, +// }); +// return response.data.data; +// } /** * 获取默认组织信息 diff --git a/src/drawApp/iscsApp.ts b/src/drawApp/iscsApp.ts index 5109ad4..2538171 100644 --- a/src/drawApp/iscsApp.ts +++ b/src/drawApp/iscsApp.ts @@ -20,7 +20,6 @@ import { import { useDrawStore } from 'src/stores/draw-store'; import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; import { getDraft } from 'src/api/DraftApi'; -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'; @@ -171,6 +170,7 @@ import { FireIntercommunicationSignalTemplate, } from 'src/graphics/FAS/fireIntercommunicationSignal/FireIntercommunicationSignal'; // import { getOnlyToken } from 'src/configs/TokenManage'; +import { getJwtToken } from 'src/configs/TokenManage'; let drawApp: IDrawApp | null = null; @@ -194,12 +194,10 @@ export function initIscsDrawApp(): IDrawApp { dataLoader: loadDrawDatas, isSupportDeletion: isSupportDeletion, }); - getJwt().then((res) => { - drawApp.enableWsMassaging({ - engine: ClientEngine.MQTT, - wsUrl: `${getWebsocketUrl()}`, - token: res.getJwt as string, - }); + drawApp.enableWsMassaging({ + engine: ClientEngine.MQTT, + wsUrl: `${getWebsocketUrl()}`, + token: getJwtToken() as string, }); const app = drawApp; diff --git a/src/pages/UserLogin.vue b/src/pages/UserLogin.vue index 22fc224..30fc533 100644 --- a/src/pages/UserLogin.vue +++ b/src/pages/UserLogin.vue @@ -54,8 +54,14 @@