Commit f0b69608 authored by xxx's avatar xxx

1

parent 4117a6f1
......@@ -8,7 +8,7 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<script src="https://cdn.bootcss.com/eruda/1.5.8/eruda.min.js"></script>
<script>
eruda.init();
//eruda.init();
</script>
<!-- <title><%= htmlWebpackPlugin.options.title %></title> -->
......
......@@ -173,11 +173,13 @@ export default {
roadblockNum:0,
//websocket对象
websocketIndex:null,
//判断是否连接天线的信号
antennaConnectorBoolean:false,
}
},
mounted(){
let that = this;
//that.initWebSocketIndex();
that.initWebSocketIndex();
this.loadData();
this.setNowTimes();
this.zongTimer1 = setInterval(() => {
......@@ -233,8 +235,6 @@ export default {
}
}
})
//WebSocket重连
//that.reconnectIndex();
}, 8000)
},
......@@ -252,18 +252,18 @@ export default {
},
//初始化weosocket
initWebSocketIndex(){
const wsuri1 = "ws://8.143.203.103:9095";//连接地址,可加参数
//const wsuri1 = "ws://192.168.0.111:9095/ws";//连接地址,可加参数
const wsuri1 = "ws://8.143.203.103:9095/ws";//连接地址,可加参数
this.websocketIndex = new WebSocket(wsuri1);
this.websocketIndex.onopen = this.websocketonopenIndex;
this.websocketIndex.onerror = this.websocketonerrorIndex;
this.websocketIndex.onmessage = this.websocketonmessageIndex;
this.websocketIndex.onclose = this.websocketcloseIndex;
// this.websocketsendIndex('gpsclient');
// this.websocketonmessageIndex();
},
//WebSocket连接成功
websocketonopenIndex() {
console.log("9095WebSocket连接成功")
this.websocketsendIndex('gpsclient');
},
//WebSocket连接错误
websocketonerrorIndex(e) {
......@@ -275,13 +275,13 @@ export default {
if(e == undefined){
return
}else{
let obj1 = JSON.parse(e.data);
console.log(obj1);
this.antennaConnectorBoolean = true;
}
},
//WebSocket数据发送
websocketsendIndex(agentData){
this.websocketIndex.send(agentData);
this.websocketonmessageIndex();
},
//WebSocket关闭
websocketcloseIndex(e){
......
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