Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NewTruckTerminalSyetem
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SQL_Mou
NewTruckTerminalSyetem
Commits
4117a6f1
Commit
4117a6f1
authored
Nov 30, 2022
by
xxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
82f2d7a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
64 deletions
+71
-64
index.vue
src/views/MLargeScreen/index.vue
+71
-64
No files found.
src/views/MLargeScreen/index.vue
View file @
4117a6f1
...
...
@@ -171,10 +171,13 @@ export default {
audioTishiViewShow
:
false
,
//路障申报数量
roadblockNum
:
0
,
//websocket对象
websocketIndex
:
null
,
}
},
mounted
(){
let
that
=
this
;
//that.initWebSocketIndex();
this
.
loadData
();
this
.
setNowTimes
();
this
.
zongTimer1
=
setInterval
(()
=>
{
...
...
@@ -230,74 +233,78 @@ export default {
}
}
})
//WebSocket重连
//that.reconnectIndex();
},
8000
)
},
methods
:{
// getSerialSend() {
// //console.log(123);
// window.SerialPort.send("hello");
// },
// getSerialReceive() {
// //console.log(123);
// let cont = "";
// cont = window.SerialPort.receive()
// window.alert(cont);
// },
// //初始化weosocket
// initWebSocket(){
// const wsuri = "ws://8.143.203.103:9095";//连接地址,可加参数
// // const wsuri = process.env.VUE_APP_WS_API + "/" + 'pcBigScreen';
// this.websocket = new WebSocket(wsuri);
// this.websocket.onopen = this.websocketonopen;
// this.websocket.onerror = this.websocketonerror;
// this.websocket.onmessage = this.websocketonmessage;
// this.websocket.onclose = this.websocketclose;
// this.websocketonmessage();
// },
// //WebSocket连接成功
// websocketonopen() {
// console.log("WebSocket连接成功");
// },
// //WebSocket连接错误
// websocketonerror(e) {
// console.log("WebSocket连接发生错误");
// },
// //WebSocket数据接收
// websocketonmessage(e){
// //console.log("e",e);
// if(e == undefined){
// return
// }else{
// let obj1 = JSON.parse(e.data);
// console.log(obj1);
// }
// },
// //WebSocket数据发送
// websocketsend(agentData){
// this.websocket.send(agentData);
// },
// //WebSocket关闭
// websocketclose(e){
// //console.log("connection closed (" + e.code + ")");
// console.log("connection closed !");
// },
// //WebSocket重连
// reconnect(){
// var This=this;
// if (this.websocket.readyState === 1) { // that.websock.readyState = 1 表示连接成功,可以立即发送信息
// This.websocketonmessage();
// } else if (this.websocket.readyState === 0) { // 表示正在连接,设置300ms后发送信息
// setTimeout(function () {
// This.websocketonmessage();
// }, 300);
// } else { // 连接未创建或者创建失败,则重新创建连接,并设置500ms后发送信息
// This.initWebSocket();
// setTimeout(function () {
// This.websocketonmessage();
// }, 500);
// }
// },
getSerialSendIndex
()
{
//console.log(123);
window
.
SerialPort
.
send
(
"
hello
"
);
},
getSerialReceiveIndex
()
{
//console.log(123);
let
cont
=
""
;
console
.
log
(
window
.
SerialPort
.
receive
());
cont
=
window
.
SerialPort
.
receive
()
window
.
alert
(
cont
);
},
//初始化weosocket
initWebSocketIndex
(){
const
wsuri1
=
"
ws://8.143.203.103:9095
"
;
//连接地址,可加参数
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连接成功
"
)
},
//WebSocket连接错误
websocketonerrorIndex
(
e
)
{
console
.
log
(
"
9095WebSocket连接发生错误
"
);
},
//WebSocket数据接收
websocketonmessageIndex
(
e
){
console
.
log
(
"
indexWebsocketMessage
"
,
e
);
if
(
e
==
undefined
){
return
}
else
{
let
obj1
=
JSON
.
parse
(
e
.
data
);
console
.
log
(
obj1
);
}
},
//WebSocket数据发送
websocketsendIndex
(
agentData
){
this
.
websocketIndex
.
send
(
agentData
);
},
//WebSocket关闭
websocketcloseIndex
(
e
){
console
.
log
(
"
connection closed !
"
);
},
//WebSocket重连
reconnectIndex
(){
var
This
=
this
;
if
(
this
.
websocketIndex
.
readyState
===
1
)
{
// that.websock.readyState = 1 表示连接成功,可以立即发送信息
This
.
websocketonmessageIndex
();
}
else
if
(
this
.
websocketIndex
.
readyState
===
0
)
{
// 表示正在连接,设置300ms后发送信息
setTimeout
(
function
()
{
This
.
websocketonmessageIndex
();
},
300
);
}
else
{
// 连接未创建或者创建失败,则重新创建连接,并设置500ms后发送信息
console
.
log
(
3
);
This
.
initWebSocketIndex
();
setTimeout
(
function
()
{
This
.
websocketonmessageIndex
();
},
500
);
}
},
loadData
(){
let
that
=
this
;
let
href1
=
window
.
location
.
href
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment