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
c1a1afd5
Commit
c1a1afd5
authored
Nov 09, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1109
parent
141b86ab
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
356 additions
and
245 deletions
+356
-245
dev/src/view/addDevice/v_wifiAdd.js
+55
-0
dev/src/view/device/v_index.js
+2
-2
web/view/addDevice/wifiAdd.html
+1
-0
web/view/addDevice/wifiAdd.js
+286
-231
web/view/device/index.js
+12
-12
No files found.
dev/src/view/addDevice/v_wifiAdd.js
View file @
c1a1afd5
...
@@ -152,11 +152,30 @@ function connectButtonTap(self){
...
@@ -152,11 +152,30 @@ function connectButtonTap(self){
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
"findWifi"
);
console
.
log
(
"findWifi"
);
console
.
log
(
response
);
console
.
log
(
response
);
console
.
log
(
JSON
.
stringify
(
response
));
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: findWifi'
+
JSON
.
stringify
(
response
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
if
(
response
.
data
==
'onProvisioning'
){
if
(
response
.
data
==
'onProvisioning'
){
//wifi链接中
//wifi链接中
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 开始配网'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
uComponents
.
showCommLoading
(
self
);
uComponents
.
showCommLoading
(
self
);
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBinding'
));
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBinding'
));
}
else
if
(
response
.
data
==
'provisioned success'
){
}
else
if
(
response
.
data
==
'provisioned success'
){
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 配网成功'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
//wifi连接成功,停止连接wifi
//wifi连接成功,停止连接wifi
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBindSuccess'
));
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBindSuccess'
));
// iot.business.sds.stopFindWifi({
// iot.business.sds.stopFindWifi({
...
@@ -167,21 +186,51 @@ function connectButtonTap(self){
...
@@ -167,21 +186,51 @@ function connectButtonTap(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: findWifiError'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
}
}
});
});
let
deviceId
=
null
;
let
deviceId
=
null
;
iot
.
business
.
sds
.
findDevices
({
iot
.
business
.
sds
.
findDevices
({
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: findDevices'
+
JSON
.
stringify
(
response
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
let
productId
=
iot
.
navigator
.
getExtras
().
model
;
let
productId
=
iot
.
navigator
.
getExtras
().
model
;
if
(
response
.
data
==
"onJoining"
){
if
(
response
.
data
==
"onJoining"
){
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 激活中'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.deviceActivating'
));
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.deviceActivating'
));
}
else
if
(
response
.
data
==
"joined success"
){
}
else
if
(
response
.
data
==
"joined success"
){
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 激活成功'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
let
deviceId
=
response
.
info
.
sn
;
let
deviceId
=
response
.
info
.
sn
;
unbind
(
self
,
deviceId
,
productId
);
unbind
(
self
,
deviceId
,
productId
);
// bind(self, deviceId, productId);
// bind(self, deviceId, productId);
}
else
if
(
response
.
data
==
"fail"
){
}
else
if
(
response
.
data
==
"fail"
){
//连接失败
//连接失败
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 激活失败'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'wifiAdd.deviceActivateFailure'
));
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'wifiAdd.deviceActivateFailure'
));
self
.
setStatus
(
2
);
self
.
setStatus
(
2
);
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'addDevice.reBindDevice'
));
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'addDevice.reBindDevice'
));
...
@@ -194,6 +243,12 @@ function connectButtonTap(self){
...
@@ -194,6 +243,12 @@ function connectButtonTap(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: findDevicesError'
+
JSON
.
stringify
(
response
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
);
}
}
}
});
});
}
}
...
...
dev/src/view/device/v_index.js
View file @
c1a1afd5
...
@@ -781,7 +781,7 @@ function securityAlarmTap(self){
...
@@ -781,7 +781,7 @@ function securityAlarmTap(self){
//tap 门锁用户
//tap 门锁用户
function
doorlockUserTap
(
self
){
function
doorlockUserTap
(
self
){
if
(
self
.
getValueDoorlockUser
()
==
1
){
//
if(self.getValueDoorlockUser() == 1){
iot
.
navigator
.
openWindow
({
iot
.
navigator
.
openWindow
({
url
:
'../doorlockUsers/index.html'
,
url
:
'../doorlockUsers/index.html'
,
id
:
'doorlockUsers'
,
id
:
'doorlockUsers'
,
...
@@ -792,7 +792,7 @@ function doorlockUserTap(self){
...
@@ -792,7 +792,7 @@ function doorlockUserTap(self){
role
:
self
.
getRole
()
role
:
self
.
getRole
()
}
}
});
});
}
//
}
}
}
//tap 远程开门
//tap 远程开门
...
...
web/view/addDevice/wifiAdd.html
View file @
c1a1afd5
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
display
:
none
;
display
:
none
;
}
}
</style>
</style>
<script
type=
"text/javascript"
src=
"./start.js"
></script>
<script
type=
"text/javascript"
src=
"../../lib/js/p.js"
></script>
<script
type=
"text/javascript"
src=
"../../lib/js/p.js"
></script>
<script
type=
"text/javascript"
src=
"../../lib/js/UIOT.js"
></script>
<script
type=
"text/javascript"
src=
"../../lib/js/UIOT.js"
></script>
</head>
</head>
...
...
web/view/addDevice/wifiAdd.js
View file @
c1a1afd5
...
@@ -25,270 +25,325 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
...
@@ -25,270 +25,325 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
_public
.
iot
.
ready
(
init
);
_public
.
iot
.
ready
(
init
);
function
init
()
{
function
init
()
{
//通用 input、按钮、dialog、loading组件
//通用 input、按钮、dialog、loading组件
_public
.
uPublic
.
componentsInit
([
'u-text'
,
'u-button'
,
'u-comm-loading'
,
'u-dialog'
,
'u-loading'
]);
_public
.
uPublic
.
componentsInit
([
'u-text'
,
'u-button'
,
'u-comm-loading'
,
'u-dialog'
,
'u-loading'
]);
var
app
=
new
Vue
({
var
app
=
new
Vue
({
data
:
{
data
:
{
textWiFiName
:
null
,
textWiFiName
:
null
,
textPassword
:
null
,
textPassword
:
null
,
textErrorTip
:
null
,
textErrorTip
:
null
,
//配置组件
//配置组件
componentsConfig
:
initComponentsConfig
(),
componentsConfig
:
initComponentsConfig
(),
status
:
0
status
:
0
},
},
mounted
:
function
mounted
()
{
mounted
:
function
mounted
()
{
resolve
(
this
);
resolve
(
this
);
},
},
methods
:
{
methods
:
{
getTextWiFiName
:
function
getTextWiFiName
()
{
getTextWiFiName
:
function
getTextWiFiName
()
{
return
this
.
textWiFiName
;
return
this
.
textWiFiName
;
},
},
setTextWiFiName
:
function
setTextWiFiName
(
text
)
{
setTextWiFiName
:
function
setTextWiFiName
(
text
)
{
this
.
textWiFiName
=
text
;
this
.
textWiFiName
=
text
;
},
},
getTextPassword
:
function
getTextPassword
()
{
getTextPassword
:
function
getTextPassword
()
{
return
this
.
textPassword
;
return
this
.
textPassword
;
},
},
setTextPassword
:
function
setTextPassword
(
pwd
)
{
setTextPassword
:
function
setTextPassword
(
pwd
)
{
this
.
textPassword
=
pwd
;
this
.
textPassword
=
pwd
;
},
},
gettTextErrorTip
:
function
gettTextErrorTip
()
{
gettTextErrorTip
:
function
gettTextErrorTip
()
{
return
this
.
textErrorTip
;
return
this
.
textErrorTip
;
},
},
setTextErrorTip
:
function
setTextErrorTip
(
tip
)
{
setTextErrorTip
:
function
setTextErrorTip
(
tip
)
{
this
.
textErrorTip
=
tip
;
this
.
textErrorTip
=
tip
;
},
},
getStatus
:
function
getStatus
()
{
getStatus
:
function
getStatus
()
{
return
this
.
status
;
return
this
.
status
;
},
},
setStatus
:
function
setStatus
(
status
)
{
setStatus
:
function
setStatus
(
status
)
{
this
.
status
=
status
;
this
.
status
=
status
;
},
},
onPasswordChange
:
function
onPasswordChange
(
text
)
{
onPasswordChange
:
function
onPasswordChange
(
text
)
{
passwordChange
(
this
,
text
);
passwordChange
(
this
,
text
);
},
},
//tap <
//tap <
onBackTap
:
function
onBackTap
()
{
onBackTap
:
function
onBackTap
()
{
backTap
();
backTap
();
},
},
//tap 连接
//tap 连接
onConnectButtonTap
:
function
onConnectButtonTap
()
{
onConnectButtonTap
:
function
onConnectButtonTap
()
{
connectButtonTap
(
this
);
connectButtonTap
(
this
);
},
},
//tap loading button
//tap loading button
onCommLoadingButtonTap
:
function
onCommLoadingButtonTap
()
{
onCommLoadingButtonTap
:
function
onCommLoadingButtonTap
()
{
commLoadingButtonTap
(
this
);
commLoadingButtonTap
(
this
);
}
}
}
}
}).
$mount
(
'#app'
);
}).
$mount
(
'#app'
);
}
}
//配置组件参数
//配置组件参数
function
initComponentsConfig
()
{
function
initComponentsConfig
()
{
return
{
return
{
passwordInput
:
{
passwordInput
:
{
initParam
:
{
initParam
:
{
class
:
'custom-password-text'
,
class
:
'custom-password-text'
,
icon
:
''
,
icon
:
''
,
placeholder
:
Vue
.
t
(
'wifiAdd.passwordInputTip'
),
placeholder
:
Vue
.
t
(
'wifiAdd.passwordInputTip'
),
type
:
'password'
type
:
'password'
}
}
},
},
//连接 button 参数
//连接 button 参数
connectButton
:
{
connectButton
:
{
initParam
:
{
initParam
:
{
class
:
'custom-button'
,
class
:
'custom-button'
,
text
:
Vue
.
t
(
'btn.connect'
)
text
:
Vue
.
t
(
'btn.connect'
)
}
}
},
},
dialog
:
{
dialog
:
{
initParam
:
{
initParam
:
{
class
:
'custom-dialog'
class
:
'custom-dialog'
}
}
},
},
loading
:
{
loading
:
{
initParam
:
{
initParam
:
{
class
:
'custom-loading'
class
:
'custom-loading'
}
}
},
},
ucommloading
:
{
ucommloading
:
{
initParam
:
{
initParam
:
{
class
:
'custom-comm-loading'
,
class
:
'custom-comm-loading'
,
buttonText
:
Vue
.
t
(
'btn.confirm'
),
buttonText
:
Vue
.
t
(
'btn.confirm'
),
text
:
Vue
.
t
(
'addDevice.loading'
),
text
:
Vue
.
t
(
'addDevice.loading'
),
status
:
0
status
:
0
}
}
}
}
};
};
}
}
function
resolve
(
self
)
{
function
resolve
(
self
)
{
_public
.
iot
.
business
.
sds
.
getSSId
({
_public
.
iot
.
business
.
sds
.
getSSId
({
success
:
function
success
(
response
)
{
success
:
function
success
(
response
)
{
console
.
log
(
response
);
console
.
log
(
response
);
self
.
textWiFiName
=
response
.
data
.
ssid
;
self
.
textWiFiName
=
response
.
data
.
ssid
;
console
.
log
(
self
.
textWiFiName
);
console
.
log
(
self
.
textWiFiName
);
},
},
error
:
function
error
(
_error
)
{
error
:
function
error
(
_error
)
{
console
.
log
(
_error
);
console
.
log
(
_error
);
_public
.
uPublic
.
openRequestErrorAlert
(
self
);
_public
.
uPublic
.
openRequestErrorAlert
(
self
);
}
}
});
});
}
}
function
passwordChange
(
self
,
text
)
{
function
passwordChange
(
self
,
text
)
{
self
.
textPassword
=
text
;
self
.
textPassword
=
text
;
console
.
log
(
'passwordChange: '
+
self
.
textPassword
);
console
.
log
(
'passwordChange: '
+
self
.
textPassword
);
}
}
//tap <
//tap <
function
backTap
()
{
function
backTap
()
{
_public
.
iot
.
navigator
.
back
();
_public
.
iot
.
navigator
.
back
();
}
}
//tap 连接
//tap 连接
function
connectButtonTap
(
self
)
{
function
connectButtonTap
(
self
)
{
// console.log(self.getTextWiFiName());
// console.log(self.getTextWiFiName());
// console.log(self.getTextPassword());
// 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
()
==
''
)
{
self
.
setTextErrorTip
(
Vue
.
t
(
'wifiAdd.passwordInputTip'
));
self
.
setTextErrorTip
(
Vue
.
t
(
'wifiAdd.passwordInputTip'
));
}
else
{
}
else
{
_public
.
iot
.
business
.
sds
.
findWifi
({
_public
.
iot
.
business
.
sds
.
findWifi
({
data
:
{
data
:
{
model
:
_public
.
iot
.
navigator
.
getExtras
().
model
,
model
:
_public
.
iot
.
navigator
.
getExtras
().
model
,
ssid
:
self
.
getTextWiFiName
(),
ssid
:
self
.
getTextWiFiName
(),
wifiPwd
:
self
.
getTextPassword
(),
wifiPwd
:
self
.
getTextPassword
(),
timeout
:
20000
timeout
:
20000
},
},
success
:
function
success
(
response
)
{
success
:
function
success
(
response
)
{
console
.
log
(
"findWifi"
);
console
.
log
(
"findWifi"
);
console
.
log
(
response
);
console
.
log
(
response
);
if
(
response
.
data
==
'onProvisioning'
)
{
console
.
log
(
JSON
.
stringify
(
response
));
//wifi链接中
if
(
window
.
iotDebug
)
{
_public
.
uComponents
.
showCommLoading
(
self
);
iotDebug
.
push
(
'end: findWifi'
+
JSON
.
stringify
(
response
));
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBinding'
));
}
else
if
(
response
.
data
==
'provisioned success'
)
{
//wifi连接成功,停止连接wifi
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBindSuccess'
));
// iot.business.sds.stopFindWifi({
// success: (response) => {},
// error: (error) => {}
// });
}
},
error
:
function
error
(
_error2
)
{
console
.
log
(
_error2
);
}
});
var
deviceId
=
null
;
_public
.
iot
.
business
.
sds
.
findDevices
({
success
:
function
success
(
response
)
{
console
.
log
(
response
);
var
productId
=
_public
.
iot
.
navigator
.
getExtras
().
model
;
if
(
response
.
data
==
"onJoining"
)
{
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.deviceActivating'
));
}
else
if
(
response
.
data
==
"joined success"
)
{
var
_deviceId
=
response
.
info
.
sn
;
unbind
(
self
,
_deviceId
,
productId
);
// bind(self, deviceId, productId);
}
else
if
(
response
.
data
==
"fail"
)
{
//连接失败
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'wifiAdd.deviceActivateFailure'
));
self
.
setStatus
(
2
);
_public
.
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'addDevice.reBindDevice'
));
//停止查找设备
_public
.
iot
.
business
.
sds
.
stopFindDevices
({
success
:
function
success
(
response
)
{},
error
:
function
error
(
_error3
)
{}
});
}
},
error
:
function
error
(
_error4
)
{
console
.
log
(
_error4
);
}
});
}
}
setTimeout
(
function
()
{
if
(
window
.
iotDebug
)
{
if
(
self
.
getStatus
()
==
0
)
{
iotDebug
.
upload
(
_public
.
iot
);
console
.
log
(
"timeout"
);
}
//连接失败
if
(
response
.
data
==
'onProvisioning'
)
{
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'wifiAdd.bindTimeout'
));
//wifi链接中
self
.
setStatus
(
2
);
if
(
window
.
iotDebug
)
{
_public
.
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'addDevice.reBindDevice'
));
iotDebug
.
push
(
'end: 开始配网'
);
//停止查找设备
}
_public
.
iot
.
business
.
sds
.
stopFindDevices
({
if
(
window
.
iotDebug
)
{
success
:
function
success
(
response
)
{},
iotDebug
.
upload
(
_public
.
iot
);
error
:
function
error
(
_error5
)
{}
}
});
_public
.
uComponents
.
showCommLoading
(
self
);
}
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBinding'
));
},
_config2
.
default
.
wifi_add_timeout
);
}
else
if
(
response
.
data
==
'provisioned success'
)
{
if
(
window
.
iotDebug
)
{
iotDebug
.
push
(
'end: 配网成功'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
_public
.
iot
);
}
//wifi连接成功,停止连接wifi
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBindSuccess'
));
// iot.business.sds.stopFindWifi({
// success: (response) => {},
// error: (error) => {}
// });
}
},
error
:
function
error
(
_error2
)
{
console
.
log
(
_error2
);
if
(
window
.
iotDebug
)
{
iotDebug
.
push
(
'end: findWifiError'
+
JSON
.
stringify
(
_error2
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
_public
.
iot
);
}
}
});
var
deviceId
=
null
;
_public
.
iot
.
business
.
sds
.
findDevices
({
success
:
function
success
(
response
)
{
console
.
log
(
response
);
if
(
window
.
iotDebug
)
{
iotDebug
.
push
(
'end: findDevices'
+
JSON
.
stringify
(
response
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
_public
.
iot
);
}
var
productId
=
_public
.
iot
.
navigator
.
getExtras
().
model
;
if
(
response
.
data
==
"onJoining"
)
{
if
(
window
.
iotDebug
)
{
iotDebug
.
push
(
'end: 激活中'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
_public
.
iot
);
}
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.deviceActivating'
));
}
else
if
(
response
.
data
==
"joined success"
)
{
if
(
window
.
iotDebug
)
{
iotDebug
.
push
(
'end: 激活成功'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
_public
.
iot
);
}
var
_deviceId
=
response
.
info
.
sn
;
unbind
(
self
,
_deviceId
,
productId
);
// bind(self, deviceId, productId);
}
else
if
(
response
.
data
==
"fail"
)
{
//连接失败
if
(
window
.
iotDebug
)
{
iotDebug
.
push
(
'end: 激活失败'
);
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
_public
.
iot
);
}
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'wifiAdd.deviceActivateFailure'
));
self
.
setStatus
(
2
);
_public
.
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'addDevice.reBindDevice'
));
//停止查找设备
_public
.
iot
.
business
.
sds
.
stopFindDevices
({
success
:
function
success
(
response
)
{},
error
:
function
error
(
_error3
)
{}
});
}
},
error
:
function
error
(
_error4
)
{
console
.
log
(
_error4
);
if
(
window
.
iotDebug
)
{
iotDebug
.
push
(
'end: findDevicesError'
+
JSON
.
stringify
(
response
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
_public
.
iot
);
}
}
});
}
setTimeout
(
function
()
{
if
(
self
.
getStatus
()
==
0
)
{
console
.
log
(
"timeout"
);
//连接失败
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'wifiAdd.bindTimeout'
));
self
.
setStatus
(
2
);
_public
.
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'addDevice.reBindDevice'
));
//停止查找设备
_public
.
iot
.
business
.
sds
.
stopFindDevices
({
success
:
function
success
(
response
)
{},
error
:
function
error
(
_error5
)
{}
});
}
},
_config2
.
default
.
wifi_add_timeout
);
}
}
//tap loading button
//tap loading button
function
commLoadingButtonTap
(
self
)
{
function
commLoadingButtonTap
(
self
)
{
if
(
self
.
getStatus
()
==
1
)
{
if
(
self
.
getStatus
()
==
1
)
{
//绑定成功
//绑定成功
_public
.
uComponents
.
hideCommLoading
(
self
);
_public
.
uComponents
.
hideCommLoading
(
self
);
_public
.
iot
.
navigator
.
openWindow
({
_public
.
iot
.
navigator
.
openWindow
({
url
:
'../device/index.html'
,
url
:
'../device/index.html'
,
id
:
'device'
id
:
'device'
});
});
}
else
if
(
self
.
getStatus
()
==
2
)
{
}
else
if
(
self
.
getStatus
()
==
2
)
{
//绑定失败
//绑定失败
_public
.
uComponents
.
hideCommLoading
(
self
);
_public
.
uComponents
.
hideCommLoading
(
self
);
self
.
setStatus
(
0
);
self
.
setStatus
(
0
);
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'addDevice.loading'
));
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'addDevice.loading'
));
}
}
}
}
function
unbind
(
self
,
deviceId
,
productId
)
{
function
unbind
(
self
,
deviceId
,
productId
)
{
console
.
log
(
deviceId
);
console
.
log
(
deviceId
);
_public
.
iot
.
business
.
api
.
sendCustom
(
'lock/unbindDevice'
,
{
_public
.
iot
.
business
.
api
.
sendCustom
(
'lock/unbindDevice'
,
{
data
:
{
data
:
{
device_sn
:
deviceId
device_sn
:
deviceId
},
},
success
:
function
success
(
response
)
{
success
:
function
success
(
response
)
{
console
.
log
(
response
);
console
.
log
(
response
);
bind
(
self
,
deviceId
,
productId
);
bind
(
self
,
deviceId
,
productId
);
},
},
error
:
function
error
(
_error6
)
{
error
:
function
error
(
_error6
)
{
console
.
log
(
_error6
);
console
.
log
(
_error6
);
},
},
complete
:
function
complete
()
{}
complete
:
function
complete
()
{}
});
});
}
}
function
bind
(
self
,
deviceId
,
productId
)
{
function
bind
(
self
,
deviceId
,
productId
)
{
_public
.
iot
.
business
.
api
.
sendCustom
(
'lock/bind'
,
{
_public
.
iot
.
business
.
api
.
sendCustom
(
'lock/bind'
,
{
data
:
{
data
:
{
product_id
:
productId
,
product_id
:
productId
,
device_id
:
deviceId
,
device_id
:
deviceId
,
// mac: parameters.mac,
// mac: parameters.mac,
nickname
:
''
nickname
:
''
},
},
success
:
function
success
(
response
)
{
success
:
function
success
(
response
)
{
console
.
log
(
response
);
console
.
log
(
response
);
var
data
=
response
.
data
;
var
data
=
response
.
data
;
if
(
data
.
success
)
{
if
(
data
.
success
)
{
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
1
,
Vue
.
t
(
'wifiAdd.deviceActivateSuccess'
));
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
1
,
Vue
.
t
(
'wifiAdd.deviceActivateSuccess'
));
_public
.
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'btn.confirm'
));
_public
.
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'btn.confirm'
));
self
.
setStatus
(
1
);
self
.
setStatus
(
1
);
}
}
},
},
error
:
function
error
(
_error7
)
{
error
:
function
error
(
_error7
)
{
console
.
log
(
_error7
);
console
.
log
(
_error7
);
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'wifiAdd.deviceActivateFailure'
));
_public
.
uComponents
.
changeCommLoadingStatusAndText
(
self
,
2
,
Vue
.
t
(
'wifiAdd.deviceActivateFailure'
));
_public
.
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'addDevice.reBindDevice'
));
_public
.
uComponents
.
changeCommButtonText
(
self
,
Vue
.
t
(
'addDevice.reBindDevice'
));
self
.
setStatus
(
2
);
self
.
setStatus
(
2
);
},
},
complete
:
function
complete
()
{}
complete
:
function
complete
()
{}
});
});
}
}
/* WEBPACK VAR INJECTION */
}.
call
(
exports
,
__webpack_require__
(
2
)[
"default"
]))
/* WEBPACK VAR INJECTION */
}.
call
(
exports
,
__webpack_require__
(
2
)[
"default"
]))
...
...
web/view/device/index.js
View file @
c1a1afd5
...
@@ -24706,18 +24706,18 @@ function securityAlarmTap(self) {
...
@@ -24706,18 +24706,18 @@ function securityAlarmTap(self) {
//tap 门锁用户
//tap 门锁用户
function
doorlockUserTap
(
self
)
{
function
doorlockUserTap
(
self
)
{
if
(
self
.
getValueDoorlockUser
()
==
1
)
{
// if(self.getValueDoorlockUser() == 1)
{
_public
.
iot
.
navigator
.
openWindow
({
_public
.
iot
.
navigator
.
openWindow
({
url
:
'../doorlockUsers/index.html'
,
url
:
'../doorlockUsers/index.html'
,
id
:
'doorlockUsers'
,
id
:
'doorlockUsers'
,
extras
:
{
extras
:
{
deviceId
:
self
.
deviceId
,
deviceId
:
self
.
deviceId
,
uuid
:
self
.
getUuid
(),
uuid
:
self
.
getUuid
(),
lockId
:
self
.
getLockId
(),
lockId
:
self
.
getLockId
(),
role
:
self
.
getRole
()
role
:
self
.
getRole
()
}
}
});
});
}
//
}
}
}
//tap 远程开门
//tap 远程开门
...
...
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