解决实时监控vlc崩溃问题,将vlc挂载至ref上再做操作,v-if以及ref混用需this.$nextTick(() => {})处理(注意:vlc一定要如数清空,且在路由离开时的钩子函数里面清)

merge-requests/1/head
张鑫 5 years ago
parent ad99550b1a
commit ef919ce3da

@ -1,5 +1,5 @@
{ {
"description": "德泰克垛机视觉系统", "description": "德泰克垛机视觉系统",
"type": -1, "type": -1,
"rights": "duojiSystem", "rights": "duojiSystem",
"children": [{ "children": [{

@ -6,12 +6,12 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>泰克垛机视觉系统</title> <title>泰克垛机视觉系统</title>
</head> </head>
<body> <body>
<noscript> <noscript>
<strong>We're sorry but 德泰克垛机视觉系统 doesn't work properly without JavaScript enabled. Please enable it to <strong>We're sorry but 德泰克垛机视觉系统 doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong> continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>

File diff suppressed because one or more lines are too long

@ -2,7 +2,7 @@
<a-layout-sider :class="['aside', collapsed ? 'merge' :'']" v-model="collapsed" theme="dark" :trigger="null" collapsible> <a-layout-sider :class="['aside', collapsed ? 'merge' :'']" v-model="collapsed" theme="dark" :trigger="null" collapsible>
<div class="logo"> <div class="logo">
<!-- <img src="@/assets/logo1.png" alt />--> <!-- <img src="@/assets/logo1.png" alt />-->
<span class="logo-title">泰克垛机视觉系统</span> <span class="logo-title">泰克垛机视觉系统</span>
</div> </div>
<a-menu :selectedKeys="selectedKeys" <a-menu :selectedKeys="selectedKeys"
:openKeys.sync="openKeys" :openKeys.sync="openKeys"
@ -62,7 +62,7 @@ export default {
parents = this.$router.options.routes[0].children.filter(ele => { parents = this.$router.options.routes[0].children.filter(ele => {
if ( if (
this.userInfo.permissionList.some(item => { this.userInfo.permissionList.some(item => {
return item.rights === ele.name && ele.name.indexOf("center") < 0 && item.rights === ele.name && ele.name.indexOf("ioTable") < 0 && item.rights === ele.name && ele.name.indexOf("realTimeMonitoringModel") < 0 && item.rights === ele.name && ele.name.indexOf("plcStatus") < 0 && item.rights === ele.name && ele.name.indexOf("cameraManageModel") < 0; return item.rights === ele.name && ele.name.indexOf("center") < 0 && item.rights === ele.name && ele.name.indexOf("ioTable") < 0 && item.rights === ele.name && ele.name.indexOf("realTimeMonitoringModel") < 0 && item.rights === ele.name && ele.name.indexOf("plcStatus") < 0 && item.rights === ele.name && ele.name.indexOf("cameraManageModel") < 0 && item.rights === ele.name && ele.name.indexOf("checkOperation") < 0;
}) })
) { ) {
return ele; return ele;
@ -83,7 +83,7 @@ export default {
recursionRoute(parents); recursionRoute(parents);
}else { }else {
parents = this.$router.options.routes[0].children.filter(item => { parents = this.$router.options.routes[0].children.filter(item => {
return !item.name.startsWith("center") && !item.name.startsWith("ioTable") && !item.name.startsWith("realTimeMonitoringModel") && !item.name.startsWith("plcStatus") && !item.name.startsWith("cameraManageModel"); return !item.name.startsWith("center") && !item.name.startsWith("ioTable") && !item.name.startsWith("realTimeMonitoringModel") && !item.name.startsWith("plcStatus") && !item.name.startsWith("cameraManageModel") && !item.name.startsWith("checkOperation");
}); });
} }
this.routes = parents; this.routes = parents;

@ -28,7 +28,8 @@ import {
DatePicker, DatePicker,
Upload, Upload,
Radio, Radio,
Badge Badge,
Carousel
} from "ant-design-vue"; } from "ant-design-vue";
Vue.use(Layout); Vue.use(Layout);
Vue.use(ConfigProvider); Vue.use(ConfigProvider);
@ -58,6 +59,7 @@ Vue.use(DatePicker)
Vue.use(Upload) Vue.use(Upload)
Vue.use(Radio) Vue.use(Radio)
Vue.use(Badge) Vue.use(Badge)
Vue.use(Carousel)
Vue.prototype.$message = message; Vue.prototype.$message = message;
Vue.prototype.$info = Modal.info; Vue.prototype.$info = Modal.info;
Vue.prototype.$success = Modal.success; Vue.prototype.$success = Modal.success;

@ -66,34 +66,6 @@ const routes = [{
}, },
component: () => import('@/views/alarmVideos/index') component: () => import('@/views/alarmVideos/index')
}, },
//设置二级菜单
// {
// path: 'checkManage',
// name: 'checkManage',
// meta: {
// icon: 'form',
// name: '盘点管理',
// unfold:true
// },
// children: [
// {
// path: 'checkManage',
// name: 'checkManage',
// meta: {
// name: '盘点管理'
// },
// component: () => import('@/views/checkManage/index'),
// },
// {
// path: 'checkOperation',
// name: 'checkOperation',
// meta: {
// name: '盘点操作'
// },
// component: () => import('@/views/checkManage/checkOperation'),
// },
// ]
// },
{ {
path: 'checkManage', path: 'checkManage',
name: 'checkManage', name: 'checkManage',
@ -101,7 +73,15 @@ const routes = [{
icon: 'form', icon: 'form',
name: '盘点管理', name: '盘点管理',
}, },
component: () => import('@/views/checkManage/index') component: () => import('@/views/checkManage/index'),
},
{
path: 'checkOperation',
name: 'checkOperation',
meta: {
name: '盘点操作'
},
component: () => import('@/views/checkManage/checkOperation'),
}, },
{ {
path: 'roadwayManage', path: 'roadwayManage',

@ -1,5 +1,124 @@
<template> <template>
<div class="checkOperation">
<div class="topMenu">
<a-select default-value="lucy" style="width: 160px;margin-right:25px" @change="handleChange">
<a-select-option value="jack">
巷道一
</a-select-option>
<a-select-option value="lucy">
巷道二
</a-select-option>
</a-select>
<a-select default-value="lucy" style="width: 160px;margin-right:25px" @change="handleChange">
<a-select-option value="jack">
左货架
</a-select-option>
<a-select-option value="lucy">
右货架
</a-select-option>
</a-select>
<a-select default-value="lucy" style="width: 160px" @change="handleChange">
<a-select-option value="jack">
</a-select-option>
<a-select-option value="lucy">
</a-select-option>
</a-select>
<div class="carousel-box">
<a-carousel class="carousel" ref="carousel">
<div class="carousel-page">
<p class="carousel-page-title">工单号223333331123213</p>
<div class="carousel-page-content">
<div class="img-box">
<img
src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1520587439,1746635941&fm=26&gp=0.jpg"
alt="">
<p>操作前照片</p>
</div>
<div class="img-box">
<img
src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=274465270,4254987731&fm=26&gp=0.jpg"
alt="">
<p>操作后照片</p>
</div>
</div>
<div class="info-box">
<p>系统登记品规xxxsxxxx</p>
<p>系统登记数量23021</p>
</div>
</div>
<div><h3>2</h3></div>
<div><h3>3</h3></div>
<div><h3>4</h3></div>
</a-carousel>
</div>
<div> <div>
盘点操作 <div @click="prev()"></div>
<div @click="next()"></div>
</div>
</div>
</div> </div>
</template> </template>
<script>
export default {
data() {
return {}
},
methods: {
prev() {
this.$refs.carousel.prev();
},
next() {
this.$refs.carousel.next();
}
}
}
</script>
<style lang="scss">
.ant-carousel .slick-slide {
color: #000000;
}
.carousel-box {
width: 1200px;
/*border: solid 1px red;*/
.carousel-page {
display: flex;
align-items: center;
justify-content: left;
&-title {
color: #009FE3;
}
&-content {
display: flex;
align-items: center;
justify-content: left;
}
.img-box {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-right: 25px;
img {
width: 400px;
}
}
.info-box {
color: #000000;
display: flex;
align-items: center;
justify-content: center;
}
}
}
</style>

@ -23,6 +23,7 @@
<div class="line" v-for="(f,index) in Number(item.leftColumn)" :key="index"> <div class="line" v-for="(f,index) in Number(item.leftColumn)" :key="index">
<div <div
class="ele" class="ele"
@click="tocheckOperation"
:style="{background:i+'-'+f == '4-14'|| i+'-'+f=='8-18'?'#bfbfbf':'#bfbfbf'}" :style="{background:i+'-'+f == '4-14'|| i+'-'+f=='8-18'?'#bfbfbf':'#bfbfbf'}"
v-for="(i,index) in Number(item.leftRow)" v-for="(i,index) in Number(item.leftRow)"
:key="index">{{i}}-{{f}} :key="index">{{i}}-{{f}}
@ -100,6 +101,9 @@ export default {
handleChange(value) { handleChange(value) {
console.log(value) console.log(value)
this.select = value this.select = value
},
tocheckOperation() {
// this.$router.push({name:'checkOperation'})
} }
}, },
components: {} components: {}

@ -19,7 +19,7 @@
<div class="login-cover-logo"> <div class="login-cover-logo">
<img src="@/assets/logo.png" alt="logo" /> <img src="@/assets/logo.png" alt="logo" />
</div> </div>
<div class="login-cover-title">泰克垛机视觉系统</div> <div class="login-cover-title">泰克垛机视觉系统</div>
</div> </div>
<!-- <div class="login-footer">Copyright © 2020 ZheHe technology CO., LTD.</div> --> <!-- <div class="login-footer">Copyright © 2020 ZheHe technology CO., LTD.</div> -->
</div> </div>

@ -7,10 +7,12 @@
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<div class="flex-layouts"> <div class="flex-layouts">
<div class="video-list" v-for="(item,index) in realTimeListData" :key="(index+1).toString()" v-show="tabKey==0? tabKey==0 : tabKey==(index+1).toString()"> <div class="video-list" v-for="(item,index) in realTimeListData" :key="(index+1).toString()">
<div class="video-item" v-for="i in item.cameras" :key="i.id"> <div class="video-item" v-for="i in item.cameras" :key="i.id">
<template v-if="tabKey==0? tabKey==0 : tabKey==(index+1).toString()">
<object style="width:390px;height:219px" class="video-obj" :id="'video'+i.id" <object style="width:390px;height:219px" class="video-obj" :id="'video'+i.id"
type='application/x-vlc-plugin' events='True' width="100%" height="100%" type='application/x-vlc-plugin' events='True' width="100%" height="100%"
ref="vlc"
pluginspage="http://www.videolan.org" pluginspage="http://www.videolan.org"
codebase="http://downloads.videolan.org/pub/videolan/vlc-webplugins/2.0.6/npapi-vlc-2.0.6.tar.xz"> codebase="http://downloads.videolan.org/pub/videolan/vlc-webplugins/2.0.6/npapi-vlc-2.0.6.tar.xz">
<param name='controls' value='false'/> <param name='controls' value='false'/>
@ -36,6 +38,8 @@
</div> </div>
</div> </div>
</template>
</div> </div>
</div> </div>
</div> </div>
@ -54,25 +58,38 @@ export default {
path: [], path: [],
player: "", player: "",
visible: false, visible: false,
modelData: [], modelData: []
vlcz: null
}; };
}, },
inject: ['reload'], inject: ['reload'],
mounted() { mounted() {
console.log('index mounted执行了') console.log('index mounted执行了')
this.getRealTimeList() this.getRealTimeList()
if (sessionStorage.getItem('tabKey') == null) {
sessionStorage.setItem('tabKey', 0)
}
this.tabKey = sessionStorage.getItem('tabKey')
}, },
destroyed(){ destroyed(){
if (this.$refs.vlc) {
for (var i = 0; i < this.$refs.vlc.length; i++) {
this.$refs.vlc[i].playlist.stop();
}
}
}, },
beforeRouteLeave(to,form,next) { beforeRouteLeave(to,form,next) {
if (this.vlcz.playlist) { // console.log(11111111111111)
this.vlcz.playlist.stop(); console.log(this.$refs.vlc)
this.$nextTick(() => {
if (this.$refs.vlc) {
for (var i = 0; i < this.$refs.vlc.length; i++) {
this.$refs.vlc[i].playlist.stop();
}
next(true) next(true)
} else { } else {
next(true) next(true)
} }
})
console.log('beforeRouteLeave') console.log('beforeRouteLeave')
}, },
methods: { methods: {
@ -100,20 +117,28 @@ export default {
playVideo(id, rtsp) { playVideo(id, rtsp) {
// url ---tick TypeError: t.module.postMessage is not a function // url ---tick TypeError: t.module.postMessage is not a function
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(function () {
var vlc = document.getElementById(`${id}`); var vlc = document.getElementById(`${id}`);
var options = new Array(":network-caching=100");// var options = new Array(":network-caching=100");//
var vlcItem = vlc.playlist.add(`${rtsp}`, `${id}`, options); var vlcItem = vlc.playlist.add(`${rtsp}`, `${id}`, options);
// vlc.playlist.play() // vlc.playlist.play()
vlc.playlist.playItem(vlcItem); vlc.playlist.playItem(vlcItem);
return this.vlcz = vlc console.log(22222222222222)
console.log(vlc)
}, 500)
}) })
}, },
tabsChange(key) { tabsChange(key) {
console.log(key) console.log(key)
sessionStorage.setItem('tabKey', key)
this.reload()
}, },
showModel(item) { showModel(item) {
console.log(item) console.log(item)
this.$nextTick(() => {
this.$router.push({name: "realTimeMonitoringModel", query: {modelData: item}}); this.$router.push({name: "realTimeMonitoringModel", query: {modelData: item}});
})
}, },
}, },
}; };

@ -1,6 +1,6 @@
<template> <template>
<div class="video-mask" :style="{width:w,height:h}"> <div class="video-mask" :style="{width:w,height:h}">
<object class="video-obj" id="video" type='application/x-vlc-plugin' events='True' <object id="video" type='application/x-vlc-plugin' events='True'
width="100%" height="100%" pluginspage="http://www.videolan.org" width="100%" height="100%" pluginspage="http://www.videolan.org"
codebase="http://downloads.videolan.org/pub/videolan/vlc-webplugins/2.0.6/npapi-vlc-2.0.6.tar.xz"> codebase="http://downloads.videolan.org/pub/videolan/vlc-webplugins/2.0.6/npapi-vlc-2.0.6.tar.xz">
<param name='controls' value='false'/> <param name='controls' value='false'/>
@ -80,14 +80,14 @@ export default {
console.log(this.id) console.log(this.id)
this.getHdVideos(this.$route.query.modelData.rtsp) this.getHdVideos(this.$route.query.modelData.rtsp)
}, },
beforeRouteLeave(to, form, next) { // beforeRouteLeave(to, form, next) {
if (this.vlcm) { // if (this.vlcm) {
this.vlcm.playlist.stop(); // this.vlcm.playlist.stop();
next(true) // next(true)
} else { // } else {
next(true) // next(true)
} // }
}, // },
methods: { methods: {
handleCancel() { handleCancel() {
this.$router.push({name: 'realTimeMonitoring'}); this.$router.push({name: 'realTimeMonitoring'});

@ -293,6 +293,7 @@ export default {
values.leftRow = Number(values.leftRow) values.leftRow = Number(values.leftRow)
values.leftType = Number(values.leftType) values.leftType = Number(values.leftType)
values.plcPort = Number(values.plcPort) values.plcPort = Number(values.plcPort)
values.plcId = Number(values.plcId)
values.rightColumn = Number(values.rightColumn) values.rightColumn = Number(values.rightColumn)
values.rightRow = Number(values.rightRow) values.rightRow = Number(values.rightRow)
values.rightType = Number(values.rightType) values.rightType = Number(values.rightType)

Loading…
Cancel
Save