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
314b404f
Commit
314b404f
authored
Dec 22, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2017/12/22
1.首页代码规范优化
parent
6049e46b
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
265 additions
and
474 deletions
+265
-474
dev/src/public/loop.js
+2
-2
dev/src/public/public.js
+11
-6
dev/src/view/addDevice/v_index.js
+1
-8
dev/src/view/addDevice/v_wifiAdd.js
+27
-30
dev/src/view/addDevice/v_wifiAddHelp.js
+0
-12
dev/src/view/device/v_alarmInfo.js
+50
-58
dev/src/view/device/v_hijackRecord.js
+2
-12
dev/src/view/device/v_index.js
+93
-171
dev/src/view/device/v_opendoorRecord.js
+7
-20
dev/src/view/doorlockManage/v_editName.js
+7
-10
dev/src/view/doorlockManage/v_index.js
+63
-144
dev/src/view/myInfo/v_index.js
+1
-1
web/lib/js/UIOT.js
+1
-0
No files found.
dev/src/public/loop.js
View file @
314b404f
...
@@ -90,8 +90,8 @@ class Loop{
...
@@ -90,8 +90,8 @@ class Loop{
this
.
time
=
setTimeout
(()
=>
{
this
.
time
=
setTimeout
(()
=>
{
this
.
clearTime
();
this
.
clearTime
();
this
.
canDo
=
false
;
this
.
canDo
=
false
;
//
this.fincb.error('timeout');
this
.
fincb
.
error
(
'timeout'
);
//
this.fincb.complete();
this
.
fincb
.
complete
();
console
.
log
(
"超时"
);
console
.
log
(
"超时"
);
this
.
intervalcb
=
null
;
this
.
intervalcb
=
null
;
this
.
fincb
=
null
;
this
.
fincb
=
null
;
...
...
dev/src/public/public.js
View file @
314b404f
...
@@ -147,7 +147,8 @@ uPublic.logout = function(opts){
...
@@ -147,7 +147,8 @@ uPublic.logout = function(opts){
});
});
}
}
uPublic
.
upDateRead
=
async
function
(
key
){
// 更新缓存中history存储的isReadFlag 和 time
uPublic
.
upDateRead
=
async
function
(
key
,
time
){
let
oldHistory
=
{
let
oldHistory
=
{
alarm
:
{
alarm
:
{
time
:
null
,
time
:
null
,
...
@@ -163,7 +164,8 @@ uPublic.upDateRead = async function(key){
...
@@ -163,7 +164,8 @@ uPublic.upDateRead = async function(key){
}
}
};
};
try
{
try
{
oldHistory
=
await
iot
.
storage
.
getMap
(
'history'
);
let
history
=
await
iot
.
storage
.
getMap
(
'history'
);
oldHistory
=
history
?
history
:
oldHistory
;
console
.
log
(
oldHistory
);
console
.
log
(
oldHistory
);
}
}
catch
(
error
){
catch
(
error
){
...
@@ -172,12 +174,15 @@ uPublic.upDateRead = async function(key){
...
@@ -172,12 +174,15 @@ uPublic.upDateRead = async function(key){
let
newHistory
=
oldHistory
;
let
newHistory
=
oldHistory
;
newHistory
[
key
].
isReadFlag
=
true
;
newHistory
[
key
].
isReadFlag
=
true
;
iot
.
storage
.
setMap
(
'history'
,
newHistory
,
(
response
)
=>
{
newHistory
[
key
].
time
=
time
;
console
.
log
(
res
);
let
flag
=
await
iot
.
storage
.
setMap
(
'history'
,
newHistory
);
},
()
=>
{
if
(
flag
){
});
return
false
;
}
}
}
iot
.
ready
(()
=>
{
iot
.
ready
(()
=>
{
uPublic
.
recalc
();
uPublic
.
recalc
();
});
});
...
...
dev/src/view/addDevice/v_index.js
View file @
314b404f
...
@@ -61,18 +61,11 @@ function backTap(){
...
@@ -61,18 +61,11 @@ function backTap(){
//tap 扫描绑定设备
//tap 扫描绑定设备
function
scanAddTap
(){
function
scanAddTap
(){
// iot.navigator.openWindow({
iot
.
navigator
.
openWindow
({
// url: './scanCodeAdd.html',
// id: 'scanCodeAdd'
// });
mui
.
openWindow
({
url
:
'./scanCodeAdd.html'
,
url
:
'./scanCodeAdd.html'
,
id
:
'scanCodeAdd'
,
id
:
'scanCodeAdd'
,
show
:
{
show
:
{
aniShow
:
"none"
aniShow
:
"none"
},
waiting
:
{
autoShow
:
false
}
}
});
});
}
}
...
...
dev/src/view/addDevice/v_wifiAdd.js
View file @
314b404f
...
@@ -40,7 +40,7 @@ function init() {
...
@@ -40,7 +40,7 @@ function init() {
setTextPassword
(
pwd
){
setTextPassword
(
pwd
){
this
.
textPassword
=
pwd
;
this
.
textPassword
=
pwd
;
},
},
get
t
TextErrorTip
(){
getTextErrorTip
(){
return
this
.
textErrorTip
;
return
this
.
textErrorTip
;
},
},
setTextErrorTip
(
tip
){
setTextErrorTip
(
tip
){
...
@@ -110,12 +110,12 @@ function initComponentsConfig() {
...
@@ -110,12 +110,12 @@ function initComponentsConfig() {
}
}
}
}
//页面渲染后,获取wifi名称
function
resolve
(
self
){
function
resolve
(
self
){
iot
.
business
.
sds
.
getSSId
({
iot
.
business
.
sds
.
getSSId
({
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
self
.
textWiFiName
=
response
.
data
.
ssid
;
self
.
textWiFiName
=
response
.
data
.
ssid
;
console
.
log
(
self
.
textWiFiName
);
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
...
@@ -130,11 +130,13 @@ function resolve(self){
...
@@ -130,11 +130,13 @@ function resolve(self){
});
});
}
}
//设置wifi密码
function
passwordChange
(
self
,
text
){
function
passwordChange
(
self
,
text
){
self
.
textPassword
=
text
;
self
.
setTextPassword
(
text
)
;
console
.
log
(
'passwordChange: '
+
self
.
textPassword
);
console
.
log
(
'passwordChange: '
+
self
.
getTextPassword
()
);
}
}
//重新mui.back
mui
.
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{
});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{
});
iot
.
navigator
.
back
();
iot
.
navigator
.
back
();
...
@@ -147,8 +149,6 @@ function backTap(){
...
@@ -147,8 +149,6 @@ function backTap(){
//tap 连接
//tap 连接
function
connectButtonTap
(
self
){
function
connectButtonTap
(
self
){
// console.log(self.getTextWiFiName());
// console.log(self.getTextPassword());
if
(
self
.
getTextWiFiName
()
==
null
||
self
.
getTextWiFiName
().
trim
()
==
''
){
if
(
self
.
getTextWiFiName
()
==
null
||
self
.
getTextWiFiName
().
trim
()
==
''
){
self
.
setTextErrorTip
(
Vue
.
t
(
'wifiAdd.unbindWifiTip'
));
self
.
setTextErrorTip
(
Vue
.
t
(
'wifiAdd.unbindWifiTip'
));
}
else
if
(
self
.
getTextPassword
()
==
null
||
self
.
getTextPassword
().
trim
()
==
''
){
}
else
if
(
self
.
getTextPassword
()
==
null
||
self
.
getTextPassword
().
trim
()
==
''
){
...
@@ -189,10 +189,6 @@ function connectButtonTap(self){
...
@@ -189,10 +189,6 @@ function connectButtonTap(self){
}
}
//wifi连接成功,停止连接wifi
//wifi连接成功,停止连接wifi
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBindSuccess'
));
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBindSuccess'
));
// iot.business.sds.stopFindWifi({
// success: (response) => {},
// error: (error) => {}
// });
}
}
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
...
@@ -233,7 +229,6 @@ function connectButtonTap(self){
...
@@ -233,7 +229,6 @@ function connectButtonTap(self){
}
}
let
deviceId
=
response
.
info
.
sn
;
let
deviceId
=
response
.
info
.
sn
;
unbind
(
self
,
deviceId
,
productId
);
unbind
(
self
,
deviceId
,
productId
);
// bind(self, deviceId, productId);
}
else
if
(
response
.
data
==
"fail"
){
}
else
if
(
response
.
data
==
"fail"
){
//连接失败
//连接失败
if
(
window
.
iotDebug
){
if
(
window
.
iotDebug
){
...
@@ -280,25 +275,7 @@ function connectButtonTap(self){
...
@@ -280,25 +275,7 @@ function connectButtonTap(self){
},
config
.
wifi_add_timeout
);
},
config
.
wifi_add_timeout
);
}
}
//tap loading button
//云端绑定之前先解绑
function
commLoadingButtonTap
(
self
)
{
if
(
self
.
getStatus
()
==
1
){
//绑定成功
uComponents
.
hideCommLoading
(
self
);
iot
.
navigator
.
fire
(
plus
.
webview
.
getWebviewById
(
'device'
),
'returnPage'
,{});
iot
.
navigator
.
openWindow
({
url
:
'../device/index.html'
,
id
:
'device'
});
}
else
if
(
self
.
getStatus
()
==
2
){
//绑定失败
uComponents
.
hideCommLoading
(
self
);
self
.
setStatus
(
0
);
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'addDevice.loading'
));
}
}
function
unbind
(
self
,
deviceId
,
productId
){
function
unbind
(
self
,
deviceId
,
productId
){
console
.
log
(
deviceId
);
console
.
log
(
deviceId
);
iot
.
business
.
api
.
sendCustom
(
'lock/unbindDevice'
,{
iot
.
business
.
api
.
sendCustom
(
'lock/unbindDevice'
,{
...
@@ -332,6 +309,7 @@ function unbind(self, deviceId, productId){
...
@@ -332,6 +309,7 @@ function unbind(self, deviceId, productId){
});
});
}
}
//云端绑定
function
bind
(
self
,
deviceId
,
productId
){
function
bind
(
self
,
deviceId
,
productId
){
iot
.
business
.
api
.
sendCustom
(
'lock/bind'
,{
iot
.
business
.
api
.
sendCustom
(
'lock/bind'
,{
data
:
{
data
:
{
...
@@ -370,3 +348,21 @@ function bind(self, deviceId, productId){
...
@@ -370,3 +348,21 @@ function bind(self, deviceId, productId){
complete
:
()
=>
{}
complete
:
()
=>
{}
});
});
}
}
//tap loading button
function
commLoadingButtonTap
(
self
)
{
if
(
self
.
getStatus
()
==
1
){
//绑定成功
uComponents
.
hideCommLoading
(
self
);
iot
.
navigator
.
fire
(
plus
.
webview
.
getWebviewById
(
'device'
),
'returnPage'
,{});
iot
.
navigator
.
openWindow
({
url
:
'../device/index.html'
,
id
:
'device'
});
}
else
if
(
self
.
getStatus
()
==
2
){
//绑定失败
uComponents
.
hideCommLoading
(
self
);
self
.
setStatus
(
0
);
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'addDevice.loading'
));
}
}
\ No newline at end of file
dev/src/view/addDevice/v_wifiAddHelp.js
View file @
314b404f
...
@@ -79,15 +79,4 @@ function wifiAddButtonTap(){
...
@@ -79,15 +79,4 @@ function wifiAddButtonTap(){
url
:
'./wifiAdd.html'
,
url
:
'./wifiAdd.html'
,
id
:
'wifiAdd'
id
:
'wifiAdd'
});
});
console
.
log
(
"in"
);
// iot.business.sds.wifiDeviceConfig({
// success: function (response) {
// console.log('wifiDeviceConfig success');
// console.log(response);
// },
// error: function (error) {
// console.log('wifiDeviceConfig error');
// console.log(error);
// }
// });
}
}
\ No newline at end of file
dev/src/view/device/v_alarmInfo.js
View file @
314b404f
...
@@ -47,6 +47,7 @@ function init() {
...
@@ -47,6 +47,7 @@ function init() {
setDeviceId
(
id
){
setDeviceId
(
id
){
this
.
deviceId
=
id
;
this
.
deviceId
=
id
;
},
},
//tap 点击加载更多
onListLoadTap
(){
onListLoadTap
(){
listLoadTap
(
this
);
listLoadTap
(
this
);
},
},
...
@@ -82,74 +83,65 @@ function initComponentsConfig() {
...
@@ -82,74 +83,65 @@ function initComponentsConfig() {
}
}
}
}
function
resolve
(
self
)
{
// 获取历史记录
self
.
setDeviceId
(
iot
.
navigator
.
getExtras
().
deviceId
);
function
resolve
(
self
)
{
uComponents
.
showLoading
(
self
);
self
.
setDeviceId
(
iot
.
navigator
.
getExtras
().
deviceId
);
iot
.
business
.
api
.
sendCustom
(
'lock/getHistoryRecord'
,
uComponents
.
showLoading
(
self
);
{
iot
.
business
.
api
.
sendCustom
(
'lock/getHistoryRecord'
,
data
:
{
{
device_id
:
self
.
getDeviceId
(),
data
:
{
action
:
2
,
device_id
:
self
.
getDeviceId
(),
start_id
:
self
.
getStartId
(),
action
:
2
,
page_size
:
PAGE_SIZE
start_id
:
self
.
getStartId
(),
},
page_size
:
PAGE_SIZE
success
:
(
response
)
=>
{
},
console
.
log
(
response
);
success
:
async
(
response
)
=>
{
if
(
self
.
flag
){
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
self
.
flag
){
if
(
data
&&
data
.
record
.
length
>
0
){
let
record
=
data
.
record
;
// iot.storage.setMap('notifyTime', moment(record[0].time).unix(), (res) => {
// console.log(res);
// self.flag = false;
// }, () => {
// });
uPublic
.
upDateRead
(
'notify'
);
}
}
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
if
(
data
&&
data
.
record
.
length
>
0
){
let
list
=
[];
let
record
=
data
.
record
;
let
record
=
data
.
record
;
for
(
let
i
=
0
;
i
<
record
.
length
;
i
++
){
self
.
flag
=
await
uPublic
.
upDateRead
(
'notify'
,
moment
(
record
[
0
].
time
).
unix
());
list
[
i
]
=
{
value
:
record
[
i
].
openId
,
leftImage
:
'../../resources/image/green_alarmInfo'
+
record
[
i
].
mode
+
'_icon.png'
,
subtitle
:
Vue
.
t
(
'alarmInfo.'
+
config
.
alarmMode
[
record
[
i
].
mode
]
+
''
),
rightText
:
moment
(
record
[
i
].
time
).
format
(
"YYYY.MM.DD HH:mm:ss"
)
};
}
self
.
setList
(
self
.
getList
().
concat
(
list
));
if
(
record
.
length
>
0
){
self
.
setStartId
(
record
[
record
.
length
-
1
].
id
);
}
//更新列表数据
uComponents
.
changeList
(
self
,
self
.
getList
());
}
else
{
}
}
uComponents
.
hideLoading
(
self
);
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 获取报警信息失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取报警信息失败');
// }
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
}
});
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
}
if
(
data
){
let
list
=
[];
let
record
=
data
.
record
;
for
(
let
i
=
0
;
i
<
record
.
length
;
i
++
){
list
[
i
]
=
{
value
:
record
[
i
].
openId
,
leftImage
:
'../../resources/image/green_alarmInfo'
+
record
[
i
].
mode
+
'_icon.png'
,
subtitle
:
Vue
.
t
(
'alarmInfo.'
+
config
.
alarmMode
[
record
[
i
].
mode
]
+
''
),
rightText
:
moment
(
record
[
i
].
time
).
format
(
"YYYY.MM.DD HH:mm:ss"
)
};
}
self
.
setList
(
self
.
getList
().
concat
(
list
));
if
(
record
.
length
>
0
){
self
.
setStartId
(
record
[
record
.
length
-
1
].
id
);
}
//更新列表数据
uComponents
.
changeList
(
self
,
self
.
getList
());
}
else
{
}
uComponents
.
hideLoading
(
self
);
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
});
}
//tap <
//tap <
function
backTap
(){
function
backTap
(){
iot
.
navigator
.
aback
();
iot
.
navigator
.
aback
();
}
}
//重写mui.back
mui
.
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
console
.
log
(
"fire"
);
...
...
dev/src/view/device/v_hijackRecord.js
View file @
314b404f
...
@@ -106,12 +106,7 @@ function initComponentsConfig() {
...
@@ -106,12 +106,7 @@ function initComponentsConfig() {
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
&&
data
.
record
.
length
>
0
){
if
(
data
&&
data
.
record
.
length
>
0
){
let
record
=
data
.
record
;
let
record
=
data
.
record
;
// iot.storage.setMap('alarmTime', moment(record[0].time).unix(), (res) => {
self
.
flag
=
await
uPublic
.
upDateRead
(
'alarm'
,
moment
(
record
[
0
].
time
).
unix
());
// console.log(res);
// self.flag = false;
// }, () => {
// });
uPublic
.
upDateRead
(
'alarm'
);
}
}
}
}
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
...
@@ -152,12 +147,6 @@ function initComponentsConfig() {
...
@@ -152,12 +147,6 @@ function initComponentsConfig() {
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 获取劫持报警信息'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取劫持报警信息');
// }
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
...
@@ -171,6 +160,7 @@ function backTap(){
...
@@ -171,6 +160,7 @@ function backTap(){
iot
.
navigator
.
aback
();
iot
.
navigator
.
aback
();
}
}
//重写mui.back
mui
.
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
console
.
log
(
"fire"
);
...
...
dev/src/view/device/v_index.js
View file @
314b404f
...
@@ -87,9 +87,6 @@ function init() {
...
@@ -87,9 +87,6 @@ function init() {
opendoorRecordFlag
:
false
,
opendoorRecordFlag
:
false
,
securityAlarmFlag
:
false
,
securityAlarmFlag
:
false
,
hijackAlarmFlag
:
false
,
hijackAlarmFlag
:
false
,
notifyTime
:
null
,
alarmTime
:
null
,
openTime
:
null
,
//是否显示远程开门页面
//是否显示远程开门页面
remoteOpendoorShowFlag
:
false
,
remoteOpendoorShowFlag
:
false
,
//远程开门密码
//远程开门密码
...
@@ -99,19 +96,23 @@ function init() {
...
@@ -99,19 +96,23 @@ function init() {
//当前状态
//当前状态
status
:
0
,
status
:
0
,
flag
:
true
,
flag
:
true
,
//门铃等待计时器
time
:
null
,
time
:
null
,
//门铃总计时器
timeout
:
null
,
timeout
:
null
,
//远程开门计时器
remoteTime
:
null
remoteTime
:
null
},
},
mounted
(){
mounted
(){
//显示loading
uComponents
.
showLoading
(
this
);
uComponents
.
showLoading
(
this
);
//监听推送
notificationListener
(
this
);
notificationListener
(
this
);
let
self
=
this
;
//获取设备信息
//获取设备信息
getDevices
(
this
);
getDevices
(
this
);
//注册监听上报
//注册监听上报
registerPushListener
(
this
);
registerPushListener
(
this
);
let
self
=
this
;
window
.
addEventListener
(
'returnPage'
,
function
(
event
){
window
.
addEventListener
(
'returnPage'
,
function
(
event
){
//获取设备信息
//获取设备信息
getDevices
(
self
);
getDevices
(
self
);
...
@@ -435,29 +436,7 @@ function getDevices(self){
...
@@ -435,29 +436,7 @@ function getDevices(self){
console
.
log
(
response
);
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
if
(
data
){
self
.
mac
=
data
[
0
].
mac
;
getDevicesSuccess
(
self
,
data
);
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
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
getLockInfo
(
self
);
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
},
complete
:
()
=>
{}
});
}
}
else
{
}
else
{
initDeviceInfo
(
self
);
initDeviceInfo
(
self
);
uComponents
.
hideLoading
(
self
);
uComponents
.
hideLoading
(
self
);
...
@@ -477,6 +456,31 @@ function getDevices(self){
...
@@ -477,6 +456,31 @@ function getDevices(self){
});
});
}
}
function
getDevicesSuccess
(
self
,
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
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
getLockInfo
(
self
);
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
},
complete
:
()
=>
{}
});
}
}
function
getLockInfo
(
self
){
function
getLockInfo
(
self
){
console
.
log
(
"getLockInfo"
);
console
.
log
(
"getLockInfo"
);
...
@@ -506,8 +510,6 @@ function getLockInfo(self){
...
@@ -506,8 +510,6 @@ function getLockInfo(self){
function
getLockInfoSuccess
(
self
,
data
){
function
getLockInfoSuccess
(
self
,
data
){
//判断云端是否绑定
//判断云端是否绑定
if
(
data
.
lock_id
){
if
(
data
.
lock_id
){
//获取‘未读’小红点状态
// getRecordTime(self, data);
//更改按钮为‘可点击’样式
//更改按钮为‘可点击’样式
setValueOfSwitch
(
self
,
false
);
setValueOfSwitch
(
self
,
false
);
//设置门锁信息
//设置门锁信息
...
@@ -557,6 +559,32 @@ function getLockInfoSuccess(self, data){
...
@@ -557,6 +559,32 @@ function getLockInfoSuccess(self, data){
}
}
}
}
//获取设备的初始状态
function
getDeviceStatus
(
self
){
iot
.
business
.
sds
.
getDeviceStatus
({
data
:
{
uuid
:
self
.
uuid
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
setBatteryPercentAndIcon
(
self
,
data
.
BatteryPercentage
.
value
);
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 获取设备状态'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'获取设备状态'
);
}
uPublic
.
openRequestErrorAlert
(
self
);
}
});
}
async
function
updateHistoryMap
(
self
,
historyRecord
){
async
function
updateHistoryMap
(
self
,
historyRecord
){
let
oldHistory
=
{
let
oldHistory
=
{
alarm
:
{
alarm
:
{
...
@@ -573,28 +601,29 @@ async function updateHistoryMap(self, historyRecord){
...
@@ -573,28 +601,29 @@ async function updateHistoryMap(self, historyRecord){
}
}
};
};
try
{
try
{
oldH
istory
=
await
iot
.
storage
.
getMap
(
'history'
);
let
h
istory
=
await
iot
.
storage
.
getMap
(
'history'
);
console
.
log
(
oldHistory
)
;
oldHistory
=
history
?
history
:
oldHistory
;
}
}
catch
(
error
)
{
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
}
}
console
.
log
(
oldHistory
.
open
.
time
);
let
openHistory
=
historyRecord
.
open
;
let
openHistory
=
historyRecord
.
open
;
let
newHistory
=
oldHistory
;
let
newHistory
=
oldHistory
;
console
.
log
(
historyRecord
.
hasOwnProperty
(
'alarm'
)
&&
oldHistory
.
alarm
.
time
!=
moment
(
historyRecord
.
alarm
).
unix
());
if
(
historyRecord
.
hasOwnProperty
(
'alarm'
)
&&
oldHistory
.
alarm
.
time
!=
moment
(
historyRecord
.
alarm
).
unix
()){
let
now
=
moment
(
new
Date
()).
unix
();
newHistory
.
alarm
.
time
=
moment
(
historyRecord
.
alarm
).
unix
();
newHistory
.
alarm
.
isReadFlag
=
false
;
if
(
openHistory
.
length
&&
oldHistory
.
open
.
time
<
moment
(
openHistory
[
0
].
time
).
unix
()
&&
now
-
moment
(
openHistory
[
0
].
time
).
unix
()
<
3600
){
}
if
(
openHistory
.
length
&&
oldHistory
.
open
.
time
!=
moment
(
openHistory
[
0
].
time
).
unix
()){
newHistory
.
open
.
time
=
moment
(
openHistory
[
0
].
time
).
unix
();
newHistory
.
open
.
time
=
moment
(
openHistory
[
0
].
time
).
unix
();
newHistory
.
open
.
isReadFlag
=
false
;
newHistory
.
open
.
isReadFlag
=
false
;
}
}
if
(
historyRecord
.
hasOwnProperty
(
'notify'
)
&&
oldHistory
.
notify
.
time
!=
moment
(
historyRecord
.
notify
).
unix
()){
newHistory
.
notify
.
time
=
moment
(
historyRecord
.
notify
).
unix
()
let
historyType
=
[
'alarm'
,
'notify'
];
newHistory
.
open
.
isReadFlag
=
false
;
for
(
let
i
=
0
;
i
<
historyType
.
length
;
i
++
){
if
(
historyRecord
.
hasOwnProperty
(
historyType
[
i
])
&&
oldHistory
[
historyType
[
i
]].
time
<
moment
(
historyRecord
[
historyType
[
i
]]).
unix
()
&&
now
-
moment
(
historyRecord
[
historyType
[
i
]]).
unix
()
<
3600
){
newHistory
[
historyType
[
i
]].
time
=
moment
(
historyRecord
[
historyType
[
i
]]).
unix
()
newHistory
[
historyType
[
i
]].
isReadFlag
=
false
;
}
}
}
iot
.
storage
.
setMap
(
'history'
,
newHistory
,
(
response
)
=>
{
iot
.
storage
.
setMap
(
'history'
,
newHistory
,
(
response
)
=>
{
...
@@ -610,55 +639,6 @@ async function updateHistoryMap(self, historyRecord){
...
@@ -610,55 +639,6 @@ async function updateHistoryMap(self, historyRecord){
});
});
}
}
function
getDeviceStatus
(
self
){
iot
.
business
.
sds
.
getDeviceStatus
({
data
:
{
uuid
:
self
.
uuid
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
setBatteryPercentAndIcon
(
self
,
data
.
BatteryPercentage
.
value
);
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 获取设备状态'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'获取设备状态'
);
}
uPublic
.
openRequestErrorAlert
(
self
);
}
});
}
function
getNewInfo
(
self
){
console
.
log
(
"getNewInfo"
);
iot
.
business
.
api
.
sendCustom
(
'lock/getNewInfo'
,{
data
:
{
device_id
:
self
.
deviceId
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
// let data = uPublic.checkResponseData(response.data);
// if(data){
// getLockInfoSuccess(self, data);
// }else{
// initDeviceInfo(self);
// }
},
error
:
(
error
)
=>
{
uPublic
.
openRequestErrorAlert
(
self
);
console
.
log
(
error
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
});
}
//云端获取设备信息失败
//云端获取设备信息失败
function
initDeviceInfo
(
self
){
function
initDeviceInfo
(
self
){
setValueOfSwitch
(
self
,
true
);
setValueOfSwitch
(
self
,
true
);
...
@@ -675,7 +655,6 @@ function initDeviceInfo(self){
...
@@ -675,7 +655,6 @@ function initDeviceInfo(self){
self
.
setValueRemoteOpendoor
(
0
);
self
.
setValueRemoteOpendoor
(
0
);
}
}
async
function
loopGetLockInfo
(
self
,
delay
,
timeout
){
async
function
loopGetLockInfo
(
self
,
delay
,
timeout
){
let
oldHistoryId
=
null
;
let
oldHistoryId
=
null
;
try
{
try
{
...
@@ -695,9 +674,9 @@ async function loopGetLockInfo(self, delay, timeout){
...
@@ -695,9 +674,9 @@ async function loopGetLockInfo(self, delay, timeout){
}
}
}
}
},
},
timeout
:
20
000
,
timeout
:
config
.
getHistoryTime
*
1
000
,
interval
:{
interval
:{
delay
:
3
000
,
delay
:
config
.
intervalTime
*
1
000
,
cb
:
{
cb
:
{
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
'intervalcbSuccess:'
+
JSON
.
stringify
(
response
));
console
.
log
(
'intervalcbSuccess:'
+
JSON
.
stringify
(
response
));
...
@@ -721,64 +700,22 @@ async function loopGetLockInfo(self, delay, timeout){
...
@@ -721,64 +700,22 @@ async function loopGetLockInfo(self, delay, timeout){
}
}
},
},
stopcondition
:
async
(
response
)
=>
{
stopcondition
:
async
(
response
)
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
let
data
=
response
.
data
;
let
data
=
response
.
data
;
if
(
data
.
hasOwnProperty
(
'historyId'
)){
if
(
data
.
hasOwnProperty
(
'historyId'
)){
let
newHistoryId
=
data
.
historyId
;
let
newHistoryId
=
data
.
historyId
;
if
(
oldHistoryId
!=
newHistoryId
){
if
(
oldHistoryId
!=
newHistoryId
){
iot
.
storage
.
setMap
(
'historyId'
,
newHistoryId
,
(
res
)
=>
{
iot
.
storage
.
setMap
(
'historyId'
,
newHistoryId
,
(
res
)
=>
{
console
.
log
(
res
);
console
.
log
(
res
);
},
()
=>
{
},
()
=>
{
});
});
return
true
;
return
true
;
}
}
}
}
}
}
}).
start
();
}).
start
();
}
}
async
function
getRecordTime
(
self
,
data
){
console
.
log
(
getRecordTime
);
try
{
self
.
notifyTime
=
await
iot
.
storage
.
getMap
(
'notifyTime'
);
self
.
alarmTime
=
await
iot
.
storage
.
getMap
(
'alarmTime'
);
self
.
openTime
=
await
iot
.
storage
.
getMap
(
'openTime'
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
let
newNotifyTime
=
data
.
notify_time
==
null
?
null
:
moment
(
data
.
notify_time
).
unix
();
let
newAlarmTime
=
data
.
alarm_time
==
null
?
null
:
moment
(
data
.
alarm_time
).
unix
();
let
newOpenTime
=
data
.
open_time
==
null
?
null
:
moment
(
data
.
open_time
).
unix
();
self
.
securityAlarmFlag
=
showNewMessage
(
self
.
notifyTime
,
newNotifyTime
);
self
.
hijackAlarmFlag
=
showNewMessage
(
self
.
alarmTime
,
newAlarmTime
);
self
.
opendoorRecordFlag
=
showNewMessage
(
self
.
openTime
,
newOpenTime
);
}
function
showNewMessage
(
oldTime
,
newTime
,
flag
){
let
now
=
moment
(
new
Date
(),
"YYYY-MM-DD hh:mm:ss"
).
unix
();
console
.
log
(
oldTime
);
console
.
log
(
newTime
);
if
(
oldTime
){
if
(
newTime
!=
null
&&
newTime
-
oldTime
>
0
){
return
true
;
oldTime
=
newTime
;
}
else
{
return
false
;
}
}
else
{
if
(
newTime
!=
null
&&
now
-
newTime
<
3600
){
return
true
;
oldTime
=
newTime
;
}
else
{
return
false
;
}
}
}
function
setValueOfSwitch
(
self
,
flag
){
function
setValueOfSwitch
(
self
,
flag
){
self
.
setOpendoorRecordDisabledFlag
(
flag
);
self
.
setOpendoorRecordDisabledFlag
(
flag
);
self
.
setSecurityAlarmDisabledFlag
(
flag
);
self
.
setSecurityAlarmDisabledFlag
(
flag
);
...
@@ -906,10 +843,10 @@ function setRemoteOpenDoorLoading(self, status, text, buttonText){
...
@@ -906,10 +843,10 @@ function setRemoteOpenDoorLoading(self, status, text, buttonText){
self
.
setRemoteOpendoorDisabledFlag
(
true
);
self
.
setRemoteOpendoorDisabledFlag
(
true
);
case
2
:
case
2
:
window
.
clearTimeout
(
self
.
remoteTime
);
window
.
clearTimeout
(
self
.
remoteTime
);
uComponents
.
changeCommButtonText
(
self
,
buttonText
);
case
0
:
case
0
:
self
.
setStatus
(
status
);
self
.
setStatus
(
status
);
uComponents
.
changeCommLoadingStatusAndText
(
self
,
status
,
text
);
uComponents
.
changeCommLoadingStatusAndText
(
self
,
status
,
text
);
uComponents
.
changeCommButtonText
(
self
,
buttonText
);
break
;
break
;
}
}
}
}
...
@@ -927,6 +864,7 @@ function ringBell(self){
...
@@ -927,6 +864,7 @@ function ringBell(self){
},
config
.
await_time
*
2
);
},
config
.
await_time
*
2
);
}
}
//铃声和动画循环一遍
function
simpleRingBell
(
self
,
i
){
function
simpleRingBell
(
self
,
i
){
window
.
clearTimeout
(
self
.
timeout
);
window
.
clearTimeout
(
self
.
timeout
);
self
.
setDoorbellRingingFlag
(
true
);
self
.
setDoorbellRingingFlag
(
true
);
...
@@ -1036,9 +974,7 @@ function opendoorRecordTap(self){
...
@@ -1036,9 +974,7 @@ function opendoorRecordTap(self){
//tap 安全报警
//tap 安全报警
function
securityAlarmTap
(
self
){
function
securityAlarmTap
(
self
){
if
(
self
.
valueSecurityAlarm
){
if
(
self
.
valueSecurityAlarm
){
if
(
self
.
notifyTime
!=
null
){
self
.
securityAlarmFlag
=
false
;
self
.
securityAlarmFlag
=
false
;
}
iot
.
navigator
.
openWindow
({
iot
.
navigator
.
openWindow
({
url
:
'./alarmInfo.html'
,
url
:
'./alarmInfo.html'
,
id
:
'alarmInfo'
,
id
:
'alarmInfo'
,
...
@@ -1052,10 +988,7 @@ function securityAlarmTap(self){
...
@@ -1052,10 +988,7 @@ function securityAlarmTap(self){
//tap 劫持报警
//tap 劫持报警
function
hijackAlarmTap
(
self
){
function
hijackAlarmTap
(
self
){
if
(
self
.
valueHijackAlarm
){
if
(
self
.
valueHijackAlarm
){
console
.
log
(
self
.
alarmTime
);
self
.
hijackAlarmFlag
=
false
;
if
(
self
.
alarmTime
!=
null
){
self
.
hijackAlarmFlag
=
false
;
}
iot
.
navigator
.
openWindow
({
iot
.
navigator
.
openWindow
({
url
:
'./hijackRecord.html'
,
url
:
'./hijackRecord.html'
,
id
:
'hijackRecord'
,
id
:
'hijackRecord'
,
...
@@ -1141,9 +1074,7 @@ function confirmButtonTap(self){
...
@@ -1141,9 +1074,7 @@ function confirmButtonTap(self){
self
.
setTextErrorTip
(
Vue
.
t
(
'remoteOpendoor.error.noPasswordTip'
));
self
.
setTextErrorTip
(
Vue
.
t
(
'remoteOpendoor.error.noPasswordTip'
));
}
else
{
}
else
{
uComponents
.
showCommLoading
(
self
);
uComponents
.
showCommLoading
(
self
);
self
.
setStatus
(
0
);
setRemoteOpenDoorLoading
(
self
,
0
,
Vue
.
t
(
'remoteOpendoor.loading'
));
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'remoteOpendoor.loading'
));
// console.log(self.mac);
let
keyIv
=
crypto
.
enkey
(
self
.
mac
.
replace
(
/:/g
,
''
));
let
keyIv
=
crypto
.
enkey
(
self
.
mac
.
replace
(
/:/g
,
''
));
// console.log(keyIv);
// console.log(keyIv);
let
pwd
=
crypto
.
encode
(
self
.
getTextPassword
(),
keyIv
);
let
pwd
=
crypto
.
encode
(
self
.
getTextPassword
(),
keyIv
);
...
@@ -1165,7 +1096,6 @@ function confirmButtonTap(self){
...
@@ -1165,7 +1096,6 @@ function confirmButtonTap(self){
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
//密码下发成功
//密码下发成功
console
.
log
(
response
);
console
.
log
(
response
);
self
.
getStatus
(
0
);
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
...
@@ -1182,13 +1112,8 @@ function confirmButtonTap(self){
...
@@ -1182,13 +1112,8 @@ function confirmButtonTap(self){
});
});
}
}
self
.
remoteTime
=
setTimeout
(
function
(){
self
.
remoteTime
=
setTimeout
(
function
(){
console
.
log
(
self
.
getStatus
());
if
(
self
.
getStatus
()
==
0
){
if
(
self
.
getStatus
()
==
0
){
//连接失败
setRemoteOpenDoorLoading
(
self
,
2
,
Vue
.
t
(
'remoteOpendoor.remoteTimeout'
),
Vue
.
t
(
'remoteOpendoor.remoteOpendoorAgain'
));
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'remoteOpendoor.remoteTimeout'
));
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'remoteOpendoor.remoteOpendoorAgain'
));
self
.
setStatus
(
2
);
window
.
clearTimeout
(
self
.
remoteTime
);
}
}
},
config
.
remote_opendoor_timeout
);
},
config
.
remote_opendoor_timeout
);
}
}
...
@@ -1197,11 +1122,8 @@ function confirmButtonTap(self){
...
@@ -1197,11 +1122,8 @@ function confirmButtonTap(self){
function
commLoadingButtonTap
(
self
){
function
commLoadingButtonTap
(
self
){
if
(
self
.
getStatus
()
==
1
){
if
(
self
.
getStatus
()
==
1
){
//远程开门成功
//远程开门成功
uComponents
.
hideCommLoading
(
self
);
self
.
setRemoteOpendoorShowFlag
(
false
);
self
.
setRemoteOpendoorShowFlag
(
false
);
}
else
if
(
self
.
getStatus
()
==
2
){
//远程开门失败
uComponents
.
hideCommLoading
(
self
);
}
}
uComponents
.
hideCommLoading
(
self
);
}
}
dev/src/view/device/v_opendoorRecord.js
View file @
314b404f
...
@@ -107,6 +107,7 @@ function backTap(){
...
@@ -107,6 +107,7 @@ function backTap(){
iot
.
navigator
.
aback
();
iot
.
navigator
.
aback
();
}
}
//重写mui.back
mui
.
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
console
.
log
(
"fire"
);
...
@@ -118,6 +119,7 @@ function listLoadTap(self) {
...
@@ -118,6 +119,7 @@ function listLoadTap(self) {
resolve
(
self
);
resolve
(
self
);
}
}
//获取历史记录(整个设备)
function
getHistoryRecord
(
self
){
function
getHistoryRecord
(
self
){
iot
.
business
.
api
.
sendCustom
(
'lock/getHistoryRecord'
,
iot
.
business
.
api
.
sendCustom
(
'lock/getHistoryRecord'
,
{
{
...
@@ -127,29 +129,18 @@ function getHistoryRecord(self){
...
@@ -127,29 +129,18 @@ function getHistoryRecord(self){
start_id
:
self
.
getStartId
(),
start_id
:
self
.
getStartId
(),
page_size
:
PAGE_SIZE
page_size
:
PAGE_SIZE
},
},
success
:
(
response
)
=>
{
success
:
async
(
response
)
=>
{
setListData
(
self
,
response
);
setListData
(
self
,
response
);
if
(
self
.
flag
){
if
(
self
.
flag
){
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
&&
data
.
record
.
length
>
0
){
if
(
data
&&
data
.
record
.
length
>
0
){
let
record
=
data
.
record
;
let
record
=
data
.
record
;
// iot.storage.setMap('openTime', moment(record[0].time).unix(), (res) => {
self
.
flag
=
await
uPublic
.
upDateRead
(
'open'
,
moment
(
record
[
0
].
time
).
unix
());
// console.log(res);
// self.flag = false;
// }, () => {
// });
uPublic
.
upDateRead
(
'open'
);
}
}
}
}
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 获取开门记录失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取开门记录失败');
// }
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
...
@@ -158,6 +149,7 @@ function getHistoryRecord(self){
...
@@ -158,6 +149,7 @@ function getHistoryRecord(self){
});
});
}
}
//获取个人历史记录
function
getPersonalHistory
(
self
,
id
){
function
getPersonalHistory
(
self
,
id
){
iot
.
business
.
api
.
sendCustom
(
'lock/getPersonalHistory'
,
iot
.
business
.
api
.
sendCustom
(
'lock/getPersonalHistory'
,
{
{
...
@@ -173,13 +165,7 @@ function getPersonalHistory(self, id){
...
@@ -173,13 +165,7 @@ function getPersonalHistory(self, id){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
uPublic
.
openRequestErrorAlert
(
self
);
// iotDebug.push('end: 获取个人开门历史记录'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取个人开门历史记录');
// }
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
uComponents
.
hideLoading
(
self
);
...
@@ -187,6 +173,7 @@ function getPersonalHistory(self, id){
...
@@ -187,6 +173,7 @@ function getPersonalHistory(self, id){
});
});
}
}
//设置历史记录渲染列表
function
setListData
(
self
,
response
){
function
setListData
(
self
,
response
){
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
if
(
data
){
...
...
dev/src/view/doorlockManage/v_editName.js
View file @
314b404f
...
@@ -82,10 +82,6 @@ function initComponentsConfig() {
...
@@ -82,10 +82,6 @@ function initComponentsConfig() {
}
}
}
}
function
alert
(){
alert
(
'aaa'
);
}
function
nameChange
(
self
,
text
){
function
nameChange
(
self
,
text
){
self
.
setTextName
(
text
);
self
.
setTextName
(
text
);
self
.
setTextErrorTip
(
''
);
self
.
setTextErrorTip
(
''
);
...
@@ -97,6 +93,13 @@ function backTap(){
...
@@ -97,6 +93,13 @@ function backTap(){
iot
.
navigator
.
back
();
iot
.
navigator
.
back
();
}
}
//重写mui.back
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
}
//tap 保存
//tap 保存
function
saveTap
(
self
){
function
saveTap
(
self
){
if
(
self
.
getTextName
()
==
null
||
self
.
getTextName
().
trim
()
==
''
){
if
(
self
.
getTextName
()
==
null
||
self
.
getTextName
().
trim
()
==
''
){
...
@@ -123,12 +126,6 @@ function saveTap(self){
...
@@ -123,12 +126,6 @@ function saveTap(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 修改设备名称失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'修改设备名称失败');
// }
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'editName.editNameFailue'
),
{
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'editName.editNameFailue'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
let
opener
=
plus
.
webview
.
currentWebview
().
opener
();
let
opener
=
plus
.
webview
.
currentWebview
().
opener
();
...
...
dev/src/view/doorlockManage/v_index.js
View file @
314b404f
...
@@ -18,6 +18,7 @@ function init() {
...
@@ -18,6 +18,7 @@ function init() {
//项目 list组件
//项目 list组件
uPublic
.
componentsExtend
([
'grid-list'
]);
uPublic
.
componentsExtend
([
'grid-list'
]);
uPublic
.
closeSlideBack
();
uPublic
.
closeSlideBack
();
console
.
log
(
iot
.
navigator
.
getExtras
());
const
app
=
new
Vue
({
const
app
=
new
Vue
({
data
:{
data
:{
//配置组件
//配置组件
...
@@ -197,6 +198,7 @@ function initComponentsConfig() {
...
@@ -197,6 +198,7 @@ function initComponentsConfig() {
}
}
}
}
//获取设备信息
function
getDoorlockInfo
(
self
){
function
getDoorlockInfo
(
self
){
uComponents
.
showLoading
(
self
);
uComponents
.
showLoading
(
self
);
let
productId
=
config
.
model
;
let
productId
=
config
.
model
;
...
@@ -216,57 +218,14 @@ function getDoorlockInfo(self){
...
@@ -216,57 +218,14 @@ function getDoorlockInfo(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 获取门锁信息失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取门锁信息失败');
// }
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
uComponents
.
hideLoading
(
self
);
}
}
});
});
// iot.business.api.send('device/getList',{
// data: {
// sds: false,
// device_id: self.extras.deviceId,
// product_id: productId,
// parent_id: 0,
// start_id: 0,
// number: 10
// },
// success: (response) => {
// console.log(response);
// let data = uPublic.checkResponseData(response.data);
// if(data){
// self.setDoorlock(response.data[0]);
// self.setTextNickname(self.getDoorlock().nickname);
// console.log(self.getDoorlock());
// }
// },
// error: (error) => {
// //请求失败
// uPublic.openRequestErrorAlert(self);
// console.log(error);
// },
// complete: () => {
// uComponents.hideLoading(self);
// }
// },true);
}
}
//tap <
function
backTap
(){
iot
.
navigator
.
aback
();
}
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
}
//tap 修改设备昵称
//tap 修改设备昵称
function
editNameTap
(
self
){
function
editNameTap
(
self
){
...
@@ -282,44 +241,40 @@ function editNameTap(self){
...
@@ -282,44 +241,40 @@ function editNameTap(self){
}
}
}
}
//tap
解绑门锁
//tap
‘解绑门锁’ 显示解绑门锁弹框
function
unbindDoorlockButtonTap
(
self
){
function
unbindDoorlockButtonTap
(
self
){
self
.
setUnbindShowDialog
(
true
);
self
.
setUnbindShowDialog
(
true
);
//uComponents.openConfirm(self, Vue.t('doorlockManage.unbindDialogTip'),
// {text: Vue.t('dialog.cancel'), callback: function () {}},
// {text: Vue.t('dialog.unbind'), callback: function () {
// uComponents.showLoading(self);
// iot.business.sds.unbindDevice({
// data: {
// uuid: self.extras.uuid
// },
// success: (response) => {
// console.log(response);
// unbind(self);
// },
// error: (error) => {
// console.log(error)
// },
// complete: () => {
//
// }
// });
// }}
// );
}
}
//tap 隐藏提示框
//tap 确认解绑门锁
function
unbindStateDialogTap
(
self
){
function
confirmTap
(
self
){
self
.
setStateShowFlag
(
false
);
self
.
setUnbindShowDialog
(
false
);
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
// sds解绑门锁
if
(
self
.
getUnbindSucceess
){
iot
.
business
.
sds
.
unbindDevice
({
iot
.
navigator
.
openWindow
({
data
:
{
url
:
'../device/index.html'
,
uuid
:
self
.
extras
.
uuid
id
:
'device'
},
});
success
:
(
response
)
=>
{
}
console
.
log
(
response
);
unbind
(
self
);
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: sds解绑设备失败'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'sds解绑设备失败'
);
}
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
}
});
}
}
// 云端解绑门锁
function
unbind
(
self
){
function
unbind
(
self
){
iot
.
business
.
api
.
sendCustom
(
'lock/unbind'
,{
iot
.
business
.
api
.
sendCustom
(
'lock/unbind'
,{
data
:
{
data
:
{
...
@@ -335,12 +290,6 @@ function unbind(self){
...
@@ -335,12 +290,6 @@ function unbind(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 云端解绑失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'云端解绑失败');
// }
self
.
setStateShowFlag
(
false
);
self
.
setStateShowFlag
(
false
);
self
.
setShowMsg
(
Vue
.
t
(
'doorlockManage.unbindFailue'
));
self
.
setShowMsg
(
Vue
.
t
(
'doorlockManage.unbindFailue'
));
self
.
setUnbindSucceess
(
false
);
self
.
setUnbindSucceess
(
false
);
...
@@ -351,46 +300,44 @@ function unbind(self){
...
@@ -351,46 +300,44 @@ function unbind(self){
});
});
}
}
//function unbindUser(self){
//选择是否清除所有信息,默认选择为‘清除所有信息’
// iot.business.api.sendCustom('lock/unbindUser',{
function
isClearSwitchTap
(
self
,
value
){
// data: {
self
.
setValueIsClear
(
value
);
// rel_id: self.getDoorlock().id,
console
.
log
(
self
.
getValueIsClear
());
// device_id: self.getDoorlock().device_id,
}
// user_id: self.getDoorlock().user_device_id
// },
// success: (response) => {
// self.setStateShowFlag(true);
// self.setShowMsg(Vue.t('doorlockUser.unbindSuccess'));
// self.setUnbindSucceess(true);
// },
// error: (error) => {
// console.log(error);
// self.setStateShowFlag(false);
// self.setShowMsg(Vue.t('doorlockUser.unbindFailue'));
// self.setUnbindSucceess(false);
// },
// complete: () => {
// uComponents.hideLoading(self);
// }
// });
//}
//tap <
function
backTap
(){
iot
.
navigator
.
aback
();
}
//重写mui.back
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
}
// 选择: 是否接收门铃消息推送
function
doorbellSwitchTap
(
self
,
value
){
function
doorbellSwitchTap
(
self
,
value
){
self
.
setValueDoorbell
(
value
);
self
.
setValueDoorbell
(
value
);
setOption
(
self
);
setOption
(
self
);
}
}
// 选择: 是否接收报警消息推送
function
alarmSwitchTap
(
self
,
value
){
function
alarmSwitchTap
(
self
,
value
){
self
.
setValueAlarm
(
value
);
self
.
setValueAlarm
(
value
);
setOption
(
self
);
setOption
(
self
);
}
}
// 选择: 是否接收开门消息推送
function
opendoorSwitchTap
(
self
,
value
){
function
opendoorSwitchTap
(
self
,
value
){
self
.
setValueOpendoor
(
value
);
self
.
setValueOpendoor
(
value
);
setOption
(
self
);
setOption
(
self
);
}
}
// 调用设置推送接口
function
setOption
(
self
){
function
setOption
(
self
){
// uComponents.showLoading(self);
iot
.
business
.
api
.
sendCustom
(
'lock/setPushOption'
,
iot
.
business
.
api
.
sendCustom
(
'lock/setPushOption'
,
{
{
data
:
{
data
:
{
...
@@ -404,54 +351,26 @@ function setOption(self){
...
@@ -404,54 +351,26 @@ function setOption(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 设置推送失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'设置推送失败');
// }
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
// uComponents.hideLoading(self);
}
}
});
});
}
}
//tap 取消解绑门锁
function
cancelTap
(
self
){
function
cancelTap
(
self
){
self
.
setUnbindShowDialog
(
false
);
self
.
setUnbindShowDialog
(
false
);
}
}
function
confirmTap
(
self
){
//tap 绑定成功弹框提示-->回到首页
self
.
setUnbindShowDialog
(
false
);
function
unbindStateDialogTap
(
self
){
iot
.
business
.
sds
.
unbindDevice
({
self
.
setStateShowFlag
(
false
);
data
:
{
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
uuid
:
self
.
extras
.
uuid
if
(
self
.
getUnbindSucceess
){
},
iot
.
navigator
.
openWindow
({
success
:
(
response
)
=>
{
url
:
'../device/index.html'
,
console
.
log
(
response
);
id
:
'device'
unbind
(
self
);
});
},
}
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: sds解绑设备失败'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'sds解绑设备失败'
);
}
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
}
});
// unbind(self);
}
function
isClearSwitchTap
(
self
,
value
){
self
.
setValueIsClear
(
value
);
console
.
log
(
self
.
getValueIsClear
());
}
}
dev/src/view/myInfo/v_index.js
View file @
314b404f
...
@@ -144,7 +144,7 @@ function logoutButtonTap(self){
...
@@ -144,7 +144,7 @@ function logoutButtonTap(self){
console
.
log
(
"sdsLogout:"
+
response
);
console
.
log
(
"sdsLogout:"
+
response
);
let
sdsResponse
=
response
;
let
sdsResponse
=
response
;
iot
.
business
.
websql
.
delMaps
([
'utoken'
,
'userinfo'
],
(
response
)
=>
{
iot
.
business
.
websql
.
delMaps
([
'utoken'
,
'userinfo'
],
(
response
)
=>
{
iot
.
storage
.
delMaps
([
'
notifyTime'
,
'alarmTime'
,
'openTime
'
],
(
response
)
=>
{
iot
.
storage
.
delMaps
([
'
historyId'
,
'history
'
],
(
response
)
=>
{
console
.
log
(
"clearMap"
+
response
);
console
.
log
(
"clearMap"
+
response
);
//打开首页
//打开首页
iot
.
navigator
.
openWindow
({
iot
.
navigator
.
openWindow
({
...
...
web/lib/js/UIOT.js
View file @
314b404f
...
@@ -4928,6 +4928,7 @@ var App = function (_Base) {
...
@@ -4928,6 +4928,7 @@ var App = function (_Base) {
url
:
params
.
url
,
url
:
params
.
url
,
id
:
params
.
id
,
id
:
params
.
id
,
styles
:
params
.
styles
||
{},
styles
:
params
.
styles
||
{},
show
:
params
.
show
,
extras
:
{
IOTData
:
params
.
extras
},
extras
:
{
IOTData
:
params
.
extras
},
waiting
:
params
.
waiting
||
{
autoShow
:
false
}
waiting
:
params
.
waiting
||
{
autoShow
:
false
}
});
});
...
...
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