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
felix
DoorLock
Commits
505e5da4
Commit
505e5da4
authored
Dec 06, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1206
parent
7a4ccf81
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
178 additions
and
44 deletions
+178
-44
dev/core/I18NPackage.js
+1
-0
dev/src/lang/zh.json
+3
-1
dev/src/public/public.js
+29
-0
dev/src/view/device/v_index.js
+111
-37
dev/src/view/doorlockUsers/v_doorlockUser.js
+1
-1
dev/src/view/doorlockUsers/v_index.js
+1
-1
web/lib/js/p.js
+28
-0
web/resources/lang/zh.json
+0
-0
web/view/device/index.js
+0
-0
web/view/doorlockUsers/doorlockUser.html
+1
-1
web/view/doorlockUsers/doorlockUser.js
+1
-1
web/view/doorlockUsers/index.html
+1
-1
web/view/doorlockUsers/index.js
+1
-1
No files found.
dev/core/I18NPackage.js
View file @
505e5da4
...
...
@@ -37,6 +37,7 @@ class I18NPackage{
}
apply
(
compiler
){
langGroup
=
getAllLang
(
langPath
,
componentPath
);
compiler
.
plugin
(
"watch-run"
,
(
compilation
,
callback
)
=>
{
if
(
!
this
.
watching
){
this
.
watching
=
true
;
...
...
dev/src/lang/zh.json
View file @
505e5da4
...
...
@@ -230,7 +230,9 @@
"userList"
:{
"name"
:
"昵称:"
,
"noUserTip"
:
"暂无用户"
,
"defaultName"
:
"管理员"
"defaultName"
:
"管理员"
,
"binded"
:
"已绑定"
,
"unbind"
:
"未绑定"
},
"addUser"
:{
"nameInputTip"
:
"请输入您想添加的用户名"
,
...
...
dev/src/public/public.js
View file @
505e5da4
...
...
@@ -234,4 +234,32 @@ iot.navigator.getCurrentWebView = function (){
return
plus
.
webview
.
currentWebview
();
}
uPublic
.
loopUtils
=
function
(
func
,
opts
,
intervalTime
,
time
){
var
_this
=
this
;
var
params
=
_extends
({},
opts
);
var
loop
=
function
loop
()
{
var
handle
=
setTimeout
(
function
()
{
_this
.
loopUtils
(
func
,
opts
,
intervalTime
,
time
);
window
.
clearTimeout
(
handle
);
},
intervalTime
);
};
params
.
success
=
function
(
ret
)
{
if
(
opts
.
success
(
ret
)
===
false
)
{
return
;
}
loop
();
};
params
.
error
=
function
(
err
)
{
if
(
opts
.
error
(
err
)
===
false
)
{
return
;
}
loop
();
};
func
();
var
timeout
=
setTimeout
(
function
(){
window
.
clearTimeout
(
handle
);
window
.
clearTimeout
(
timeout
);
},
time
);
}
export
{
iot
,
uPublic
,
uComponents
}
\ No newline at end of file
dev/src/view/device/v_index.js
View file @
505e5da4
...
...
@@ -67,6 +67,10 @@ function init() {
mac
:
null
,
//设备uuid
uuid
:
null
,
//设备model
model
:
null
,
//sds设备用户信息
userInfo
:
null
,
//门锁id
lockId
:
null
,
//获取用户的身份
...
...
@@ -89,7 +93,10 @@ function init() {
//远程开门错误提示
textErrorTip
:
null
,
//当前状态
status
:
0
status
:
0
,
flag
:
true
,
time
:
null
,
timeout
:
null
},
mounted
(){
notificationListener
(
this
);
...
...
@@ -105,6 +112,17 @@ function init() {
//注册监听上报
registerPushListener
(
self
);
});
// uPublic.loopUtils(function(){
// console.log('1233434');
// }, {
// success: (response) => {
// console.log('success');
// },
// error: (err) => {
// console.log(err);
// }
// }, 1, 30000);
// ringBell(this);sss
},
methods
:{
setValueRemoteOpendoor
(
value
){
...
...
@@ -415,13 +433,50 @@ function initComponentsConfig() {
}
}
function
loopGetLockInfo
(
self
,
delay
,
timeout
,
){
var
handle
=
setInterval
(
function
(){
getLockInfo
(
self
);
},
delay
*
1000
);
setTimeout
(
function
()
{
window
.
clearInterval
(
handle
);
},
timeout
*
1000
);
}
function
getDevices
(
self
){
iot
.
business
.
sds
.
getDevicesByUser
({
success
:
(
response
)
=>
{
console
.
log
(
response
);
// alert(JSON.stringify(response));
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
response
.
data
==
'success'
){
if
(
data
){
self
.
mac
=
data
[
0
].
mac
;
self
.
deviceId
=
data
[
0
].
sn
;
self
.
uuid
=
data
[
0
].
uuid
;
self
.
model
=
data
[
0
].
model
;
if
(
self
.
uuid
){
iot
.
business
.
device
.
getInfo
({
data
:
{
sds
:
true
,
uuid
:
self
.
uuid
},
success
:
(
response
)
=>
{
console
.
log
(
"getInfo"
);
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
console
.
log
(
data
);
if
(
data
.
hasOwnProperty
(
'relAccounts'
)){
self
.
userInfo
=
data
.
relAccounts
;
getLockInfo
(
self
);
}
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
},
complete
:
()
=>
{}
});
}
}
else
{
setValueOfSwitch
(
self
,
true
);
self
.
setLockId
(
null
);
self
.
mac
=
null
;
...
...
@@ -432,11 +487,6 @@ function getDevices(self){
self
.
opendoorRecordFlag
=
false
;
self
.
securityAlarmFlag
=
false
;
self
.
hijackAlarmFlag
=
false
;
}
else
if
(
data
){
self
.
mac
=
data
[
0
].
mac
;
self
.
deviceId
=
data
[
0
].
sn
;
self
.
uuid
=
data
[
0
].
uuid
;
getLockInfo
(
self
);
}
},
error
:
(
error
)
=>
{
...
...
@@ -455,9 +505,9 @@ function getDevices(self){
function
registerPushListener
(
self
){
iot
.
business
.
sds
.
registerPushListener
({
success
:
(
response
)
=>
{
let
data
=
response
.
data
;
console
.
log
(
"registerPushListener"
);
console
.
log
(
data
);
console
.
log
(
response
);
let
data
=
response
.
data
;
setDevceInfo
(
self
,
data
.
params
.
data
);
},
error
:
(
error
)
=>
{
...
...
@@ -474,9 +524,6 @@ function registerPushListener(self){
}
async
function
getRecordTime
(
self
,
data
){
// let notifyTime = null;
// let alarmTime = null;
// let openTime = null;
try
{
self
.
notifyTime
=
await
getRecordTimeMap
(
'notifyTime'
);
}
...
...
@@ -615,7 +662,9 @@ function getLockInfo(self){
console
.
log
(
"getLockInfo"
);
iot
.
business
.
api
.
sendCustom
(
'lock/getLockInfo'
,{
data
:
{
device_id
:
self
.
deviceId
device_id
:
self
.
deviceId
,
// product_id: self.model,
// userinfo: self.userInfo
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
...
...
@@ -697,6 +746,8 @@ function getLockInfo(self){
//设置设备信息
function
setDevceInfo
(
self
,
data
)
{
console
.
log
(
data
);
let
notifyMode
=
[
'1'
,
'2'
,
'3'
];
console
.
log
(
notifyMode
.
indexOf
(
data
.
notify_type
.
value
));
if
(
data
.
BatteryPercentage
){
self
.
setBatteryPercent
(
data
.
BatteryPercentage
.
value
);
if
(
data
.
BatteryPercentage
.
value
>=
10
){
...
...
@@ -709,8 +760,10 @@ function setDevceInfo(self, data) {
if
(
data
.
action
.
value
==
'notify'
){
if
(
data
.
notify_type
.
value
==
104
){
//门铃响了
let
now
=
moment
();
let
time
=
moment
(
data
.
time
.
value
,
"YY-MM-DD-hh-mm-ss"
);
console
.
log
(
'门铃时间差'
+
now
.
diff
(
time
,
'seconds'
)
+
'timeout'
+
config
.
ringBell_timeout
);
if
(
now
.
diff
(
time
,
'seconds'
)
<
config
.
ringBell_timeout
&&
now
.
diff
(
time
,
'seconds'
)
>
0
){
self
.
setRingingTime
(
time
.
format
(
"HH:mm"
));
ringBell
(
self
);
...
...
@@ -730,13 +783,13 @@ function setDevceInfo(self, data) {
},(
300
-
now
.
diff
(
time
,
'seconds'
))
*
1000
);
}
}
else
if
(
data
.
notify_type
.
value
==
2
){
// getLockInfo(self
);
}
else
if
(
notifyMode
.
indexOf
(
data
.
notify_type
.
value
)
!=
-
1
){
loopGetLockInfo
(
self
,
1
,
10
);
}
}
if
(
data
.
action
.
value
==
'lock_log'
&&
(
data
.
lock_action
.
value
==
'1'
||
data
.
lock_action
.
value
==
'4'
)){
//开门或远程开门成功
// getLockInfo(self
);
loopGetLockInfo
(
self
,
1
,
10
);
if
(
data
.
lock_action
.
value
==
'4'
){
uComponents
.
changeCommLoadingStatusAndText
(
self
,
1
,
Vue
.
t
(
'remoteOpendoor.openDoorSuccess'
));
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'btn.confirm'
));
...
...
@@ -752,32 +805,51 @@ function setDevceInfo(self, data) {
self
.
setStatus
(
2
);
}
}
async
function
ringBell
(
self
){
self
.
setRingTime
(
0
);
try
{
self
.
setRingTime
(
config
.
ring_time
/
(
config
.
shake_times
+
config
.
await_time
));
for
(
let
i
=
0
;
i
<
self
.
getRingTime
();){
function
ringBell
(
self
){
window
.
clearInterval
(
self
.
time
);
window
.
clearTimeout
(
self
.
timeout
);
let
intervalTime
=
10000
;
let
i
=
0
;
simpleRingBell
(
self
,
i
);
self
.
time
=
setInterval
(
function
(){
i
++
;
simpleRingBell
(
self
,
i
);
},
intervalTime
);
}
function
simpleRingBell
(
self
,
i
){
window
.
clearTimeout
(
self
.
timeout
);
self
.
setDoorbellRingingFlag
(
true
);
let
time
=
await
sleep
(
1000
*
config
.
shake_times
);
let
p
=
plus
.
audio
.
createPlayer
(
"_../../resources/audio/tipSound2.mp3"
);
p
.
play
(
function
()
{
console
.
log
(
"Audio play success!"
);
},
function
(
e
)
{
console
.
log
(
"Audio play error: "
+
e
.
message
);
});
self
.
timeout
=
setTimeout
(
function
(){
p
=
plus
.
audio
.
createPlayer
(
"_../../resources/audio/tipSound2.mp3"
);
p
.
play
(
function
()
{
console
.
log
(
"Audio play success!"
);
},
function
(
e
)
{
console
.
log
(
"Audio play error: "
+
e
.
message
);
});
window
.
clearTimeout
(
self
.
timeout
);
self
.
timeout
=
setTimeout
(
function
(){
self
.
setDoorbellRingingFlag
(
false
);
time
=
await
sleep
(
config
.
await_time
);
i
++
;
window
.
clearTimeout
(
self
.
timeout
);
if
(
i
>
2
){
window
.
clearInterval
(
self
.
time
);
}
},
3000
);
if
(
i
>
2
){
window
.
clearInterval
(
self
.
time
);
}
catch
(
err
){
console
.
log
(
err
);
},
2000
);
if
(
i
>
2
){
window
.
clearInterval
(
self
.
time
);
}
}
function
sleep
(
time
){
return
new
Promise
(
function
(
resolve
,
reject
){
let
timeOut
=
setTimeout
(()
=>
{
resolve
(
time
);
clearTimeout
(
timeOut
);
},
time
);
})
}
function
pushAction
(
self
,
msg
)
{
var
payload
=
msg
.
payload
;
console
.
log
(
payload
);
...
...
@@ -799,7 +871,9 @@ function pushAction(self, msg) {
let
time
=
moment
(
payload
.
time
,
"YYYY-MM-DD hh:mm:ss"
);
console
.
log
(
now
.
diff
(
time
,
'seconds'
));
if
(
now
.
diff
(
time
,
'seconds'
)
<
config
.
ringBell_timeout
&&
now
.
diff
(
time
,
'seconds'
)
>
0
){
ringBell
(
self
);
if
(
!
self
.
getRingTime
()){
// ringBell(self);
}
}
}
else
if
(
payload
.
type
==
"remoteOpen"
){
//远程开门通知
...
...
dev/src/view/doorlockUsers/v_doorlockUser.js
View file @
505e5da4
...
...
@@ -286,7 +286,7 @@ function setUserInfo(self, data){
image
:
data
.
role
==
0
?
'../../resources/image/green_admin_icon.png'
:
data
.
user_id
==
null
?
'../../resources/image/gray_unbindHead_icon.png'
:
'../../resources/image/green_bindHead_icon.png'
,
role
:
data
.
role
,
title
:
data
.
nickname
,
subtitle
:
data
.
username
subtitle
:
''
}
self
.
setBindShowFlag
(
data
.
user_id
?
false
:
true
);
self
.
setUnbindShowFlag
(
data
.
user_id
?
true
:
false
);
...
...
dev/src/view/doorlockUsers/v_index.js
View file @
505e5da4
...
...
@@ -196,7 +196,7 @@ function setUserData(self, data){
role
:
data
[
i
].
role
,
image
:
data
[
i
].
role
==
0
?
'../../resources/image/green_admin_icon.png'
:
data
[
i
].
user_id
==
null
?
'../../resources/image/gray_unbindHead_icon.png'
:
'../../resources/image/green_bindHead_icon.png'
,
title
:
data
[
i
].
nickname
,
subtitle
:
data
[
i
].
username
subtitle
:
data
[
i
].
username
?
Vue
.
t
(
'userList.binded'
):
Vue
.
t
(
'userList.unbind'
)
}
}
console
.
log
(
data
);
...
...
web/lib/js/p.js
View file @
505e5da4
...
...
@@ -9740,6 +9740,34 @@ iot.navigator.getCurrentWebView = function () {
return
plus
.
webview
.
currentWebview
();
};
uPublic
.
loopUtils
=
function
(
func
,
opts
,
intervalTime
,
time
)
{
var
_this
=
this
;
var
params
=
_extends
({},
opts
);
var
loop
=
function
loop
()
{
var
handle
=
setTimeout
(
function
()
{
_this
.
loopUtils
(
func
,
opts
,
intervalTime
,
time
);
window
.
clearTimeout
(
handle
);
},
intervalTime
);
};
params
.
success
=
function
(
ret
)
{
if
(
opts
.
success
(
ret
)
===
false
)
{
return
;
}
loop
();
};
params
.
error
=
function
(
err
)
{
if
(
opts
.
error
(
err
)
===
false
)
{
return
;
}
loop
();
};
func
();
var
timeout
=
setTimeout
(
function
()
{
window
.
clearTimeout
(
handle
);
window
.
clearTimeout
(
timeout
);
},
time
);
};
exports
.
iot
=
iot
;
exports
.
uPublic
=
uPublic
;
exports
.
uComponents
=
uComponents
;
...
...
web/resources/lang/zh.json
View file @
505e5da4
This diff is collapsed.
Click to expand it.
web/view/device/index.js
View file @
505e5da4
This diff is collapsed.
Click to expand it.
web/view/doorlockUsers/doorlockUser.html
View file @
505e5da4
...
...
@@ -33,7 +33,7 @@
<v-touch
tag=
"p"
class=
"userInfo-title"
v-bind:class=
"{'userInfo-title-disabled': role}"
v-on:tap=
"onEditNameTap"
>
{{ userInfo.title == (null || '') ? $t('doorlockUser.defaultName') : userInfo.title}}
</v-touch>
<p
class=
"userInfo-subtitle"
>
<img
class=
"userInfo-subimage"
v-if=
"userInfo.image && userInfo.role != 0"
v-bind:src=
"userInfo.image"
>
{{ $t('doorlockUser.name') }}
<span
class=
"userInfo-name"
v-if=
"userInfo.subtitle"
>
{{ userInfo.subtitle }}
</span
>
<!--<span class="userInfo-name" v-if="userInfo.subtitle">{{ userInfo.subtitle }}</span>--
>
<v-touch
tag=
"span"
class=
"userInfo-toBind"
v-show=
"bindShowFlag && !role"
v-on:tap=
"onBindTap"
>
{{ $t('doorlockUser.inviteBind') }}
</v-touch>
<u-button
:init-param=
"componentsConfig.unbindButton.initParam"
v-on:u-button-tap=
"onUnbindButtonTap"
v-show=
"(unbindShowFlag && !role && userInfo.role != 0)"
></u-button>
</p>
...
...
web/view/doorlockUsers/doorlockUser.js
View file @
505e5da4
...
...
@@ -1136,7 +1136,7 @@ function setUserInfo(self, data) {
image
:
data
.
role
==
0
?
'../../resources/image/green_admin_icon.png'
:
data
.
user_id
==
null
?
'../../resources/image/gray_unbindHead_icon.png'
:
'../../resources/image/green_bindHead_icon.png'
,
role
:
data
.
role
,
title
:
data
.
nickname
,
subtitle
:
data
.
username
subtitle
:
''
};
self
.
setBindShowFlag
(
data
.
user_id
?
false
:
true
);
self
.
setUnbindShowFlag
(
data
.
user_id
?
true
:
false
);
...
...
web/view/doorlockUsers/index.html
View file @
505e5da4
...
...
@@ -36,7 +36,7 @@
<p
class=
"user-list-title"
>
{{ item.title == (null || '')? $t('userList.defaultName'):item.title}}
</p>
<p
class=
"user-list-subtitle"
>
<img
class=
"user-list-subimage"
v-if=
"item.image && item.role != 0"
v-bind:src=
"item.image"
>
{{ $t('userList.name') }}
<span
v-if=
"item.subtitle"
>
{{ item.subtitle }}
</span>
<span
v-if=
"item.subtitle"
>
{{ item.subtitle }}
</span>
</p>
</div>
</v-touch>
...
...
web/view/doorlockUsers/index.js
View file @
505e5da4
...
...
@@ -1019,7 +1019,7 @@ function setUserData(self, data) {
role
:
data
[
i
].
role
,
image
:
data
[
i
].
role
==
0
?
'../../resources/image/green_admin_icon.png'
:
data
[
i
].
user_id
==
null
?
'../../resources/image/gray_unbindHead_icon.png'
:
'../../resources/image/green_bindHead_icon.png'
,
title
:
data
[
i
].
nickname
,
subtitle
:
data
[
i
].
username
subtitle
:
data
[
i
].
username
?
Vue
.
t
(
'userList.binded'
)
:
Vue
.
t
(
'userList.unbind'
)
};
}
console
.
log
(
data
);
...
...
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