|
|
@ -5,6 +5,7 @@ import { Message } from "element-ui"; |
|
|
|
import { |
|
|
|
getCameraStream, |
|
|
|
getNearCamera, |
|
|
|
getNearCameraNew, |
|
|
|
} from "@screen/pages/Home/components/RoadAndEvents/utils/httpList.js"; |
|
|
|
|
|
|
|
/** |
|
|
@ -63,13 +64,26 @@ async function getUrl({ camId, url, pileNum, rangeIndex } = {}) { |
|
|
|
if (url) return url; |
|
|
|
|
|
|
|
if (pileNum) { |
|
|
|
const { code, data } = await getNearCamera(pileNum).catch(() => ({})); |
|
|
|
if (code != 200 || !data?.length) { |
|
|
|
let code, data, cameraData; |
|
|
|
if (rangeIndex) { |
|
|
|
if (typeof rangeIndex === "string") |
|
|
|
cameraData = await getNearCameraNew(pileNum).catch(() => ({})); |
|
|
|
else cameraData = await getNearCamera(pileNum).catch(() => ({})); |
|
|
|
} else { |
|
|
|
cameraData = await getNearCamera(pileNum).catch(() => ({})); |
|
|
|
} |
|
|
|
code = cameraData.code; |
|
|
|
data = cameraData.data; |
|
|
|
// console.log(rangeIndex, "rangeIndex", cameraData);
|
|
|
|
if ( |
|
|
|
code != 200 || |
|
|
|
(Array.isArray(data) ? !data?.length : !Object.keys(data || {}).length) |
|
|
|
) { |
|
|
|
Message.warning("未获取到附近的相机信息"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
camId = data[rangeIndex || 0]?.camId; |
|
|
|
console.log(rangeIndex, "rangeIndex", data, data[rangeIndex], cameraData); |
|
|
|
} |
|
|
|
|
|
|
|
if (camId) { |
|
|
|