Commit e4cd9fcc by 夏新然

Merge branch 'fanxing' of http://git.keliuyun.com:55676/platform/fanxing_new into fanxing

2 parents 04de1051 9d616cf0
import axios from '../../util/ajax'
import {asyncRouterMap, constantRouterMap } from '@/router'
/**
* 获取路由列表
*/
function getMenuInfo(token) {
return new Promise((reslove, reject) =>{
axios.get(IP + "/api/v1/auth/apps/" + 'edd4abed322af106f0a06e2204202d79' + "/menus?shape=list",{
headers: {
'authorization': localStorage.getItem('atoken')
},
}).then(response => {
reslove(response);
})
});
}
/**
* 判断是否有权限
* @param {*} router
* @param {*} roles
*/
function hasPerminssion(router, roles) {
let status = false
if (roles) {
roles.forEach(ele => {
if (ele.path == router.path) {
status = true;
return false;
}
})
}
return status
}
/**
* 根据后台返回的路由权限
* 动态匹配路由
* @param {*} asyncRouterMap
* @param {*} roles
*/
function filterAsyncRouter(asyncRouterMap, roles) {
const newData = [];
// return routers
asyncRouterMap.forEach(ele => {
let obj = {};
if (hasPerminssion(ele, roles)) {
obj['path'] = ele.path;
obj['name'] = ele.name;
obj['component'] = ele.component;
if (ele.children && ele.children.length > 0) {
obj['children'] = filterAsyncRouter(ele.children, roles)
} else {
obj['children'] = []
}
} else {
return false
}
newData.push(obj)
});
return newData
}
/**
* 根据路由和当前跳转key(路由路径)
* 获取第三级路由
* @param {*} router
* @param {*} key
*/
function filterTwoMenu(router, key) {
let data = [],
state = true;
router.forEach(e => {
if(e.path == key)
if(e.children) {
data = e.children
} else {
data = [];
}
})
return data;
}
const menu = {
state: {
routers: constantRouterMap,
addRouter: [],
threeMenu:[],
},
mutations:{
SET_ROUTERS: (state, routers) => {
state.addRouter = routers;
state.routers = constantRouterMap.concat(routers);
},
SET_THREEMENU: (state, routers) => {
state.threeMenu = routers;
},
},
actions: {
GetMenuRole({ commit, state}) {
return new Promise((resolve, reject) => {
getMenuInfo().then(response => {
let accessedRouters = filterAsyncRouter(asyncRouterMap,response.data.list_data);
// commit('SET_ROUTERS', accessedRouters);
commit('SET_ROUTERS', accessedRouters);
resolve(accessedRouters);
})
})
},
GetTwoMenu({commit, state},data) {
return new Promise((reslove,reject) => {
const tmenus = filterTwoMenu(state.routers, data);
commit('SET_THREEMENU', tmenus);
reslove(tmenus);
})
},
},
}
export default menu
/**
* 权限模块
* 模块功能
* 1.获取菜单权限
* 2.获取设备信息
* 3.获取websocket信息
* 4.初始化加载所需api
*/
import router from './router'
import store from './store'
import {pushws, facews,devws} from './util/websocket'
import {faceapi} from './util/api.js'
router.beforeEach((to, from, next) => {
if (to.path === '/') {
next()
} else {
if (store.getters.permission_routers.length === 0) { //判断当前用户是否拉取了路由
store.dispatch('GetMenuRole').then(res => { //获取菜单
router.addRoutes(res);
if( !PushWs ){ //菜单拉取成功连接 websocket
pushws();
}
if(!FaceWs) {
facews();
}
if(!DevWs) {
devws();
}
/**
* 初始化页面所需api
**/
faceapi.setBehaviorLocal();
faceapi.getCodeName();
faceapi.getSite();
faceapi.getOrg();
faceapi.getAddress();
faceapi.getFaceDbData();
faceapi.getProvince();
}).catch(() => {
next({
path: '/'
})
})
} else {
}
if (store.getters.dev_unid === ""){ //获取设备信息
store.dispatch('GetDev')
}
}
next()
});
<template>
<div class="ocx-box" id="ocx-box" v-show="isShow">
<object id="VionVideo1" classid="clsid:93F960BB-5AF9-402B-A3DF-06112F14DC02" codebase="VionPlatformVideo.ocx" width="100%"
height="100%">
<!-- <param name="_Version" value="65536">
<param name="_ExtentX" value="2646">
<param name="_ExtentY" value="1323">
<param name="_StockProps" value="0"> -->
</object>
</div>
</template>
<script>
import {
mapState
} from 'vuex'
export default {
data() {
return {
urlFlag:false,
isShow:true
};
},
props: ['playurl', 'type'],
methods: {
videoPlay: function () {
this.urlFlag = false
if (!this.playurl.sip_serv_ip) {
let url = this.playurl.rtsp_url
let ocxPlayRes = document.getElementById('VionVideo1').StartPlay(url, 0);
console.log('video Ocx播放rtsp流返回值:', ocxPlayRes);
if (ocxPlayRes != 0) {
alert('播放失败!');
}
} else {
let OcxResponse = document.getElementById('VionVideo1').StartPlaySip(this.playurl.sip_serv_id, this.playurl.sip_serv_ip,
this.playurl.sip_serv_port, this.playurl.sip_unid, this.playurl.sip_password, this.playurl.devId, 0)
console.log('video Ocx播放sip流返回值:', OcxResponse);
if (OcxResponse != 0 && OcxResponse != 200) {
alert('播放失败!');
}
}
},
downOcx: function () {
if (this.fileUrl !== '' && !this.installOcx) {
location.href = this.fileUrl;
}
},
installOcxInfo: function () {
this.$confirm('为了正常使用,是否安装OCX控件?', '友情提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.installOcx = false;
this.downOcx();
}).catch(() => {
this.installOcxInfo();
});
},
initocx() {
VionVideo1.Init(0, 'Null', 4);
},
downloadOCx() {
// if (navigator.userAgent.indexOf('Trident') > -1) {
// this.axios.get(IP + "/api/v1/device/dlfile", {
// params: {
// file_type: "video_ocx"
// }
// })
// .then(response => {
// location.href = response.data.file_url;
// });
// } else {
// this.$message.error("视频控件加载失败请用IE10及以上版本打开!");
// }
},
checkIE() {
var agent = navigator.userAgent.toLowerCase();
if (/(msie\s|trident.*rv:)([\w.]+)/.test(agent) && document.documentMode < 10) {
this.$message.error("IE 版本过低请升级到IE10级以上版本!");
}
}
},
created() {
// this.checkIE();
},
computed: {
...mapState(['ocxstate'])
},
mounted() {
// VionVideo1.Init(0, 'Null', 4);
// try {
// if (document.getElementById("VionVideo1").GetVersion()) {
// }
// } catch (error) {
// this.downloadOCx();s
// }
},
watch: {
ocxstate(val) {
try {
if(val == 0){
this.isShow = false
document.getElementById("VionVideo1").StartPlay(1);
} else {
this.isShow = true
document.getElementById("VionVideo1").StartPlay(0);
}
} catch (error) {
console.log(error)
}
},
},
beforeDestroy: function () {
// if (this.videoplayer.techName_ == "Flash" && this.videoplayer.pause) {
// this.videoplayer.pause();
// }
}
};
</script>
<style lang="stylus" scoped>
.ocx-box{
height 100%
width 100%
}
</style>
<template>
<div class="item">
<div class="player">
<div class="ocx-box">
<!-- <object id="VionVideo" classid="clsid:96DFBBAF-4220-4978-9681-4ABA534A7718"
width="98%" height="450" style="margin-left:.9%">
</object> -->
<object height="90%" width="100%" id="nvrTotalOcx" name="nvrTotalOcx"
classid="CLSID:96DFBBAF-4220-4978-9681-4ABA534A7718"
style="margin-top:20px"
>
<param name="BorderStyle" value="1" />
<param name="MousePointer" value="0" />
<param name="Enabled" value="1" />
<param name="Min" value="0" />
<param name="Max" value="10" />
<embed wmode="opaque"></embed>
<param name="wmode" value="transparent">
</object>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {};
},
props: ["playersrc", "vnum"],
methods: {
initocx(){
VionVideo.Init(0, 'Null', 4);
},
downloadOCx() {
if (navigator.userAgent.indexOf('Trident') > -1) {
this.axios.get(IP + "/api/v1/device/dlfile", {
params: {
file_type: "video_ocx"
}
})
.then(response => {
location.href = response.data.file_url;
});
} else {
this.$message.error("视频控件加载失败请用IE10及以上版本打开!");
}
},
checkIE() {
var agent = navigator.userAgent.toLowerCase();
if (/(msie\s|trident.*rv:)([\w.]+)/.test(agent) && document.documentMode < 10) {
this.$message.error("IE 版本过低请升级到IE10级以上版本!");
}
}
},
created() {
this.checkIE();
},
computed(){
},
mounted() {
var testStr = 'Null';
nvrTotalOcx.Init(0, testStr, 4);
nvrTotalOcx.SetSingleWindow(true);
nvrTotalOcx.SetParam("SetLanguage", "Chinese");
nvrTotalOcx.SetParam("VideoSize", 0);
var medianame = '视频0';
var hostname = window.location.hostname;
var port,url;
port=8554;
url = "rtsp://192.168.9.133:8554//opt/data/vedio/1579253441478.264";
let a = ''
setTimeout(()=>{
a = nvrTotalOcx.PlayRealVideo(url,1,'video','192.168.9.133',0);
},500)
setTimeout(()=>{
a = nvrTotalOcx.PlayRealVideo(url,1,'video','192.168.9.133',0);
},1000)
console.log('shipin'+a)
},
watch: {
},
beforeDestroy: function () {
if (this.videoplayer.techName_ == "Flash" && this.videoplayer.pause) {
this.videoplayer.pause();
}
}
};
</script>
<style lang="stylus" scoped>
.ocx-box{
height 50vh
width 35vw
}
</style>
......@@ -7,8 +7,14 @@
<!-- <eventList></eventList> -->
<devInfo></devInfo>
</div>
<!-- <div class="video-box">
</div> -->
<div class="video-box" v-show="ocxstatus">
<div class="video-box-close" @click="closeocx"></div>
<!-- <mPlayvideo :playersrc="playurl"></mPlayvideo> -->
<!-- <videoPlay ref="mapvideo1" :playurl="playurl"></videoPlay> -->
<videoPlay2 ref="mapvideo2" :playurl="playurl2"></videoPlay2>
<!-- <videoPlay ref="mapvideo" :playurl="playurl"></videoPlay> -->
</div>
</div>
<div style="clear: both;"></div>
</el-col>
......@@ -98,6 +104,9 @@
</template>
<script>
// import mPlayvideo from "../public/mapvideo"
// import videoPlay from "../public/mapvideo";
import videoPlay2 from "../public/mapvideo2";
import showmap from "./map";
import illegaltrend from "./illegaltrend";
import eventTypedis from "./eventTypedis";
......@@ -113,9 +122,11 @@ export default {
keyVehicleData: [],
illageList: [],
setShow: false,
ocxstatus:true,
archiveUnid: 0,
snap_num: 0,
playurl: "",
playurl: {},
playurl2:"",
audit_num: 0,
snapData: {
illega_total_snap_num: 0,
......@@ -126,19 +137,39 @@ export default {
};
},
components: {
showmap,
showmap,
// mPlayvideo,
// videoPlay,
videoPlay2,
illegaltrend,
eventTypedis,
alarmEvent,
devInfo,
eventList
},
mounted() {},
mounted() {
// let urlarr = ["rtsp://192.168.9.133:8554//opt/data/vedio/1579253441478.264","tsp://192.168.9.133:8554//opt/data/vedio/1577516797543.264"]
// urlarr.forEach((ele) => {
// let obj = {}
// obj.rtsp_url =ele;
// setTimeout(()=>{
// let obj = {}
// obj.rtsp_url = ele
// this.playurl = obj
// this.$refs.mapvideo.videoPlay();
// },100)
// })
},
methods: {
alarmevent(data) {
//移动地图
this.$refs.map.movemap(data);
},
closeocx(){
this.ocxstatus=false;
},
getTrafficSnap() {
this.$api.show.getTrafficSnap().then(res => {
this.snapData = res;
......@@ -378,10 +409,10 @@ export default {
.video-box {
position: absolute;
height: 46.5vh;
width: 30vw;
height 48vh
width 35vw
margin-bottom: 1vh;
background: #444444;
background: #f0f0f0;
left: 0;
right: 0;
top: 0;
......@@ -389,4 +420,20 @@ export default {
margin: auto;
z-index: 1000;
}
.video-box-close{
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.video-box-close:after {
height:20px;
width:20px;
content: "✖";
color:#444444;
}
.play-item{
width:200px;
height:200px;
}
</style>
<template>
<div>
<div id="map" class="maps"></div>
<div id="popup" class="ol-popup">
<div id="popup" class="ol-popup">
<a
href="#"
id="popup-closer"
class="ol-popup-closer"
@click="closepopup"
></a>
<div id="t-popup-content"></div>
<div class="" id="t-popup-content">
</div>
</div>
<div id="videopopup" class="ol-popup">
<a
......@@ -17,8 +18,8 @@
class="ol-popup-closer"
@click="closevideopopup"
></a>
<div id="">
<videoPlay ref="ocx" :playurl="playurl"></videoPlay>
<div class="mapvideo">
<videoPlay ref="mapvideo" :playurl="playurl"></videoPlay>
</div>
</div>
</div>
......@@ -73,7 +74,8 @@ var overlay = "";
export default {
data() {
return {
devList: []
devList: [],
playurl:{}
};
},
components: {
......@@ -292,23 +294,23 @@ export default {
autoPan: true,
position: pos,
autoPanAnimation: {
duration: 500
duration: 50
}
});
map.addOverlay(overlay);
let obj = {};
if (data.vchan_name == "视频1") {
obj.rtsp_url =
"rtsp://192.168.9.133:20090/6af6f0f9a445463d8b07273fe538694d";
"rtsp://192.168.9.133:8554//opt/data/vedio/1579253441478.264";
} else if (data.vchan_name == "视频2") {
obj.rtsp_url =
"rtsp://192.168.9.133:20090/68504674201c4490bfe1a9d18c86b6ac";
"rtsp://192.168.9.133:8554//opt/data/vedio/1577516797543.264";
}
this.playurl = obj;
// this.$store.commit('setocxstate', 1)
setTimeout(() => {
this.$refs.ocx.videoPlay();
}, 0);
this.$refs.mapvideo.videoPlay();
}, 100);
//获取视频流
// this.$api.device.getFxStream(this.dev_unid, data.vchan_refid).then(res => {
// debugger
......@@ -447,4 +449,8 @@ export default {
color: red
}
}
.mapvideo{
height 100%;
width 100%;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!