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
6a4b3465
Commit
6a4b3465
authored
Nov 03, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1103
parent
0af83892
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
77 deletions
+86
-77
dev/src/public/crypto.js
+7
-1
dev/src/public/public.js
+11
-11
dev/src/view/device/v_index.js
+30
-38
dev/src/view/login/v_index.js
+3
-2
web/lib/js/p.js
+12
-11
web/view/device/device.css
+11
-10
web/view/device/index.html
+1
-1
web/view/device/index.js
+0
-0
web/view/device/remoteOpendoor.js
+9
-1
web/view/login/index.js
+2
-2
No files found.
dev/src/public/crypto.js
View file @
6a4b3465
...
...
@@ -21,7 +21,13 @@ class crypto{
return
keyIv
;
}
static
encode
(
msg
,
keyIv
){
let
message
=
JSON
.
stringify
(
msg
);
let
message
=
''
;
if
(
typeof
(
msg
)
==
'object'
){
message
=
JSON
.
stringify
(
msg
);
}
else
{
message
=
msg
;
}
console
.
log
(
message
);
let
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
keyIv
.
key
);
let
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
keyIv
.
iv
);
let
code
=
CryptoJS
.
AES
.
encrypt
(
message
,
key
,
{
iv
:
iv
},{
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
nopadding
});
...
...
dev/src/public/public.js
View file @
6a4b3465
...
...
@@ -141,21 +141,21 @@ iot.navigator.trigger = function (element, eventType, eventData) {
};
iot
.
navigator
.
closeAllBesidesItself
=
function
()
{
var
wvs
=
plus
.
webview
.
all
();
// var curWb = plus.webview.currentWebview();
for
(
var
i
=
0
;
i
<
wvs
.
length
-
1
;
i
++
)
{
// if (wvs[i].id != curWb.id) {
wvs
[
i
].
close
();
// var wvs = plus.webview.all();
//// var curWb = plus.webview.currentWebview();
// for (var i = 0; i < wvs.length-1; i++) {
//// if (wvs[i].id != curWb.id) {
// wvs[i].close();
//// }
// }
}
}
iot
.
navigator
.
closeAll
=
function
(){
var
wvs
=
plus
.
webview
.
all
();
var
curWb
=
plus
.
webview
.
currentWebview
();
for
(
var
i
=
0
;
i
<
wvs
.
length
;
i
++
)
{
wvs
[
i
].
close
();
}
//
var wvs = plus.webview.all();
//
var curWb = plus.webview.currentWebview();
//
for (var i = 0; i < wvs.length; i++) {
//
wvs[i].close();
//
}
}
iot
.
ready
(
function
(){
...
...
dev/src/view/device/v_index.js
View file @
6a4b3465
...
...
@@ -32,42 +32,43 @@ function init() {
valueHijackAlarm
:
0
,
//门锁管理
valueDoorlockManage
:
0
,
//门锁最新消息是否滚动
activeFlag
:
true
,
followShowFlag
:
false
,
doorbellShowFlag
:
false
,
bindDoorlockShowFlag
:
false
,
//配置组件
componentsConfig
:
initComponentsConfig
(),
//电量
batteryState
:
null
,
//
followShowFlag
:
false
,
//电量icon
batteryState
:
''
,
//电量百分比
batteryPercent
:
100
,
//响铃时间
ringingTime
:
null
,
//门铃是否响起
doorbellRingingFlag
:
false
,
//是否显示"门铃响了"文本
textDoorbellRingingFlag
:
false
,
//远程开门是否开启
//点击远程开门提示
remoteOpendoorFlag
:
false
,
//设备ID
deviceId
:
null
,
//设备mac
mac
:
null
,
//设备uuid
uuid
:
null
,
//门锁id
lockId
:
null
,
//获取用户的身份
role
:
null
,
//最新消息
newMsg
:
''
,
//是否第一次获取门锁信息
isFirstGetLockInfo
:
true
,
lockId
:
null
,
//获取用户的身份
role
:
null
,
//是否显示远程开门页面
remoteOpendoorShowFlag
:
false
,
//远程开门密码
textPassword
:
null
,
//远程开门错误提示
textErrorTip
:
null
,
//当前状态
status
:
null
},
mounted
(){
...
...
@@ -93,13 +94,10 @@ function init() {
//注册监听上报
iot
.
business
.
sds
.
registerPushListener
({
success
:
(
response
)
=>
{
console
.
log
(
response
);
let
data
=
response
.
data
;
console
.
log
(
data
);
// if(data.hasOwnProperty('params')){
console
.
log
(
"registerPushListener"
);
console
.
log
(
data
);
setDevceInfo
(
self
,
data
.
params
.
data
);
// }
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
...
...
@@ -175,12 +173,6 @@ function init() {
setDoorbellRingingFlag
(
boolean
){
this
.
doorbellRingingFlag
=
boolean
;
},
getTextDoorbellRingingFlag
(){
return
this
.
textDoorbellRingingFlag
;
},
setTextDoorbellRingingFlag
(
flag
){
this
.
textDoorbellRingingFlag
=
flag
;
},
getRemoteOpendoorFlag
(){
return
this
.
remoteOpendoorFlag
;
},
...
...
@@ -415,8 +407,6 @@ function getDeviceStatus(self){
success
:
(
response
)
=>
{
console
.
log
(
response
);
let
data
=
response
.
data
;
// self.setBatteryPercent(data.BatteryPercentage.value);
// self.setBatteryState(config.powerIcon[Math.round(data.BatteryPercentage.value/20)]);
console
.
log
(
"getStatus"
);
setDevceInfo
(
self
,
data
);
},
...
...
@@ -431,32 +421,26 @@ function getLockInfo(self){
console
.
log
(
"getLockInfo"
);
iot
.
business
.
api
.
sendCustom
(
'lock/getLockInfo'
,{
data
:
{
// device_id:"600194283588"
device_id
:
self
.
deviceId
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
// self.setBatteryPercent(data.battery);
// self.setBatteryState(config.powerIcon[Math.round(data.battery/20)]);
//判断云端是否绑定
if
(
data
.
lock_id
){
setValueOfSwitch
(
self
,
1
);
self
.
setLockId
(
data
.
lock_id
);
self
.
setRole
(
data
.
role
);
console
.
log
(
data
.
info
);
if
(
self
.
isFirstGetLockInfo
){
getDeviceStatus
(
self
);
self
.
setIsFirstGetLockInfo
(
false
);
}
if
(
data
.
info
&&
data
.
info
.
length
){
console
.
log
(
data
.
info
);
self
.
newMsg
=
''
;
for
(
let
i
=
0
;
i
<
data
.
info
.
length
;
i
++
){
let
now
=
moment
();
let
time
=
moment
(
data
.
info
[
i
].
time
);
console
.
log
(
now
.
diff
(
time
,
'hours'
));
if
(
now
.
diff
(
time
,
'hours'
)
<
24
){
if
(
data
.
info
[
i
].
nickname
==
null
){
self
.
newMsg
+=
moment
(
data
.
info
[
i
].
time
).
format
(
"YY.MM.DD HH:mm"
)
+
' ID:'
+
data
.
info
[
i
].
openId
+
Vue
.
t
(
'opendoorRecord.'
+
config
.
openDoorMode
[
data
.
info
[
i
].
mode
]
+
''
)
+
'<br>'
;
...
...
@@ -465,6 +449,11 @@ function getLockInfo(self){
}
}
}
if
(
data
.
info
[
0
].
nickname
==
null
){
self
.
newMsg
+=
moment
(
data
.
info
[
0
].
time
).
format
(
"YY.MM.DD HH:mm"
)
+
' ID:'
+
data
.
info
[
0
].
openId
+
Vue
.
t
(
'opendoorRecord.'
+
config
.
openDoorMode
[
data
.
info
[
0
].
mode
]
+
''
);
}
else
{
self
.
newMsg
+=
moment
(
data
.
info
[
0
].
time
).
format
(
"YY.MM.DD HH:mm"
)
+
data
.
info
[
0
].
nickname
+
Vue
.
t
(
'opendoorRecord.'
+
config
.
openDoorMode
[
data
.
info
[
0
].
mode
]
+
''
);
}
uComponents
.
changeMarqueeText
(
self
,
self
.
newMsg
);
}
else
{
uComponents
.
changeMarqueeText
(
self
,
Vue
.
t
(
'device.noNewMsg'
));
...
...
@@ -473,10 +462,7 @@ function getLockInfo(self){
}
else
{
uComponents
.
changeMarqueeText
(
self
,
Vue
.
t
(
'device.defaultNewMsg'
));
}
}
else
{
// uComponents.changeMarqueeText(self, Vue.t('device.noNewMsg'));
// self.setRingingTime(null);
}
}
else
{
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
...
...
@@ -491,14 +477,10 @@ function getLockInfo(self){
function
setDevceInfo
(
self
,
data
)
{
console
.
log
(
data
);
self
.
setBatteryPercent
(
data
.
BatteryPercentage
.
value
);
// self.setBatteryState(config.powerIcon[Math.round(data.BatteryPercentage.value/20)]);
if
(
data
.
BatteryPercentage
.
value
>=
10
){
//向上取整
//self.setIsYellow(true);
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
ceil
(
data
.
BatteryPercentage
.
value
/
20
)]);
}
else
{
//
//self.setIsRed(true);
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
round
(
data
.
BatteryPercentage
.
value
/
20
)]);
}
if
(
data
.
action
.
value
==
'notify'
){
...
...
@@ -507,7 +489,6 @@ function setDevceInfo(self, data) {
let
now
=
moment
();
let
time
=
moment
(
data
.
time
.
value
,
"YY-MM-DD-hh-mm-ss"
);
if
(
now
.
diff
(
time
,
'hours'
)
<
24
){
self
.
setTextDoorbellRingingFlag
(
true
);
self
.
setRingingTime
(
time
.
format
(
"HH:mm"
));
console
.
log
(
"innnnn"
);
ringBell
(
self
);
...
...
@@ -526,6 +507,12 @@ function setDevceInfo(self, data) {
self
.
setStatus
(
1
);
}
}
if
(
data
.
ErrorCode
){
//远程开门失败
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'remoteOpendoor.openDoorFailure'
));
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'remoteOpendoor.remoteOpendoorAgain'
));
self
.
setStatus
(
2
);
}
}
async
function
ringBell
(
self
){
try
{
...
...
@@ -618,6 +605,7 @@ function myInfoTap(self){
});
}
//tap 绑定门锁
function
bindDoorlockTap
(){
iot
.
navigator
.
openWindow
({
url
:
'../addDevice/index.html'
,
...
...
@@ -722,10 +710,12 @@ function laterFollowTap(self){
self
.
setFollowShowFlag
(
false
);
}
//tap 远程开门页面返回
function
backTap
(
self
){
self
.
setRemoteOpendoorShowFlag
(
false
);
}
//远程开门密码
function
passwordChange
(
self
,
text
){
self
.
setTextPassword
(
text
);
self
.
setTextErrorTip
(
''
);
...
...
@@ -742,6 +732,7 @@ function confirmButtonTap(self){
console
.
log
(
self
.
mac
);
let
keyIv
=
crypto
.
enkey
(
self
.
mac
.
replace
(
/:/g
,
''
));
console
.
log
(
keyIv
);
self
.
setTextPassword
({
'pwd'
:
'123'
});
let
pwd
=
crypto
.
encode
(
self
.
getTextPassword
(),
keyIv
);
console
.
log
(
pwd
);
let
msg
=
crypto
.
decode
(
pwd
,
keyIv
);
...
...
@@ -783,6 +774,7 @@ function confirmButtonTap(self){
},
config
.
remote_opendoor_timeout
);
}
//tap comm-loading ‘确认’
function
commLoadingButtonTap
(
self
){
if
(
self
.
getStatus
()
==
1
){
//绑定成功
...
...
dev/src/view/login/v_index.js
View file @
6a4b3465
...
...
@@ -106,7 +106,7 @@ function loginButtonTap(self){
}
function
cloudsLogin
(
self
,
id
){
uComponents
.
showLoading
(
self
);
//
uComponents.showLoading(self);
iot
.
business
.
user
.
simpleLogin
({
data
:
{
username
:
id
,
...
...
@@ -141,7 +141,7 @@ function cloudsLogin(self, id){
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
//
uComponents.hideLoading(self);
}
});
}
\ No newline at end of file
web/lib/js/p.js
View file @
6a4b3465
...
...
@@ -9646,21 +9646,21 @@ iot.navigator.trigger = function (element, eventType, eventData) {
};
iot
.
navigator
.
closeAllBesidesItself
=
function
()
{
var
wvs
=
plus
.
webview
.
all
();
// var curWb = plus.webview.currentWebview();
for
(
var
i
=
0
;
i
<
wvs
.
length
-
1
;
i
++
)
{
// if (wvs[i].id != curWb.id) {
wvs
[
i
].
close
();
// var wvs = plus.webview.all();
//// var curWb = plus.webview.currentWebview();
// for (var i = 0; i < wvs.length-1; i++) {
//// if (wvs[i].id != curWb.id) {
// wvs[i].close();
//// }
// }
}
};
iot
.
navigator
.
closeAll
=
function
()
{
var
wvs
=
plus
.
webview
.
all
();
var
curWb
=
plus
.
webview
.
currentWebview
();
for
(
var
i
=
0
;
i
<
wvs
.
length
;
i
++
)
{
wvs
[
i
].
close
();
}
//
var wvs = plus.webview.all();
//
var curWb = plus.webview.currentWebview();
//
for (var i = 0; i < wvs.length; i++) {
//
wvs[i].close();
//
}
};
iot
.
ready
(
function
()
{
...
...
@@ -17795,6 +17795,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
let
uComponents
=
{};
uComponents
.
showLoading
=
function
(
vmObj
)
{
console
.
log
(
"uComponents.showLoading"
+
(
new
Date
().
getTime
()));
vmObj
.
$refs
.
uloading
.
show
();
};
uComponents
.
hideLoading
=
function
(
vmObj
)
{
...
...
web/view/device/device.css
View file @
6a4b3465
...
...
@@ -1255,31 +1255,32 @@ p {
}
.active
.u-marquee-text
{
-webkit-animation
:
marquee
5s
linear
infinite
;
animation
:
marquee
5s
linear
infinite
;
-webkit-animation
:
marquee
10s
linear
infinite
;
animation
:
marquee
10s
linear
infinite
;
line-height
:
0.96rem
;
}
@-webkit-keyframes
marquee
{
from
{
-webkit-transform
:
translate
(
0
,
0
.533
rem
);
transform
:
translate
(
0
,
0
.533
rem
);
-webkit-transform
:
translate
(
0
,
0rem
);
transform
:
translate
(
0
,
0rem
);
}
to
{
-webkit-transform
:
translate
(
0
,
-
100%
);
transform
:
translate
(
0
,
-
100%
);
-webkit-transform
:
translate
(
0
,
-
2.83rem
);
transform
:
translate
(
0
,
-
2.83rem
);
}
}
@keyframes
marquee
{
from
{
-webkit-transform
:
translate
(
0
,
0
.533
rem
);
transform
:
translate
(
0
,
0
.533
rem
);
-webkit-transform
:
translate
(
0
,
0rem
);
transform
:
translate
(
0
,
0rem
);
}
to
{
-webkit-transform
:
translate
(
0
,
-
100%
);
transform
:
translate
(
0
,
-
100%
);
-webkit-transform
:
translate
(
0
,
-
2.83rem
);
transform
:
translate
(
0
,
-
2.83rem
);
}
}
...
...
web/view/device/index.html
View file @
6a4b3465
...
...
@@ -33,7 +33,7 @@
<p></p>
</div>
</div>
<div
class=
"doorbellTip"
><span>
{{ ringingTime }}
</span>
{{
textDoorbellRingingFlag
? $t('device.doorLockRinging'):'' }}
</div>
<div
class=
"doorbellTip"
><span>
{{ ringingTime }}
</span>
{{
ringingTime
? $t('device.doorLockRinging'):'' }}
</div>
</div>
<p
class=
"batteryState"
:class=
"[{yellowWarning: batteryPercent<=20},{redWarning: batteryPercent<10}]"
><span
v-html=
"batteryState"
></span><span>
{{ batteryPercent }}%
</span></p>
</div>
...
...
web/view/device/index.js
View file @
6a4b3465
This diff is collapsed.
Click to expand it.
web/view/device/remoteOpendoor.js
View file @
6a4b3465
...
...
@@ -6106,6 +6106,8 @@ Object.defineProperty(exports, "__esModule", {
value
:
true
});
var
_typeof
=
typeof
Symbol
===
"function"
&&
typeof
Symbol
.
iterator
===
"symbol"
?
function
(
obj
)
{
return
typeof
obj
;
}
:
function
(
obj
)
{
return
obj
&&
typeof
Symbol
===
"function"
&&
obj
.
constructor
===
Symbol
&&
obj
!==
Symbol
.
prototype
?
"symbol"
:
typeof
obj
;
};
var
_createClass
=
function
()
{
function
defineProperties
(
target
,
props
)
{
for
(
var
i
=
0
;
i
<
props
.
length
;
i
++
)
{
var
descriptor
=
props
[
i
];
descriptor
.
enumerable
=
descriptor
.
enumerable
||
false
;
descriptor
.
configurable
=
true
;
if
(
"value"
in
descriptor
)
descriptor
.
writable
=
true
;
Object
.
defineProperty
(
target
,
descriptor
.
key
,
descriptor
);
}
}
return
function
(
Constructor
,
protoProps
,
staticProps
)
{
if
(
protoProps
)
defineProperties
(
Constructor
.
prototype
,
protoProps
);
if
(
staticProps
)
defineProperties
(
Constructor
,
staticProps
);
return
Constructor
;
};
}();
/**
* @class
* crypto
...
...
@@ -6148,7 +6150,13 @@ var crypto = function () {
},
{
key
:
"encode"
,
value
:
function
encode
(
msg
,
keyIv
)
{
var
message
=
JSON
.
stringify
(
msg
);
var
message
=
''
;
if
((
typeof
msg
===
"undefined"
?
"undefined"
:
_typeof
(
msg
))
==
'object'
)
{
message
=
JSON
.
stringify
(
msg
);
}
else
{
message
=
msg
;
}
console
.
log
(
message
);
var
key
=
_cryptoJs2
.
default
.
enc
.
Utf8
.
parse
(
keyIv
.
key
);
var
iv
=
_cryptoJs2
.
default
.
enc
.
Utf8
.
parse
(
keyIv
.
iv
);
var
code
=
_cryptoJs2
.
default
.
AES
.
encrypt
(
message
,
key
,
{
iv
:
iv
},
{
mode
:
_cryptoJs2
.
default
.
mode
.
CBC
,
padding
:
_cryptoJs2
.
default
.
pad
.
nopadding
});
...
...
web/view/login/index.js
View file @
6a4b3465
...
...
@@ -112,7 +112,7 @@ function loginButtonTap(self) {
}
function
cloudsLogin
(
self
,
id
)
{
_public
.
uComponents
.
showLoading
(
self
);
//
uComponents.showLoading(self);
_public
.
iot
.
business
.
user
.
simpleLogin
({
data
:
{
username
:
id
,
...
...
@@ -146,7 +146,7 @@ function cloudsLogin(self, id) {
_public
.
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
function
complete
()
{
_public
.
uComponents
.
hideLoading
(
self
);
//
uComponents.hideLoading(self);
}
});
}
...
...
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