Commit f0b69608 authored by xxx's avatar xxx

1

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