|
|
@ -1,4 +1,4 @@ |
|
|
|
import React, { useEffect, useRef } from 'react'; |
|
|
|
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 './videoScreen.less' |
|
|
@ -6,61 +6,151 @@ import VideoCard from './videoCard' |
|
|
|
|
|
|
|
|
|
|
|
const VideoScreen = (props) => { |
|
|
|
const [pageSize, setPageSize] = useState(4) //每页视频数量 |
|
|
|
const [queryData, setQueryData] = useState([{ label: '全部', value: '全部', key: '0' }]) //查询树状数据 |
|
|
|
const [leftTree, setLefTtree] = useState([]) //左侧树状数据 |
|
|
|
const [playData, setPlayData] = useState([]) //视频数据 |
|
|
|
const [queryValue, setQueryValue] = useState(['全部']) //查询条件 |
|
|
|
|
|
|
|
const api = useRef(); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
let query = [] |
|
|
|
treeData?.map(v => [ |
|
|
|
query.push({ label: v.label, value: v.value, key: v.key }) |
|
|
|
]) |
|
|
|
setQueryData([{ label: '全部', value: '全部', key: '0', children: query }]) |
|
|
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (treeData && queryValue.includes('全部')) { |
|
|
|
setLefTtree(treeData) |
|
|
|
} else { |
|
|
|
let leftData = [] |
|
|
|
queryValue.map(item => leftData.push(treeData?.find(({ value }) => item == value))) //获取左侧树状数据 |
|
|
|
setLefTtree(leftData) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, [queryData, queryValue]) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
const treeData = [{ |
|
|
|
label: '全部', |
|
|
|
value: '全部', |
|
|
|
key: '0', |
|
|
|
children: [{ |
|
|
|
label: '公司', |
|
|
|
value: '公司', |
|
|
|
key: '0-1', |
|
|
|
children: [ |
|
|
|
{ |
|
|
|
label: '大门', |
|
|
|
value: '大门', |
|
|
|
key: '0-1-1', |
|
|
|
}, { |
|
|
|
label: '机房', |
|
|
|
value: '机房', |
|
|
|
key: '0-1-2', |
|
|
|
}, { |
|
|
|
label: '后门', |
|
|
|
value: '后门', |
|
|
|
key: '0-1-3', |
|
|
|
}, |
|
|
|
] |
|
|
|
}, { |
|
|
|
label: '外部', |
|
|
|
value: '外部', |
|
|
|
key: '0-2', |
|
|
|
children: [ |
|
|
|
{ |
|
|
|
label: '门口', |
|
|
|
value: '门口', |
|
|
|
key: '0-2-1', |
|
|
|
}, |
|
|
|
] |
|
|
|
}] |
|
|
|
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 screen = { |
|
|
|
width: 193, |
|
|
|
marginRight: 20, |
|
|
|
marginBottom: 16, |
|
|
|
color: "#fff", |
|
|
|
}; |
|
|
|
//搜索条件赛选样式 |
|
|
|
const screen = { width: 193, marginRight: 20, marginBottom: 16, color: "#fff", }; |
|
|
|
|
|
|
|
//宫格设置点击 |
|
|
|
const flipScreens = (data) => { |
|
|
|
console.log(data); |
|
|
|
switch (data) { |
|
|
|
case "单屏": |
|
|
|
setPageSize(1) |
|
|
|
break; |
|
|
|
case "4分屏": |
|
|
|
setPageSize(4) |
|
|
|
break; |
|
|
|
case "6分屏": |
|
|
|
setPageSize(6) |
|
|
|
break; |
|
|
|
case "12分屏": |
|
|
|
setPageSize(12) |
|
|
|
break; |
|
|
|
default: |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const data = [{ |
|
|
|
channelNo: 1, |
|
|
|
content: ['5442542542', '452345', '234524525'], |
|
|
|
serialNo: "G75922040", |
|
|
|
type: "yingshi", |
|
|
|
yingshiToken: "at.02vgv9vn19rek6hh6a9k35r61rf2orw5-6pmmn2tu6v-040zcc8-xj4tdjtau" |
|
|
|
},] |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
@ -101,21 +191,25 @@ const VideoScreen = (props) => { |
|
|
|
<TreeSelect |
|
|
|
style={{ width: 150, }} |
|
|
|
dropdownStyle={{ maxHeight: 300, overflow: 'auto', color: '#FFFFFF', }} |
|
|
|
treeData={treeData} |
|
|
|
treeData={queryData} |
|
|
|
placeholder="请选择" |
|
|
|
multiple={true} |
|
|
|
defaultValue={['全部']} |
|
|
|
maxTagCount={1} |
|
|
|
onChange={(e) => { |
|
|
|
console.log(e) |
|
|
|
setQueryValue(e) |
|
|
|
}} |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<Tree |
|
|
|
multiple |
|
|
|
treeData={treeData} |
|
|
|
treeData={leftTree} |
|
|
|
defaultExpandAll |
|
|
|
onChange={(e) => { |
|
|
|
console.log(e); |
|
|
|
}} |
|
|
|
style={{ width: 150, color: '#FFFFFF' }} |
|
|
|
/> |
|
|
|
</div> |
|
|
@ -191,13 +285,14 @@ const VideoScreen = (props) => { |
|
|
|
</Button> */} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div style={{ display: 'flex', height: '100%' }}> |
|
|
|
<div style={{ display: 'flex', height: `calc( 100% - 160px )` }}> |
|
|
|
{/* 视频 */} |
|
|
|
<div style={{ flex: 1, height: '100%' }}> |
|
|
|
<Row style={{ height: `calc( 100% - 160px )` }}> |
|
|
|
{data.map((v, index) => { |
|
|
|
return <VideoCard key={'VideoCard' + index} data={v} /> |
|
|
|
})} |
|
|
|
<Row style={{ height: '100%' }}> |
|
|
|
{/* {data.map((v, index) => { |
|
|
|
console.log(v); |
|
|
|
return <VideoCard key={'VideoCard' + index} data={v} pageSize={pageSize} /> |
|
|
|
})} */} |
|
|
|
</Row> |
|
|
|
</div> |
|
|
|
{/* 视频设置 */} |
|
|
@ -211,13 +306,13 @@ const VideoScreen = (props) => { |
|
|
|
return <div key={index}> |
|
|
|
<Popover |
|
|
|
position='left' |
|
|
|
// trigger='click' |
|
|
|
trigger='click' |
|
|
|
content={() => { |
|
|
|
switch (v.value) { |
|
|
|
case '宫格设置': |
|
|
|
return <div style={{ height: 69, background: '#01185F', boxShadow: ' inset 0px 0px 5px 1px rgba(28,96,254,0.2500)', display: 'flex', justifyContent: 'space-evenly', alignItems: 'center' }}> |
|
|
|
{v.screen.map((item) => { |
|
|
|
return <div key={item.img}> |
|
|
|
return <div key={item.img} onClick={() => flipScreens(item.value)}> |
|
|
|
<img src={`/assets/images/application/${item.img}.png`} alt="" style={{ width: 40, height: 40, }} /> |
|
|
|
<div style={{ width: 40, fontWeight: 400, color: ' #D9D9D9', fontSize: 12, textAlign: 'center' }}>{item.value}</div> |
|
|
|
</div> |
|
|
|