Forráskód Böngészése

[Fix R3-10] 恢复 /modelreq 相对路径与 glob.wsUrl(去硬编码 IP:端口)

恢复被 7e9858ec 回退的 09-14 已采纳改动(依据 4b94efbd),并加固 VoiceBroadcast 两处 WS 协议改写:
- mxServerConfig.json saveDwgUrl / configurable.data.ts 3 处 mp4 / fileEdit.html api.js → 站点相对路径或运行时配置
- VoiceBroadcast(.Gsd).vue:恢复 useGlobSetting().wsUrl;协议改写锚定完整 URL(原 ?. 只作用于端口字面量从未生效);
  glob.wsUrl 缺失时回退 location.origin + '/modelreq' 并按 location.protocol 推导 ws/wss
- 未触碰免密/自动登录流程代码
lizuo 1 napja
szülő
commit
0cbede66eb

+ 5 - 2
public/fileEdit.html

@@ -7,8 +7,11 @@
 <body>
 
 <div id="fileEdit"></div>
-<!--// 页面引入document的api.js-->
-<script type="text/javascript" src="http://47.94.222.6:9050/web-apps/apps/api/documents/api.js"></script>
+<!--// 页面引入document的api.js([R3-10] 恢复 4b94efbd:原硬编码公网 OnlyOffice 地址(值见 git 历史,已失效)改为运行时配置下发:读 public/js/config.js 的 onlyOfficeUrl 反代前缀,与 src/utils/onlyOffice.ts 同约定,缺省回退 '/documents')-->
+<script type="text/javascript" src="/js/config.js"></script>
+<script type="text/javascript">
+    document.write('<script type="text/javascript" src="' + ((typeof VUE_APP_URL !== 'undefined' && VUE_APP_URL.onlyOfficeUrl) || '/documents') + '/web-apps/apps/api/documents/api.js"><\/script>');
+</script>
 <script>
 
     //office文件在线编辑、预览

+ 2 - 2
public/mxcad/mxServerConfig.json

@@ -23,8 +23,8 @@
 	"mxfilepath": "/mxcad/file/",
 	"?saveUrl": "保存文件服务地址",
 	"saveUrl": "http://localhost:1337/mxcad/savemxweb",
-	"?saveDwgUrl": "保存DWG文件服务地址",
-	"saveDwgUrl": "http://182.92.126.35:8092/modelreq/safety/cadFile/transformCadFileType",
+	"?saveDwgUrl": "保存DWG文件服务地址。原为硬编码旧云环境 IP:端口(值见 git 历史 4b94efbd),现恢复为站点相对路径:同源经 nginx /modelreq 反代至网关,换部署环境无需改代码",
+	"saveDwgUrl": "/modelreq/safety/cadFile/transformCadFileType",
 	"?printPdfUrl": "把指定范围输出到pdf的服务地址",
 	"printPdfUrl": "http://localhost:1337/mxcad/print_to_pdf",
     "?cutDwgUrl": "把指定范围输出到DWG的服务地址",

+ 8 - 2
src/layouts/default/header/components/VoiceBroadcast.vue

@@ -58,6 +58,7 @@
   import { usePermissionStore } from '/@/store/modules/permission';
   import SpeakVoice from './notify/speakVoice';
   import { useDrag } from '@/hooks/event/useDrag';
+  import { useGlobSetting } from '/@/hooks/setting';
   import dayjs from 'dayjs';
   export default defineComponent({
     name: 'VoiceBroadcast',
@@ -70,6 +71,7 @@
       const { hasPermission } = usePermission();
       const permissionStore = usePermissionStore();
       const router = useRouter();
+      const glob = useGlobSetting();
       const list = (params) => defHttp.get({ url: '/safety/ventanalyAlarmLog/list', params });
       const cleanAlarm = () => defHttp.get({ url: '/safety/ventanalyAlarmLog/cleanAlarmLog' });
       const activeKey = ref(0);
@@ -130,8 +132,12 @@
         let userId = unref(userStore.getUserInfo).id + '?token=' + token;
         console.log(userStore.getUserInfo, 'userId---');
         // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
-        // let url = glob.wsUrl?.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId;
-        let url = 'http://' + window.location.hostname + ':9999'?.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId;
+        // [R3-10] WS 端点恢复读运行时配置 glob.wsUrl(public/js/config.js 单点配置),去掉对网关端口的 http 硬编码直连。
+        // 原 'http://' + hostname + '<端口>'?.replace(...) 写法中 ?. 只作用于端口字面量,协议改写从未生效;
+        // 现把协议改写锚定在完整 URL 的协议头上。glob.wsUrl 缺失时回退 同源 /modelreq(nginx 反代至网关),
+        // 回退地址的协议取自 location.protocol,replace 后即得到正确的 ws/wss。
+        const wsBase = glob.wsUrl || window.location.origin + '/modelreq';
+        let url = wsBase.replace(/^https:\/\//, 'wss://').replace(/^http:\/\//, 'ws://') + '/websocket/' + userId;
         console.log(url, 'url------');
         connectWebSocket(url);
         onWebSocket(onWebSocketMessage);

+ 8 - 1
src/layouts/default/header/components/VoiceBroadcastGsd.vue

@@ -47,6 +47,7 @@
   import dayjs from 'dayjs';
 
   import { useDrag } from '@/hooks/event/useDrag';
+  import { useGlobSetting } from '/@/hooks/setting';
   export default defineComponent({
     name: 'VoiceBroadcast',
     components: { SoundOutlined, ClearOutlined, BellOutlined, WarningOutlined, CloseOutlined },
@@ -58,6 +59,7 @@
       const { hasPermission } = usePermission();
       const permissionStore = usePermissionStore();
       const router = useRouter();
+      const glob = useGlobSetting();
       const activeKey = ref(0);
       const isShowWarningBroad = ref(false);
       const isBroad = ref(false);
@@ -99,7 +101,12 @@
         // let userId = unref(userStore.getUserInfo).id + '_' + wsClientId;
         let userId = unref(userStore.getUserInfo).id + '?token=' + token;
         // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
-        let url = 'http://' + window.location.hostname + ':9999'?.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId;
+        // [R3-10] WS 端点恢复读运行时配置 glob.wsUrl(public/js/config.js 单点配置),去掉对网关端口的 http 硬编码直连。
+        // 原 'http://' + hostname + '<端口>'?.replace(...) 写法中 ?. 只作用于端口字面量,协议改写从未生效;
+        // 现把协议改写锚定在完整 URL 的协议头上。glob.wsUrl 缺失时回退 同源 /modelreq(nginx 反代至网关),
+        // 回退地址的协议取自 location.protocol,replace 后即得到正确的 ws/wss。
+        const wsBase = glob.wsUrl || window.location.origin + '/modelreq';
+        let url = wsBase.replace(/^https:\/\//, 'wss://').replace(/^http:\/\//, 'ws://') + '/websocket/' + userId;
         connectWebSocket(url);
         onWebSocket(onWebSocketMessage);
       }

+ 6 - 3
src/views/vent/home/configurable/configurable.data.ts

@@ -6510,7 +6510,8 @@ export const testConfigVent182: Config[] = [
       background: {
         show: true,
         type: 'video',
-        link: 'http://182.92.126.35:8092/modelreq/sys/common/static/webfile/mainFan.mp4',
+        // [R3-10] 原为硬编码旧云环境 IP:端口(值见 git 历史 4b94efbd),现恢复为站点相对路径:同源经 nginx /modelreq 反代,换环境无需改代码
+        link: '/modelreq/sys/common/static/webfile/mainFan.mp4',
       },
       layout: {
         direction: 'column',
@@ -6581,7 +6582,8 @@ export const testConfigVent182: Config[] = [
       background: {
         show: true,
         type: 'video',
-        link: 'http://182.92.126.35:8092/modelreq/sys/common/static/webfile/fanLocal.mp4',
+        // [R3-10] 原为硬编码旧云环境 IP:端口(值见 git 历史 4b94efbd),现恢复为站点相对路径:同源经 nginx /modelreq 反代,换环境无需改代码
+        link: '/modelreq/sys/common/static/webfile/fanLocal.mp4',
       },
       layout: {
         direction: 'column',
@@ -6652,7 +6654,8 @@ export const testConfigVent182: Config[] = [
       background: {
         show: true,
         type: 'video',
-        link: 'http://182.92.126.35:8092/modelreq/sys/common/static/webfile/gate.mp4',
+        // [R3-10] 原为硬编码旧云环境 IP:端口(值见 git 历史 4b94efbd),现恢复为站点相对路径:同源经 nginx /modelreq 反代,换环境无需改代码
+        link: '/modelreq/sys/common/static/webfile/gate.mp4',
       },
       layout: {
         direction: 'row',