wenlele
1 year ago
5 changed files with 376 additions and 299 deletions
@ -0,0 +1,64 @@ |
|||
import React, { useEffect, useRef, useState } from 'react' |
|||
import { connect } from 'react-redux' |
|||
import { YSIframePlayer } from '../../../../../components' |
|||
|
|||
import { LeftOutlined, RightOutlined } from '@ant-design/icons'; |
|||
|
|||
const videoMonitor = (props) => { |
|||
const { dispatch, videoCenterList } = props |
|||
|
|||
const [pageLeft, setPageLeft] = useState(0) //左边翻页
|
|||
|
|||
|
|||
|
|||
let renderVideo = (item, index) => { |
|||
return <YSIframePlayer |
|||
containerId={`yingshiPlay_lu_${index}`} |
|||
height='100%' |
|||
width="100%" |
|||
url={`ezopen://open.ys7.com/${item.deviceSerial}/${item.channelNo || '1'}.hd.live`} |
|||
audio="0" |
|||
ysToken={item.token} |
|||
videoState={{ |
|||
status: item.status |
|||
}} |
|||
/> |
|||
} |
|||
|
|||
return ( |
|||
videoCenterList?.length > 0 ? <div style={{ width: '100%', height: '100%', display: "flex", alignItems: 'center', justifyContent: 'space-around' }}> |
|||
<LeftOutlined style={{ width: "5%", color: '#FFF', cursor: 'pointer' }} onClick={() => { |
|||
if (pageLeft > 0) setPageLeft(pageLeft - 1) |
|||
}} /> |
|||
<div style={{ width: '90%', height: "98%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:'space-between' }}> |
|||
{videoCenterList?.slice(pageLeft * 3, (pageLeft + 1) * 3)?.map((v, index) => { |
|||
return <div style={{ width: "95%", height: "30%", backgroundSize: 'cover', position: "relative", }}> |
|||
{renderVideo(v, index)} |
|||
<div style={{ width: "100%", position: "absolute", bottom: 0 }}> |
|||
<div style={{ width: "100%", height: "20%", backgroundColor: "rgba(0,0,0,0.6)", color: '#FFF', overflow: "hiddden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> |
|||
<img src='/assets/images/leadership/weizhis.png' style={{ width: "6%", height: "80%", marginLeft: "3%", marginRight: "3%" }} /> |
|||
{v.deviceName} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
})} |
|||
</div> |
|||
<RightOutlined style={{ width: "5%", color: '#FFF', cursor: 'pointer' }} onClick={() => { |
|||
if (pageLeft + 1 < Math.ceil(videoCenterList?.length / 3)) setPageLeft(pageLeft + 1) |
|||
}} /> |
|||
|
|||
|
|||
</div> |
|||
: |
|||
<div style={{ color: "#fff", textAlign: 'center', height: "20%", display: 'flex', alignItems: "center", justifyContent: "space-around" }}>暂无摄像头信息</div> |
|||
|
|||
); |
|||
} |
|||
|
|||
function mapStateToProps (state) { |
|||
const { videoCenterList } = state |
|||
return { |
|||
videoCenterList: videoCenterList.data || [] |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(videoMonitor) |
Loading…
Reference in new issue