Browse Source

大屏视频播放

dev
巴林闲侠 2 years ago
parent
commit
77d7ec0061
  1. 2
      web/client/src/components/index.js
  2. 11
      web/client/src/sections/quanju/containers/footer/conserve/right/right-top.js
  3. 22
      web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js
  4. 4
      web/client/src/sections/quanju/containers/footer/leadership/right/hudong.js
  5. 202
      web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js
  6. 76
      web/client/src/sections/quanju/containers/footer/leadership/right/right-top.js
  7. 4
      web/package.json

2
web/client/src/components/index.js

@ -4,7 +4,6 @@
import Upload from './Upload'; import Upload from './Upload';
import NoResource from './no-resource'; import NoResource from './no-resource';
import LimitTextArea from './limit-textarea'; import LimitTextArea from './limit-textarea';
import ProcessForm from './process_form'
import FlowRecordTable from './flowRecordTable' import FlowRecordTable from './flowRecordTable'
import Table from './table' import Table from './table'
import Search from './search' import Search from './search'
@ -16,7 +15,6 @@ export {
Upload, Upload,
NoResource, NoResource,
LimitTextArea, LimitTextArea,
ProcessForm,
FlowRecordTable, FlowRecordTable,
Table, Table,
Search, Search,

11
web/client/src/sections/quanju/containers/footer/conserve/right/right-top.js

@ -84,7 +84,16 @@ const RightTop = (props) => {
<div style={{ position: "fixed", width: "400px", height: "200px", zIndex: 100, right: "24%", marginTop: "0", top: "25%" }}> <div style={{ position: "fixed", width: "400px", height: "200px", zIndex: 100, right: "24%", marginTop: "0", top: "25%" }}>
<img src='/assets/images/leadership/beijinglan.png' style={{ width: "100%", height: "100%" }} /> <img src='/assets/images/leadership/beijinglan.png' style={{ width: "100%", height: "100%" }} />
<div style={{ width: "50%", height: "100%", position: "absolute", top: "0", }}> <div style={{ width: "50%", height: "100%", position: "absolute", top: "0", }}>
<Hua shuzu={[{ "imgs": item.conserveAfterPic ? item.conserveAfterPic[0] : "" }, { "imgs": item.conserveBeforePic ? item.conserveBeforePic[0] : "" }, { "imgs": item.conserveUnderwayPic ? item.conserveUnderwayPic[0] : "" }]} /> <Hua shuzu={[{
"imgs": item.conserveAfterPic ?
item.conserveAfterPic[0] : ""
}, {
"imgs": item.conserveBeforePic ?
item.conserveBeforePic[0] : ""
}, {
"imgs": item.conserveUnderwayPic ?
item.conserveUnderwayPic[0] : ""
}]} />
</div> </div>
<div style={{ position: "absolute", top: "0", width: "50%", left: "50%", paddingRight: "10px" }}> <div style={{ position: "absolute", top: "0", width: "50%", left: "50%", paddingRight: "10px" }}>
<p style={{ marginTop: "20px", color: "#FFFFFF", fontSize: "16px", fontFamily: "YouSheBiaoTiHei" }}> <p style={{ marginTop: "20px", color: "#FFFFFF", fontSize: "16px", fontFamily: "YouSheBiaoTiHei" }}>

22
web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js

@ -2,10 +2,10 @@ import React, { useEffect, useState } from 'react'
import Module from '../../../public/module' import Module from '../../../public/module'
import Lunbo from "../right/lunbo" import Lunbo from "../right/lunbo"
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { YSIframePlayer } from '../../../../../../components'
// import "./left.less" // import "./left.less"
const Leftcenter = ({ videoCenterList }) => { const Leftcenter = ({ videoCenterList }) => {
console.log(videoCenterList);
const style = { height: "30%", marginTop: "5%" } const style = { height: "30%", marginTop: "5%" }
// const hualun = "auto" // const hualun = "auto"
const [num, setNum] = useState(1); const [num, setNum] = useState(1);
@ -31,10 +31,10 @@ const Leftcenter = ({ videoCenterList }) => {
const timer = setInterval(() => { const timer = setInterval(() => {
if (num == list.length) { if (num == list.length) {
setNum(1); setNum(1);
setTu(list[0].img); // setTu(list[0].img);
} else { } else {
setNum(num + 1); setNum(num + 1);
setTu(list[num].img); // setTu(list[num].img);
} }
}, 2000 * 10); }, 2000 * 10);
return () => clearInterval(timer); return () => clearInterval(timer);
@ -77,10 +77,24 @@ const Leftcenter = ({ videoCenterList }) => {
<div style={{ width: "60%", height: "100%", float: "left", marginLeft: "1%" }}> <div style={{ width: "60%", height: "100%", float: "left", marginLeft: "1%" }}>
{ {
list.map((item, index) => { list.map((item, index) => {
console.log(item);
return index + 1 == num ? return index + 1 == num ?
<div style={{ width: "100%", height: "100%", position: "relative" }}> <div style={{ width: "100%", height: "100%", position: "relative" }}>
<img style={{ width: "100%", height: '100%', position: "absolute", bottom: "5%" }} src={item.img} /> {/* <img style={{ width: "100%", height: '100%', position: "absolute", bottom: "5%" }} src={item.img} /> */}
<YSIframePlayer
containerId={`yingshiPlay_${index}`}
height='100%'
width="100%"
url={`ezopen://open.ys7.com/${item.deviceSerial}/${item.channelNo || '1'}.live`}
audio="0"
ysToken={item.token}
videoState={{
status: item.status
}}
/>
<p style={{ <p style={{
width: "100%", height: "3vh", position: "absolute", bottom: "3%", width: "100%", height: "3vh", position: "absolute", bottom: "3%",
backgroundColor: "rgba(0,0,0,0.26)", lineHeight: "3vh", textAlign: "" backgroundColor: "rgba(0,0,0,0.26)", lineHeight: "3vh", textAlign: ""

4
web/client/src/sections/quanju/containers/footer/leadership/right/hudong.js

@ -48,6 +48,7 @@ class ReactCarousel extends Component {
} }
render () { render () {
console.log(this.props);
return ( return (
<div className="ReactCarousel" style={{ width: "100%", height: "100%" }}> <div className="ReactCarousel" style={{ width: "100%", height: "100%" }}>
<div className="contain" <div className="contain"
@ -128,7 +129,10 @@ class ReactCarousel extends Component {
) )
} }
componentDidMount () { //一开始自动播放 componentDidMount () { //一开始自动播放
if(this.props.shuzu)
setTimeout(() => {
this.start(); this.start();
}, 0)
} }
componentWillUnmount () { //销毁前清除定时器 componentWillUnmount () { //销毁前清除定时器

202
web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js

@ -0,0 +1,202 @@
import React, { Component } from 'react';
import './left.less';
import { connect } from 'react-redux'
import { YSIframePlayer } from '../../../../../../components'
class ReactCarousel extends Component {
chunk (arr, size) {
var arr1 = new Array();
for (var i = 0; i < Math.ceil(arr.length / size); i++) {
arr1[i] = new Array();
}
var j = 0;
var x = 0;
for (var i = 0; i < arr.length; i++) {
if (!((i % size == 0) && (i != 0))) {
arr1[j][x] = arr[i];
x++;
} else {
j++;
x = 0;
arr1[j][x] = arr[i];
x++;
}
}
return arr1;
}
constructor() {
super();
this.state = {
imgs: [],
showIndex: 0, //显示第几个图片
timer: null, // 定时器
show: false, // 前后按钮显示
}
}
renderVideo = (item, index) => {
return <YSIframePlayer
containerId={`yingshiPlay_lu_${index}`}
height='100%'
width="100%"
url={`ezopen://open.ys7.com/${item.deviceSerial}/${item.channelNo || '1'}.live`}
audio="0"
ysToken={item.token}
videoState={{
status: item.status
}}
/>
}
render () {
console.log(this.props);
const { imgs } = this.state
return (
<div className="ReactCarousel" style={{ width: "100%", height: "100%" }}>
<div className="contain"
onMouseEnter={() => { this.stop() }} //鼠标进入停止自动播放
onMouseLeave={() => { this.start() }} //鼠标退出自动播放
>
<ul className="ul">
{
this.state.imgs.map((value, index) => {
return (
<li style={{ position: "relative", left: "8%", width: "100%", height: "100%", top: "-5%", fontSize: "12px" }} className={index === this.state.showIndex ? 'show' : ''}
key={index}
>
{
imgs.map((value, index) => {
if (index == 0) {
return value?.deviceSerial ? <div style={{ width: "45%", height: "40%", backgroundSize: 'cover', position: "absolute", left: "-3%", top: "5%" }}>
{this.renderVideo(value, index)}
<div style={{ width: "100%", height: "100%", position: "absolute", top: "80%" }}>
<div style={{ width: "100%", height: "20%", backgroundColor: "rgba(0,0,0,0.6)", overflow: "hiddden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
<img src='/assets/images/leadership/weizhis.png' style={{ width: "6%", height: "80%", marginLeft: "3%", marginRight: "3%" }} />
{value?.deviceName}
</div>
</div>
</div> : ''
} else if (index == 1) {
return value?.deviceSerial ? <div style={{ width: "45%", height: "40%", backgroundSize: 'cover', position: "absolute", left: "45%", top: "5%" }}>
{this.renderVideo(value, index)}
<div style={{ width: "100%", height: "100%", position: "absolute", top: "80%" }}>
<div style={{ width: "100%", height: "20%", backgroundColor: "rgba(0,0,0,0.6)", overflow: "hiddden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
<img src='/assets/images/leadership/weizhis.png' style={{ width: "6%", height: "80%", marginLeft: "3%", marginRight: "3%" }} />
{value?.deviceName}
</div>
</div>
</div> : ""
} else if (index == 2) {
return value?.deviceSerial ? <div style={{ width: "45%", height: "40%", backgroundSize: 'cover', position: "absolute", left: "-3%", top: "49%" }}>
{this.renderVideo(value, index)}
<div style={{ width: "100%", height: "100%", position: "absolute", top: "80%" }}>
<div style={{ width: "100%", height: "20%", backgroundColor: "rgba(0,0,0,0.6)", overflow: "hiddden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
<img src='/assets/images/leadership/weizhis.png' style={{ width: "6%", height: "80%", marginLeft: "3%", marginRight: "3%" }} />
{value?.deviceName}
</div>
</div>
</div> : ""
} else if (index == 3) {
return value?.deviceSerial ? <div style={{ width: "45%", height: "40%", backgroundSize: 'cover', position: "absolute", left: "45%", top: "49%" }}>
{this.renderVideo(value, index)}
<div style={{ width: "100%", height: "100%", position: "absolute", top: "80%" }}>
<div style={{ width: "100%", height: "20%", backgroundColor: "rgba(0,0,0,0.6)", overflow: "hiddden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
<img src='/assets/images/leadership/weizhis.png' style={{ width: "6%", height: "80%", marginLeft: "3%", marginRight: "3%" }} />
{value?.deviceName}
</div>
</div>
</div> : ""
} else {
return undefined
}
})
}
</li>
)
})
}
</ul>
{/* <div className="control" style={{ width: "100%", height: "10%" }}>
<span style={{ position: "absolute", top: "86%", width: "3%", height: "8%" }} className="left" onClick={(e) => { this.previous(e) }}>
<img src='/assets/images/leadership/zuofanye.png' style={{ width: "100%", height: "100%" }} />
</span>
<span style={{ position: "absolute", top: "86%", width: "3%", height: "8%", right: "6%" }} className="right" onClick={(e) => { this.next(e) }}>
<img src='/assets/images/leadership/youofanye.png' style={{ width: "100%", height: "100%" }} />
</span>
</div> */}
</div>
</div>
)
}
componentWillReceiveProps (nextProps, oldProps) {
if (nextProps.videoCenterList && nextProps.videoCenterList.length && (!oldProps.videoCenterList || !oldProps.videoCenterList.length)) {
this.setState({
imgs: nextProps.videoCenterList.slice(-4)
})
}
}
componentDidMount () { //一开始自动播放
setTimeout(() => {
this.start();
}, 0)
}
componentWillUnmount () { //销毁前清除定时器
this.stop();
}
stop = () => { //暂停
let { timer } = this.state;
clearInterval(timer);
}
start = () => { //开始
let { timer } = this.state;
timer = setInterval(() => {
this.next();
}, 300000);
this.setState({
timer
})
}
change = (index) => { //点击下面的按钮切换当前显示的图片
let { showIndex } = this.state;
showIndex = index;
this.setState({
showIndex
})
}
previous = (e) => { //上一张
let ev = e || window.event;
let { showIndex, imgs } = this.state;
if (showIndex <= 0) {
showIndex = imgs.length - 1;
} else {
showIndex--;
}
this.setState({
showIndex
})
}
next = (e) => { //下一张
let ev = e || window.event;
let { showIndex, imgs } = this.state;
if (showIndex >= imgs.length - 1) {
showIndex = 0;
} else {
showIndex++;
}
this.setState({
showIndex
})
}
}
function mapStateToProps (state) {
const { videoCenterList } = state
return {
videoCenterList: videoCenterList.data || []
}
}
export default connect(mapStateToProps)(ReactCarousel)

76
web/client/src/sections/quanju/containers/footer/leadership/right/right-top.js

@ -2,10 +2,11 @@ import React, { useState, useEffect } from 'react';
import Module from '../../../public/module' import Module from '../../../public/module'
import { Radio, Select, Spin } from 'antd'; import { Radio, Select, Spin } from 'antd';
import Lunbo from "./lunbo" import Lunbo from "./lunbo"
import Huadong from './hudong'; import Huadong from './hudongVideo';
import { connect } from 'react-redux'
import "./left.less" import "./left.less"
const Righttop = () => { const Righttop = ({ videoCenterList }) => {
const { Option } = Select; const { Option } = Select;
const style = { height: "68%" } const style = { height: "68%" }
const children = []; const children = [];
@ -19,20 +20,20 @@ const Righttop = () => {
}; };
const [list, setList] = useState([ const [list, setList] = useState([
{ name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, // { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" },
{ name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, // { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" },
{ name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, // { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" },
{ name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, // { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" },
{ name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, // { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" },
{ name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, // { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" },
{ name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, // { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" },
{ name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, // { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" },
{ name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, // { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" },
{ name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, // { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" },
]) ])
for (let i = 0; i < list.length; i++) { // for (let i = 0; i < list.length; i++) {
children.push(<Option key={i.toString(36) + i}>{list[i].name}</Option>); // children.push(<Option key={i.toString(36) + i}>{list[i].name}</Option>);
} // }
// useEffect(() => { // useEffect(() => {
// const timer = setInterval(() => { // const timer = setInterval(() => {
@ -46,10 +47,17 @@ const Righttop = () => {
// }, 6000); // }, 6000);
// return () => clearInterval(timer); // return () => clearInterval(timer);
// }, [num]); // }, [num]);
useEffect(() => {
if (videoCenterList.length) {
setList(videoCenterList.slice(-4))
}
}, [videoCenterList])
const renderBody = () => { const renderBody = () => {
const offlineDevice = videoCenterList.filter(v => v.status == 0)
return ( return (
<div id='op' style={{ width: "100%", height: "55%" }}>{ <div id='op' style={{ width: "100%", height: "55%" }}>{
list.map((item, index) => { offlineDevice.length ? offlineDevice.map((item, index) => {
return ( return (
<div style={{ width: "100%", height: "100%" }} > <div style={{ width: "100%", height: "100%" }} >
<div style={{ width: "100%", height: "100%", }}> <div style={{ width: "100%", height: "100%", }}>
@ -61,17 +69,16 @@ const Righttop = () => {
}} onMouseLeave={() => { }} onMouseLeave={() => {
setNum() setNum()
}}> }}>
{num == index ? <img src={item.img} style={{ width: "100%", height: "120%", position: "absolute", }} /> : ""} {/* {num == index ? <img src={item.img} style={{ width: "100%", height: "120%", position: "absolute", }} /> : ""}
{num == index ? <img src={item.img} style={{ width: "5%", height: "100%", position: "absolute", left: "-0.5%", top: "20%" }} /> : ""} {num == index ? <img src={item.img} style={{ width: "5%", height: "100%", position: "absolute", left: "-0.5%", top: "20%" }} /> : ""} */}
<p style={{ position: "absolute", left: "5%", color: num == index ? "#FFFFFF" : "rgba(216,240,255,0.8)" }} >{item.name}</p> <p style={{ position: "absolute", left: "5%", color: num == index ? "#FFFFFF" : "rgba(216,240,255,0.8)" }} >{item.deviceName}</p>
<p style={{ position: "absolute", right: "5%", color: num == index ? "#FFFFFF" : "rgba(216,240,255,0.8)" }}>{item.name}</p> <p style={{ position: "absolute", right: "5%", color: num == index ? "#FFFFFF" : "rgba(216,240,255,0.8)" }}>{item.deviceSerial}</p>
</li> </li>
</div> </div>
</div> </div>
) )
}) : ''
})
} }
</div > </div >
) )
@ -81,12 +88,16 @@ const Righttop = () => {
<Module style={style} title={"路面执法监控"}> <Module style={style} title={"路面执法监控"}>
<div style={{ width: "100%", height: "65%", position: "relative" }}> <div style={{ width: "100%", height: "65%", position: "relative" }}>
<p style={{ position: "absolute", left: "25%", top: "2%", fontSize: "14px", color: "#FFFFFF" }}>监控总数</p><p style={{ position: "absolute", left: "37%", fontSize: "24px", marginLeft: "1%", top: "-0.5%", color: "#FFFFFF", fontFamily: "YouSheBiaoTiHei" }}>129</p> <p style={{ position: "absolute", left: "25%", top: "2%", fontSize: "14px", color: "#FFFFFF" }}>监控总数</p><p style={{ position: "absolute", left: "37%", fontSize: "24px", marginLeft: "1%", top: "-0.5%", color: "#FFFFFF", fontFamily: "YouSheBiaoTiHei" }}>{videoCenterList.length}</p>
<p style={{ position: "absolute", left: "55%", top: "2%", fontSize: "14px", color: "#FFFFFF" }}>在线率</p><p style={{ position: "absolute", right: "15%", fontSize: "24px", marginLeft: "2%", top: "-0.5%", color: "#FFFFFF", fontFamily: "YouSheBiaoTiHei" }}>88.87%</p> <p style={{ position: "absolute", left: "55%", top: "2%", fontSize: "14px", color: "#FFFFFF" }}>在线率</p><p style={{ position: "absolute", right: "15%", fontSize: "24px", marginLeft: "2%", top: "-0.5%", color: "#FFFFFF", fontFamily: "YouSheBiaoTiHei" }}>
{
videoCenterList.length ?
((videoCenterList.filter(v => v.status == 1).length / videoCenterList.length) * 100).toFixed(0) : '100'
}%</p>
<div style={{ width: "100%", height: "10%", position: "relative" }}> <div style={{ width: "100%", height: "10%", position: "relative" }}>
<img src='/assets/images/leadership/head.png' style={{ width: "15%", marginLeft: "5%" }} /> <img src='/assets/images/leadership/head.png' style={{ width: "15%", marginLeft: "5%" }} />
<div className='wy-rightTop' style={{ position: "absolute", right: "5%", top: "130%" }}> {/* <div className='wy-rightTop' style={{ position: "absolute", right: "5%", top: "130%" }}>
<Select <Select
size={size} size={size}
defaultValue="选择路段" defaultValue="选择路段"
@ -100,11 +111,10 @@ const Righttop = () => {
{children} {children}
</Select> </Select>
<div>{size}</div> <div>{size}</div>
</div> */}
</div> </div>
<div style={{ width: "100%", height: "90%", position: "relative", top: "10%" }}>
</div>
<div style={{ width: "100%", height: "80%", position: "relative", top: "10%" }}>
<Huadong /> <Huadong />
</div> </div>
</div> </div>
@ -131,4 +141,12 @@ const Righttop = () => {
</> </>
) )
} }
export default Righttop
function mapStateToProps (state) {
const { videoCenterList } = state
return {
videoCenterList: videoCenterList.data || []
}
}
export default connect(mapStateToProps)(Righttop)

4
web/package.json

@ -6,11 +6,7 @@
"scripts": { "scripts": {
"test": "mocha", "test": "mocha",
"start": "cross-env NODE_ENV=development npm run start-params", "start": "cross-env NODE_ENV=development npm run start-params",
<<<<<<< Updated upstream
"start-params": "node server -p 5000 -u http://localhost:13400 --qndmn http://rfkimpwbb.hn-bkt.clouddn.com --vcmpWebUrl https://mediaconsole.ngaiot.com --vcmpMirrorId 24461524032354", "start-params": "node server -p 5000 -u http://localhost:13400 --qndmn http://rfkimpwbb.hn-bkt.clouddn.com --vcmpWebUrl https://mediaconsole.ngaiot.com --vcmpMirrorId 24461524032354",
=======
"start-params": "node server -p 5000 -u http://localhost:13401 --qndmn http://rfkimpwbb.hn-bkt.clouddn.com",
>>>>>>> Stashed changes
"deploy": "export NODE_ENV=production&&npm run color && npm run build && node server", "deploy": "export NODE_ENV=production&&npm run color && npm run build && node server",
"build-dev": "export NODE_ENV=development&&webpack --config webpack.config.js", "build-dev": "export NODE_ENV=development&&webpack --config webpack.config.js",
"build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js", "build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js",

Loading…
Cancel
Save