diff --git a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx
index 8816200..4230970 100644
--- a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx
@@ -8,7 +8,7 @@ import { Button, ToastFactory, } from '@douyinfe/semi-ui';
import VideoHeader from './voiceHeader'
import VideoOperation from './videoOperation'
import './videoPlay.less';
-import EZUIKit from 'ezuikit-js'
+import EZUIKit, { log } from 'ezuikit-js'
import { done } from "nprogress";
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
@@ -18,492 +18,493 @@ const yingshiOpenSoundKey = 'openSound'
const VideoPlay = ({
- height, width, containerId = 'myPlayer',
- // playUrl,
- name,
- global,
- videoStyle,
- changeData,
- videoObj,
- sizeWh,
- slideDown, //视频下方操作是否滑动
- IsSize, //是否按照16:9的比例播放
- // videoObj = {
- // type: 'yingshi',
- // audio: false,
- // serialNo: 'G75922040', // 设备序列号 必须
- // channelNo: 1, //
- // yingshiToken: 'at.6nn6duwz8g8gbd919as9a6ea82bmn31x-709fnp7s3k-13q3v7e-mlov7lysf', // 萤石必须
- // playUrlSd: 'ezopen://open.ys7.com/G75922040/1.live', // 必须
- // // playUrl: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000003',
- // playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live',
- // replayUrl: 'ezopen://open.ys7.com/G75922040/1.hd.local.rec',
- // },
- // videoObj = {
- // type: 'yingshi',
- // audio: false,
- // serialNo: 'G56385051', // 设备序列号 必须
- // channelNo: 1, //
- // yingshiToken: 'at.6nn6duwz8g8gbd919as9a6ea82bmn31x-709fnp7s3k-13q3v7e-mlov7lysf', // 萤石必须
- // playUrlSd: 'ezopen://open.ys7.com/G56384814/1.live', // 必须
- // // playUrl: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000003',
- // playUrlHd: 'ezopen://open.ys7.com/G56384814/1.hd.live',
- // replayUrl: 'ezopen://open.ys7.com/G56384814/1.hd.local.rec',
- // },
-
- // videoObj = {
- // type: 'cascade',
- // audio: false,
- // serialNo: '34020000001310000001', // 设备序列号 必须
- // topSerialNo: '34020000001110000077', // 设备顶级序列号 必须
- // playUrlSd: 'http://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000001', // 必须
- // // playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live',
- // // replayUrl: 'ezopen://open.ys7.com/G75922040/1.rec',
- // },
-
- //
- iotVideoServer,
- local, //是否本地调用视频
+ height, width, containerId = 'myPlayer',
+ // playUrl,
+ name,
+ global,
+ videoStyle,
+ changeData,
+ videoObj,
+ sizeWh,
+ slideDown, //视频下方操作是否滑动
+ IsSize, //是否按照16:9的比例播放
+ // videoObj = {
+ // type: 'yingshi',
+ // audio: false,
+ // serialNo: 'G75922040', // 设备序列号 必须
+ // channelNo: 1, //
+ // yingshiToken: 'at.6nn6duwz8g8gbd919as9a6ea82bmn31x-709fnp7s3k-13q3v7e-mlov7lysf', // 萤石必须
+ // playUrlSd: 'ezopen://open.ys7.com/G75922040/1.live', // 必须
+ // // playUrl: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000003',
+ // playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live',
+ // replayUrl: 'ezopen://open.ys7.com/G75922040/1.hd.local.rec',
+ // },
+ // videoObj = {
+ // type: 'yingshi',
+ // audio: false,
+ // serialNo: 'G56385051', // 设备序列号 必须
+ // channelNo: 1, //
+ // yingshiToken: 'at.6nn6duwz8g8gbd919as9a6ea82bmn31x-709fnp7s3k-13q3v7e-mlov7lysf', // 萤石必须
+ // playUrlSd: 'ezopen://open.ys7.com/G56384814/1.live', // 必须
+ // // playUrl: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000003',
+ // playUrlHd: 'ezopen://open.ys7.com/G56384814/1.hd.live',
+ // replayUrl: 'ezopen://open.ys7.com/G56384814/1.hd.local.rec',
+ // },
+
+ // videoObj = {
+ // type: 'cascade',
+ // audio: false,
+ // serialNo: '34020000001310000001', // 设备序列号 必须
+ // topSerialNo: '34020000001110000077', // 设备顶级序列号 必须
+ // playUrlSd: 'http://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000001', // 必须
+ // // playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live',
+ // // replayUrl: 'ezopen://open.ys7.com/G75922040/1.rec',
+ // },
+
+ //
+ iotVideoServer,
+ local, //是否本地调用视频
}) => {
- console.log(videoObj);
- if (videoObj.type == 'yingshi') {
- videoObj = {
- ...videoObj,
- playUrlSd: `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.live`,
- playUrlHd: `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.hd.live`,
- replayUrl: `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.hd.local.rec`,
- }
- }
-
-
- const [jessibuca, setjessibuca] = useState(null)
- const [player, setPlayer] = useState(null)
- const [isPlaying, setIsPlaying] = useState(false)
- const [operationState, setoperationState] = useState()
- const [voiceDisY, setVoiceDisY] = useState(0)
- const [processDisX, setProcessDisX] = useState(0)
- const [isAdjustProcess, setIsAdjustProcess] = useState(false)
- const [histroyTime, setHistroyTime] = useState([])
- const [histroyBegain, setHistroyBegain] = useState()
- const [roll, setRoll] = useState()//滚动备注
- const [photo, setPhoto] = useState(1)//滚动备注
- const [size, setSize] = useState({ parentWidth: sizeWh?.parentWidth, parentHeight: sizeWh?.parentHeight, width: width || sizeWh?.parentWidth, height: height || sizeWh?.parentHeight }) //视频本身和父级尺寸
- const [resolution, setResolution] = useState('sd') // 标清 sd 高清 hd
- const [videoMask, setVideoMask] = useState(true) // 标清 sd 高清 hd
-
-
- // 标记萤石操作中,等待ifream返回信息后清空
- const [yingshiPrepare, setYingshiPrepare] = useState('')
-
- const operationRef = useRef(null)
- const Begain = useRef()
- const playBackTime = useRef([])
- const quanp = useRef()
- const processChangeTimeoutRef = useRef(null)
- // 标记萤石操作中,等待ifream返回信息后清空
- const yingshiPrepareRef = useRef(null)
- const playState = useRef(false) //播放状态
- const player_ = useRef(null)
-
- useEffect(() => {
- setRoll(false)
- }, [resolution]);
-
-
- useEffect(() => {
- setResolution(changeData?.hdChecked ? 'hd' : 'sd')
- if (player) {
- player.stop().then(() => {
- player.play({ url: changeData?.hdChecked ? videoObj.playUrlHd : videoObj.playUrlSd })
- })
- }
- }, [changeData?.hdChecked])
-
- const changeSelectState = (key) => {
- // if (videoObj.type == 'yingshi' && yingshiPrepareRef.current) {
- // return
- // }
- const nextOperationState = JSON.parse(JSON.stringify(operationRef.current))
- if (key == 'histroy' && nextOperationState.histroy.select) {
- // 取消历史播放
- setProcessDisX(0)
- setHistroyTime([])
- playBackTime.current = []
- }
-
- for (let k in nextOperationState) {
- if (k == key) {
- nextOperationState[k].select = !nextOperationState[k].select
- } else if (k !== 'fullScreen') {
- nextOperationState[k].select = false
+ // console.log(sizeWh,videoObj);
+ if (videoObj.type == 'yingshi') {
+ videoObj = {
+ ...videoObj,
+ playUrlSd: `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.live`,
+ playUrlHd: `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.hd.live`,
+ replayUrl: `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.hd.local.rec`,
+ }
+ }
+
+
+ const [jessibuca, setjessibuca] = useState(null)
+ const [player, setPlayer] = useState(null)
+ const [isPlaying, setIsPlaying] = useState(false)
+ const [operationState, setoperationState] = useState()
+ const [voiceDisY, setVoiceDisY] = useState(0)
+ const [processDisX, setProcessDisX] = useState(0)
+ const [isAdjustProcess, setIsAdjustProcess] = useState(false)
+ const [histroyTime, setHistroyTime] = useState([])
+ const [histroyBegain, setHistroyBegain] = useState()
+ const [roll, setRoll] = useState()//滚动备注
+ const [photo, setPhoto] = useState(1)//滚动备注
+ const [size, setSize] = useState({ parentWidth: sizeWh?.parentWidth, parentHeight: sizeWh?.parentHeight, width: width || sizeWh?.parentWidth, height: height || sizeWh?.parentHeight }) //视频本身和父级尺寸
+ const [resolution, setResolution] = useState('sd') // 标清 sd 高清 hd
+ const [videoMask, setVideoMask] = useState(true) // 标清 sd 高清 hd
+
+
+ // 标记萤石操作中,等待ifream返回信息后清空
+ const [yingshiPrepare, setYingshiPrepare] = useState('')
+
+ const operationRef = useRef(null)
+ const Begain = useRef()
+ const playBackTime = useRef([])
+ const quanp = useRef()
+ const processChangeTimeoutRef = useRef(null)
+ // 标记萤石操作中,等待ifream返回信息后清空
+ const yingshiPrepareRef = useRef(null)
+ const playState = useRef(false) //播放状态
+ const player_ = useRef(null)
+
+ useEffect(() => {
+ setRoll(false)
+ }, [resolution]);
+
+
+ useEffect(() => {
+ setResolution(changeData?.hdChecked ? 'hd' : 'sd')
+ if (player) {
+ player.stop().then(() => {
+ player.play({ url: changeData?.hdChecked ? videoObj.playUrlHd : videoObj.playUrlSd })
+ })
+ }
+ }, [changeData?.hdChecked])
+
+ const changeSelectState = (key) => {
+ // if (videoObj.type == 'yingshi' && yingshiPrepareRef.current) {
+ // return
+ // }
+ const nextOperationState = JSON.parse(JSON.stringify(operationRef.current))
+ if (key == 'histroy' && nextOperationState.histroy.select) {
+ // 取消历史播放
+ setProcessDisX(0)
+ setHistroyTime([])
+ playBackTime.current = []
+ }
+
+ for (let k in nextOperationState) {
+ if (k == key) {
+ nextOperationState[k].select = !nextOperationState[k].select
+ } else if (k !== 'fullScreen') {
+ nextOperationState[k].select = false
+ }
+ }
+ operationRef.current = nextOperationState
+
+ if (operationRef.current.histroy.select && histroyTime.length == 0) {
+ setHistroyTime([moment().subtract(72, 'hours').format(timeFormat), moment().format(timeFormat)])
+ playBackTime.current = [moment().subtract(72, 'hours').format(timeFormat), moment().format(timeFormat)]
+ }
+ setoperationState(nextOperationState)
+ }
+
+ // 实时播放左下方操作栏内容
+ const operation = [{
+ key: 'control',
+ click: () => {
+ changeSelectState('control')
+ }
+ }, {
+ key: 'talk',
+ hide: !(videoObj.type == 'yingshi'),
+ click: (e) => {
+ console.log(e);
+ changeSelectState('talk')
+ }
+ }, {
+ key: 'fullScreen',
+ click: () => {
+ changeSelectState('fullScreen')
+ let videoplay = document.getElementById('vcmp_videoplay')
+ if (screenfull.isEnabled) {
+ screenfull.toggle(videoplay);
+ if (videoObj?.type == 'yingshi' && player) {
+ if (operationRef.current?.fullScreen.select) {
+ console.log(5515);
+ player.reSize(screen.width, screen.height);
+ } else {
+ console.log(5515);
+
+ player.reSize(size?.width, size?.height);
+ }
}
- }
- operationRef.current = nextOperationState
-
- if (operationRef.current.histroy.select && histroyTime.length == 0) {
- setHistroyTime([moment().subtract(72, 'hours').format(timeFormat), moment().format(timeFormat)])
- playBackTime.current = [moment().subtract(72, 'hours').format(timeFormat), moment().format(timeFormat)]
- }
- setoperationState(nextOperationState)
- }
-
- // 实时播放左下方操作栏内容
- const operation = [{
- key: 'control',
- click: () => {
- changeSelectState('control')
- }
- }, {
- key: 'talk',
- hide: !(videoObj.type == 'yingshi'),
- click: (e) => {
- console.log(e);
- changeSelectState('talk')
- }
- }, {
- key: 'fullScreen',
- click: () => {
- changeSelectState('fullScreen')
- let videoplay = document.getElementById('vcmp_videoplay')
- if (screenfull.isEnabled) {
- screenfull.toggle(videoplay);
- if (videoObj?.type == 'yingshi') {
- console.log(operationRef.current);
- if (operationRef.current?.fullScreen.select) {
- player.reSize(screen.width, screen.height);
- } else {
- player.reSize(size?.width, size?.height);
- }
- }
+ }
+ }
+ }, {
+ key: 'histroy',
+ hide: !Boolean(videoObj.replayUrl),
+ click: () => {
+ changeSelectState('histroy')
+ player.stop().then(() => {
+ if (operationRef.current?.histroy?.select && Begain.current) {
+ player.play({ url: `${videoObj.replayUrl}?begin=${moment(Begain.current).format("YYYYMMDDHHmmss")}&end=${moment(playBackTime.current[1]).format("YYYYMMDDHHmmss")}` })
+ }
+ playState.current = false
+ })
+ }
+ },]
+
+ // useEffect(() => {
+ // createPlay()
+ // }, [quanp.current])
+
+ useEffect(() => {
+ createPlay()
+ let nextOperationState = {}
+ for (let p of operation) {
+ nextOperationState[p.key] = {
+ select: false
+ }
+ }
+ setoperationState(nextOperationState)
+ operationRef.current = nextOperationState
+
+ // 全屏状态监听
+ screenfull.on('change', () => {
+ if (screenfull.isFullscreen && operationRef.current && !operationRef.current['fullScreen'].select) {
+ changeSelectState('fullScreen')
+ }
+ if (!screenfull.isFullscreen && operationRef.current && operationRef.current['fullScreen'].select) {
+ changeSelectState('fullScreen')
+ }
+ });
+ // const resize_ = () => {
+ // const VideoLocal = document.getElementById('vcmp_videoplay')
+ // setSize({ parentWidth: VideoLocal?.clientWidth, parentHeight: VideoLocal?.clientHeight, width: VideoLocal?.clientWidth, height: VideoLocal?.clientHeight })
+
+ // }
+ // if (local) {
+ // window.addEventListener('resize', resize_); //只要窗口殴大小发生像素变化就会触发
+ // }
+ return () => {
+ console.log(854453453);
+ if (jessibuca) {
+ jessibuca.destroy()
+ }
+ if (player && videoObj.type == 'yingshi') {
+ console.log(854453453);
+ player.stop()
+ }
+ // if (local) {
+ // window.removeEventListener('resize', resize_);
+ // }
+ }
+ }, [])
+
+ useEffect(() => {
+ if (histroyTime.length) {
+ setHistroyBegain(histroyTime[0])
+ Begain.current = histroyTime[0]
+ document.getElementById('process_point').style.left = 0 + 'px'; // 重置进度条的位置
+ if (videoObj.type == 'yingshi') {
+ // yingshiPrepareRef.current = 'play'
+ // setYingshiPrepare('play')
+ }
+ } else {
+ setHistroyBegain(null)
+ Begain.current == null
+ }
+ }, [histroyTime])
+ useEffect(() => {
+ if (operationState && operationState.histroy.select) {
+ if (isAdjustProcess) {
+ // 调整进度条 更新播放开始时间
+ if (processChangeTimeoutRef.current) {
+ clearTimeout(processChangeTimeoutRef.current)
}
- }
- }, {
- key: 'histroy',
- hide: !Boolean(videoObj.replayUrl),
- click: () => {
- changeSelectState('histroy')
+ processChangeTimeoutRef.current = setTimeout(() => {
+ setHistroyBegain(
+ moment(histroyTime[0])
+ .add(
+ Math.abs(moment(histroyTime[0]).diff(moment(histroyTime[1]), 'seconds')) * (processDisX / document.getElementById('process_point').parentElement.offsetWidth),
+ 'second'
+ )
+ .format(timeFormat)
+ )
+ Begain.current = moment(histroyTime[0])
+ .add(
+ Math.abs(moment(histroyTime[0]).diff(moment(histroyTime[1]), 'seconds')) * (processDisX / document.getElementById('process_point').parentElement.offsetWidth),
+ 'second'
+ )
+ .format(timeFormat)
+ if (videoObj.type == 'yingshi') {
+ // yingshiPrepareRef.current = 'play'
+ // setYingshiPrepare('play')
+ }
+ }, 300)
player.stop().then(() => {
- if (operationRef.current?.histroy?.select && Begain.current) {
- player.play({ url: `${videoObj.replayUrl}?begin=${moment(Begain.current).format("YYYYMMDDHHmmss")}&end=${moment(playBackTime.current[1]).format("YYYYMMDDHHmmss")}` })
- }
- playState.current = false
+ player.play({ url: `${videoObj.replayUrl}?begin=${moment(Begain.current).format("YYYYMMDDHHmmss")}&end=${moment(playBackTime.current[1]).format("YYYYMMDDHHmmss")}` })
+ playState.current = false
})
- }
- },]
-
- // useEffect(() => {
- // createPlay()
- // }, [quanp.current])
-
- useEffect(() => {
- createPlay()
- let nextOperationState = {}
- for (let p of operation) {
- nextOperationState[p.key] = {
- select: false
- }
- }
- setoperationState(nextOperationState)
- operationRef.current = nextOperationState
-
- // 全屏状态监听
- screenfull.on('change', () => {
- if (screenfull.isFullscreen && operationRef.current && !operationRef.current['fullScreen'].select) {
- changeSelectState('fullScreen')
- }
- if (!screenfull.isFullscreen && operationRef.current && operationRef.current['fullScreen'].select) {
- changeSelectState('fullScreen')
- }
- });
- // const resize_ = () => {
- // const VideoLocal = document.getElementById('vcmp_videoplay')
- // setSize({ parentWidth: VideoLocal?.clientWidth, parentHeight: VideoLocal?.clientHeight, width: VideoLocal?.clientWidth, height: VideoLocal?.clientHeight })
-
- // }
- // if (local) {
- // window.addEventListener('resize', resize_); //只要窗口殴大小发生像素变化就会触发
- // }
- return () => {
- if (jessibuca) {
- jessibuca.destroy()
- }
- if (player && videoObj.type == 'yingshi' && player) {
- console.log(11111111111);
- player.stop()
- }
- // if (local) {
- // window.removeEventListener('resize', resize_);
- // }
- }
- }, [])
-
- useEffect(() => {
- if (histroyTime.length) {
- setHistroyBegain(histroyTime[0])
- Begain.current = histroyTime[0]
- document.getElementById('process_point').style.left = 0 + 'px'; // 重置进度条的位置
- if (videoObj.type == 'yingshi') {
- // yingshiPrepareRef.current = 'play'
- // setYingshiPrepare('play')
- }
- } else {
- setHistroyBegain(null)
- Begain.current == null
- }
- }, [histroyTime])
- useEffect(() => {
- if (operationState && operationState.histroy.select) {
- if (isAdjustProcess) {
- // 调整进度条 更新播放开始时间
- if (processChangeTimeoutRef.current) {
- clearTimeout(processChangeTimeoutRef.current)
- }
- processChangeTimeoutRef.current = setTimeout(() => {
- setHistroyBegain(
- moment(histroyTime[0])
- .add(
- Math.abs(moment(histroyTime[0]).diff(moment(histroyTime[1]), 'seconds')) * (processDisX / document.getElementById('process_point').parentElement.offsetWidth),
- 'second'
- )
- .format(timeFormat)
- )
- Begain.current = moment(histroyTime[0])
- .add(
- Math.abs(moment(histroyTime[0]).diff(moment(histroyTime[1]), 'seconds')) * (processDisX / document.getElementById('process_point').parentElement.offsetWidth),
- 'second'
- )
- .format(timeFormat)
- if (videoObj.type == 'yingshi') {
- // yingshiPrepareRef.current = 'play'
- // setYingshiPrepare('play')
- }
- }, 300)
- player.stop().then(() => {
- player.play({ url: `${videoObj.replayUrl}?begin=${moment(Begain.current).format("YYYYMMDDHHmmss")}&end=${moment(playBackTime.current[1]).format("YYYYMMDDHHmmss")}` })
- playState.current = false
- })
+ } else {
+ // 随播放时间变化更新进度条
+ document.getElementById('process_point').style.left = processDisX - 4.5 + 'px'
+ }
+ }
+ }, [processDisX])
+
+ const createPlay = async () => {
+ if (videoObj.type != 'yingshi') {
+ try {
+ // const inviteRes = await IotVideoServerRequest.get(VideoServeApi.invite, {
+ // id: '36011200002002021114',
+ // channel: '36011200581314002900'
+ // }).then(res => {
+ // console.log(res);
+ // }, err => {.
+ // console.log(err);
+ // })
+ console.log(videoObj);
+ const inviteRes_ = await request.get(`${iotVideoServer}/api/gb28181/invite?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`)
+ } catch (error) {
+ console.log(error.response);
+ }
+
+
+ let $container = document.getElementById(containerId);
+ const jessibuca = new window.Jessibuca({
+ container: $container,
+ videoBuffer: 0.2, // 缓存时长
+ isResize: false,
+ text: "",
+ loadingText: "加载中",
+ debug: true,
+ showBandwidth: false, // 显示网速
+ operateBtns: {
+ fullscreen: true,
+ screenshot: false,
+ play: false,
+ audio: false,
+ },
+ forceNoOffscreen: false,
+ isNotMute: false,
+ });
+ setjessibuca(jessibuca)
+ play({ jessibuca })
+ } else {
+ const player = new EZUIKit.EZUIKitPlayer({
+ id: containerId, // 视频容器ID
+ accessToken: videoObj?.yingshiToken,
+ url: videoObj.playUrlSd,
+ width: setupSize('width'),
+ height: setupSize('height'),
+ handleSuccess: () => { //播放成功
+ setRoll(true)
+ setVideoMask(false)
+ playState.current = true
+ },
+ handleError: (e) => { //播放失败
+ console.log(e, '播放失败');
+ },
+ })
+ setPlayer(player)
+ }
+ }
+
+ const play = (params) => {
+ if (videoObj.type == 'yingshi') {
+
+ } else if ((params.jessibuca || jessibuca) && videoObj.playUrlSd) {
+ const jes = params.jessibuca || jessibuca
+ jes.play(videoObj.playUrlSd);
+ setIsPlaying(true)
+ }
+ }
+
+ const pause = () => {
+ if (videoObj.type == 'yingshi' && player) {
+ 5
+ } else if (jessibuca) {
+ jessibuca.pause();
+ setIsPlaying(false)
+ }
+ }
+
+ const closeSound = () => {
+ if (videoObj.type == 'yingshi') {
+ yingshiPrepareRef.current = yingshiCloseSoundKey
+ setYingshiPrepare(yingshiCloseSoundKey)
+ // yingshiOperation(yingshiCloseSoundKey)
+ }
+ }
+
+ const openSound = () => {
+ if (videoObj.type == 'yingshi') {
+ yingshiPrepareRef.current = yingshiOpenSoundKey
+ setYingshiPrepare(yingshiOpenSoundKey)
+ // yingshiOperation(yingshiOpenSoundKey)
+ }
+ }
+
+ const setupSize = (data) => {
+ if (!operationRef.current?.fullScreen.select) {
+ let containerWidth = sizeWh?.parentWidth //容器的宽高和视频的宽高
+ let containerHeight = sizeWh?.parentHeight
+ let videoWidth = width || sizeWh?.width
+ let videoHeight = height || sizeWh?.height
+
+ if (IsSize == 'true') {
+ if (containerWidth >= videoWidth && containerHeight >= videoHeight) {
+ if (videoHeight / videoWidth >= 0.55 && videoHeight / videoWidth <= 0.57) {
+
+ } else {
+ console.warn('宽高不符合尺寸要求,故返回合适的尺寸')
+ if (videoWidth / 16 > videoHeight / 9) {
+ videoWidth = (videoHeight / 9) * 16
+ } else {
+ videoHeight = (videoWidth / 16) * 9
+ }
+ }
} else {
- // 随播放时间变化更新进度条
- document.getElementById('process_point').style.left = processDisX - 4.5 + 'px'
- }
- }
- }, [processDisX])
-
- const createPlay = async () => {
- if (videoObj.type != 'yingshi') {
- try {
- // const inviteRes = await IotVideoServerRequest.get(VideoServeApi.invite, {
- // id: '36011200002002021114',
- // channel: '36011200581314002900'
- // }).then(res => {
- // console.log(res);
- // }, err => {.
- // console.log(err);
- // })
- console.log(videoObj);
- const inviteRes_ = await request.get(`${iotVideoServer}/api/gb28181/invite?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`)
- } catch (error) {
- console.log(error.response);
+ console.warn('传递宽高参数有误,请确认容器大小范围内')
+ if (containerWidth / 16 > containerHeight / 9) {
+ videoWidth = (containerHeight / 9) * 16
+ } else {
+ videoHeight = (containerWidth / 16) * 9
+ }
}
-
- let $container = document.getElementById(containerId);
- const jessibuca = new window.Jessibuca({
- container: $container,
- videoBuffer: 0.2, // 缓存时长
- isResize: false,
- text: "",
- loadingText: "加载中",
- debug: true,
- showBandwidth: false, // 显示网速
- operateBtns: {
- fullscreen: true,
- screenshot: false,
- play: false,
- audio: false,
- },
- forceNoOffscreen: false,
- isNotMute: false,
- });
- setjessibuca(jessibuca)
- play({ jessibuca })
- } else {
- const player = new EZUIKit.EZUIKitPlayer({
- id: containerId, // 视频容器ID
- accessToken: videoObj?.yingshiToken,
- url: videoObj.playUrlSd,
- width: setupSize('width'),
- height: setupSize('height'),
- handleSuccess: () => { //播放成功
- setRoll(true)
- setVideoMask(false)
- playState.current = true
- },
- handleError: (e) => { //播放失败
- console.log(e, '播放失败');
- },
- })
- setPlayer(player)
- player_.current = player
- }
- }
-
- const play = (params) => {
- if (videoObj.type == 'yingshi') {
-
- } else if ((params.jessibuca || jessibuca) && videoObj.playUrlSd) {
- const jes = params.jessibuca || jessibuca
- jes.play(videoObj.playUrlSd);
- setIsPlaying(true)
- }
- }
-
- const pause = () => {
- if (videoObj.type == 'yingshi' && player) {
- 5
- } else if (jessibuca) {
- jessibuca.pause();
- setIsPlaying(false)
- }
- }
-
- const closeSound = () => {
- if (videoObj.type == 'yingshi') {
- yingshiPrepareRef.current = yingshiCloseSoundKey
- setYingshiPrepare(yingshiCloseSoundKey)
- // yingshiOperation(yingshiCloseSoundKey)
- }
- }
-
- const openSound = () => {
- if (videoObj.type == 'yingshi') {
- yingshiPrepareRef.current = yingshiOpenSoundKey
- setYingshiPrepare(yingshiOpenSoundKey)
- // yingshiOperation(yingshiOpenSoundKey)
- }
- }
-
- const setupSize = (data) => {
- if (!operationRef.current?.fullScreen.select) {
- let containerWidth = sizeWh?.parentWidth //容器的宽高和视频的宽高
- let containerHeight = sizeWh?.parentHeight
- let videoWidth = width || sizeWh?.width
- let videoHeight = height || sizeWh?.height
-
- if (IsSize == 'true') {
- if (containerWidth >= videoWidth && containerHeight >= videoHeight) {
- if (videoHeight / videoWidth >= 0.55 && videoHeight / videoWidth <= 0.57) {
-
- } else {
- console.warn('宽高不符合尺寸要求,故返回合适的尺寸')
- if (videoWidth / 16 > videoHeight / 9) {
- videoWidth = (videoHeight / 9) * 16
- } else {
- videoHeight = (videoWidth / 16) * 9
- }
- }
- } else {
- console.warn('传递宽高参数有误,请确认容器大小范围内')
- if (containerWidth / 16 > containerHeight / 9) {
- videoWidth = (containerHeight / 9) * 16
- } else {
- videoHeight = (containerWidth / 16) * 9
- }
- }
-
- if (videoObj.type == 'yingshi' && player) {
- player.reSize(videoWidth, videoHeight)
- }
- } else {
- if (videoObj.type == 'yingshi' && player) {
- player.reSize(width || sizeWh?.parentWidth, height || sizeWh?.parentHeight)
- }
+ if (videoObj.type == 'yingshi' && player) {
+ player.reSize(videoWidth, videoHeight)
}
- setSize({ parentWidth: containerWidth, parentHeight: containerHeight, width: videoWidth, height: videoHeight })
- return data == 'width' ? videoWidth : data == 'height' ? videoHeight : ''
- }
- }
-
- useEffect(() => {
- setupSize()
- }, [sizeWh])
-
- return (
- <>
-
-
- {/* 顶部信息 */}
-
- {/* 视频内容 */}
- {
- //
- }
-
- {videoMask ?
: ''}
-
- {/* 下方操作栏 */}
- {/* 显示操作功能条件(宽高) */}
- {size?.parentWidth > 320 ?
-
: ""
- }
-
-
+ } else {
+ if (videoObj.type == 'yingshi' && player?.pluginStatus) {
+ player.reSize(width || sizeWh?.parentWidth, height || sizeWh?.parentHeight)
+ }
+ }
+ setSize({ parentWidth: containerWidth, parentHeight: containerHeight, width: videoWidth, height: videoHeight })
+ return data == 'width' ? videoWidth : data == 'height' ? videoHeight : ''
+ }
+ }
+ useEffect(() => {
+ setupSize()
+ }, [sizeWh])
+
+ return (
+ <>
+
+
+ {/* 顶部信息 */}
+
+ {/* 视频内容 */}
+ {
+ //
+ }
+
+ {videoMask ?
: ''}
+
+ {/* 下方操作栏 */}
+ {/* 显示操作功能条件(宽高) */}
+ {size?.parentWidth > 320 ?
+
: ""
+ }
- >
- )
+
+
+ >
+ )
}
function mapStateToProps (state) {
- const { auth, global } = state;
- return {
- user: auth.user,
- iotVideoServer: global.iotVideoServer,
- };
+ const { auth, global } = state;
+ return {
+ user: auth.user,
+ iotVideoServer: global.iotVideoServer,
+ };
}
export default connect(mapStateToProps)(VideoPlay);
\ No newline at end of file
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/journaling/containers/journalingCenter.jsx b/code/VideoAccess-VCMP/web/client/src/sections/journaling/containers/journalingCenter.jsx
index 031d612..0d24b62 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/journaling/containers/journalingCenter.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/journaling/containers/journalingCenter.jsx
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react';
import { connect } from 'react-redux';
import { Coming } from '$components'
-import VideoScreen from '../components/videoScreen'
+
import '../style.less'
@@ -9,10 +9,8 @@ import '../style.less'
const JournalingCenter = (props) => {
return (
- //
- <>
-
- >
+
+
)
}
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/journaling/components/container.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx
similarity index 67%
rename from code/VideoAccess-VCMP/web/client/src/sections/journaling/components/container.jsx
rename to code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx
index 64d3644..6e7621f 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/journaling/components/container.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx
@@ -8,6 +8,7 @@ import { useState } from 'react';
const Container = ({ videoObj, pageSize }) => {
const [videoWidth, setVideoWidth] = useState()
const [videoHeight, setVideoHeight] = useState()
+ // console.log(videoObj);
useEffect(() => {
const resize_ = () => {
@@ -25,19 +26,21 @@ const Container = ({ videoObj, pageSize }) => {
setVideoWidth(document.getElementById('videoo').clientWidth)
setVideoHeight(document.getElementById('videoo').clientHeight)
}, [pageSize])
- console.log(videoWidth, videoHeight);
+ // console.log(videoWidth, videoHeight);
return (
-
-
+
+ {videoWidth && videoHeight ?
+
: ""}
+
{videoObj?.label}
)
}
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoCard.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoCard.jsx
similarity index 96%
rename from code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoCard.jsx
rename to code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoCard.jsx
index ddd4f06..b768299 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoCard.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoCard.jsx
@@ -7,9 +7,6 @@ import Container from "./container";
const VideoCard = ({ data, pageSize }) => {
-
-
-
let span = 8
let rowsCount = 2
if (pageSize === 1) {
@@ -29,7 +26,7 @@ const VideoCard = ({ data, pageSize }) => {
rowsCount = 3
}
let cheight = Math.floor(100 / rowsCount) + "%"
-console.log(pageSize,span,cheight);
+
return (
<>
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoScreen.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx
similarity index 67%
rename from code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoScreen.jsx
rename to code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx
index 71d96a5..29f739e 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoScreen.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx
@@ -1,102 +1,104 @@
import React, { useEffect, useRef, useState } from 'react';
import { connect } from 'react-redux';
-import { TreeSelect, Tree, Form, Button, Popover, Tag, Switch, Input, Row } from '@douyinfe/semi-ui';
+import { TreeSelect, Tree, Form, Button, Popover, Tag, Switch, Input, Row, Pagination, Checkbox } from '@douyinfe/semi-ui';
import './videoScreen.less'
import VideoCard from './videoCard'
const VideoScreen = (props) => {
- const treeData = [{
- label: '公司',
- value: '公司',
- key: '0-1',
- children: [
- {
- label: '大门',
- value: '大门',
- key: '0-1-1',
- videoData: {
- channelNo: 1,
- content: ['5442542542', '452345', '234524525'],
- serialNo: "F61504020",
- type: "yingshi",
- yingshiToken: "at.7pl4c5orb9fpndtlbjpsn5m11szujnf7-1laxxre0ob-010o8fw-kqeuwthva"
- }
- }, {
- label: '机房',
- value: '机房',
- key: '0-1-2',
- videoData: {
- channelNo: 3,
- content: ['5442542542', '452345', '234524525'],
- serialNo: "F61504020",
- type: "yingshi",
- yingshiToken: "at.7pl4c5orb9fpndtlbjpsn5m11szujnf7-1laxxre0ob-010o8fw-kqeuwthva"
- }
- }, {
- label: '后门',
- value: '后门',
- key: '0-1-3',
- videoData: {
- channelNo: 1,
- content: ['5442542542', '452345', '234524525'],
- serialNo: "F61504020",
- type: "yingshi",
- yingshiToken: "at.7pl4c5orb9fpndtlbjpsn5m11szujnf7-1laxxre0ob-010o8fw-kqeuwthva"
- }
- },
- ]
- }, {
- label: '外部',
- value: '外部',
- key: '0-2',
- children: [
- {
- label: '水库',
- value: '水库',
- key: '0-2-1',
- children: [
- {
- label: '房子',
- value: '房子',
- key: '0-2-1-1',
- videoData: {
- channelNo: 1,
- content: ['5442542542', '452345', '234524525'],
- serialNo: "F61504020",
- type: "yingshi",
- yingshiToken: "at.7pl4c5orb9fpndtlbjpsn5m11szujnf7-1laxxre0ob-010o8fw-kqeuwthva",
- }
- },
- ]
- },
- ]
- }, {
- label: '外',
- value: '外',
- key: '0-3',
- children: [
- {
- label: '库',
- value: '库',
- key: '0-3-1',
- children: [
- {
- label: '子',
- value: '子',
- key: '0-3-1-1',
- },
- ]
- },
- ]
- }]
+ const treeData = [
+ {
+ label: '公司',
+ value: '公司',
+ key: '0-1',
+ children: [
+ {
+ label: '大门',
+ value: '大门',
+ key: '0-1-1',
+ videoData: {
+ channelNo: 1,
+ content: ['5442542542', '452345', '234524525'],
+ serialNo: "F61504020",
+ type: "yingshi",
+ yingshiToken: "at.6vznnc23bv51vzjt7lnkj7e19bb2z61f-3gnj7m5lxp-10666cy-bgwcjkekk"
+ }
+ }, {
+ label: '机房',
+ value: '机房',
+ key: '0-1-2',
+ videoData: {
+ channelNo: 3,
+ content: ['5442542542', '452345', '234524525'],
+ serialNo: "F61504020",
+ type: "yingshi",
+ yingshiToken: "at.6vznnc23bv51vzjt7lnkj7e19bb2z61f-3gnj7m5lxp-10666cy-bgwcjkekk"
+ }
+ }, {
+ label: '后门',
+ value: '后门',
+ key: '0-1-3',
+ videoData: {
+ channelNo: 2,
+ content: ['5442542542', '452345', '234524525'],
+ serialNo: "F61504020",
+ type: "yingshi",
+ yingshiToken: "at.6vznnc23bv51vzjt7lnkj7e19bb2z61f-3gnj7m5lxp-10666cy-bgwcjkekk"
+ }
+ },
+ ]
+ },
+ {
+ label: '外部',
+ value: '外部',
+ key: '0-2',
+ children: [
+ {
+ label: '水库',
+ value: '水库',
+ key: '0-2-1',
+ children: [
+ {
+ label: '房子',
+ value: '房子',
+ key: '0-2-1-1',
+ videoData: {
+ channelNo: null,
+ content: ['5442542542', '452345', '234524525'],
+ serialNo: "G56384764",
+ type: "yingshi",
+ yingshiToken: "at.c7dnknnvd4irh8zddul3dgkpb4f3oz83-4n6u7zv8st-1gxz7ny-lgffyh25z",
+ }
+ },
+ ]
+ },
+ ]
+ }, {
+ label: '外',
+ value: '外',
+ key: '0-3',
+ children: [
+ {
+ label: '库',
+ value: '库',
+ key: '0-3-1',
+ children: [
+ {
+ label: '子',
+ value: '子',
+ key: '0-3-1-1',
+ },
+ ]
+ },
+ ]
+ }]
const [pageSize, setPageSize] = useState(4) //每页视频数量
const [queryData, setQueryData] = useState([{ label: '全部', value: '全部', key: '0' }]) //查询树状数据
- const [leftTree, setLefTtree] = useState([{ label: '全部', value: '全部', key: '0', children: treeData}]) //左侧树状数据
+ const [leftTree, setLefTtree] = useState(treeData) //左侧树状数据
const [playData, setPlayData] = useState([]) //视频数据
const [queryValue, setQueryValue] = useState(['全部']) //查询条件
- const [leftValue, setLeftValue] = useState() //
+ const [leftValue, setLeftValue] = useState(treeData.map(v => v.value)) //树状被选中的视频
const api = useRef();
@@ -106,27 +108,52 @@ const VideoScreen = (props) => {
query.push({ label: v.label, value: v.value, key: v.key })
])
setQueryData([{ label: '全部', value: '全部', key: '0', children: query }])
+ let playVideo = []
+ const playVideoData = (data) => {
+ // console.log(data);
+ data.map(v => {
+ if (v.videoData) playVideo.push(v)
+ if (v.children) playVideoData(v.children)
+ })
+
+ }
+ playVideoData(treeData)
+ setPlayData(playVideo)
+ // console.log(playVideo);
}, [])
useEffect(() => {
if (treeData && queryValue.includes('全部')) {
setLefTtree(treeData)
+
} else {
let leftData = []
- queryValue.map(item => leftData.push(treeData?.find(({ value }) => item == value))) //获取左侧树状数据
- setLefTtree([{ label: '全部', value: '全部', key: '0', children: leftData }])
+ queryValue.map(item => {
+ leftData.push(treeData?.find(({ value }) => item == value))
+ }) //获取左侧树状数据
+ console.log(leftData);
+ setLefTtree(leftData)
+ let playVideo = []
+ const playVideoData = (data) => {
+ // console.log(data);
+ data.map(v => {
+ if (v.videoData) playVideo.push(v)
+ if (v.children) playVideoData(v.children)
+ })
+
+ }
+ playVideoData(leftData)
+ setPlayData(playVideo)
}
- }, [queryData, queryValue])
+ }, [queryData, queryValue, leftValue])
useEffect(() => {
- setLeftValue()
}, [])
-
//搜索条件赛选样式
const screen = { width: 193, marginRight: 20, marginBottom: 16, color: "#fff", };
@@ -162,7 +189,7 @@ const VideoScreen = (props) => {
background: 'url(/assets/images/application/background.png) 100% 100%',
backgroundSize: '100% 100%',
color: '#FFFFFF',
- position: 'absolute', minWidth: 1000,
+ // minWidth: 1000,
}}>
{/* 头部标题 */}
{
-
+
查询:
{
multiple
treeData={leftTree}
defaultExpandAll
- defaultValue={['公司','外部']}
+ value={leftValue}
blockNode={false}
onChange={(e) => {
console.log(e);
setLeftValue(e)
}}
- onSelect={(e)=>{
+ onSelect={(e) => {
console.log(e);
}}
style={{ width: 150, color: '#FFFFFF' }}
/>
+ console.log(checked)} aria-label="Checkbox 示例" style={{ position: 'absolute', right: 0, bottom: 60 }}>全选
{
*/}
-
+
{/* 视频 */}
-
- {/* {data.map((v, index) => {
- console.log(v);
+
+ {playData?.map((v, index) => {
return
- })} */}
+ })}
+
+
+ 共{10}个设备
+
+
{
+ // setQuery({ limit: pageSize, page: currentPage - 1 });
+ // page.current = currentPage - 1
+ }}
+ />
+
{/* 视频设置 */}
{
return
{
switch (v.value) {
case '宫格设置':
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoScreen.less b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.less
similarity index 89%
rename from code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoScreen.less
rename to code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.less
index e070836..bfda255 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/journaling/components/videoScreen.less
+++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.less
@@ -1,6 +1,7 @@
.KJBlue {
.semi-tree-option,
.semi-icon,
+ .semi-checkbox-addon, //全选文字
.semi-form-field-label-text {
color: #fff;
}
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx
index b145d78..df8205d 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx
@@ -2,458 +2,462 @@ import React, { useEffect, useState, useRef } from 'react';
import { connect } from 'react-redux';
import '../style.less'
import { Tree, Popconfirm, Typography, Input, Switch, Modal, Checkbox, CheckboxGroup } from "@douyinfe/semi-ui";
+import VideoScreen from '../components/videoScreen'
const MirroringDetail = (props) => {
- const { history, dispatch, actions, user, loading, StatusPushList } = props;
- const { openness } = actions;
- useEffect(() => {
+ const { history, dispatch, actions, user, loading, StatusPushList } = props;
+ const { openness } = actions;
+ useEffect(() => {
- }, []);
- // const = useRef(0)
+ }, []);
+ // const = useRef(0)
- const [chooseNum, setChooseNum] = useState(0);//当前选择tab
- const [chooseList, setChooseList] = useState(['节点', '样式', '功能']);
- const [editKey, setEditKey] = useState('')
- const [comingVisible, setComingVisible] = useState(false)
- const [treeData, setTreeData] = useState([//树形控件数据
- {
- label: '主要节点1',
- value: '0',
- key: '0',
- },
- ]);
- const searchData = useRef({})//摄像头查询条件
- const [search, setSearch] = useState({}); //搜索条件
- const [indeterminate, setIndeterminate] = useState(true);//全选
- const [checkAll, setCheckall] = useState(false);//全选是否
- const onCheckAllChange = (e) => {//全选
- console.log(e);
- setCheckedList(e.target.checked ? plainOptions : []);
- setIndeterminate(false);
- setCheckall(e.target.checked);
- };
- const equipmentGetCamera = () => {
- searchData.current = { ...search }
- dispatch(openness.getCamera(searchData.current)).then((res) => {
- // limits.current = res.payload.data.data.length
- console.log(res.payload.data.data);
- });
- }
- useEffect(() => {
- equipmentGetCamera();
- }, []);
- function nodeDelete (item) {//删除树状子节点
- let mainData = JSON.parse(JSON.stringify(treeData))
- let nodeKeyArr = item.key.split('-')
- if (nodeKeyArr.length == 1) {
- mainData.splice(
- mainData.indexOf(mainData.find(function (element) {
- return element.key === item.key
- })), 1)
- } else if (nodeKeyArr.length == 2) {
- for (let index = 0; index < mainData.length; index++) {
- mainData[index].children.splice(
- mainData[index].children.indexOf(mainData[index].children.find(function (element) {
- return element.key === item.key
- })), 1)
+ const [chooseNum, setChooseNum] = useState(0);//当前选择tab
+ const [chooseList, setChooseList] = useState(['节点', '样式', '功能']);
+ const [editKey, setEditKey] = useState('')
+ const [comingVisible, setComingVisible] = useState(false)
+ const [treeData, setTreeData] = useState([//树形控件数据
+ {
+ label: '主要节点1',
+ value: '0',
+ key: '0',
+ },
+ ]);
+ const searchData = useRef({})//摄像头查询条件
+ const [search, setSearch] = useState({}); //搜索条件
+ const [indeterminate, setIndeterminate] = useState(true);//全选
+ const [checkAll, setCheckall] = useState(false);//全选是否
+ const onCheckAllChange = (e) => {//全选
+ console.log(e);
+ setCheckedList(e.target.checked ? plainOptions : []);
+ setIndeterminate(false);
+ setCheckall(e.target.checked);
+ };
+ const equipmentGetCamera = () => {
+ searchData.current = { ...search }
+ dispatch(openness.getCamera(searchData.current)).then((res) => {
+ // limits.current = res.payload.data.data.length
+ console.log(res.payload.data.data);
+ });
+ }
+ useEffect(() => {
+ equipmentGetCamera();
+ }, []);
+ function nodeDelete (item) {//删除树状子节点
+ let mainData = JSON.parse(JSON.stringify(treeData))
+ let nodeKeyArr = item.key.split('-')
+ if (nodeKeyArr.length == 1) {
+ mainData.splice(
+ mainData.indexOf(mainData.find(function (element) {
+ return element.key === item.key
+ })), 1)
+ } else if (nodeKeyArr.length == 2) {
+ for (let index = 0; index < mainData.length; index++) {
+ mainData[index].children.splice(
+ mainData[index].children.indexOf(mainData[index].children.find(function (element) {
+ return element.key === item.key
+ })), 1)
+ }
+ } else if (nodeKeyArr.length == 3) {
+ for (let j = 0; j < mainData.length; j++) {
+ for (let i = 0; i < mainData[j].children.length; i++) {
+ mainData[j].children[i].children.splice(
+ mainData[j].children[i].children.indexOf(mainData[j].children[i].children.find(function (element) {
+ return element.key === item.key
+ })), 1)
}
- } else if (nodeKeyArr.length == 3) {
- for (let j = 0; j < mainData.length; j++) {
- for (let i = 0; i < mainData[j].children.length; i++) {
- mainData[j].children[i].children.splice(
- mainData[j].children[i].children.indexOf(mainData[j].children[i].children.find(function (element) {
- return element.key === item.key
- })), 1)
- }
+ }
+ } else if (nodeKeyArr.length == 4) {
+ for (let k = 0; k < mainData.length; k++) {
+ for (let j = 0; j < mainData[k].children.length; j++) {
+ for (let i = 0; i < mainData[k].children[j].children.length; i++) {
+ mainData[k].children[j].children[i].children.splice(
+ mainData[k].children[j].children[i].children.indexOf(mainData[k].children[j].children[i].children.find(function (element) {
+ return element.key === item.key
+ })), 1)
+ }
}
- } else if (nodeKeyArr.length == 4) {
- for (let k = 0; k < mainData.length; k++) {
- for (let j = 0; j < mainData[k].children.length; j++) {
- for (let i = 0; i < mainData[k].children[j].children.length; i++) {
- mainData[k].children[j].children[i].children.splice(
- mainData[k].children[j].children[i].children.indexOf(mainData[k].children[j].children[i].children.find(function (element) {
- return element.key === item.key
- })), 1)
- }
- }
+ }
+ }
+ setTreeData(mainData)
+ }
+ function nodeAdd (item) {//添加树状子节点
+ let mainData = JSON.parse(JSON.stringify(treeData))
+ let nodeKeyArr = item.key.split('-')
+ if (nodeKeyArr.length == 1) {
+ for (let index = 0; index < mainData.length; index++) {
+ if (mainData[index].key == item.key) {
+ if (mainData[index].children && mainData[index].children > 0) {
+ let mainKey = mainData[index].children[mainData[index].children.length - 1].key
+ let thekeyarr = mainKey.split('-')
+ mainData[index].children.push({
+ label: '二级节点' + (Number(thekeyarr[1]) + 2),
+ value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1),
+ key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1),
+ })
+ }
+ else {
+ let mainKey = mainData[index].key
+ let thekeyarr = mainKey.split('-')
+ mainData[index].children = [{
+ label: '二级节点1',
+ value: (Number(thekeyarr[0])) + '-0',
+ key: (Number(thekeyarr[0])) + '-0',
+ }]
+ }
}
- }
- setTreeData(mainData)
- }
- function nodeAdd (item) {//添加树状子节点
- let mainData = JSON.parse(JSON.stringify(treeData))
- let nodeKeyArr = item.key.split('-')
- if (nodeKeyArr.length == 1) {
- for (let index = 0; index < mainData.length; index++) {
- if (mainData[index].key == item.key) {
- if (mainData[index].children && mainData[index].children > 0) {
- let mainKey = mainData[index].children[mainData[index].children.length - 1].key
- let thekeyarr = mainKey.split('-')
- mainData[index].children.push({
- label: '二级节点' + (Number(thekeyarr[1]) + 2),
- value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1),
- key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1]) + 1),
- })
- }
- else {
- let mainKey = mainData[index].key
- let thekeyarr = mainKey.split('-')
- mainData[index].children = [{
- label: '二级节点1',
- value: (Number(thekeyarr[0])) + '-0',
- key: (Number(thekeyarr[0])) + '-0',
- }]
- }
- }
+ }
+ } else if (nodeKeyArr.length == 2) {
+ for (let index = 0; index < mainData.length; index++) {
+ for (let j = 0; j < mainData[index].children.length; j++) {
+ if (mainData[index].children[j].key == item.key) {
+ if (mainData[index].children[j].children && mainData[index].children[j].children.length > 0) {
+ let mainKey = mainData[index].children[j].children[mainData[index].children[j].children.length - 1].key
+ let thekeyarr = mainKey.split('-')
+ mainData[index].children[j].children.push({
+ label: '三级节点' + (Number(thekeyarr[2]) + 2),
+ value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1),
+ key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1),
+ })
+ }
+ else {
+ let mainKey = mainData[index].children[j].key
+ let thekeyarr = mainKey.split('-')
+ mainData[index].children[j].children = [{
+ label: '三级节点1',
+ value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0',
+ key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0',
+ }]
+ }
+ }
}
- } else if (nodeKeyArr.length == 2) {
- for (let index = 0; index < mainData.length; index++) {
- for (let j = 0; j < mainData[index].children.length; j++) {
- if (mainData[index].children[j].key == item.key) {
- if (mainData[index].children[j].children && mainData[index].children[j].children.length > 0) {
- let mainKey = mainData[index].children[j].children[mainData[index].children[j].children.length - 1].key
- let thekeyarr = mainKey.split('-')
- mainData[index].children[j].children.push({
- label: '三级节点' + (Number(thekeyarr[2]) + 2),
- value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1),
- key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-' + (Number(thekeyarr[2]) + 1),
- })
- }
- else {
- let mainKey = mainData[index].children[j].key
- let thekeyarr = mainKey.split('-')
- mainData[index].children[j].children = [{
- label: '三级节点1',
- value: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0',
- key: (Number(thekeyarr[0])) + '-' + (Number(thekeyarr[1])) + '-0',
- }]
- }
- }
- }
+ }
+ }
+ setTreeData(mainData)
+ }
+ function changeLable (value, item) {//编辑摄像头名称
+ console.log('valvalval', value);
+ console.log('itemitem', item);
+ let mainData = JSON.parse(JSON.stringify(treeData))
+ let nodeKeyArr = item.key.split('-')
+ if (nodeKeyArr.length == 1) {
+ for (let index = 0; index < mainData.length; index++) {
+ if (mainData[index].key == item.key) {
+ mainData[index].label = value
}
- }
- setTreeData(mainData)
- }
- function changeLable (value, item) {//编辑摄像头名称
- console.log('valvalval', value);
- console.log('itemitem', item);
- let mainData = JSON.parse(JSON.stringify(treeData))
- let nodeKeyArr = item.key.split('-')
- if (nodeKeyArr.length == 1) {
- for (let index = 0; index < mainData.length; index++) {
- if (mainData[index].key == item.key) {
- mainData[index].label = value
- }
+ }
+ } else if (nodeKeyArr.length == 2) {
+ for (let index = 0; index < mainData.length; index++) {
+ for (let j = 0; j < mainData[index].children.length; j++) {
+ if (mainData[index].children[j].key == item.key) {
+ mainData[index].children[j].label = value
+ }
}
- } else if (nodeKeyArr.length == 2) {
- for (let index = 0; index < mainData.length; index++) {
- for (let j = 0; j < mainData[index].children.length; j++) {
- if (mainData[index].children[j].key == item.key) {
- mainData[index].children[j].label = value
- }
- }
+ }
+ } else if (nodeKeyArr.length == 3) {
+ for (let index = 0; index < mainData.length; index++) {
+ for (let j = 0; j < mainData[index].children.length; j++) {
+ for (let k = 0; k < mainData[index].children[j].children.length; k++) {
+ if (mainData[index].children[j].children[k].key == item.key) {
+ mainData[index].children[j].children[k].label = value
+ }
+ }
}
- } else if (nodeKeyArr.length == 3) {
- for (let index = 0; index < mainData.length; index++) {
- for (let j = 0; j < mainData[index].children.length; j++) {
- for (let k = 0; k < mainData[index].children[j].children.length; k++) {
- if (mainData[index].children[j].children[k].key == item.key) {
- mainData[index].children[j].children[k].label = value
- }
- }
- }
- }
- }
- setTreeData(mainData)
- }
- function lableBlur () {
- setEditKey('')
- }
- function cameraAdd (item) {//添加摄像头
+ }
+ }
+ setTreeData(mainData)
+ }
+ function lableBlur () {
+ setEditKey('')
+ }
+ function cameraAdd (item) {//添加摄像头
- }
- const renderLabel = (label, item) => {//树状展示
- let keyArr = item.key.split('-')
- return (
-
- {
- keyArr.length == 1 ? (
-
-
-
![设置](/assets/images/imageImg/folder.png)
-
-
- {
- editKey == item.key ? (
- changeLable(value, item)} style={{ width: 65 }} className='inputpadding' size='small'>
- ) :
- (
-
- {label}
- )
- }
-
-
- ) : (
-
- {
- editKey == item.key ? (
- changeLable(value, item)} style={{ width: 65 }} className='inputpadding' size='small'>
- ) :
- (
-
- {label}
- )
- }
-
- )
- }
-
- {
- !item.children || item.children < 1 ? (
-
cameraAdd(item)}>
-
![添加摄像头](/assets/images/imageImg/nodeCamera.png)
-
- ) : ('')
- }
-
{ setEditKey(item.key) }}>
+ }
+ const renderLabel = (label, item) => {//树状展示
+ let keyArr = item.key.split('-')
+ return (
+
+ {
+ keyArr.length == 1 ? (
+
+
![编辑](/assets/images/imageImg/nodeEdit.png)
-
-
nodeDelete(item)}>
-
-
![删除](/assets/images/imageImg/nodeDel.png)
-
-
- {
- keyArr.length > 2 ? ('') : (
-
nodeAdd(item)}>
-
![添加子节点](/assets/images/imageImg/nodeadd.png)
-
- )
- }
-
-
- )
- };
- function toback () {//返回上一个页面
- history.goBack()
- }
- function tochange (index) {//节点样式功能切换
- setChooseNum(index)
- }
- function addMainNode () {//增加主要节点
- let mainData = JSON.parse(JSON.stringify(treeData))
- if (mainData.length > 0) {
- let mainKey = mainData[mainData.length - 1].key
- mainKey = Number(mainKey) + 2
- mainData.push({
- label: '主要节点' + mainKey,
- value: String(mainKey - 1),
- key: String(mainKey - 1),
- })
- }
- else {
- mainData.push({
- label: '主要节点1',
- value: '0',
- key: '0',
- })
- }
- setTreeData(mainData)
- }
- return (
-
-
-
-
+
+
+ {
+ editKey == item.key ? (
+ changeLable(value, item)} style={{ width: 65 }} className='inputpadding' size='small'>
+ ) :
+ (
+
+ {label}
+ )
+ }
+
+
+ ) : (
+
+ {
+ editKey == item.key ? (
+ changeLable(value, item)} style={{ width: 65 }} className='inputpadding' size='small'>
+ ) :
+ (
+
+ {label}
+ )
+ }
+
+ )
+ }
+
+ {
+ !item.children || item.children < 1 ? (
+
cameraAdd(item)}>
![设置](/assets/images/imageImg/toback.png)
-
-
- 智慧小蓝智慧排涝视频融合系统
-
-
+
+ ) : ('')
+ }
+
{ setEditKey(item.key) }}>
+
![编辑](/assets/images/imageImg/nodeEdit.png)
+
+
nodeDelete(item)}>
+
+
![删除](/assets/images/imageImg/nodeDel.png)
+
+
+ {
+ keyArr.length > 2 ? ('') : (
+
nodeAdd(item)}>
![设置](/assets/images/imageImg/nameChange.png)
-
-
-
+
+ )
+ };
+ function toback () {//返回上一个页面
+ history.goBack()
+ }
+ function tochange (index) {//节点样式功能切换
+ setChooseNum(index)
+ }
+ function addMainNode () {//增加主要节点
+ let mainData = JSON.parse(JSON.stringify(treeData))
+ if (mainData.length > 0) {
+ let mainKey = mainData[mainData.length - 1].key
+ mainKey = Number(mainKey) + 2
+ mainData.push({
+ label: '主要节点' + mainKey,
+ value: String(mainKey - 1),
+ key: String(mainKey - 1),
+ })
+ }
+ else {
+ mainData.push({
+ label: '主要节点1',
+ value: '0',
+ key: '0',
+ })
+ }
+ setTreeData(mainData)
+ }
+ return (
+
+
+
+
+
![设置](/assets/images/imageImg/toback.png)
+
+
+ 智慧小蓝智慧排涝视频融合系统
+
+
+
![设置](/assets/images/imageImg/nameChange.png)
+
+
+
+
+
![设置](/assets/images/imageImg/save.png)
+
+
+
![设置](/assets/images/imageImg/upload.png)
+
+
+
+
+
+
+ {chooseList.map((item, index) => {
+ return (
+
tochange(index)} >
+ {item}
+
+ )
+ })}
+
+ {/* 节点 */}
+
+
+
![设置](/assets/images/imageImg/save.png)
-
-
+
+
+ 增加主要节点
+
+
+
+
+ {/* 添加视频 */}
+
+
+
添加视频
+
![设置](/assets/images/imageImg/upload.png)
-
-
-
-
-
-
- {chooseList.map((item, index) => {
- return (
-
tochange(index)} >
- {item}
-
- )
- })}
-
- {/* 节点 */}
-
-
-
-
![设置](/assets/images/imageImg/addMainNodes.png)
-
-
- 增加主要节点
-
+
+
+
+
- {/* 添加视频 */}
-
-
-
添加视频
-
-
![设置](/assets/images/imageImg/close.png)
-
-
-
-
-
摄像头名称
-
-
-
-
-
![设置](/assets/images/imageImg/find.png)
-
-
-
-
-
- 全选
-
-
-
- console.log(checked)} aria-label="Checkbox 示例">隐藏添加过的
-
-
+
+
-
- {/* 样式 */}
-
-
-
header
-
console.log(v)} size="small" aria-label="是否有头部">
+
+
+
+
+ 全选
+
-
{ setComingVisible(true) }}>
-
自定义样式
-
-
![设置](/assets/images/imageImg/down.png)
-
+
+ console.log(checked)} aria-label="Checkbox 示例">隐藏添加过的
-
-
-
-
+
+
+
+ {/* 样式 */}
+
+
+
header
+
console.log(v)} size="small" aria-label="是否有头部">
+
+
{ setComingVisible(true) }}>
+
自定义样式
+
+
![设置](/assets/images/imageImg/down.png)
+
+
+
+
+
+
+
+
-
{
- setComingVisible(false)
- }}
- width={610}
- onCancel={() => {
- setComingVisible(false)
- }}
- okText="确定"
- cancelText="取消"
- closeOnEsc={true}
- >
- 开发中,敬请期待~
-
-
- )
+
+
{
+ setComingVisible(false)
+ }}
+ width={610}
+ onCancel={() => {
+ setComingVisible(false)
+ }}
+ okText="确定"
+ cancelText="取消"
+ closeOnEsc={true}
+ >
+ 开发中,敬请期待~
+
+
+ )
}
function mapStateToProps (state) {
- const { auth, global } = state;
- return {
- user: auth.user,
- actions: global.actions,
- };
+ const { auth, global } = state;
+ return {
+ user: auth.user,
+ actions: global.actions,
+ };
}
export default connect(mapStateToProps)(MirroringDetail);
diff --git a/code/VideoAccess-VCMP/web/client/src/utils/webapi.js b/code/VideoAccess-VCMP/web/client/src/utils/webapi.js
index e351858..2c698e4 100644
--- a/code/VideoAccess-VCMP/web/client/src/utils/webapi.js
+++ b/code/VideoAccess-VCMP/web/client/src/utils/webapi.js
@@ -13,7 +13,6 @@ const { basicAction, RouteRequest } = webUtils
export {
basicAction, RouteRequest
}
-console.log(basicAction, RouteRequest);
export const ApiTable = {
login: "login",