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
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
149 additions
and
85 deletions
+149
-85
dev/src/lang/zh.json
+2
-1
dev/src/view/addDevice/v_wifiAdd.js
+44
-0
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 @@
"followCont2"
:
"1.保存二维码-2.用微信从<span>相册选取扫码</span>-3.关注"
,
"laterFollow"
:
"稍后关注"
,
"newMsgDoorlock"
:
"门锁最新消息"
,
"doorLockRinging"
:
"门铃响了"
"doorLockRinging"
:
"门铃响了"
,
"defaultNewMsg"
:
"您尚未绑定门锁"
},
"opendoorRecord"
:{
"noRecordTip"
:
"暂无记录"
,
...
...
dev/src/view/addDevice/v_wifiAdd.js
View file @
cdae6692
...
...
@@ -24,6 +24,7 @@ function init() {
},
mounted
(){
resolve
(
this
);
},
methods
:{
getTextWiFiName
(){
...
...
@@ -180,19 +181,62 @@ function connectButtonTap(self){
console
.
log
(
error
);
}
});
let
deviceId
=
null
;
iot
.
business
.
sds
.
findDevices
({
success
:
(
response
)
=>
{
console
.
log
(
"findDevices"
);
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"
){
//云端绑定
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, '绑定成功');
// self.setStatus(1);
// //停止查找设备
iot
.
business
.
sds
.
stopFindDevices
({
success
:
(
response
)
=>
{},
error
:
(
error
)
=>
{}
});
}
else
if
(
response
.
data
==
"fail"
){
//连接失败
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
'绑定失败'
);
...
...
dev/src/view/device/v_index.js
View file @
cdae6692
...
...
@@ -45,7 +45,9 @@ function init() {
//设备ID
deviceId
:
null
,
//设备uuid
uuid
:
null
uuid
:
null
,
//最新消息
newMsg
:
null
},
mounted
(){
let
self
=
this
;
...
...
@@ -54,7 +56,9 @@ function init() {
iot
.
business
.
sds
.
getDevicesByUser
({
success
:
(
response
)
=>
{
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
.
deviceId
=
data
[
0
].
sn
;
iot
.
business
.
sds
.
getDeviceStatus
({
...
...
@@ -69,30 +73,7 @@ function init() {
uPublic
.
openRequestErrorAlert
(
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
{
getLockInfo
(
self
);
}
},
error
:
(
error
)
=>
{}
...
...
@@ -101,10 +82,46 @@ function init() {
iot
.
business
.
sds
.
registerPushListener
({
success
:
(
response
)
=>
{
console
.
log
(
response
);
if
(
response
.
hasOwnProperty
(
'params'
)){
console
.
log
(
JSON
.
parse
(
response
));
setDevceInfo
(
self
,
response
.
params
);
if
(
typeof
(
response
)
==
'string'
){
console
.
log
(
"in"
);
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
)
=>
{
console
.
log
(
error
);
...
...
@@ -114,13 +131,10 @@ function init() {
let
power
=
5
;
this
.
batteryPercent
=
power
/
5
*
100
;
this
.
batteryState
=
config
.
powerIcon
[
power
];
let
newMsg
=
'2017.08.02 18:45 宝贝指纹开门'
;
//
let newMsg = '2017.08.02 18:45 宝贝指纹开门';
// uComponents.changeMarqueeText(this, newMsg);
let
time
=
new
Date
();
this
.
ringingTime
=
moment
(
time
).
format
(
"HH:mm"
);
// getNewOpenDoorRecord(this);
},
methods
:{
getValueOpendoorRecord
(){
...
...
@@ -247,7 +261,7 @@ function initComponentsConfig() {
marquee
:
{
initParam
:
{
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 参数
...
...
@@ -316,38 +330,51 @@ function initComponentsConfig() {
}
}
//设置设备信息
function
setDevceInfo
(
self
,
data
)
{
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
(
''
,{
function
getLockInfo
(
self
){
iot
.
business
.
api
.
sendCustom
(
'lock/getLockInfo'
,{
data
:
{
uuid
:
'uuid'
,
start_id
:
0
,
page_size
:
0
// device_id:"600194283588"
device_id
:
self
.
deviceId
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
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
)
=>
{
uPublic
.
openRequestErrorAlert
(
self
);
error
:
(
error
)
=>
{
console
.
log
(
error
);
},
complete
:
()
=>
{
}
uPublic
.
openRequestErrorAlert
(
self
);
}
});
}
//设置设备信息
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 个人信息
function
myInfoTap
(
self
){
iot
.
navigator
.
openWindow
({
...
...
dev/src/view/device/v_remoteOpendoor.js
View file @
cdae6692
...
...
@@ -137,8 +137,11 @@ function confirmButtonTap(self){
data
:
{
uuid
:
self
.
getUuid
(),
setParams
:
{
'POW'
:
{
'value'
:
'20'
'action'
:
{
'value'
:
'openDoor'
},
'remote_open_door'
:
{
'value'
:
self
.
getTextPassword
()
}
}
},
...
...
web/lib/less/myInfo/myInfo.less
View file @
cdae6692
...
...
@@ -51,27 +51,27 @@
// line-height: 1;
// .flex();
// }
&:first-child{
float: right;
font-family: iconfont;
font-size: @TEXT-COMPONENT-ICON-FONTSIZE;
-webkit-font-smoothing: antialiased;
.transform(rotate(180deg));
}
&:last-child{
//
&:first-child{
//
float: right;
//
font-family: iconfont;
//
font-size: @TEXT-COMPONENT-ICON-FONTSIZE;
//
-webkit-font-smoothing: antialiased;
//
.transform(rotate(180deg));
//
}
//
&:last-child{
font-size: 12px;
float: right;
}
//
}
}
}
.editPassword{
span{
&:nth-child(2){
//
&:nth-child(2){
font-family: iconfont;
font-size: @TEXT-COMPONENT-ICON-FONTSIZE;
-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 @@
</div>
<div
class=
"doorbellTip"
v-bind:class=
"[{active: doorbellRingingFlag}]"
><span>
{{ ringingTime }}
</span>
{{ $t('device.doorLockRinging') }}
</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
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>
<div
class=
"switchGroup"
>
<div
class=
"guoupRow"
>
...
...
web/view/myInfo/index.html
View file @
cdae6692
...
...
@@ -26,13 +26,11 @@
<ul
class=
"editMyInfo"
>
<v-touch
tag=
"li"
class=
"editNickname"
v-on:tap=
"onEditNicknameTap"
>
{{ $t('myInfo.editNickname') }}
<span>

</span><span>
{{ nickname }}
</span>
<span>
{{ nickname }}
</span>
</v-touch>
<v-touch
tag=
"li"
class=
"editPassword"
v-on:tap=
"onEditPasswordTap"
>
{{ $t('myInfo.editPassword') }}
<span>

</span><span>

</span>
<span>

</span>
</v-touch>
</ul>
<u-loading
ref=
"uloading"
:init-param=
"componentsConfig.loading.initParam"
></u-loading>
...
...
web/view/myInfo/myInfo.css
View file @
cdae6692
...
...
@@ -589,21 +589,12 @@ p {
background
:
linear-gradient
(
to
right
,
#242635
,
#fff
,
#242635
);
}
.editMyInfo
li
span
:first-child
{
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
{
.editMyInfo
li
span
{
font-size
:
0.32rem
;
float
:
right
;
}
.editMyInfo
.editPassword
span
:nth-child
(
2
)
{
.editMyInfo
.editPassword
span
{
font-family
:
iconfont
;
font-size
:
0.533rem
;
-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