Browse Source

镜像

dev_trial
wenlele 2 years ago
parent
commit
439bf94ef6
  1. 3
      code/VideoAccess-VCMP/api/config.js
  2. 2
      code/VideoAccess-VCMP/web/client/src/layout/containers/layout/index.jsx
  3. 15
      code/VideoAccess-VCMP/web/client/src/sections/openness/actions/mirroring.js
  4. 24
      code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx
  5. 60
      code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroring.jsx
  6. 1
      code/VideoAccess-VCMP/web/client/src/utils/webapi.js

3
code/VideoAccess-VCMP/api/config.js

@ -101,7 +101,8 @@ const product = {
{ p: '/status/alarm', o: 'POST' }, { p: '/status/alarm', o: 'POST' },
{ p: '/camera/unique/all', o: 'GET' }, { p: '/camera/unique/all', o: 'GET' },
{ p: '/status/alarm/confirm', o: 'PUT' }, { p: '/status/alarm/confirm', o: 'PUT' },
{ p: '/status/check', o: 'GET' } { p: '/status/check', o: 'GET' },
{ p: '/mirror/:mirrorId', o: 'GET' },
], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由 ], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由
redis: { redis: {
host: IOTA_REDIS_SERVER_HOST, host: IOTA_REDIS_SERVER_HOST,

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

@ -49,7 +49,7 @@ const LayoutContainer = props => {
useEffect(() => { useEffect(() => {
NProgress.done(); NProgress.done();
if ((!user || !user.authorized) && !authCrossLoading && props.location.pathname != '/video_play_status') { if ((!user || !user.authorized) && !authCrossLoading && props.location.pathname != '/video_play_status'&& props.location.pathname != '/callService') {
history.push('/signin'); history.push('/signin');
} }
if (msg) { if (msg) {

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

@ -111,10 +111,11 @@ export function getErrorCode (query) {//查取指定状态码信息
} }
export function getMirrorMid (orgId) {//获取指定镜像信息 export function getMirrorMid (orgId,query) {//获取指定镜像信息
return (dispatch) => return (dispatch) =>
basicAction({ basicAction({
type: "get", type: "get",
query,
dispatch: dispatch, dispatch: dispatch,
actionType: "GET_MIRRORMID", actionType: "GET_MIRRORMID",
url: `${ApiTable.getMirrorMid.replace("{mid}", orgId)}`, url: `${ApiTable.getMirrorMid.replace("{mid}", orgId)}`,
@ -122,3 +123,15 @@ export function getMirrorMid (orgId) {//获取指定镜像信息
reducer: { name: "" }, reducer: { name: "" },
}) })
} }
export function putUpdateMid (orgId) { //编辑推送配置
return (dispatch) =>
basicAction({
type: "put",
dispatch: dispatch,
actionType: "PUT_UPDATE_MID",
url: `${ApiTable.putUpdateMid.replace('{mirrorId}', orgId)}`,
msg: { option: '更新镜像服务ID' },
reducer: {},
});
}

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

@ -2,12 +2,14 @@ import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { tree } from './mirroringDetail'; import { tree } from './mirroringDetail';
import VideoScreen from '../components/videoScreen'; import VideoScreen from '../components/videoScreen';
import { push } from 'react-router-redux';
import qs from "qs";
import { Notification } from '@douyinfe/semi-ui';
const CallService = (props) => { const CallService = (props) => {
const { dispatch, actions, user } = props const { dispatch, actions, user, } = props
const [treeData, setTreeData] = useState([]) // const [treeData, setTreeData] = useState([]) //
const [headerName, setHeaderName] = useState('dfvbfdbe') const [headerName, setHeaderName] = useState('dfvbfdbe')
const [showHeader, setShowHeader] = useState(true) // const [showHeader, setShowHeader] = useState(true) //
@ -16,15 +18,11 @@ const CallService = (props) => {
const [videoPlay, setVideoPlay] = useState(true) // const [videoPlay, setVideoPlay] = useState(true) //
useEffect(() => { useEffect(() => {
const mid = qs.parse(props.location.search.slice(1))?.mid
dispatch(actions.openness.getMirrorMid(user?.mid || mid, { check: true })).then((r) => {
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) { if (r?.success) {
let data = r?.payload?.data || {} let data = r?.payload?.data || {}
let filterGrouplist = data.filterGroup
let filterGrouplist =data.filterGroup
for (let i = 0; i < filterGrouplist.length; i++) { for (let i = 0; i < filterGrouplist.length; i++) {
filterGrouplist[i].num = i filterGrouplist[i].num = i
if (filterGrouplist[i].filters.length > 0) { if (filterGrouplist[i].filters.length > 0) {
@ -38,10 +36,12 @@ const CallService = (props) => {
setShowHeader(data.showHeader) setShowHeader(data.showHeader)
setFilterGroup(filterGrouplist) setFilterGroup(filterGrouplist)
setTemplate(data.template) setTemplate(data.template)
}
})
} else { } else {
dispatch(push('/callService')); dispatch(push('/noMatch'))
Notification.error({
content: '获取镜像服务失败',
duration: 3,
})
} }
}) })

60
code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroring.jsx

@ -2,9 +2,10 @@ import React, { useEffect, useState, useRef } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { push } from 'react-router-redux'; import { push } from 'react-router-redux';
import '../style.less' import '../style.less'
import { Notification, Popconfirm } from "@douyinfe/semi-ui"; import { Notification, Popconfirm, Modal } from "@douyinfe/semi-ui";
import copy from "copy-to-clipboard"; import copy from "copy-to-clipboard";
import moment from "moment"; import moment from "moment";
import { IconRefresh } from '@douyinfe/semi-icons';
const Mirroring = (props) => { const Mirroring = (props) => {
const { history, dispatch, actions, user, loading, StatusPushList } = props; const { history, dispatch, actions, user, loading, StatusPushList } = props;
@ -26,6 +27,8 @@ const Mirroring = (props) => {
]); ]);
const [myCustomList, setMyCustomList] = useState([])// const [myCustomList, setMyCustomList] = useState([])//
const [isUpdate, setIsUpate] = useState(false)
const [updateId, setUpdateId] = useState()
useEffect(() => { useEffect(() => {
getMirror() getMirror()
}, []); }, []);
@ -42,10 +45,10 @@ const Mirroring = (props) => {
setMaskNum(1000) setMaskNum(1000)
} }
function todetail (color) {// function todetail (color) {//
dispatch(push('/mirroring_detail'+'?template='+color)); dispatch(push('/mirroring_detail' + '?template=' + color));
} }
function tomirrordetail(mid,template){ function tomirrordetail (mid, template) {
dispatch(push('/mirroring_detail'+'?template='+template+'&mid='+mid)); dispatch(push('/mirroring_detail' + '?template=' + template + '&mid=' + mid));
} }
function todelete (id) {// function todelete (id) {//
dispatch(openness.delMirror(id)).then((res) => { dispatch(openness.delMirror(id)).then((res) => {
@ -57,22 +60,22 @@ const Mirroring = (props) => {
getMirror() getMirror()
}) })
} }
function topublish(id){ function topublish (id) {
dispatch(openness.putMirrorPublish(id)).then((res) => { dispatch(openness.putMirrorPublish(id)).then((res) => {
getMirror() getMirror()
}) })
} }
function getTime(date){ function getTime (date) {
if(date){ if (date) {
let year = moment(date).year() + '-' let year = moment(date).year() + '-'
let month = (moment(date).month() + 1) > 10 ? (moment(date).month() + 1) + '-' : '0' + (moment(date).month() + 1) + '-' let month = (moment(date).month() + 1) > 10 ? (moment(date).month() + 1) + '-' : '0' + (moment(date).month() + 1) + '-'
let day = moment(date).date() > 10 ? moment(date).date() : '0' + moment(date).date(); let day = moment(date).date() > 10 ? moment(date).date() : '0' + moment(date).date();
let hour = moment(date).hour() > 10 ? moment(date).hour() : '0' + moment(date).hour(); let hour = moment(date).hour() > 10 ? moment(date).hour() : '0' + moment(date).hour();
let minute = moment(date).minute() > 10 ? moment(date).minute() : '0' + moment(date).minute(); let minute = moment(date).minute() > 10 ? moment(date).minute() : '0' + moment(date).minute();
let second = moment(date).second() > 10 ? moment(date).second() : '0' + moment(date).second(); let second = moment(date).second() > 10 ? moment(date).second() : '0' + moment(date).second();
return year + month+day + ' ' + hour + ':' + minute + ':' + second return year + month + day + ' ' + hour + ':' + minute + ':' + second
} }
else{ else {
return '' return ''
} }
} }
@ -205,13 +208,13 @@ const Mirroring = (props) => {
src={item.template == 'blue' ? '/assets/images/imageImg/textblue.png' : item.template == 'black' ? '/assets/images/imageImg/textblack.png' : '/assets/images/imageImg/textwhite.png'} src={item.template == 'blue' ? '/assets/images/imageImg/textblue.png' : item.template == 'black' ? '/assets/images/imageImg/textblack.png' : '/assets/images/imageImg/textwhite.png'}
alt="设置" alt="设置"
style={{ width: 330, height: 153, cursor: 'pointer' }} style={{ width: 330, height: 153, cursor: 'pointer' }}
onClick={() => {tomirrordetail(item.mid,item.template)}} onClick={() => { tomirrordetail(item.mid, item.template) }}
/> />
<div style={{ color: '#2F2F2F', fontSize: 16, width: 300, textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden' }}> <div style={{ color: '#2F2F2F', fontSize: 16, width: 300, textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden' }}>
{item.title} {item.title}
</div> </div>
<div style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', marginTop: 10 }}> <div style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', marginTop: 10 }}>
<div style={{ display: 'flex', cursor: 'pointer' }} onClick={()=>topublish(item.id)}> <div style={{ display: 'flex', cursor: 'pointer' }} onClick={() => topublish(item.id)}>
<div style={{ display: 'flex', alignItems: 'center' }}> <div style={{ display: 'flex', alignItems: 'center' }}>
<img <img
src="/assets/images/imageImg/release.png" src="/assets/images/imageImg/release.png"
@ -256,14 +259,19 @@ const Mirroring = (props) => {
</Popconfirm> </Popconfirm>
</div> </div>
<div style={{ color: 'rgba(0,0,0,0.45)', marginTop: 10, fontSize: 12 }}> <div style={{ color: 'rgba(0,0,0,0.45)', marginTop: 10, fontSize: 12 }}>
最后编辑于{getTime(item.updateTime)||getTime(item.createTime)} 最后编辑于{getTime(item.updateTime) || getTime(item.createTime)}
</div> </div>
<div style={{ color: 'rgba(0,0,0,0.45)', marginTop: 8, fontSize: 12 }}> <div style={{ color: 'rgba(0,0,0,0.45)', marginTop: 8, fontSize: 12 }}>
最后发布于{getTime(item.publishTime)} 最后发布于{getTime(item.publishTime)}
</div> </div>
<div style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', marginTop: 12 }}> <div style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', marginTop: 12 }}>
<IconRefresh style={{ color: 'rgb(74 129 205 / 93%)', marginRight: 4 }} onClick={() => {
setIsUpate(true)
setUpdateId(item.id)
}} />
<div style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }} onClick={() => { <div style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }} onClick={() => {
copy(item.mid ? item.mid : "暂无id"); const url = document.location?.toString()?.split("/") || []
copy(item.mid ? `${url[0] + '//' + url[2] + '/callService?mid=' + item.mid}` : "暂无id");
Notification.success({ Notification.success({
content: "复制成功", content: "复制成功",
duration: 2, duration: 2,
@ -284,6 +292,32 @@ const Mirroring = (props) => {
})} })}
</div> </div>
</div> </div>
{isUpdate ? <Modal
title="更新mid"
visible={true}
onOk={() => {
dispatch(openness.putUpdateMid(updateId)).then(res => {
if (res.success) {
myCustomList?.forEach(v => {
if (v.id == updateId) {
v.mid = res.payload.data?.mid
}
})
setMyCustomList([...myCustomList])
setIsUpate(false)
setUpdateId('')
}
})
}}
onCancel={() => {
setIsUpate(false)
setUpdateId('')
}}
closeOnEsc={true}
>
更新镜像服务的mid后历史复制的镜像播放地址无效需复制新的镜像地址
</Modal> : ""
}
</> </>
) )
} }

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

@ -78,6 +78,7 @@ export const ApiTable = {
getMirror: 'mirror/{mid}', //获取指定镜像信息 getMirror: 'mirror/{mid}', //获取指定镜像信息
putMirror: 'mirror', //编辑镜像信息 putMirror: 'mirror', //编辑镜像信息
getMirrorMid:'mirror/{mid}' , //获取指定镜像信息 getMirrorMid:'mirror/{mid}' , //获取指定镜像信息
putUpdateMid:'mirror/{mirrorId}/id', //更新镜像服务ID
}; };

Loading…
Cancel
Save