Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
罗鑫霖
/
vion-tools
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cc008975
authored
Mar 24, 2020
by
周志凯
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
nature socket
1 parent
5cbfc59c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
22 deletions
index.html
index.html
View file @
cc00897
...
@@ -1498,7 +1498,7 @@
...
@@ -1498,7 +1498,7 @@
stepList
:
[]
stepList
:
[]
};
};
obj
.
stepType
=
wsUrl
;
obj
.
stepType
=
wsUrl
;
obj
.
mark
=
params
.
mark
||
params
.
featureType
;
obj
.
mark
=
params
.
mark
;
if
(
!
webSockUrl
)
{
if
(
!
webSockUrl
)
{
webSock
=
window
.
location
.
host
;
webSock
=
window
.
location
.
host
;
}
}
...
@@ -1857,7 +1857,10 @@
...
@@ -1857,7 +1857,10 @@
// 参数 mallIds,startDate,endDate,scheduleType
// 参数 mallIds,startDate,endDate,scheduleType
// 店员重新比对 /mall/staff
// 店员重新比对 /mall/staff
// 参数 mallIds,startDate,endDate,scheduleType
// 参数 mallIds,startDate,endDate,scheduleType
this
.
socket
&&
this
.
socket
.
close
()
if
(
this
.
socket
)
{
this
.
socket
.
close
()
this
.
socket
=
null
}
this
.
results
=
[]
this
.
results
=
[]
this
.
startTiming
=
0
this
.
startTiming
=
0
this
.
endTiming
=
0
this
.
endTiming
=
0
...
@@ -1904,29 +1907,61 @@
...
@@ -1904,29 +1907,61 @@
wsUrl
=
webSockUrl
||
window
.
location
.
host
,
wsUrl
=
webSockUrl
||
window
.
location
.
host
,
socketUrl
=
"ws://"
+
wsUrl
+
"/recal/schedule/"
+
scheduleType
socketUrl
=
"ws://"
+
wsUrl
+
"/recal/schedule/"
+
scheduleType
console
.
log
(
'[socketUrl]:'
,
socketUrl
)
console
.
log
(
'[socketUrl]:'
,
socketUrl
)
self
.
socket
=
new
ws
(
socketUrl
)
if
(
"WebSocket"
in
window
)
{
self
.
socket
.
onconnecting
=
function
(
ev
)
{
self
.
socket
=
new
WebSocket
(
socketUrl
);
console
.
log
(
'socket:onconnecting'
,
ev
)
}
else
if
(
"MozWebSocket"
in
window
)
{
}
self
.
socket
=
new
MozWebSocket
(
socketUrl
);
self
.
socket
.
onopen
=
function
(
ev
)
{
}
else
{
console
.
log
(
'socket:onopen'
,
ev
)
self
.
socket
=
new
SockJS
(
socketUrl
);
self
.
startTiming
=
+
new
Date
()
self
.
fetchApi
(
callbackUrlPath
,
callbackParam
)
}
self
.
socket
.
onclose
=
function
(
ev
)
{
console
.
log
(
'socket:onclose'
,
ev
)
// log('WebSocket Closed!!')
}
}
self
.
socket
.
onmessage
=
function
(
ev
)
{
try
{
console
.
log
(
'socket:onmessage'
,
ev
)
self
.
socket
.
onopen
=
function
(
ev
)
{
var
msg
=
JSON
.
parse
(
ev
.
data
)
self
.
startTiming
=
+
new
Date
()
console
.
log
(
'[onmessage]:'
,
msg
)
self
.
fetchApi
(
callbackUrlPath
,
callbackParam
)
self
.
dealMessage
(
msg
)
};
if
(
msg
.
stepCount
===
1
)
{
self
.
socket
.
onclosed
=
function
()
{
self
.
endTiming
=
+
new
Date
()
console
.
log
(
'socket:onclose'
)
self
.
socket
.
close
()
};
self
.
socket
.
onmessage
=
function
(
evt
)
{
var
msg
=
JSON
.
parse
(
ev
.
data
)
console
.
log
(
'[onmessage]:'
,
msg
)
self
.
dealMessage
(
msg
)
if
(
msg
.
stepCount
===
1
)
{
self
.
endTiming
=
+
new
Date
()
self
.
socket
.
close
()
}
};
self
.
socket
.
onerror
=
function
(
event
)
{
console
.
log
(
"设备WebSocket:发生错误 "
);
console
.
log
(
event
);
}
}
}
catch
(
error
)
{
console
.
log
(
'onSocketConnect:'
,
error
)
}
}
// self.socket = new ws(socketUrl)
// self.socket.onconnecting = function (ev) {
// console.log('socket:onconnecting', ev)
// }
// self.socket.onopen = function(ev) {
// console.log('socket:onopen', ev)
// self.startTiming = +new Date()
// self.fetchApi(callbackUrlPath, callbackParam)
// }
// self.socket.onclose = function(ev) {
// console.log('socket:onclose', ev)
// // log('WebSocket Closed!!')
// }
// self.socket.onmessage = function(ev) {
// console.log('socket:onmessage', ev)
// var msg = JSON.parse(ev.data)
// console.log('[onmessage]:', msg)
// self.dealMessage(msg)
// if (msg.stepCount === 1) {
// self.endTiming = +new Date()
// self.socket.close()
// }
// }
},
},
fetchApi
(
urlPath
,
parameter
)
{
fetchApi
(
urlPath
,
parameter
)
{
const
{
const
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment