Commit 37073fa3 authored by 周宏民's avatar 周宏民

pref: 消息通知视频弹框 接入

parent 5558c330
Pipeline #86943 waiting for manual action with stages
...@@ -106,11 +106,13 @@ ...@@ -106,11 +106,13 @@
"@ant-design/pro-utils": "^1.10.4", "@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3", "@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"@congcongcai/jieba.js": "0.0.3",
"@esri/calcite-colors": "6.0.3", "@esri/calcite-colors": "6.0.3",
"@wisdom-cesium/cesium": "^1.1.48", "@wisdom-cesium/cesium": "^1.1.48",
"@wisdom-cesium/krpano": "1.0.29-60", "@wisdom-cesium/krpano": "1.0.29-60",
"@wisdom-components/basictable": "^1.5.16", "@wisdom-components/basictable": "^1.5.16",
"@wisdom-components/empty": "^1.4.1", "@wisdom-components/empty": "^1.4.1",
"@wisdom-components/videoslidermodal": "^1.1.60",
"@wisdom-map/amap": "1.7.0", "@wisdom-map/amap": "1.7.0",
"@wisdom-map/arcgismap": "1.4.0-277", "@wisdom-map/arcgismap": "1.4.0-277",
"@wisdom-map/basemap": "1.1.0-41", "@wisdom-map/basemap": "1.1.0-41",
...@@ -118,10 +120,8 @@ ...@@ -118,10 +120,8 @@
"@wisdom-utils/components": "0.1.356", "@wisdom-utils/components": "0.1.356",
"@wisdom-utils/runtime": "0.0.48", "@wisdom-utils/runtime": "0.0.48",
"@wisdom-utils/utils": "0.1.396", "@wisdom-utils/utils": "0.1.396",
"@congcongcai/jieba.js" : "0.0.3",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "4.21.2", "antd": "4.21.2",
"long": "^5.2.3",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
"compression": "1.7.4", "compression": "1.7.4",
"connected-react-router": "6.4.0", "connected-react-router": "6.4.0",
...@@ -140,6 +140,7 @@ ...@@ -140,6 +140,7 @@
"kit_logger": "^1.0.2", "kit_logger": "^1.0.2",
"kit_utils": "^1.3.11", "kit_utils": "^1.3.11",
"lodash": "4.17.11", "lodash": "4.17.11",
"long": "^5.2.3",
"minimist": "1.2.0", "minimist": "1.2.0",
"mqtt-client": "^1.0.14", "mqtt-client": "^1.0.14",
"omit.js": "^2.0.2", "omit.js": "^2.0.2",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -47,6 +47,7 @@ export const API = { ...@@ -47,6 +47,7 @@ export const API = {
GET_WEB_TICKET: '/PandaOMS/OMS/GetTicketByToken', GET_WEB_TICKET: '/PandaOMS/OMS/GetTicketByToken',
GET_ACCOUNT_PAGE_LIST: '/PandaWorkFlow/WorkFlow/AccountManage/GetAccountPageList', GET_ACCOUNT_PAGE_LIST: '/PandaWorkFlow/WorkFlow/AccountManage/GetAccountPageList',
GET_VIDEO_PLAY_LIST_BY_DEVICE_CODE: '/PandaMonitor/Monitor/Video/GetVideoPlayListByDeviceCode',
}; };
const services = { const services = {
...@@ -239,6 +240,11 @@ const services = { ...@@ -239,6 +240,11 @@ const services = {
method: constants.REQUEST_METHOD_POST, method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_METHOD_POST, type: constants.REQUEST_METHOD_POST,
}, },
GetVideoPlayListByDeviceCode: {
url: API.GET_VIDEO_PLAY_LIST_BY_DEVICE_CODE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
}; };
export const searchAutoCity = keywords => { export const searchAutoCity = keywords => {
......
...@@ -6,6 +6,9 @@ import { FormattedMessage } from '@wisdom-utils/components'; ...@@ -6,6 +6,9 @@ import { FormattedMessage } from '@wisdom-utils/components';
import { history } from '@wisdom-utils/runtime'; import { history } from '@wisdom-utils/runtime';
import { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout/helpers'; import { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout/helpers';
import classNames from 'classnames'; import classNames from 'classnames';
import { appService } from '@/api';
import { getVideoUrl } from '@/utils/utils';
import VideoSliderModal from '@wisdom-components/videoslidermodal';
import Notifier from '../../layouts/AppLayout/notifier/notice'; import Notifier from '../../layouts/AppLayout/notifier/notice';
import NoticeIcon from '../../layouts/AppLayout/notifier'; import NoticeIcon from '../../layouts/AppLayout/notifier';
import { ERR_OK, MESSAGE_TYPE, NEW_MESSAGE } from '../../layouts/AppLayout/notifier/constants'; import { ERR_OK, MESSAGE_TYPE, NEW_MESSAGE } from '../../layouts/AppLayout/notifier/constants';
...@@ -15,9 +18,15 @@ import isProd from '../../utils/env'; ...@@ -15,9 +18,15 @@ import isProd from '../../utils/env';
import { getMessageTypeIcon } from '../../layouts/AppLayout/notifier/utils'; import { getMessageTypeIcon } from '../../layouts/AppLayout/notifier/utils';
// import NoticeIcon from '../NoticeIcon'; // import NoticeIcon from '../NoticeIcon';
import styles from './index.less'; import styles from './index.less';
const { TextArea } = Input; const { TextArea } = Input;
const jessibucaObj = {
operateBtns: {
screenshot: false,
},
loadingText: '视频加载中',
decoder: '/JessibucaVideo/decoder.js',
};
const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, messages = [] }) => { const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, messages = [] }) => {
const [pageIndex, setPageIndex] = useState(1); const [pageIndex, setPageIndex] = useState(1);
const message = useMemo(() => messages[pageIndex - 1], [messages, pageIndex]); const message = useMemo(() => messages[pageIndex - 1], [messages, pageIndex]);
...@@ -222,48 +231,47 @@ class NoticeIconView extends Component { ...@@ -222,48 +231,47 @@ class NoticeIconView extends Component {
} }
}; };
renderVideo = message => { renderVideo = async message => {
try { try {
this.setState({ this.setState({
videoVisible: true, videoVisible: true,
}); });
const { props } = this; const { props } = this;
const infoType = message.infoType
? message.infoType
: MESSAGE_TYPE.ALARM_TYPE;
let data = [];
if (this.props.global.mqtt_mess.MessageLevel === '2.0') {
// eslint-disable-next-line no-shadow
const message = this.notifier.messageThrome(
infoType,
// eslint-disable-next-line no-use-before-define
JSON.parse(message.messContent),
);
data = message.split('\\n');
} else {
data = message.messContent.split('\\n');
}
const id = data[3]; if(!message.infoContent?.deviceCode&&!message.infoContent?.DeviceCode)return;
const name = data[0]; const {data} = await appService.GetVideoPlayListByDeviceCode({
const baseURI = isProd UserID: 1,
? window.location.origin DeviceCode: message.infoContent?.deviceCode || message.infoContent?.DeviceCode,
: `http://${window.location.hostname}:3020`; _site:props.global.userInfo.site || '',
const url = `${baseURI}/civweb4/video/indexAll.html?ID=${id}&name=${name}&site=${ })
props.global.userInfo.site const dataList = []
}`; if(Array.isArray(data)){
data.forEach((list) => {
dataList.push({
id: list.vmS_DeviceID,
name: list.channelName,
protocol: list.protocol,
username: list.username,
password: list.password,
dataRate: 'Sub',
pandavmsHost: getVideoUrl(),
gateway: true,
address: list.address,
channel: list.channelID * 1,
});
});
}
this.setState({ this.setState({
// eslint-disable-next-line react/no-unused-state videoMessage: {
videoMessage: { list:dataList,
name, title:message.infoContent?.title || ''
url, },
}, });
});
} catch (error) {
} catch (error) {
}
}
}; };
// 消息弹窗Footer // 消息弹窗Footer
...@@ -420,28 +428,19 @@ class NoticeIconView extends Component { ...@@ -420,28 +428,19 @@ class NoticeIconView extends Component {
) )
} }
{this.state.videoVisible && this.state.videoMessage && ( {this.state.videoVisible && this.state.videoMessage?.list?.length && (
<Modal <VideoSliderModal
visible={this.state.videoVisible} modalInfo={{
title={this.state.videoMessage.name} title: this.state.videoMessage.title,
footer={null} open: this.state.videoVisible,
centered visible:this.state.videoVisible,
width="50%" onCancel: () => {
zIndex={1500} this.handleCloseVideo()
ref={videoRef => (this.videoRef = videoRef)} },
className={styles.videoPopup} }}
onCancel={() => this.handleCloseVideo()} videoInfos={this.state.videoMessage.list}
> JessibucaObj={jessibucaObj}
<div className="web4_console_component"> />
{/* eslint-disable-next-line jsx-a11y/iframe-has-title */}
<iframe
id="videoIframe"
style={{ width: '100%', height: '100%' }}
frameBorder="0"
src={this.state.videoMessage.url}
/>
</div>
</Modal>
)} )}
{this.state.sysTopVisible && this.state.sysMessage && !this.props.global.isNewYear && ( {this.state.sysTopVisible && this.state.sysMessage && !this.props.global.isNewYear && (
......
...@@ -48,7 +48,6 @@ export function getBaseName() { ...@@ -48,7 +48,6 @@ export function getBaseName() {
return pkg.name.toLocaleLowerCase(); return pkg.name.toLocaleLowerCase();
} }
export const getKeyName = path => { export const getKeyName = path => {
const truePath = path.split('?')[0]; const truePath = path.split('?')[0];
const curRoute = [].filter(item => item.path.includes(truePath)); const curRoute = [].filter(item => item.path.includes(truePath));
...@@ -76,3 +75,11 @@ export function getToken() { ...@@ -76,3 +75,11 @@ export function getToken() {
export function setToken(token) { export function setToken(token) {
Cookies.set(token); Cookies.set(token);
} }
export function getVideoUrl() {
const { protocol } = window.location;
const address =
protocol === 'https:'
? window.location.origin.replace(protocol, 'wss:')
: window.location.origin.replace(protocol, 'ws:');
return `${address}/`;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment