bug修改
This commit is contained in:
parent
41df993d20
commit
89833b4afe
|
@ -1,8 +1,6 @@
|
|||
<template>
|
||||
<div class="content-box" v-loading="loading" v-if="offlineVideo">
|
||||
<div class="container offlineVideo" v-if="!loading">
|
||||
<!-- TODO -->
|
||||
<!-- <player></player> -->
|
||||
<el-empty description="此模块只支持实时视频分析"></el-empty>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1325,7 +1323,6 @@
|
|||
|
||||
<script>
|
||||
let id = 1000;
|
||||
// import player from './player.vue';
|
||||
import chartsLine from '@/components/sensorFusion/echartsLine.vue';
|
||||
import chartsPie from '@/components/sensorFusion/echartsPie.vue';
|
||||
import chartsBar from '@/components/sensorFusion/echartsBar.vue';
|
||||
|
@ -3771,7 +3768,6 @@ export default {
|
|||
thermalOD, //OD
|
||||
tableShow,
|
||||
regionTable,
|
||||
// player
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<jsmpeg-player :url="url" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { JSMpegPlayer } from 'vue-jsmpeg-player';
|
||||
import 'vue-jsmpeg-player/dist/style.css';
|
||||
export default {
|
||||
components: {
|
||||
[JSMpegPlayer.name]: JSMpegPlayer
|
||||
},
|
||||
name: 'player',
|
||||
data() {
|
||||
return {
|
||||
url: 'ws://localhost:8089/xxx',
|
||||
socket: null,
|
||||
messages: [],
|
||||
connected: '',
|
||||
inputMessage: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
const socket = new WebSocket('ws://localhost:3001');
|
||||
socket.onopen = function () {
|
||||
//连接建立时触发
|
||||
console.log('已连接到WebSocket服务器');
|
||||
this.connected = true;
|
||||
};
|
||||
socket.onmessage = function (event) {
|
||||
// 客户端接收服务端数据时触发
|
||||
console.log('收到消息:', event.data);
|
||||
this.messages.push({ id: Date.now(), text: event.data });
|
||||
};
|
||||
socket.onclose = function () {
|
||||
// 连接关闭时触发
|
||||
console.log('WebSocket连接已关闭');
|
||||
this.connected = false;
|
||||
};
|
||||
socket.onerror = function () {
|
||||
// 通信发生错误时触发
|
||||
console.log('WebSocket通信发生错误');
|
||||
};
|
||||
this.socket = socket;
|
||||
},
|
||||
//发送消息
|
||||
sendMessage() {
|
||||
if (this.socket && this.inputMessage) {
|
||||
//使用连接发送数据
|
||||
this.socket.send(this.inputMessage);
|
||||
this.inputMessage = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.socket) {
|
||||
//关闭连接
|
||||
this.socket.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
Loading…
Reference in New Issue