From 6f7c2fe61c1e3aecb74fe3a5a690d0b1b414a00d Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Fri, 7 Aug 2026 21:48:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=9B=B8=E5=85=B3=E6=96=B9?= =?UTF-8?q?=E7=AB=AF=E4=B8=8D=E5=85=81=E8=AE=B8=E8=AE=BF=E9=97=AE=E7=9A=84?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=92=8CWebsocket=E6=89=93=E5=AE=8C=E5=8C=85?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=B8=8D=E5=AF=B9=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Container/Map/index.js | 8 +++++++- src/pages/Container/Map/js/usePeoplePosition.js | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pages/Container/Map/index.js b/src/pages/Container/Map/index.js index 500e087..9f8d894 100644 --- a/src/pages/Container/Map/index.js +++ b/src/pages/Container/Map/index.js @@ -5,6 +5,7 @@ import autoFit from "autofit.js"; import { useMemo, useReducer, useRef, useState } from "react"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import { NS_BI_MARK, NS_BI_MARK_INFO, NS_BI_STATISTICS } from "~/enumerate/namespace"; +import { closeWindow } from "~/utils"; import BottomUtils from "./components/BottomUtils"; import CenterUtils from "./components/CenterUtils"; import Content from "./components/Content"; @@ -83,7 +84,12 @@ function Map(props) { setTimeout(() => { if (window.sessionStorage.getItem("token")) { props.getCorpInfo().then(({ data }) => { - if ([0, 1, 6].includes(data?.type)) { + if ([3, 4, 5].includes(data?.type)) { + // eslint-disable-next-line no-alert + alert("您当前登录的账号没有权限访问此页面"); + closeWindow(); + } + else if ([0, 1, 6].includes(data?.type)) { const id = data.id; const name = data.corpName; const longitude = data.longitude; diff --git a/src/pages/Container/Map/js/usePeoplePosition.js b/src/pages/Container/Map/js/usePeoplePosition.js index 1e50a55..5f16a52 100644 --- a/src/pages/Container/Map/js/usePeoplePosition.js +++ b/src/pages/Container/Map/js/usePeoplePosition.js @@ -8,7 +8,11 @@ export default function usePeoplePosition(mapMethods, currentBranchOffice, onPeo const points = useRef([]); const wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:"; - const wsUrl = `${wsProtocol}//${process.env.app.API_HOST.replace(/^https?:\/\//, "")}/personnelPosition/ws/location?corpinfoId=${currentBranchOffice}`; + // 生产环境的接口地址由 index.html 在运行时注入 window.process,不能使用会在打包阶段被替换的 process.env。 + const apiHost = window.process.env.app.API_HOST + .replace(/^https?:\/\//, "") + .replace(/\/$/, ""); + const wsUrl = `${wsProtocol}//${apiHost}/personnelPosition/ws/location?corpinfoId=${currentBranchOffice}`; const onMessage = async (message) => { const data = JSON.parse(message.data);