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
cdae6692
Commit
cdae6692
authored
Oct 10, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
云端绑定
parent
6e40dbb7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
151 additions
and
87 deletions
+151
-87
dev/src/lang/zh.json
+2
-1
dev/src/view/addDevice/v_wifiAdd.js
+46
-2
dev/src/view/device/v_index.js
+81
-54
dev/src/view/device/v_remoteOpendoor.js
+5
-2
web/lib/less/myInfo/myInfo.less
+11
-11
web/resources/lang/zh.json
+0
-0
web/view/device/index.html
+2
-2
web/view/myInfo/index.html
+2
-4
web/view/myInfo/myInfo.css
+2
-11
No files found.
dev/src/lang/zh.json
View file @
cdae6692
...
@@ -91,7 +91,8 @@
...
@@ -91,7 +91,8 @@
"followCont2"
:
"1.保存二维码-2.用微信从<span>相册选取扫码</span>-3.关注"
,
"followCont2"
:
"1.保存二维码-2.用微信从<span>相册选取扫码</span>-3.关注"
,
"laterFollow"
:
"稍后关注"
,
"laterFollow"
:
"稍后关注"
,
"newMsgDoorlock"
:
"门锁最新消息"
,
"newMsgDoorlock"
:
"门锁最新消息"
,
"doorLockRinging"
:
"门铃响了"
"doorLockRinging"
:
"门铃响了"
,
"defaultNewMsg"
:
"您尚未绑定门锁"
},
},
"opendoorRecord"
:{
"opendoorRecord"
:{
"noRecordTip"
:
"暂无记录"
,
"noRecordTip"
:
"暂无记录"
,
...
...
dev/src/view/addDevice/v_wifiAdd.js
View file @
cdae6692
...
@@ -24,6 +24,7 @@ function init() {
...
@@ -24,6 +24,7 @@ function init() {
},
},
mounted
(){
mounted
(){
resolve
(
this
);
resolve
(
this
);
},
},
methods
:{
methods
:{
getTextWiFiName
(){
getTextWiFiName
(){
...
@@ -180,19 +181,62 @@ function connectButtonTap(self){
...
@@ -180,19 +181,62 @@ function connectButtonTap(self){
console
.
log
(
error
);
console
.
log
(
error
);
}
}
});
});
let
deviceId
=
null
;
iot
.
business
.
sds
.
findDevices
({
iot
.
business
.
sds
.
findDevices
({
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
"findDevices"
);
console
.
log
(
"findDevices"
);
console
.
log
(
response
);
console
.
log
(
response
);
let
parameters
=
{};
// let data = "DeviceInfo:[model = THM_LIVING_ELECTRICALBLANKET_TH_1507,xModel = null,mac = B0:F8:93:10:D5:09,sn = B0F89310D509,uuid = null,connectMode = alibaba_smartconfig_v3,supportRouterProvision = false,productName = null,gatewayUuid = null,deviceType = null,alinkJoinVersion = Bind, ]"
// console.log(data);
if
(
response
.
data
)
{
let
info
=
response
.
data
.
split
(
':['
);
if
(
info
[
1
]){
let
query
=
info
[
1
].
split
(
','
);
console
.
log
(
query
);
for
(
let
i
=
0
;
i
<
query
.
length
;
i
++
){
let
pari
=
query
[
i
].
split
(
' = '
);
console
.
log
(
pari
);
parameters
[
pari
[
0
]]
=
pari
[
1
];
}
console
.
log
(
parameters
.
sn
);
}
}
if
(
parameters
.
sn
){
deviceId
=
parameters
.
sn
;
}
console
.
log
(
typeof
(
deviceId
));
if
(
response
.
data
==
"joined success"
){
if
(
response
.
data
==
"joined success"
){
//云端绑定
iot
.
business
.
device
.
bind
({
data
:
{
product_id
:
2
,
device_id
:
deviceId
,
// mac: parameters.mac,
nickname
:
''
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
//连接成功
uComponents
.
changeCommLoadingStatusAndText
(
self
,
1
,
'绑定成功'
);
self
.
setStatus
(
1
);
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
},
complete
:
()
=>
{}
});
//连接成功
//连接成功
uComponents
.
changeCommLoadingStatusAndText
(
self
,
1
,
'绑定成功'
);
//
uComponents.changeCommLoadingStatusAndText(self, 1, '绑定成功');
self
.
setStatus
(
1
);
//
self.setStatus(1);
// //停止查找设备
// //停止查找设备
iot
.
business
.
sds
.
stopFindDevices
({
iot
.
business
.
sds
.
stopFindDevices
({
success
:
(
response
)
=>
{},
success
:
(
response
)
=>
{},
error
:
(
error
)
=>
{}
error
:
(
error
)
=>
{}
});
});
}
else
if
(
response
.
data
==
"fail"
){
}
else
if
(
response
.
data
==
"fail"
){
//连接失败
//连接失败
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
'绑定失败'
);
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
'绑定失败'
);
...
...
dev/src/view/device/v_index.js
View file @
cdae6692
...
@@ -45,7 +45,9 @@ function init() {
...
@@ -45,7 +45,9 @@ function init() {
//设备ID
//设备ID
deviceId
:
null
,
deviceId
:
null
,
//设备uuid
//设备uuid
uuid
:
null
uuid
:
null
,
//最新消息
newMsg
:
null
},
},
mounted
(){
mounted
(){
let
self
=
this
;
let
self
=
this
;
...
@@ -54,7 +56,9 @@ function init() {
...
@@ -54,7 +56,9 @@ function init() {
iot
.
business
.
sds
.
getDevicesByUser
({
iot
.
business
.
sds
.
getDevicesByUser
({
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
if
(
response
.
data
==
'success'
){
// console.log(self.uuid);
}
else
if
(
data
){
self
.
uuid
=
data
[
0
].
uuid
;
self
.
uuid
=
data
[
0
].
uuid
;
self
.
deviceId
=
data
[
0
].
sn
;
self
.
deviceId
=
data
[
0
].
sn
;
iot
.
business
.
sds
.
getDeviceStatus
({
iot
.
business
.
sds
.
getDeviceStatus
({
...
@@ -69,30 +73,7 @@ function init() {
...
@@ -69,30 +73,7 @@ function init() {
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
}
}
});
});
getLockInfo
(
self
);
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
){
console
.
log
(
data
.
info
);
let
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
,
newMsg
);
}
else
{
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
uPublic
.
openRequestErrorAlert
(
self
);
}
});
}
else
{
}
}
},
},
error
:
(
error
)
=>
{}
error
:
(
error
)
=>
{}
...
@@ -101,10 +82,46 @@ function init() {
...
@@ -101,10 +82,46 @@ function init() {
iot
.
business
.
sds
.
registerPushListener
({
iot
.
business
.
sds
.
registerPushListener
({
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
if
(
response
.
hasOwnProperty
(
'params'
)){
if
(
typeof
(
response
)
==
'string'
){
console
.
log
(
JSON
.
parse
(
response
));
console
.
log
(
"in"
);
setDevceInfo
(
self
,
response
.
params
);
let
data
=
JSON
.
parse
(
response
);
console
.
log
(
data
);
console
.
log
(
moment
(
data
.
time
,
"YY-MM-DD-hh-mm-ss"
).
format
(
"HH:mm"
));
switch
(
data
.
action
){
case
'lock_log'
:
self
.
setBatteryPercent
(
data
.
battery
);
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
round
(
data
.
battery
/
20
)]);
//user_type: 0:密码用户 1:指纹用户 2:卡用户 3:遥控器 4:钥匙
//uid: 用户id
//time
if
(
lock_action
==
0
){
//再次获取最新记录
getLockInfo
(
self
);
}
break
;
case
'notify'
:
self
.
setBatteryPercent
(
data
.
battery
);
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
round
(
data
.
battery
/
20
)]);
if
(
data
.
notify_type
==
3
){
self
.
setDoorbellRingingFlag
(
true
);
setTimeout
(()
=>
{
self
.
setDoorbellRingingFlag
(
false
);
self
.
setRingingTime
(
moment
(
data
.
time
,
"YY-MM-DD-hh-mm-ss"
).
format
(
"HH:mm"
));
},
3000
);
}
else
if
(
data
.
notify_type
==
4
){
self
.
setRemoteOpendoorFlag
(
true
);
}
break
;
case
'status'
:
self
.
setBatteryPercent
(
data
.
battery
);
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
round
(
data
.
battery
/
20
)]);
break
;
case
'openDoor'
:
break
;
}
}
}
// setDevceInfo(self, response.params);
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
...
@@ -114,13 +131,10 @@ function init() {
...
@@ -114,13 +131,10 @@ function init() {
let
power
=
5
;
let
power
=
5
;
this
.
batteryPercent
=
power
/
5
*
100
;
this
.
batteryPercent
=
power
/
5
*
100
;
this
.
batteryState
=
config
.
powerIcon
[
power
];
this
.
batteryState
=
config
.
powerIcon
[
power
];
let
newMsg
=
'2017.08.02 18:45 宝贝指纹开门'
;
//
let newMsg = '2017.08.02 18:45 宝贝指纹开门';
// uComponents.changeMarqueeText(this, newMsg);
// uComponents.changeMarqueeText(this, newMsg);
let
time
=
new
Date
();
let
time
=
new
Date
();
this
.
ringingTime
=
moment
(
time
).
format
(
"HH:mm"
);
this
.
ringingTime
=
moment
(
time
).
format
(
"HH:mm"
);
// getNewOpenDoorRecord(this);
},
},
methods
:{
methods
:{
getValueOpendoorRecord
(){
getValueOpendoorRecord
(){
...
@@ -247,7 +261,7 @@ function initComponentsConfig() {
...
@@ -247,7 +261,7 @@ function initComponentsConfig() {
marquee
:
{
marquee
:
{
initParam
:
{
initParam
:
{
class
:
"custom-marquee"
,
class
:
"custom-marquee"
,
text
:
"2017.08.02 18:45 宝贝指纹开门<br>2017.08.02 18:45 宝贝指纹开门<br>2017.08.02 18:45 宝贝指纹开门"
text
:
Vue
.
t
(
'device.defaultNewMsg'
)
}
}
},
},
//开门记录switch 参数
//开门记录switch 参数
...
@@ -316,38 +330,51 @@ function initComponentsConfig() {
...
@@ -316,38 +330,51 @@ function initComponentsConfig() {
}
}
}
}
//设置设备信息
function
getLockInfo
(
self
){
function
setDevceInfo
(
self
,
data
)
{
iot
.
business
.
api
.
sendCustom
(
'lock/getLockInfo'
,{
self
.
setBatteryState
(
config
.
powerIcon
[
data
.
power
]);
self
.
setBatteryPercent
(
data
.
power
/
5
*
100
);
self
.
setRingingTime
(
moment
(
data
.
time
).
format
(
"HH:mm"
));
self
.
setDoorbellRingingFlag
(
data
);
self
.
setRemoteOpendoorFlag
(
flag
);
}
//获取最新开门记录
function
getNewOpenDoorRecord
(
self
){
iot
.
business
.
api
.
sendCustom
(
''
,{
data
:
{
data
:
{
uuid
:
'uuid'
,
// device_id:"600194283588"
start_id
:
0
,
device_id
:
self
.
deviceId
page_size
:
0
},
},
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
if
(
data
){
uComponents
.
changeMarqueeText
(
self
,
data
.
message
);
self
.
setBatteryPercent
(
data
.
battery
);
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
round
(
data
.
battery
/
20
)]);
console
.
log
(
data
.
info
);
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
{
}
}
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
uPublic
.
openRequestErrorAlert
(
self
);
console
.
log
(
error
);
console
.
log
(
error
);
},
uPublic
.
openRequestErrorAlert
(
self
);
complete
:
()
=>
{
}
}
});
});
}
}
//设置设备信息
function
setDevceInfo
(
self
,
data
)
{
console
.
log
(
"监听到了"
);
self
.
setBatteryPercent
(
data
.
battery
);
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
round
(
data
.
battery
/
20
)]);
self
.
setRingingTime
(
moment
(
data
.
time
).
format
(
"HH:mm"
));
if
(
data
.
notify_type
==
3
){
self
.
setDoorbellRingingFlag
(
true
);
setTimeout
(()
=>
{
self
.
setDoorbellRingingFlag
(
false
);
},
3000
);
}
else
if
(
data
.
notify_type
==
4
){
self
.
setRemoteOpendoorFlag
(
false
);
}
}
//tap 个人信息
//tap 个人信息
function
myInfoTap
(
self
){
function
myInfoTap
(
self
){
iot
.
navigator
.
openWindow
({
iot
.
navigator
.
openWindow
({
...
...
dev/src/view/device/v_remoteOpendoor.js
View file @
cdae6692
...
@@ -137,8 +137,11 @@ function confirmButtonTap(self){
...
@@ -137,8 +137,11 @@ function confirmButtonTap(self){
data
:
{
data
:
{
uuid
:
self
.
getUuid
(),
uuid
:
self
.
getUuid
(),
setParams
:
{
setParams
:
{
'POW'
:
{
'action'
:
{
'value'
:
'20'
'value'
:
'openDoor'
},
'remote_open_door'
:
{
'value'
:
self
.
getTextPassword
()
}
}
}
}
},
},
...
...
web/lib/less/myInfo/myInfo.less
View file @
cdae6692
...
@@ -51,27 +51,27 @@
...
@@ -51,27 +51,27 @@
// line-height: 1;
// line-height: 1;
// .flex();
// .flex();
// }
// }
&:first-child{
//
&:first-child{
float: right;
//
float: right;
font-family: iconfont;
//
font-family: iconfont;
font-size: @TEXT-COMPONENT-ICON-FONTSIZE;
//
font-size: @TEXT-COMPONENT-ICON-FONTSIZE;
-webkit-font-smoothing: antialiased;
//
-webkit-font-smoothing: antialiased;
.transform(rotate(180deg));
//
.transform(rotate(180deg));
}
//
}
&:last-child{
//
&:last-child{
font-size: 12px;
font-size: 12px;
float: right;
float: right;
}
//
}
}
}
}
}
.editPassword{
.editPassword{
span{
span{
&:nth-child(2){
//
&:nth-child(2){
font-family: iconfont;
font-family: iconfont;
font-size: @TEXT-COMPONENT-ICON-FONTSIZE;
font-size: @TEXT-COMPONENT-ICON-FONTSIZE;
-webkit-font-smoothing: antialiased;
-webkit-font-smoothing: antialiased;
}
//
}
}
}
}
}
}
}
...
...
web/resources/lang/zh.json
View file @
cdae6692
This diff is collapsed.
Click to expand it.
web/view/device/index.html
View file @
cdae6692
...
@@ -33,10 +33,10 @@
...
@@ -33,10 +33,10 @@
</div>
</div>
<div
class=
"doorbellTip"
v-bind:class=
"[{active: doorbellRingingFlag}]"
><span>
{{ ringingTime }}
</span>
{{ $t('device.doorLockRinging') }}
</div>
<div
class=
"doorbellTip"
v-bind:class=
"[{active: doorbellRingingFlag}]"
><span>
{{ ringingTime }}
</span>
{{ $t('device.doorLockRinging') }}
</div>
</div>
</div>
<p
class=
"batteryState"
><span
v-html=
"batteryState"
></span>
{{ batteryPercent }}%
</p>
<p
class=
"batteryState"
v-show=
"uuid"
><span
v-html=
"batteryState"
></span>
{{ batteryPercent }}%
</p>
</div>
</div>
<div
class=
"deviceHandle"
>
<div
class=
"deviceHandle"
>
<p
class=
"title"
>
{{ $t('device.newMsgDoorlock') }}
</p>
<p
class=
"title"
v-if=
"uuid"
>
{{ $t('device.newMsgDoorlock') }}
</p>
<u-marquee
ref=
"umarquee"
:init-param=
"componentsConfig.marquee.initParam"
:active=
"activeFlag"
></u-marquee>
<u-marquee
ref=
"umarquee"
:init-param=
"componentsConfig.marquee.initParam"
:active=
"activeFlag"
></u-marquee>
<div
class=
"switchGroup"
>
<div
class=
"switchGroup"
>
<div
class=
"guoupRow"
>
<div
class=
"guoupRow"
>
...
...
web/view/myInfo/index.html
View file @
cdae6692
...
@@ -26,13 +26,11 @@
...
@@ -26,13 +26,11 @@
<ul
class=
"editMyInfo"
>
<ul
class=
"editMyInfo"
>
<v-touch
tag=
"li"
class=
"editNickname"
v-on:tap=
"onEditNicknameTap"
>
<v-touch
tag=
"li"
class=
"editNickname"
v-on:tap=
"onEditNicknameTap"
>
{{ $t('myInfo.editNickname') }}
{{ $t('myInfo.editNickname') }}
<span>
{{ nickname }}
</span>
<span>

</span><span>
{{ nickname }}
</span>
</v-touch>
</v-touch>
<v-touch
tag=
"li"
class=
"editPassword"
v-on:tap=
"onEditPasswordTap"
>
<v-touch
tag=
"li"
class=
"editPassword"
v-on:tap=
"onEditPasswordTap"
>
{{ $t('myInfo.editPassword') }}
{{ $t('myInfo.editPassword') }}
<span>

</span>
<span>

</span><span>

</span>
</v-touch>
</v-touch>
</ul>
</ul>
<u-loading
ref=
"uloading"
:init-param=
"componentsConfig.loading.initParam"
></u-loading>
<u-loading
ref=
"uloading"
:init-param=
"componentsConfig.loading.initParam"
></u-loading>
...
...
web/view/myInfo/myInfo.css
View file @
cdae6692
...
@@ -589,21 +589,12 @@ p {
...
@@ -589,21 +589,12 @@ p {
background
:
linear-gradient
(
to
right
,
#242635
,
#fff
,
#242635
);
background
:
linear-gradient
(
to
right
,
#242635
,
#fff
,
#242635
);
}
}
.editMyInfo
li
span
:first-child
{
.editMyInfo
li
span
{
float
:
right
;
font-family
:
iconfont
;
font-size
:
0.533rem
;
-webkit-font-smoothing
:
antialiased
;
-webkit-transform
:
rotate
(
180deg
);
transform
:
rotate
(
180deg
);
}
.editMyInfo
li
span
:last-child
{
font-size
:
0.32rem
;
font-size
:
0.32rem
;
float
:
right
;
float
:
right
;
}
}
.editMyInfo
.editPassword
span
:nth-child
(
2
)
{
.editMyInfo
.editPassword
span
{
font-family
:
iconfont
;
font-family
:
iconfont
;
font-size
:
0.533rem
;
font-size
:
0.533rem
;
-webkit-font-smoothing
:
antialiased
;
-webkit-font-smoothing
:
antialiased
;
...
...
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