diff --git a/src/components/videoDHone/index.vue b/src/components/videoDHone/index.vue index c4b65e7..a48e4fe 100644 --- a/src/components/videoDHone/index.vue +++ b/src/components/videoDHone/index.vue @@ -8,6 +8,7 @@ import { ref, reactive, toRefs, onMounted, onUnmounted } from 'vue'; import { listConfig } from '@/api/system/config'; const { proxy } = getCurrentInstance(); +const { dh_video_config } = proxy.useDict('dh_video_config'); const props = defineProps({ // 内网、公网 4个配置 @@ -56,89 +57,104 @@ { deep: true, immediate: true } ); +function convertArrayToObject(array) { + console.log('array', array); + const resultObject = {}; + array.forEach(item => { + resultObject[item.label] = item.value; + }); + return resultObject; +} + // 初始化并登录插件 function initDHPlayer() { - console.log('初始化视频'); - desc.value = '插件启动中....'; - AllData.myVideoPlayer = new VideoPlayer({ - videoId: 'dhplayer-dom', // 唯一标识,必填,不能重复 - windowType: 0, // 播放器类型,必传, 0 - 实时预览,3 - 录像回放,7- 录像回放(支持倒放) - usePluginLogin: true, // 采用登录 (请默认传true,插件内部自动拉流) - pluginLoginInfo: AllData.pluginLoginInfo, - division: 1, // 默认展示的窗口数量, 必传 - draggable: false, // 窗口拖拽 【暂不支持】 - showBar: true, // 底部操作栏, 选传,【true - 显示, false - 隐藏】 - shieldClass: ['shield-class', 'select'], // 如果DOM元素被插件挡住了,把DOM元素的类名传入。 - coverShieldClass: [], // 如果插件要在dom内滚动,需要把DOM元素的类名传入,请查看案例-遮挡 - parentIframeShieldClass: [], // 有 iframe 时,top层 的 dom 元素被插件挡住了,把DOM元素的类名传入。 - // 下面均为回调函数,请按需使用,具体可在 API 内进行功能的体验和查看。 + if (dh_video_config.value) { + AllData.pluginLoginInfo = convertArrayToObject(dh_video_config.value); + console.log('看看顺序', AllData.pluginLoginInfo); + } else { + desc.value = '获取动态配置失败'; + } - // 创建播放器成功回调 - createSuccess: versionInfo => { - // 该回调触发后,我们可以进行实时预览/录像回放等操作 - // desc.value = '创建成功!!!' + versionInfo.message; - console.log('准备进入', AllData.channelId); - AllData.Getchajian = 1; - startReal(); - }, - // 创建播放器失败回调 - createError: err => { - console.log('错误', JSON.stringify(err)); - // 有错误码,可打印查看错误信息 - // desc.value = '创建失败!!!' + JSON.stringify(err); - AllData.Getchajian = null; + nextTick(() => { + console.log('初始化视频', AllData.pluginLoginInfo); + desc.value = '插件启动中....'; + AllData.myVideoPlayer = new VideoPlayer({ + videoId: 'dhplayer-dom', // 唯一标识,必填,不能重复 + windowType: 0, // 播放器类型,必传, 0 - 实时预览,3 - 录像回放,7- 录像回放(支持倒放) + usePluginLogin: true, // 采用登录 (请默认传true,插件内部自动拉流) + pluginLoginInfo: AllData.pluginLoginInfo, + division: 1, // 默认展示的窗口数量, 必传 + draggable: false, // 窗口拖拽 【暂不支持】 + showBar: true, // 底部操作栏, 选传,【true - 显示, false - 隐藏】 + shieldClass: ['shield-class', 'select'], // 如果DOM元素被插件挡住了,把DOM元素的类名传入。 + coverShieldClass: [], // 如果插件要在dom内滚动,需要把DOM元素的类名传入,请查看案例-遮挡 + parentIframeShieldClass: [], // 有 iframe 时,top层 的 dom 元素被插件挡住了,把DOM元素的类名传入。 + // 下面均为回调函数,请按需使用,具体可在 API 内进行功能的体验和查看。 - GetchajianUrl(); - }, - // 插件公共回调 - dhPlayerMessage: (info, err) => {}, - // 实时预览成功回调 - realSuccess: info => {}, - // 实时预览失败回调 - realError: (info, err) => {}, - // 对讲成功回调 - talkSuccess: info => {}, - // 对讲失败回调 - talkError: (info, err) => {}, - // 录像播放成功回调 - playbackSuccess: info => {}, - // 录像播放失败回调 - playbackError: (info, err) => {}, - // 录像播放完成回调 - playbackFinish: info => {}, - // 抓图成功回调 - snapshotSuccess: ({ base64Url, path }, info) => { - var byteCharacters = atob(base64Url.replace(/^data:image\/(png|jpeg|jpg);base64,/, '')); - var byteNumbers = new Array(byteCharacters.length); - for (var i = 0; i < byteCharacters.length; i++) { - byteNumbers[i] = byteCharacters.charCodeAt(i); - } - var byteArray = new Uint8Array(byteNumbers); - var blob = new Blob([byteArray], { - type: undefined, - }); - var aLink = document.createElement('a'); - let time = proxy.moment(new Date().getTime()).format('YYYY-MM-DD HH:mm:ss'); - aLink.download = `大华截图-${time}.jpg`; //这里写保存时的图片名称 - aLink.href = URL.createObjectURL(blob); - aLink.click(); - }, - // 本地录像下载成功回调 - videoDownloadSuccess: (path, info) => { - alert('本地录像地址:' + path); - }, - // 关闭视频窗口回调 - closeWindowSuccess: ({ isAll, snum, channelList }) => {}, - // 鼠标单击窗口回调 - clickWindow: snum => {}, - // 鼠标双击窗口回调 - dbClickWindow: snum => {}, - // 播放器窗口的数量回调 - changeDivision: division => {}, - // rtsp 流下载录像成功回调 - downloadRecordSuccess: info => {}, - // rtsp 流下载录像失败回调 - downloadRecordError: (info, err) => {}, + // 创建播放器成功回调 + createSuccess: versionInfo => { + // 该回调触发后,我们可以进行实时预览/录像回放等操作 + // desc.value = '创建成功!!!' + versionInfo.message; + AllData.Getchajian = 1; + startReal(); + }, + // 创建播放器失败回调 + createError: err => { + // 有错误码,可打印查看错误信息 + // desc.value = '创建失败!!!' + JSON.stringify(err); + AllData.Getchajian = null; + GetchajianUrl(); + }, + // 插件公共回调 + dhPlayerMessage: (info, err) => {}, + // 实时预览成功回调 + realSuccess: info => {}, + // 实时预览失败回调 + realError: (info, err) => {}, + // 对讲成功回调 + talkSuccess: info => {}, + // 对讲失败回调 + talkError: (info, err) => {}, + // 录像播放成功回调 + playbackSuccess: info => {}, + // 录像播放失败回调 + playbackError: (info, err) => {}, + // 录像播放完成回调 + playbackFinish: info => {}, + // 抓图成功回调 + snapshotSuccess: ({ base64Url, path }, info) => { + var byteCharacters = atob(base64Url.replace(/^data:image\/(png|jpeg|jpg);base64,/, '')); + var byteNumbers = new Array(byteCharacters.length); + for (var i = 0; i < byteCharacters.length; i++) { + byteNumbers[i] = byteCharacters.charCodeAt(i); + } + var byteArray = new Uint8Array(byteNumbers); + var blob = new Blob([byteArray], { + type: undefined, + }); + var aLink = document.createElement('a'); + let time = proxy.moment(new Date().getTime()).format('YYYY-MM-DD HH:mm:ss'); + aLink.download = `大华截图-${time}.jpg`; //这里写保存时的图片名称 + aLink.href = URL.createObjectURL(blob); + aLink.click(); + }, + // 本地录像下载成功回调 + videoDownloadSuccess: (path, info) => { + alert('本地录像地址:' + path); + }, + // 关闭视频窗口回调 + closeWindowSuccess: ({ isAll, snum, channelList }) => {}, + // 鼠标单击窗口回调 + clickWindow: snum => {}, + // 鼠标双击窗口回调 + dbClickWindow: snum => {}, + // 播放器窗口的数量回调 + changeDivision: division => {}, + // rtsp 流下载录像成功回调 + downloadRecordSuccess: info => {}, + // rtsp 流下载录像失败回调 + downloadRecordError: (info, err) => {}, + }); }); } diff --git a/src/components/videoDHone/index.vue b/src/components/videoDHone/index.vue index c4b65e7..a48e4fe 100644 --- a/src/components/videoDHone/index.vue +++ b/src/components/videoDHone/index.vue @@ -8,6 +8,7 @@ import { ref, reactive, toRefs, onMounted, onUnmounted } from 'vue'; import { listConfig } from '@/api/system/config'; const { proxy } = getCurrentInstance(); +const { dh_video_config } = proxy.useDict('dh_video_config'); const props = defineProps({ // 内网、公网 4个配置 @@ -56,89 +57,104 @@ { deep: true, immediate: true } ); +function convertArrayToObject(array) { + console.log('array', array); + const resultObject = {}; + array.forEach(item => { + resultObject[item.label] = item.value; + }); + return resultObject; +} + // 初始化并登录插件 function initDHPlayer() { - console.log('初始化视频'); - desc.value = '插件启动中....'; - AllData.myVideoPlayer = new VideoPlayer({ - videoId: 'dhplayer-dom', // 唯一标识,必填,不能重复 - windowType: 0, // 播放器类型,必传, 0 - 实时预览,3 - 录像回放,7- 录像回放(支持倒放) - usePluginLogin: true, // 采用登录 (请默认传true,插件内部自动拉流) - pluginLoginInfo: AllData.pluginLoginInfo, - division: 1, // 默认展示的窗口数量, 必传 - draggable: false, // 窗口拖拽 【暂不支持】 - showBar: true, // 底部操作栏, 选传,【true - 显示, false - 隐藏】 - shieldClass: ['shield-class', 'select'], // 如果DOM元素被插件挡住了,把DOM元素的类名传入。 - coverShieldClass: [], // 如果插件要在dom内滚动,需要把DOM元素的类名传入,请查看案例-遮挡 - parentIframeShieldClass: [], // 有 iframe 时,top层 的 dom 元素被插件挡住了,把DOM元素的类名传入。 - // 下面均为回调函数,请按需使用,具体可在 API 内进行功能的体验和查看。 + if (dh_video_config.value) { + AllData.pluginLoginInfo = convertArrayToObject(dh_video_config.value); + console.log('看看顺序', AllData.pluginLoginInfo); + } else { + desc.value = '获取动态配置失败'; + } - // 创建播放器成功回调 - createSuccess: versionInfo => { - // 该回调触发后,我们可以进行实时预览/录像回放等操作 - // desc.value = '创建成功!!!' + versionInfo.message; - console.log('准备进入', AllData.channelId); - AllData.Getchajian = 1; - startReal(); - }, - // 创建播放器失败回调 - createError: err => { - console.log('错误', JSON.stringify(err)); - // 有错误码,可打印查看错误信息 - // desc.value = '创建失败!!!' + JSON.stringify(err); - AllData.Getchajian = null; + nextTick(() => { + console.log('初始化视频', AllData.pluginLoginInfo); + desc.value = '插件启动中....'; + AllData.myVideoPlayer = new VideoPlayer({ + videoId: 'dhplayer-dom', // 唯一标识,必填,不能重复 + windowType: 0, // 播放器类型,必传, 0 - 实时预览,3 - 录像回放,7- 录像回放(支持倒放) + usePluginLogin: true, // 采用登录 (请默认传true,插件内部自动拉流) + pluginLoginInfo: AllData.pluginLoginInfo, + division: 1, // 默认展示的窗口数量, 必传 + draggable: false, // 窗口拖拽 【暂不支持】 + showBar: true, // 底部操作栏, 选传,【true - 显示, false - 隐藏】 + shieldClass: ['shield-class', 'select'], // 如果DOM元素被插件挡住了,把DOM元素的类名传入。 + coverShieldClass: [], // 如果插件要在dom内滚动,需要把DOM元素的类名传入,请查看案例-遮挡 + parentIframeShieldClass: [], // 有 iframe 时,top层 的 dom 元素被插件挡住了,把DOM元素的类名传入。 + // 下面均为回调函数,请按需使用,具体可在 API 内进行功能的体验和查看。 - GetchajianUrl(); - }, - // 插件公共回调 - dhPlayerMessage: (info, err) => {}, - // 实时预览成功回调 - realSuccess: info => {}, - // 实时预览失败回调 - realError: (info, err) => {}, - // 对讲成功回调 - talkSuccess: info => {}, - // 对讲失败回调 - talkError: (info, err) => {}, - // 录像播放成功回调 - playbackSuccess: info => {}, - // 录像播放失败回调 - playbackError: (info, err) => {}, - // 录像播放完成回调 - playbackFinish: info => {}, - // 抓图成功回调 - snapshotSuccess: ({ base64Url, path }, info) => { - var byteCharacters = atob(base64Url.replace(/^data:image\/(png|jpeg|jpg);base64,/, '')); - var byteNumbers = new Array(byteCharacters.length); - for (var i = 0; i < byteCharacters.length; i++) { - byteNumbers[i] = byteCharacters.charCodeAt(i); - } - var byteArray = new Uint8Array(byteNumbers); - var blob = new Blob([byteArray], { - type: undefined, - }); - var aLink = document.createElement('a'); - let time = proxy.moment(new Date().getTime()).format('YYYY-MM-DD HH:mm:ss'); - aLink.download = `大华截图-${time}.jpg`; //这里写保存时的图片名称 - aLink.href = URL.createObjectURL(blob); - aLink.click(); - }, - // 本地录像下载成功回调 - videoDownloadSuccess: (path, info) => { - alert('本地录像地址:' + path); - }, - // 关闭视频窗口回调 - closeWindowSuccess: ({ isAll, snum, channelList }) => {}, - // 鼠标单击窗口回调 - clickWindow: snum => {}, - // 鼠标双击窗口回调 - dbClickWindow: snum => {}, - // 播放器窗口的数量回调 - changeDivision: division => {}, - // rtsp 流下载录像成功回调 - downloadRecordSuccess: info => {}, - // rtsp 流下载录像失败回调 - downloadRecordError: (info, err) => {}, + // 创建播放器成功回调 + createSuccess: versionInfo => { + // 该回调触发后,我们可以进行实时预览/录像回放等操作 + // desc.value = '创建成功!!!' + versionInfo.message; + AllData.Getchajian = 1; + startReal(); + }, + // 创建播放器失败回调 + createError: err => { + // 有错误码,可打印查看错误信息 + // desc.value = '创建失败!!!' + JSON.stringify(err); + AllData.Getchajian = null; + GetchajianUrl(); + }, + // 插件公共回调 + dhPlayerMessage: (info, err) => {}, + // 实时预览成功回调 + realSuccess: info => {}, + // 实时预览失败回调 + realError: (info, err) => {}, + // 对讲成功回调 + talkSuccess: info => {}, + // 对讲失败回调 + talkError: (info, err) => {}, + // 录像播放成功回调 + playbackSuccess: info => {}, + // 录像播放失败回调 + playbackError: (info, err) => {}, + // 录像播放完成回调 + playbackFinish: info => {}, + // 抓图成功回调 + snapshotSuccess: ({ base64Url, path }, info) => { + var byteCharacters = atob(base64Url.replace(/^data:image\/(png|jpeg|jpg);base64,/, '')); + var byteNumbers = new Array(byteCharacters.length); + for (var i = 0; i < byteCharacters.length; i++) { + byteNumbers[i] = byteCharacters.charCodeAt(i); + } + var byteArray = new Uint8Array(byteNumbers); + var blob = new Blob([byteArray], { + type: undefined, + }); + var aLink = document.createElement('a'); + let time = proxy.moment(new Date().getTime()).format('YYYY-MM-DD HH:mm:ss'); + aLink.download = `大华截图-${time}.jpg`; //这里写保存时的图片名称 + aLink.href = URL.createObjectURL(blob); + aLink.click(); + }, + // 本地录像下载成功回调 + videoDownloadSuccess: (path, info) => { + alert('本地录像地址:' + path); + }, + // 关闭视频窗口回调 + closeWindowSuccess: ({ isAll, snum, channelList }) => {}, + // 鼠标单击窗口回调 + clickWindow: snum => {}, + // 鼠标双击窗口回调 + dbClickWindow: snum => {}, + // 播放器窗口的数量回调 + changeDivision: division => {}, + // rtsp 流下载录像成功回调 + downloadRecordSuccess: info => {}, + // rtsp 流下载录像失败回调 + downloadRecordError: (info, err) => {}, + }); }); } diff --git a/src/views/pictureOnMap/page/components/DialogTabs/component/shuikujianceEcharts.vue b/src/views/pictureOnMap/page/components/DialogTabs/component/shuikujianceEcharts.vue index a61fcdc..b512780 100644 --- a/src/views/pictureOnMap/page/components/DialogTabs/component/shuikujianceEcharts.vue +++ b/src/views/pictureOnMap/page/components/DialogTabs/component/shuikujianceEcharts.vue @@ -3,11 +3,11 @@