diff --git a/public/config/config.json b/public/config/config.json index 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/public/config/config.json b/public/config/config.json index 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/src/api/monitor/media.ts b/src/api/monitor/media.ts index 57034fd..d0f9980 100644 --- a/src/api/monitor/media.ts +++ b/src/api/monitor/media.ts @@ -12,8 +12,9 @@ } // 拉取流 -export function getMediaStream(deviceId: string, channelId: string, accessToken: string) { +export function getMediaStream(deviceId: string, channelId: string, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: `api/play/start/${channelId}/${deviceId}`, headers: { 'access-token': accessToken }, method: 'get', diff --git a/public/config/config.json b/public/config/config.json index 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/src/api/monitor/media.ts b/src/api/monitor/media.ts index 57034fd..d0f9980 100644 --- a/src/api/monitor/media.ts +++ b/src/api/monitor/media.ts @@ -12,8 +12,9 @@ } // 拉取流 -export function getMediaStream(deviceId: string, channelId: string, accessToken: string) { +export function getMediaStream(deviceId: string, channelId: string, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: `api/play/start/${channelId}/${deviceId}`, headers: { 'access-token': accessToken }, method: 'get', diff --git a/src/views/alarm/policyConfig/monitorPoint/editDialog.vue b/src/views/alarm/policyConfig/monitorPoint/editDialog.vue index f0f5bcd..c83d096 100644 --- a/src/views/alarm/policyConfig/monitorPoint/editDialog.vue +++ b/src/views/alarm/policyConfig/monitorPoint/editDialog.vue @@ -15,8 +15,10 @@ import { getMediaStream, getMediaToken } from '@/api/monitor/media' import { getDictByCode } from '@/api/system/dict' import { useCheckList } from '@/utils/useCheckList' +import useUserStore from '@/store/modules/user' // 用户信息 import { getBoxList, getModelList, getRecognitionList, getSceneList, updateMonitorPoint } from '@/api/alarm/policyConfig/monitorPoint' const emits = defineEmits(['closeRefresh']) +const user = useUserStore() const dialogStatus = ref('add') const baseurl = ref(window.location.href.split('/#')[0]) const timer = ref() // gm取流定时器 @@ -88,8 +90,12 @@ // --------------------------------------------字典--------------------------------------- const mediaServerIdMapList: any = ref([]) // 流媒体id const isProxyStreamList: any = ref([]) // 是否是代理流 +const wvpConfigList: any = ref([]) // 获取字典值 async function getDict() { + // 是否加急 + const res = await getDictByCode('wvpConfig') + wvpConfigList.value = res.data // 可选决策项 const response = await getDictByCode('mediaServerIdMap') if (response && response.data && response.data.length) { @@ -101,7 +107,9 @@ }) } getDict() -// ---------------------------------------------------------------------------------------- + +// -------------------------------------------字典------------------------------------------ + // ------------------------------------------------------------------------------------------- const edgeDeviceList: any = ref([]) // 边缘设备列表 const sceneList: any = ref([]) // 业务场景列表 @@ -755,8 +763,16 @@ // 获取流媒体token const response = await getMediaToken() mediaToken.value = response.data + + await getDict() + let url = '' + const index = wvpConfigList.value.findIndex((item: { name: string }) => item.name === user.deptId) + + if (index !== -1) { + url = `${wvpConfigList.value[0].value}://${wvpConfigList.value[index].value.replace('$', ':')}` + } // 取流 - const res = await getMediaStream(deviceId, channelId, mediaToken.value) + const res = await getMediaStream(deviceId, channelId, mediaToken.value, url) if (res && res.data) { mediaUrl.value = res.data.flv } @@ -810,6 +826,7 @@ if (currentStreamId.value) { handleStopStream(currentStreamId.value) } + // 获取视频流接口 fetchStream(cameraIndexCode).then((res: any) => { const { url, createStreamResponseId } = res diff --git a/public/config/config.json b/public/config/config.json index 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/src/api/monitor/media.ts b/src/api/monitor/media.ts index 57034fd..d0f9980 100644 --- a/src/api/monitor/media.ts +++ b/src/api/monitor/media.ts @@ -12,8 +12,9 @@ } // 拉取流 -export function getMediaStream(deviceId: string, channelId: string, accessToken: string) { +export function getMediaStream(deviceId: string, channelId: string, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: `api/play/start/${channelId}/${deviceId}`, headers: { 'access-token': accessToken }, method: 'get', diff --git a/src/views/alarm/policyConfig/monitorPoint/editDialog.vue b/src/views/alarm/policyConfig/monitorPoint/editDialog.vue index f0f5bcd..c83d096 100644 --- a/src/views/alarm/policyConfig/monitorPoint/editDialog.vue +++ b/src/views/alarm/policyConfig/monitorPoint/editDialog.vue @@ -15,8 +15,10 @@ import { getMediaStream, getMediaToken } from '@/api/monitor/media' import { getDictByCode } from '@/api/system/dict' import { useCheckList } from '@/utils/useCheckList' +import useUserStore from '@/store/modules/user' // 用户信息 import { getBoxList, getModelList, getRecognitionList, getSceneList, updateMonitorPoint } from '@/api/alarm/policyConfig/monitorPoint' const emits = defineEmits(['closeRefresh']) +const user = useUserStore() const dialogStatus = ref('add') const baseurl = ref(window.location.href.split('/#')[0]) const timer = ref() // gm取流定时器 @@ -88,8 +90,12 @@ // --------------------------------------------字典--------------------------------------- const mediaServerIdMapList: any = ref([]) // 流媒体id const isProxyStreamList: any = ref([]) // 是否是代理流 +const wvpConfigList: any = ref([]) // 获取字典值 async function getDict() { + // 是否加急 + const res = await getDictByCode('wvpConfig') + wvpConfigList.value = res.data // 可选决策项 const response = await getDictByCode('mediaServerIdMap') if (response && response.data && response.data.length) { @@ -101,7 +107,9 @@ }) } getDict() -// ---------------------------------------------------------------------------------------- + +// -------------------------------------------字典------------------------------------------ + // ------------------------------------------------------------------------------------------- const edgeDeviceList: any = ref([]) // 边缘设备列表 const sceneList: any = ref([]) // 业务场景列表 @@ -755,8 +763,16 @@ // 获取流媒体token const response = await getMediaToken() mediaToken.value = response.data + + await getDict() + let url = '' + const index = wvpConfigList.value.findIndex((item: { name: string }) => item.name === user.deptId) + + if (index !== -1) { + url = `${wvpConfigList.value[0].value}://${wvpConfigList.value[index].value.replace('$', ':')}` + } // 取流 - const res = await getMediaStream(deviceId, channelId, mediaToken.value) + const res = await getMediaStream(deviceId, channelId, mediaToken.value, url) if (res && res.data) { mediaUrl.value = res.data.flv } @@ -810,6 +826,7 @@ if (currentStreamId.value) { handleStopStream(currentStreamId.value) } + // 获取视频流接口 fetchStream(cameraIndexCode).then((res: any) => { const { url, createStreamResponseId } = res diff --git a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue index d533d56..b3c31ae 100644 --- a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue +++ b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue @@ -55,6 +55,17 @@ const alarmResultList = ref([]) as any // 报警结果列表 const alarmCount = ref(0) // 当日报警数 +// -------------------------------------------字典------------------------------------------ +const wvpConfigList: any = ref([]) + +// 获取字典值 +async function getDict() { + // 是否加急 + const res = await getDictByCode('wvpConfig') + wvpConfigList.value = res.data +} +// ---------------------------------------------------------------------------------------- + const resize = () => { const divPlugin = document.getElementById('home') as any console.log(divPlugin) @@ -158,7 +169,14 @@ // 拉取流(流媒体) async function fetchMediaStream(deviceId: string, channelId: string) { loading.value = true - const res = await getMediaStream(deviceId, channelId, mediaToken.value) + await getDict() + let url = '' + const index = wvpConfigList.value.findIndex((item: { name: string }) => item.name === user.deptId) + + if (index !== -1) { + url = `${wvpConfigList.value[0].value}://${wvpConfigList.value[index].value.replace('$', ':')}` + } + const res = await getMediaStream(deviceId, channelId, mediaToken.value, url) loading.value = false if (res && res.data) { return res.data.ws_flv @@ -290,15 +308,6 @@ } } -// -------------------------------------------字典------------------------------------------ -const wvpConfigList: any = ref([]) - -// 获取字典值 -async function getDict() { - // 是否加急 - const res = await getDictByCode('wvpConfig') - wvpConfigList.value = res.data -} // --------------------------------------------sm获取识别流地址----------------------------------------------- // 开启盒子设备流 async function controlBoxOpen(boxId: string, recognitionGb: string) { diff --git a/public/config/config.json b/public/config/config.json index 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/src/api/monitor/media.ts b/src/api/monitor/media.ts index 57034fd..d0f9980 100644 --- a/src/api/monitor/media.ts +++ b/src/api/monitor/media.ts @@ -12,8 +12,9 @@ } // 拉取流 -export function getMediaStream(deviceId: string, channelId: string, accessToken: string) { +export function getMediaStream(deviceId: string, channelId: string, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: `api/play/start/${channelId}/${deviceId}`, headers: { 'access-token': accessToken }, method: 'get', diff --git a/src/views/alarm/policyConfig/monitorPoint/editDialog.vue b/src/views/alarm/policyConfig/monitorPoint/editDialog.vue index f0f5bcd..c83d096 100644 --- a/src/views/alarm/policyConfig/monitorPoint/editDialog.vue +++ b/src/views/alarm/policyConfig/monitorPoint/editDialog.vue @@ -15,8 +15,10 @@ import { getMediaStream, getMediaToken } from '@/api/monitor/media' import { getDictByCode } from '@/api/system/dict' import { useCheckList } from '@/utils/useCheckList' +import useUserStore from '@/store/modules/user' // 用户信息 import { getBoxList, getModelList, getRecognitionList, getSceneList, updateMonitorPoint } from '@/api/alarm/policyConfig/monitorPoint' const emits = defineEmits(['closeRefresh']) +const user = useUserStore() const dialogStatus = ref('add') const baseurl = ref(window.location.href.split('/#')[0]) const timer = ref() // gm取流定时器 @@ -88,8 +90,12 @@ // --------------------------------------------字典--------------------------------------- const mediaServerIdMapList: any = ref([]) // 流媒体id const isProxyStreamList: any = ref([]) // 是否是代理流 +const wvpConfigList: any = ref([]) // 获取字典值 async function getDict() { + // 是否加急 + const res = await getDictByCode('wvpConfig') + wvpConfigList.value = res.data // 可选决策项 const response = await getDictByCode('mediaServerIdMap') if (response && response.data && response.data.length) { @@ -101,7 +107,9 @@ }) } getDict() -// ---------------------------------------------------------------------------------------- + +// -------------------------------------------字典------------------------------------------ + // ------------------------------------------------------------------------------------------- const edgeDeviceList: any = ref([]) // 边缘设备列表 const sceneList: any = ref([]) // 业务场景列表 @@ -755,8 +763,16 @@ // 获取流媒体token const response = await getMediaToken() mediaToken.value = response.data + + await getDict() + let url = '' + const index = wvpConfigList.value.findIndex((item: { name: string }) => item.name === user.deptId) + + if (index !== -1) { + url = `${wvpConfigList.value[0].value}://${wvpConfigList.value[index].value.replace('$', ':')}` + } // 取流 - const res = await getMediaStream(deviceId, channelId, mediaToken.value) + const res = await getMediaStream(deviceId, channelId, mediaToken.value, url) if (res && res.data) { mediaUrl.value = res.data.flv } @@ -810,6 +826,7 @@ if (currentStreamId.value) { handleStopStream(currentStreamId.value) } + // 获取视频流接口 fetchStream(cameraIndexCode).then((res: any) => { const { url, createStreamResponseId } = res diff --git a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue index d533d56..b3c31ae 100644 --- a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue +++ b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue @@ -55,6 +55,17 @@ const alarmResultList = ref([]) as any // 报警结果列表 const alarmCount = ref(0) // 当日报警数 +// -------------------------------------------字典------------------------------------------ +const wvpConfigList: any = ref([]) + +// 获取字典值 +async function getDict() { + // 是否加急 + const res = await getDictByCode('wvpConfig') + wvpConfigList.value = res.data +} +// ---------------------------------------------------------------------------------------- + const resize = () => { const divPlugin = document.getElementById('home') as any console.log(divPlugin) @@ -158,7 +169,14 @@ // 拉取流(流媒体) async function fetchMediaStream(deviceId: string, channelId: string) { loading.value = true - const res = await getMediaStream(deviceId, channelId, mediaToken.value) + await getDict() + let url = '' + const index = wvpConfigList.value.findIndex((item: { name: string }) => item.name === user.deptId) + + if (index !== -1) { + url = `${wvpConfigList.value[0].value}://${wvpConfigList.value[index].value.replace('$', ':')}` + } + const res = await getMediaStream(deviceId, channelId, mediaToken.value, url) loading.value = false if (res && res.data) { return res.data.ws_flv @@ -290,15 +308,6 @@ } } -// -------------------------------------------字典------------------------------------------ -const wvpConfigList: any = ref([]) - -// 获取字典值 -async function getDict() { - // 是否加急 - const res = await getDictByCode('wvpConfig') - wvpConfigList.value = res.data -} // --------------------------------------------sm获取识别流地址----------------------------------------------- // 开启盒子设备流 async function controlBoxOpen(boxId: string, recognitionGb: string) { diff --git a/src/views/monitor/realTime/index-media-single.vue b/src/views/monitor/realTime/index-media-single.vue index a69258d..5b3ef6a 100644 --- a/src/views/monitor/realTime/index-media-single.vue +++ b/src/views/monitor/realTime/index-media-single.vue @@ -6,7 +6,10 @@ import { videoTree } from '@/api/monitor/broadcast' import { analyzeFLVFirstFrame } from '@/utils/firstIframeTest' import jessibuca from '@/views/bigScreen/jessibuca.vue' +import { getDictByCode } from '@/api/system/dict' import { analyzeFLV } from '@/utils/sustainIframeTest' +import useUserStore from '@/store/modules/user' +const user = useUserStore() // 用户信息 // import const router = useRouter() const baseurl = ref(window.location.href.split('/#')[0]) @@ -42,6 +45,16 @@ width.value = divPlugin.clientWidth height.value = divPlugin.clientHeight - 5 } +// -------------------------------------------字典------------------------------------------ +const wvpConfigList: any = ref([]) + +// 获取字典值 +async function getDict() { + // 是否加急 + const res = await getDictByCode('wvpConfig') + wvpConfigList.value = res.data +} +// --------------------------------------------------------------------------------------- function filterNode(value: any, data: { name: string | any[] }) { if (value === '' || value === null) { @@ -100,7 +113,14 @@ // 拉取流 async function fetchMediaStream(deviceId: string, channelId: string) { loading.value = true - const res = await getMediaStream(deviceId, channelId, mediaToken.value) + await getDict() + let url = '' + const index = wvpConfigList.value.findIndex((item: { name: string }) => item.name === user.deptId) + + if (index !== -1) { + url = `${wvpConfigList.value[0].value}://${wvpConfigList.value[index].value.replace('$', ':')}` + } + const res = await getMediaStream(deviceId, channelId, mediaToken.value, url) loading.value = false if (res && res.data) { return res.data.ws_flv || res.data.flv @@ -149,7 +169,7 @@ * @param {Array} data - 包含组织和设备节点的 JSON 数组 * @returns {Array} 修改后的原始数据数组(直接修改对象引用) */ - function injectDeviceCounts(data: any[]): any { +function injectDeviceCounts(data: any[]): any { // ---------------------- 步骤 1:构建组织节点映射表 ---------------------- // const orgMap = new Map() // 使用 Map 存储组织节点,便于快速查找