Browse Source

镜像调用服务

release_1.3.0
wenlele 3 years ago
parent
commit
311226953a
  1. BIN
      code/VideoAccess-VCMP/web/client/assets/images/application/背景@2x (1).png
  2. 2
      code/VideoAccess-VCMP/web/client/src/app.jsx
  3. 5
      code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx
  4. 15
      code/VideoAccess-VCMP/web/client/src/layout/index.jsx
  5. 2
      code/VideoAccess-VCMP/web/client/src/sections/auth/containers/login.jsx
  6. 33
      code/VideoAccess-VCMP/web/client/src/sections/openness/actions/mirroring.js
  7. 2
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx
  8. 58
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx
  9. 76
      code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx
  10. 3
      code/VideoAccess-VCMP/web/client/src/sections/openness/containers/index.js
  11. 63
      code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx
  12. 9
      code/VideoAccess-VCMP/web/client/src/sections/openness/routes.js
  13. 2
      code/VideoAccess-VCMP/web/client/src/utils/webapi.js

BIN
code/VideoAccess-VCMP/web/client/assets/images/application/背景@2x (1).png

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 KiB

2
code/VideoAccess-VCMP/web/client/src/app.jsx

@ -20,7 +20,9 @@ const App = props => {
const { projectName } = props
useEffect(() => {
if (!window.__MICRO_APP_ENVIRONMENT__) {
document.title = projectName;
}
}, [])
return (

5
code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx

@ -13,8 +13,11 @@ const Header = (props) => {
onClick={({ itemKey }) => {
if (itemKey == "logout") {
dispatch(actions.auth.logout(user));
if (!window.__MICRO_APP_ENVIRONMENT__) {
const iotAuth = document.getElementById('iotAuth').contentWindow;
iotAuth.postMessage({ action: 'logout' }, '*');
}
if (socket) {
socket.disconnect();
}
@ -60,7 +63,7 @@ const Header = (props) => {
}}
/>
<Avatar size="small" color="light-blue" style={{marginRight:4}}>
<Avatar size="small" color="light-blue" style={{ marginRight: 4 }}>
<img src="/assets/images/avatar/6.png" />
</Avatar>
<div style={{

15
code/VideoAccess-VCMP/web/client/src/layout/index.jsx

@ -19,7 +19,7 @@ moment.locale('zh-cn');
const { initLayout, initApiRoot, resize, initWebSocket } = layoutActions;
const Root = props => {
const { sections, title, copyright } = props;
const { sections, title, copyright, actions } = props;
const [history, setHistory] = useState(null)
const [store, setStore] = useState(null)
const [outerRoutes, setOuterRoutes] = useState([])
@ -172,6 +172,9 @@ const Root = props => {
// MicroApp
const microAppListen = async (data) => {
console.log(actions);
console.log('mid:' + data.data.mid);
if (data.action == 'initMicro') {
await store.dispatch(actions.auth.initAuth({
authorized: true,
@ -179,7 +182,13 @@ const Root = props => {
// mirrorId: data.data.mirrorId
...(data.data || {})
}))
// await store.dispatch(push('/noMatch'));
if (data?.data?.mid) {
console.log(22315348);
await store.dispatch(push('/callService'));
} else {
await store.dispatch(push('/noMatch'));
}
setMicroAppWaiting(false)
}
}
@ -227,7 +236,7 @@ const Root = props => {
: ''
}
{
resourceRoot.iotAuthWeb ?
resourceRoot.iotAuthWeb && !window.__MICRO_APP_ENVIRONMENT__ ?
<iframe id="iotAuth" src={`${resourceRoot.iotAuthWeb}/cross`} style={{ position: 'absolute', top: 0, height: 1, visibility: 'hidden' }} frameBorder={0} >
<p>你的浏览器不支持 iframe</p>
</iframe>

2
code/VideoAccess-VCMP/web/client/src/sections/auth/containers/login.jsx

@ -20,8 +20,10 @@ const Login = props => {
useEffect(() => {
if (user && user.authorized) {
if (!window.__MICRO_APP_ENVIRONMENT__) {
const iotAuth = document.getElementById('iotAuth').contentWindow;
iotAuth.postMessage({ action: 'login', user: user }, '*');
}
dispatch(push('/equipmentWarehouse/nvr'));
localStorage.setItem('vcmp_selected_sider', JSON.stringify(['nvr']))
localStorage.setItem('vcmp_open_sider', JSON.stringify(['equipmentWarehouse']))

33
code/VideoAccess-VCMP/web/client/src/sections/openness/actions/mirroring.js

@ -1,8 +1,8 @@
"use strict";
import { ApiTable,basicAction } from "$utils";
import { ApiTable, basicAction } from "$utils";
export function getCamera(query) {
export function getCamera (query) {
return (dispatch) =>
basicAction({
type: "get",
@ -14,7 +14,7 @@ export function getCamera(query) {
reducer: { name: "equipmentWarehouseCamera", params: { noClear: true } },
});
}
export function getCameraListAll() {//获取摄像头能力列表
export function getCameraListAll () {//获取摄像头能力列表
return (dispatch) =>
basicAction({
type: "get",
@ -25,7 +25,7 @@ export function getCameraListAll() {//获取摄像头能力列表
reducer: { name: "" },
});
}
export function getMirrorList() {//获取摄像头能力列表
export function getMirrorList () {//获取镜像信息列表
return (dispatch) =>
basicAction({
type: "get",
@ -36,7 +36,7 @@ export function getMirrorList() {//获取摄像头能力列表
reducer: { name: "" },
});
}
export function delMirror(orgId) {//删除镜像信息
export function delMirror (orgId) {//删除镜像信息
return (dispatch) =>
basicAction({
type: "del",
@ -50,7 +50,7 @@ export function delMirror(orgId) {//删除镜像信息
reducer: { name: "" },
});
}
export function putMirrorCopy(orgId) { //编辑推送配置
export function putMirrorCopy (orgId) { //编辑推送配置
return (dispatch) =>
basicAction({
type: "put",
@ -61,7 +61,7 @@ export function putMirrorCopy(orgId) { //编辑推送配置
reducer: {},
});
}
export function putMirrorPublish(orgId) { //编辑推送配置
export function putMirrorPublish (orgId) { //编辑推送配置
return (dispatch) =>
basicAction({
type: "put",
@ -73,7 +73,7 @@ export function putMirrorPublish(orgId) { //编辑推送配置
});
}
export function getMirrorDetail(orgId) {//获取摄像头能力列表
export function getMirrorDetail (orgId) {//获取摄像头能力列表
return (dispatch) =>
basicAction({
type: "get",
@ -84,7 +84,7 @@ export function getMirrorDetail(orgId) {//获取摄像头能力列表
reducer: { name: "" },
});
}
export function putMirror(data) { //编辑推送配置
export function putMirror (data) { //编辑推送配置
return (dispatch) =>
basicAction({
type: "put",
@ -97,7 +97,7 @@ export function putMirror(data) { //编辑推送配置
});
}
export function getErrorCode(query) {//查取指定状态码信息
export function getErrorCode (query) {//查取指定状态码信息
return (dispatch) =>
basicAction({
type: "get",
@ -109,3 +109,16 @@ export function getErrorCode(query) {//查取指定状态码信息
reducer: { name: "" },
});
}
export function getMirrorMid (orgId) {//获取指定镜像信息
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_MIRRORMID",
url: `${ApiTable.getMirrorMid.replace("{mid}", orgId)}`,
msg: { option: "" },
reducer: { name: "" },
})
}

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

@ -40,7 +40,7 @@ const Container = ({ videoObj, pageSize, showHeader, videoPlay, mould }) => {
videoStyle='true'
containerId={videoObj.key}
local={true} /> :
<img src={`/assets/images/openness/${pageSize == 1 || pageSize == 4 ? mould('blue2', 'white2', 'black2') : mould('blue1.5', 'white1.5', 'black1.5')}.png`} style={{
<img src={`${__webpack_public_path__}assets/images/openness/${pageSize == 1 || pageSize == 4 ? mould('blue2', 'white2', 'black2') : mould('blue1.5', 'white1.5', 'black1.5')}.png`} style={{
display: 'inline-block', width: videoWidth - 10, height: videoHeight - 30,
}} /> : ""}
<div style={{ lineHeight: '30px', paddingLeft: 6, color: mould('#FFFFFF', '#615E5E', '#FFFFFF') }}>{videoObj?.label}</div>

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

@ -9,8 +9,8 @@ import PerfectScrollbar from "perfect-scrollbar";
let timing
let projectScrollbar;
const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, showHeader }) => {
// console.log({ : treeData });
// console.log(filterGroup);
// console.log('', treeData);
// console.log('', filterGroup);
// console.log(headerName);
// console.log(videoPlay);
// console.log(template);
@ -57,50 +57,6 @@ const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, s
// }
// },
// ]
// },
// {
// 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) //
@ -356,7 +312,7 @@ const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, s
className={template}
style={{
width: '100%', height: '100%',
background: `url(/assets/images/application/${mould('buleBackground', "whiteBackground", "blackBackground")}.png)`,
background: `url(${__webpack_public_path__}assets/images/application/${mould('buleBackground', "whiteBackground", "blackBackground")}.png)`,
color: '#FFFFFF',
// minWidth: 1000,
}}>
@ -375,7 +331,7 @@ const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, s
color: mould('#FFFFFF', 'rgba(0,0,0,0.65)', '#FFFFFF'),
lineHeight: '70px',
letterSpacing: '5px',
background: `url(/assets/images/application/${mould('buletitleBottom', "whitetitleBottom", "blacktitleBottom")}.png)`,
background: `url(${__webpack_public_path__}assets/images/application/${mould('buletitleBottom', "whitetitleBottom", "blacktitleBottom")}.png)`,
backgroundSize: '100% 100%',
}} >{headerName}</div>
</div> : ""}
@ -581,7 +537,7 @@ const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, s
</div>
{/* 视频设置 */}
<div style={{
marginTop:5, width: 64, height: 476, background: mould('#01185F', ' linear-gradient(197deg, rgba(255,255,255,0.65) 0%, #E4E4E4 100%)', 'linear-gradient(216deg, #979797 0%, #BEBEBE 53%, #969696 100%)'), boxShadow: `inset 0px 0px 5px 1px ${mould('rgba(28,96,254,0.4000)', 'rgba(97,94,94,0.5)', 'rgba(132,132,132,0.5)')}`, borderRadius: ' 1px', textAlign: 'center',
marginTop: 5, width: 64, height: 476, background: mould('#01185F', ' linear-gradient(197deg, rgba(255,255,255,0.65) 0%, #E4E4E4 100%)', 'linear-gradient(216deg, #979797 0%, #BEBEBE 53%, #969696 100%)'), boxShadow: `inset 0px 0px 5px 1px ${mould('rgba(28,96,254,0.4000)', 'rgba(97,94,94,0.5)', 'rgba(132,132,132,0.5)')}`, borderRadius: ' 1px', textAlign: 'center',
}}>
{[{ img: mould('blueGongge', 'whiteGongge', 'blackGongge'), value: '宫格设置', screen: [{ img: mould('blueScreen1', 'whiteScreen1', 'blackScreen1'), value: '单屏' }, { img: mould('blueScreen4', 'whiteScreen4', 'blackScreen4'), value: '4分屏' }, { img: mould('blueScreen6', 'whiteScreen6', 'blackScreen6'), value: '6分屏' }, { img: mould('blueScreen12', 'whiteScreen12', 'blackScreen12'), value: '12分屏' },] },
{ img: mould('bluePolling', 'whitePolling', 'blackPolling'), value: '轮询设置', },
@ -597,7 +553,7 @@ const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, s
return <div style={{ height: 69, background: mould('#01185F', 'linear-gradient(245deg, #FFFFFF 0%, #EAEBEC 100%)', 'linear-gradient(311deg, #9D9D9D 0%, #8C8C8C 50%, #7E7E7E 100%)'), boxShadow: `inset 0px 0px 5px 1px ${mould('rgba(28,96,254,0.2500)', 'rgba(97,94,94,0.39)', 'rgba(132,132,132,0.5)')}`, display: 'flex', justifyContent: 'space-evenly', alignItems: 'center' }}>
{v.screen.map((item) => {
return <div key={item.img} onClick={() => { flipScreens(item.value); setMultiScreen(item.value) }}>
<img src={`/assets/images/application/${item.img}.png`} alt="" style={{ width: 40, height: 40, }} />
<img src={`${__webpack_public_path__}assets/images/application/${item.img}.png`} alt="" style={{ width: 40, height: 40, }} />
<div style={{ width: 40, fontWeight: 400, color: mould('#D9D9D9', '#615E5E', '#D9D9D9'), fontSize: 12, textAlign: 'center' }}>{item.value}</div>
</div>
})}
@ -623,7 +579,7 @@ const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, s
}
}}
>
<img src={`/assets/images/application/${v.img}.png`} alt="" style={{ width: 54, height: 54, margin: '20px 0 0px 10px' }}
<img src={`${__webpack_public_path__}assets/images/application/${v.img}.png`} alt="" style={{ width: 54, height: 54, margin: '20px 0 0px 10px' }}
onClick={() => {
if (v.value == '背投') document.getElementById('rearProjection').requestFullscreen()
}} />

76
code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx

@ -0,0 +1,76 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { tree } from './mirroringDetail';
import VideoScreen from '../components/videoScreen';
const CallService = (props) => {
const { dispatch, actions, user } = props
const [treeData, setTreeData] = useState([]) //
const [headerName, setHeaderName] = useState('dfvbfdbe')
const [showHeader, setShowHeader] = useState(true) //
const [filterGroup, setFilterGroup] = useState([]) //
const [template, setTemplate] = useState('') //
const [videoPlay, setVideoPlay] = useState(true) //
useEffect(() => {
dispatch(actions.openness.getMirrorList()).then((res) => {
if (res?.success && res?.payload?.data?.some(v => v.mid == user?.mid)) {
dispatch(actions.openness.getMirrorMid(user?.mid)).then((r) => {
if (r?.success) {
let data = r?.payload?.data || {}
let filterGrouplist =data.filterGroup
for (let i = 0; i < filterGrouplist.length; i++) {
filterGrouplist[i].num = i
if (filterGrouplist[i].filters.length > 0) {
for (let j = 0; j < filterGrouplist[i].filters.length; j++) {
filterGrouplist[i].filters[j].num = j
}
}
}
setTreeData(tree(data.tree))
setHeaderName(data.title)
setShowHeader(data.showHeader)
setFilterGroup(filterGrouplist)
setTemplate(data.template)
}
})
} else {
dispatch(push('/callService'));
}
})
}, [])
return (
<div style={{ width: '100%', height: '100%' }}>
{treeData ? <VideoScreen
treeData={treeData}
headerName={headerName}
showHeader={showHeader}
filterGroup={filterGroup}
template={template}
videoPlay={videoPlay} /> : ""}
</div>
)
}
function mapStateToProps (state) {
const { auth, global, members } = state;
console.log('ccccccccccc', state)
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
global: global,
members: members.data,
};
}
export default connect(mapStateToProps)(CallService);

3
code/VideoAccess-VCMP/web/client/src/sections/openness/containers/index.js

@ -2,5 +2,6 @@
import Mirroring from './mirroring';
import MirroringDetail from './mirroringDetail';
import CallService from './callService';
export { Mirroring,MirroringDetail};
export { Mirroring,MirroringDetail,CallService};

63
code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx

@ -5,34 +5,8 @@ import { Tree, Popconfirm, Typography, Input, Switch, Modal, Checkbox, CheckboxG
import VideoScreen from '../components/videoScreen';
import { set } from 'nprogress';
const MirroringDetail = (props) => {
const { history, dispatch, actions, user, loading, StatusPushList } = props;
const { openness } = actions;
useEffect(() => {
let search = props.location.search
let result = search.slice(1)
let searcharr = result.split('&')
if (searcharr.length == 1) {
setTemplate(searcharr[0].split('=')[1])//
}
else {
setTemplate(searcharr[0].split('=')[1])//
dispatch(openness.getMirrorDetail(searcharr[1].split('=')[1])).then((res) => {
let filterGrouplist = res.payload.data.filterGroup
for (let i = 0; i < filterGrouplist.length; i++) {
filterGrouplist[i].num = i
if (filterGrouplist[i].filters.length > 0) {
for (let j = 0; j < filterGrouplist[i].filters.length; j++) {
filterGrouplist[i].filters[j].num = j
}
}
}
setFilterGroup(filterGrouplist);
setMirrorId(res.payload.data.id);//id
setShowHeader(res.payload.data.showHeader);
setHeaderName(res.payload.data.title);
let mytreeData = res.payload.data.tree
export const tree= (res)=>{
let mytreeData = res
for (let i = 0; i < mytreeData.length; i++) {//
mytreeData[i].value = mytreeData[i].key
for (let j = 0; j < mytreeData[i].children.length; j++) {//
@ -79,7 +53,38 @@ const MirroringDetail = (props) => {
}
}
}
setTreeData(mytreeData);
return mytreeData
}
const MirroringDetail = (props) => {
const { history, dispatch, actions, user, loading, StatusPushList } = props;
const { openness } = actions;
useEffect(() => {
let search = props.location.search
let result = search.slice(1)
let searcharr = result.split('&')
if (searcharr.length == 1) {
setTemplate(searcharr[0].split('=')[1])//
}
else {
setTemplate(searcharr[0].split('=')[1])//
dispatch(openness.getMirrorDetail(searcharr[1].split('=')[1])).then((res) => {
let filterGrouplist = res.payload.data.filterGroup
for (let i = 0; i < filterGrouplist.length; i++) {
filterGrouplist[i].num = i
if (filterGrouplist[i].filters.length > 0) {
for (let j = 0; j < filterGrouplist[i].filters.length; j++) {
filterGrouplist[i].filters[j].num = j
}
}
}
setFilterGroup(filterGrouplist);
setMirrorId(res.payload.data.id);//id
setShowHeader(res.payload.data.showHeader);
setHeaderName(res.payload.data.title);
let mytreeDatas= tree(res.payload.data.tree)
setTreeData(mytreeDatas);
})
}
equipmentGetCamera();

9
code/VideoAccess-VCMP/web/client/src/sections/openness/routes.js

@ -1,5 +1,5 @@
'use strict';
import { Mirroring,MirroringDetail } from './containers';
import { Mirroring,MirroringDetail,CallService } from './containers';
export default [{
type: 'inner',
@ -22,4 +22,11 @@ export default [{
key: 'MirroringDetail',
component: MirroringDetail,
}
},{
type: 'outer',
route: {
path: '/callService',
key: 'CallService',
component: CallService,
}
}];

2
code/VideoAccess-VCMP/web/client/src/utils/webapi.js

@ -77,6 +77,8 @@ export const ApiTable = {
putMirrorPublish: 'mirror/{mirrorId}/publish', //发布镜像信息
getMirror: 'mirror/{mid}', //获取指定镜像信息
putMirror: 'mirror', //编辑镜像信息
getMirrorMid:'mirror/{mid}' , //获取指定镜像信息
};

Loading…
Cancel
Save