Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DoorLock
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱建香
DoorLock
Commits
f1b5ce2d
Commit
f1b5ce2d
authored
Mar 16, 2018
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点击远程开门通知,远程开门按钮亮起并可点击
parent
5e05a281
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
8 deletions
+29
-8
dev/src/view/device/v_index.js
+24
-8
web/lib/js/start.js
+5
-0
No files found.
dev/src/view/device/v_index.js
View file @
f1b5ce2d
...
...
@@ -15,6 +15,8 @@ import config from '../../public/config.js';
import
{
iot
,
uPublic
,
uComponents
}
from
'../../public/public.js'
;
import
uloop
from
'../../public/uloop.js'
;
import
unotify
from
'../../public/unotify.js'
;
const
Emitter
=
require
(
'events'
).
EventEmitter
;
let
emit
=
new
Emitter
();
const
ON_LINE
=
'on'
;
const
OFF_LINE
=
'off'
;
...
...
@@ -136,7 +138,7 @@ function init() {
mounted
(){
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'start: Debug'
);
}
}
//显示loading
uComponents
.
showLoading
(
this
);
//监听推送
...
...
@@ -635,6 +637,8 @@ function getLockInfoSuccess(self, data){
}
//拼接首页滚动的三条记录
getTreenRecord
(
self
,
data
.
info
.
history
.
open
);
emit
.
emit
(
'getLockInfoSuccess'
);
}
else
{
uComponents
.
changeMarqueeText
(
self
,
[
Vue
.
t
(
'device.defaultNewMsg'
)]);
self
.
activeFlag
=
false
;
...
...
@@ -921,7 +925,7 @@ function registerPushListener(self){
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'监听消息'
);
iotDebug
=
[]
;
iotDebug
.
clear
()
;
}
},
error
:
(
error
)
=>
{
...
...
@@ -1048,10 +1052,10 @@ function setRemoteOpendoor(self, time){
iotDebug
.
push
(
'end: 远程开门'
+
'设备当前时间'
+
now
.
unix
()
+
'通知时间'
+
time
.
unix
());
}
console
.
log
(
now
.
diff
(
time
,
'seconds'
));
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 远程开门
'
+
now
.
diff
(
time
,
'seconds'
)
+
'权限
'
+
self
.
getRole
()
+
''
);
iotDebug
.
push
(
'end: 远程开门
时间差:'
+
now
.
diff
(
time
,
'seconds'
)
+
'权限:
'
+
self
.
getRole
()
+
''
);
}
if
(
now
.
diff
(
time
,
'seconds'
)
<
config
.
pushMsg_timeout
&&
now
.
diff
(
time
,
'seconds'
)
>=
0
&&
(
self
.
getRole
()
==
0
)){
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 远程开门'
+
'进入展示'
);
...
...
@@ -1081,7 +1085,7 @@ function setRemoteOpendoor(self, time){
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'远程开门'
);
iotDebug
=
[]
;
iotDebug
.
clear
()
;
}
}
...
...
@@ -1158,7 +1162,7 @@ function pushAction(self, msg) {
}
//推送消息处理方法
function
notifyDataProcessing
(
self
,
payload
){
async
function
notifyDataProcessing
(
self
,
payload
){
switch
(
payload
.
type
){
// case 'open':
// case 'notify':
...
...
@@ -1173,20 +1177,32 @@ function notifyDataProcessing(self, payload){
break
;
case
'remoteOpen'
:
//远程开门
console
.
log
(
"innnnremoteOPen"
);
await
waitGetLockInfo
();
setRemoteOpendoor
(
self
,
payload
.
time
);
break
;
}
}
function
waitGetLockInfo
(){
return
new
Promise
((
r
,
j
)
=>
{
emit
.
on
(
"getLockInfoSuccess"
,
()
=>
{
r
();
})
});
}
function
notificationListener
(
self
)
{
// 从系统消息中心点击消息启动应用事件
plus
.
push
.
addEventListener
(
'click'
,
function
(
msg
)
{
console
.
log
(
"点击推送"
);
console
.
log
(
msg
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 点击通知'
+
JSON
.
stringify
(
msg
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'点击通知'
);
iotDebug
=
[]
;
iotDebug
.
clear
()
;
}
pushAction
(
self
,
msg
);
},
false
);
...
...
@@ -1197,7 +1213,7 @@ function notificationListener(self) {
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'接收通知'
);
iotDebug
=
[]
;
iotDebug
.
clear
()
;
}
},
false
);
}
...
...
web/lib/js/start.js
View file @
f1b5ce2d
...
...
@@ -9,6 +9,11 @@ UIOT_Debug.prototype.push = function (key) {
time
:
time
});
};
UIOT_Debug
.
prototype
.
clear
=
function
()
{
this
.
logData
=
[];
}
UIOT_Debug
.
prototype
.
upload
=
function
(
iot
,
title
)
{
var
logData
=
this
.
logData
;
// console.log(logData);
...
...
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