|
@@ -58,6 +58,7 @@
|
|
|
import { usePermissionStore } from '/@/store/modules/permission';
|
|
import { usePermissionStore } from '/@/store/modules/permission';
|
|
|
import SpeakVoice from './notify/speakVoice';
|
|
import SpeakVoice from './notify/speakVoice';
|
|
|
import { useDrag } from '@/hooks/event/useDrag';
|
|
import { useDrag } from '@/hooks/event/useDrag';
|
|
|
|
|
+ import { useGlobSetting } from '/@/hooks/setting';
|
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
name: 'VoiceBroadcast',
|
|
name: 'VoiceBroadcast',
|
|
@@ -70,6 +71,7 @@
|
|
|
const { hasPermission } = usePermission();
|
|
const { hasPermission } = usePermission();
|
|
|
const permissionStore = usePermissionStore();
|
|
const permissionStore = usePermissionStore();
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
|
+ const glob = useGlobSetting();
|
|
|
const list = (params) => defHttp.get({ url: '/safety/ventanalyAlarmLog/list', params });
|
|
const list = (params) => defHttp.get({ url: '/safety/ventanalyAlarmLog/list', params });
|
|
|
const cleanAlarm = () => defHttp.get({ url: '/safety/ventanalyAlarmLog/cleanAlarmLog' });
|
|
const cleanAlarm = () => defHttp.get({ url: '/safety/ventanalyAlarmLog/cleanAlarmLog' });
|
|
|
const activeKey = ref(0);
|
|
const activeKey = ref(0);
|
|
@@ -130,8 +132,12 @@
|
|
|
let userId = unref(userStore.getUserInfo).id + '?token=' + token;
|
|
let userId = unref(userStore.getUserInfo).id + '?token=' + token;
|
|
|
console.log(userStore.getUserInfo, 'userId---');
|
|
console.log(userStore.getUserInfo, 'userId---');
|
|
|
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
|
|
// 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------');
|
|
console.log(url, 'url------');
|
|
|
connectWebSocket(url);
|
|
connectWebSocket(url);
|
|
|
onWebSocket(onWebSocketMessage);
|
|
onWebSocket(onWebSocketMessage);
|