Browse Source

预览数据连通

release_1.3.0
wenlele 2 years ago
parent
commit
3c99b1c4e3
  1. 140
      code/VideoAccess-VCMP/web/client/src/components/textScroll.jsx
  2. 19
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx
  3. 2
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/voiceHeader.jsx
  4. 14
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx
  5. 4
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoCard.jsx
  6. 347
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx
  7. 12
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.less

140
code/VideoAccess-VCMP/web/client/src/components/textScroll.jsx

@ -3,77 +3,77 @@ import moment from 'moment'
import './textScroll.less'
function TextScroll (props) {
const { content, duration, roll } = props
const [showContent, setShowContent] = useState('')
const showIndex = useRef(0)
const initialization = useRef(false)
const cancel = useRef(false)
useEffect(() => {
if (content.length) {
if (roll) {
let contentParent = document.getElementById('marquee_box')
document.getElementById('contentPMakeUp').style.width = contentParent.clientWidth + 'px'
const contentP = document.getElementById('contentP')
contentP.style.visibility = 'visible'
setShowContent(content[0])
window.cancelAnimationFrame(cancel.current)
contentParent.scrollLeft = 0
initialization.current = false
showIndex.current = 0
const { content, duration, roll, videoObj } = props
const [showContent, setShowContent] = useState('')
const showIndex = useRef(0)
const initialization = useRef(false)
const cancel = useRef(false)
useEffect(() => {
if (content.length) {
if (roll) {
let contentParent = document.getElementById("marquee_box" + videoObj.id)
document.getElementById('contentPMakeUp' + videoObj.id).style.width = contentParent.clientWidth + 'px'
const contentP = document.getElementById('contentP' + videoObj.id)
contentP.style.visibility = 'visible'
setShowContent(content[0])
window.cancelAnimationFrame(cancel.current)
contentParent.scrollLeft = 0
initialization.current = false
showIndex.current = 0
}
else {
let repeatTime = moment()
let refreshTime = moment()
const scroll = () => {
let contentParent = document.getElementById("marquee_box" + videoObj.id)
document.getElementById('contentPMakeUp' + videoObj.id).style.width = contentParent.clientWidth + 'px'
//
// if(!showContent&&!initialization.current){
if (!initialization.current) {
const contentP = document.getElementById('contentP' + videoObj.id)
contentParent.scrollLeft = 0
setShowContent(content[showIndex.current])
showIndex.current = (showIndex.current + 1) % content.length
contentP.style.visibility = 'visible'
initialization.current = true
}
//
if (moment().diff(refreshTime) > 1000 / 60) {
const contentP = document.getElementById('contentP' + videoObj.id)
//
if (moment().diff(repeatTime) > 1000 * 1.5) {
contentP.style.visibility = 'visible'
}
//
if (moment().diff(repeatTime) > 1000 * 3) {
contentParent.scrollLeft = contentParent.scrollLeft + 1
}
//
if (contentParent.scrollLeft >= contentP.clientWidth + 24) {
contentParent.scrollLeft = 0
repeatTime = moment()
setShowContent(content[showIndex.current])
showIndex.current = (showIndex.current + 1) % content.length
contentP.style.visibility = 'hidden'
}
refreshTime = moment()
}
let text = null
text = window.requestAnimationFrame(scroll)
cancel.current = text
}
else {
let repeatTime = moment()
let refreshTime = moment()
const scroll = () => {
let contentParent = document.getElementById('marquee_box')
document.getElementById('contentPMakeUp').style.width = contentParent.clientWidth + 'px'
//
// if(!showContent&&!initialization.current){
if (!initialization.current) {
const contentP = document.getElementById('contentP')
contentParent.scrollLeft = 0
setShowContent(content[showIndex.current])
showIndex.current = (showIndex.current + 1) % content.length
contentP.style.visibility = 'visible'
initialization.current = true
}
//
if (moment().diff(refreshTime) > 1000 / 60) {
const contentP = document.getElementById('contentP')
//
if (moment().diff(repeatTime) > 1000 * 1.5) {
contentP.style.visibility = 'visible'
}
//
if (moment().diff(repeatTime) > 1000 * 3) {
contentParent.scrollLeft = contentParent.scrollLeft + 1
}
//
if (contentParent.scrollLeft >= contentP.clientWidth + 24) {
contentParent.scrollLeft = 0
repeatTime = moment()
setShowContent(content[showIndex.current])
showIndex.current = (showIndex.current + 1) % content.length
contentP.style.visibility = 'hidden'
}
refreshTime = moment()
}
let text = null
text = window.requestAnimationFrame(scroll)
cancel.current = text
}
window.requestAnimationFrame(scroll)
}
}
}, [content, roll])
return (
<div className="marquee_box" id='marquee_box' style={{ overflow: 'hidden', color: '#F9F9F9' }} >
<div style={{ position: 'relative', left: 24 }}>
<div id='contentP' style={{ display: 'inline-block', visibility: 'hidden' }}>{showContent}</div>
<div id='contentPMakeUp' style={{ width: 0, display: 'inline-block' }}></div>
</div>
</div>
)
window.requestAnimationFrame(scroll)
}
}
}, [content, roll])
return (
<div className="marquee_box" id={"marquee_box" + videoObj.id} style={{ overflow: 'hidden', color: '#F9F9F9' }} >
<div style={{ position: 'relative', left: 24 }}>
<div id={'contentP' + videoObj.id} style={{ display: 'inline-block', visibility: 'hidden' }}>{showContent}</div>
<div id={'contentPMakeUp' + videoObj.id} style={{ width: 0, display: 'inline-block' }}></div>
</div>
</div>
)
}
export default React.memo(TextScroll)

19
code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx

@ -65,7 +65,7 @@ const VideoPlay = ({
iotVideoServer,
local, //
}) => {
// console.log(sizeWh,videoObj);
// console.log(containerId, videoObj);
if (videoObj.type == 'yingshi') {
videoObj = {
...videoObj,
@ -103,7 +103,7 @@ const VideoPlay = ({
// ifream
const yingshiPrepareRef = useRef(null)
const playState = useRef(false) //
const player_ = useRef(null)
const yingshiPlayer = useRef(null)
useEffect(() => {
setRoll(false)
@ -169,11 +169,8 @@ const VideoPlay = ({
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);
}
}
@ -228,17 +225,12 @@ const VideoPlay = ({
// window.addEventListener('resize', resize_); //
// }
return () => {
console.log(854453453);
if (jessibuca) {
jessibuca.destroy()
}
if (player && videoObj.type == 'yingshi') {
console.log(854453453);
player.stop()
if (yingshiPlayer.current && videoObj.type == 'yingshi') {
yingshiPlayer.current.stop()
}
// if (local) {
// window.removeEventListener('resize', resize_);
// }
}
}, [])
@ -349,6 +341,7 @@ const VideoPlay = ({
},
})
setPlayer(player)
yingshiPlayer.current = player
}
}
@ -430,7 +423,7 @@ const VideoPlay = ({
useEffect(() => {
setupSize()
}, [sizeWh])
return (
<>
<div className="vcmp_videoplay" style={{ width: size?.parentWidth || '100%', height: size?.parentHeight || '100%', backgroundColor: 'black', overflow: 'hidden', display: 'flex', alignItems: 'center', justifyContent: 'center', }}>

2
code/VideoAccess-VCMP/web/client/src/components/videoPlayer/voiceHeader.jsx

@ -96,7 +96,7 @@ const VideoHeader = ({ operationState, changeSelectState, setProcessDisX, name,
</Col>
<Col span={videoStyle == 'true' ? 24 : 15} style={{}}>
<div style={{ paddingRight: 12 }}>
{content ? <TextScroll content={content || []} duration={6} /> : ""}
{content ? <TextScroll content={content || []} duration={6} videoObj={videoObj} /> : ""}
</div>
</Col>
</Row>

14
code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx

@ -12,8 +12,8 @@ const Container = ({ videoObj, pageSize }) => {
useEffect(() => {
const resize_ = () => {
setVideoWidth(document.getElementById('videoo').clientWidth)
setVideoHeight(document.getElementById('videoo').clientHeight)
setVideoWidth(document.getElementById('video' + videoObj.key).clientWidth)
setVideoHeight(document.getElementById('video' + videoObj.key).clientHeight)
}
resize_()
window.addEventListener('resize', resize_); //
@ -23,8 +23,8 @@ const Container = ({ videoObj, pageSize }) => {
}, [])
useEffect(() => {
setVideoWidth(document.getElementById('videoo').clientWidth)
setVideoHeight(document.getElementById('videoo').clientHeight)
setVideoWidth(document.getElementById('video' + videoObj.key).clientWidth)
setVideoHeight(document.getElementById('video' + videoObj.key).clientHeight)
}, [pageSize])
// console.log(videoWidth, videoHeight);
return (
@ -36,11 +36,11 @@ const Container = ({ videoObj, pageSize }) => {
parentWidth: videoWidth - 10,
parentHeight: videoHeight - 40,
}}
videoObj={videoObj.videoData}
videoObj={videoObj.camera}
videoStyle='true'
containerId={videoObj.label}
containerId={videoObj.key}
local={true} /> : ""}
<div style={{lineHeight:'30px',paddingLeft:6}}>{videoObj?.label}</div>
<div style={{ lineHeight: '30px', paddingLeft: 6 }}>{videoObj?.label}</div>
</div>
)
}

4
code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoCard.jsx

@ -4,7 +4,7 @@ import { TreeSelect, Tree, Form, Button, Popover, Tag, Switch, Input, Row, Col }
import Container from "./container";
const VideoCard = ({ data, pageSize }) => {
const VideoCard = ({ data, pageSize , key}) => {
let span = 8
@ -29,7 +29,7 @@ const VideoCard = ({ data, pageSize }) => {
return (
<>
<Col id="videoo" span={span} style={{ height: cheight, }}>
<Col id={'video'+data.key} key={key} span={span} style={{ height: cheight, }}>
<Container
videoObj={data}
pageSize={pageSize}

347
code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx

@ -3,95 +3,103 @@ import { connect } from 'react-redux';
import { TreeSelect, Tree, Form, Button, Popover, Tag, Switch, Input, Row, Pagination, Checkbox } from '@douyinfe/semi-ui';
import './videoScreen.less'
import VideoCard from './videoCard'
import { version } from 'less';
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.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 VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, showHeader }) => {
console.log({ 视频: treeData });
console.log(filterGroup);
console.log(headerName);
console.log(videoPlay);
console.log(template);
console.log(showHeader);
// const treeData = [
// {
// label: '',
// value: '',
// key: '524252542',
// children: [
// {
// label: '',
// value: '',
// key: '2451245',
// videoData: {
// channelNo: 1,
// content: ['5442542542', '452345', '234524525'],
// serialNo: "F61504020",
// type: "yingshi",
// yingshiToken: "at.6vznnc23bv51vzjt7lnkj7e19bb2z61f-3gnj7m5lxp-10666cy-bgwcjkekk"
// }
// }, {
// label: '',
// value: '',
// key: '54252542',
// videoData: {
// channelNo: 3,
// content: ['5442542542', '452345', '234524525'],
// serialNo: "F61504020",
// type: "yingshi",
// yingshiToken: "at.6vznnc23bv51vzjt7lnkj7e19bb2z61f-3gnj7m5lxp-10666cy-bgwcjkekk"
// }
// }, {
// label: '',
// value: '',
// key: '52425425642',
// videoData: {
// channelNo: 2,
// content: ['5442542542', '452345', '234524525'],
// serialNo: "F61504020",
// type: "yingshi",
// yingshiToken: "at.6vznnc23bv51vzjt7lnkj7e19bb2z61f-3gnj7m5lxp-10666cy-bgwcjkekk"
// }
// },
// ]
// },
// {
// label: '',
// value: '',
// key: '25425425',
// children: [
// {
// label: '',
// value: '',
// key: '2542542542542',
// children: [
// {
// label: '',
// value: '',
// key: '2542542542542',
// 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' }]) //
@ -99,64 +107,101 @@ const VideoScreen = (props) => {
const [playData, setPlayData] = useState([]) //
const [queryValue, setQueryValue] = useState(['全部']) //
const [leftValue, setLeftValue] = useState(treeData.map(v => v.value)) //
const [selectAll, setSelectAll] = useState(true) //
const api = useRef();
const chooseAll = useRef(true);
useEffect(() => {
console.log(45464);
let query = []
treeData?.map(v => [
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);
}, [])
setQueryData([{ label: '全部', value: '全部', key: '00', children: query }])
let values = treeData.map(v => v.value)
videoData(treeData, values)
setLefTtree(treeData)
setLeftValue(treeData.map(v => v.value))
}, [treeData])
useEffect(() => {
console.log(queryValue);
if (treeData && queryValue.includes('全部')) {
console.log(54254);
setLefTtree(treeData)
let values = treeData.map(v => v.value)
videoData(treeData, values)
} else {
console.log(3);
let 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)
videoData(treeData, queryValue)
}
}, [queryValue]) //
useEffect(() => {
let playVideo = []
const videoPlay = (data, values) => {
data?.map(v => {
if (values?.find(vv => vv == v.value)) {
if (v.camera) playVideo.push(v)
if (v.children) {
v.children.map(vv => {
if (vv.camera) playVideo.push(vv)
if (vv.children) {
vv.children.map(c => {
if (c.camera) playVideo.push(c)
if (c.children) {
vv.children.map(cc => {
if (c.camera) playVideo.push(cc)
})
}
})
}
})
}
}
if (v.children) {
videoPlay(v.children, leftValue)
}
})
}
videoPlay(leftTree, leftValue)
console.log(playVideo);
setPlayData(playVideo);
}, [queryData, queryValue, leftValue])
for (let v of treeData) { //
if (!leftValue.includes(v.value)) {
setSelectAll(false)
return
} else {
setSelectAll(true)
}
}
}, [leftValue])
useEffect(() => {
}, [])
//
const videoData = (d, v) => {
let playVideo = []
let videos = v.map(item => d.find(vv => vv.value == item))
const playVideoData = (data) => {
data.map(c => {
if (c.videoData) playVideo.push(c)
if (c.children) playVideoData(c.children)
})
}
playVideoData(videos)
setPlayData(playVideo)
}
//
const screen = { width: 193, marginRight: 20, marginBottom: 16, color: "#fff", };
//
const flipScreens = (data) => {
@ -179,7 +224,7 @@ const VideoScreen = (props) => {
}
}
console.log(queryValue);
return (
<>
<div
@ -192,7 +237,7 @@ const VideoScreen = (props) => {
// minWidth: 1000,
}}>
{/* 头部标题 */}
<div style={{
{showHeader ? <div style={{
width: '100%', height: 80,
textAlign: 'center',
}}>
@ -208,24 +253,24 @@ const VideoScreen = (props) => {
letterSpacing: '5px',
background: 'url(/assets/images/application/titleBottom.png) 100% 100%',
backgroundSize: '100% 100%',
}} > 智慧小蓝视频融合监管中心</div>
</div>
}} >{headerName}</div>
</div> : ""}
<div style={{
height: "calc(100% - 116px)", margin: '16px', display: 'flex',
height: `calc(100% - ${showHeader ? 80 : 0}px)`, padding: '8px', display: 'flex',
}}>
<div style={{ width: 300, height: "100%", border: '2px solid #003D9E', position: 'relative' }}>
<div style={{ width: 300, height: "100%", border: '2px solid #003D9E', position: 'relative', padding: 5 }}>
<div>查询
<TreeSelect
style={{ width: 150, }}
style={{ width: 230, border: '1px solid rgba(255, 255, 255, 0.488)' }}
dropdownStyle={{ maxHeight: 300, overflow: 'auto', color: '#FFFFFF', }}
treeData={queryData}
placeholder="请选择"
multiple={true}
defaultValue={['全部']}
value={queryValue}
maxTagCount={1}
onChange={(e) => {
console.log(e)
setQueryValue(e)
}}
/>
@ -234,22 +279,30 @@ const VideoScreen = (props) => {
<Tree
multiple
treeData={leftTree}
defaultExpandAll
value={leftValue}
blockNode={false}
onChange={(e) => {
console.log(e);
// console.log(e);
setLeftValue(e)
}}
onSelect={(e) => {
console.log(e);
// console.log(e);
}}
style={{ width: 150, color: '#FFFFFF' }}
/>
<Checkbox defaultChecked onChange={checked => console.log(checked)} aria-label="Checkbox 示例" style={{ position: 'absolute', right: 0, bottom: 60 }}>全选</Checkbox>
<Checkbox
checked={selectAll}
onChange={checked => {
setSelectAll(!selectAll)
chooseAll.current = !chooseAll.current
}}
ria-label="Checkbox 示例"
style={{ position: 'absolute', right: 10, bottom: 10 }}
>
全选</Checkbox>
</div>
<div style={{
flex: 1, marginLeft: '10px', border: '2px solid #003D9E',
flex: 1, marginLeft: '4px', border: '2px solid #003D9E',
}}>
<div style={{ display: 'flex', }}>
<div style={{ flex: 1, marginTop: '10px', }}>
@ -260,7 +313,19 @@ const VideoScreen = (props) => {
layout="horizontal"
style={{ position: "relative", width: "100%", flex: 1 }}
>
<Form.Input label="设备搜索:" field="keyword" maxLength="36" placeholder="请输入设备名称" labelPosition="left" style={screen} />
<Form.Input label={<span style={{ marginRight: -14, display: 'inline-block' }}>设备搜索:</span>} field="keyword" maxLength="36" placeholder="请输入设备名称" labelPosition="left" style={{ width: 125, color: "#fff", }} />
{filterGroup?.map(v => {
return <Form.Select
label={<span style={{ marginRight: -14, display: 'inline-block' }} title={v.name}>我的...:</span>}
labelPosition="left"
field={"field" + v.num}
style={{ width: 75, color: "#fff", background: "#01185f", boxShadow: " inset 0px 0px 5px 1px rgba(28, 96, 254, 0.4)" }}
placeholder="全部"
showClear
>
{v.filters.map(vv => <Form.Select.Option value={vv.num}>{vv.name}</Form.Select.Option>)}
</Form.Select>
})}
{/* <Form.Select
label="状态查询:"
labelPosition="left"
@ -289,7 +354,7 @@ const VideoScreen = (props) => {
<Button
theme="solid"
type="primary"
style={{ width: 65, height: 30, borderRadius: 3, marginRight: 16, }}
style={{ width: 48, height: 30, borderRadius: 3, marginRight: 8, }}
onClick={() => {
// api.current.validate().then((v) => {
// setSearch(v);
@ -324,8 +389,8 @@ const VideoScreen = (props) => {
{/* 视频 */}
<div style={{ flex: 1, height: '100%' }}>
<Row style={{ height: `calc( 100% - 160px )` }}>
{playData?.map((v, index) => {
return <VideoCard key={'VideoCard' + index} data={v} pageSize={pageSize} />
{playData?.map(v => {
return <VideoCard key={'VideoCard' + v.key} data={v} pageSize={pageSize} />
})}
</Row>
<div
@ -336,10 +401,10 @@ const VideoScreen = (props) => {
}}
>
<span style={{ lineHeight: "30px" }}>
{10}个设备
{playData.length}个设备
</span>
<Pagination
total={100}
{playData.length > 0 ? <Pagination
total={playData.length}
// currentPage={1}
style={{ color: 'white' }}
@ -347,7 +412,7 @@ const VideoScreen = (props) => {
// setQuery({ limit: pageSize, page: currentPage - 1 });
// page.current = currentPage - 1
}}
/>
/> : ""}
</div>
</div>
{/* 视频设置 */}

12
code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.less

@ -1,13 +1,17 @@
.KJBlue {
.semi-tree-option,
.semi-icon,
.semi-checkbox-addon, //全选文字
.semi-form-field-label-text {
.semi-form-field-label-text,
span {
color: #fff;
}
.semi-checkbox-inner-display {
//树状多选框
border: 1px solid #fff;
border: 1px solid rgba(255, 255, 255, 0.488);
}
input {
background: #01185f;
@ -16,4 +20,8 @@
input::placeholder {
color: #fff;
}
.semi-form-field{
padding-right: 6px;
}
}

Loading…
Cancel
Save