Commit 941ff1b1 by 朱建香

1214

1.登陆获取cid
2.登陆判断sds是否初始化成功
3.iot.navigator.fire方法更改
parent 93551a29
...@@ -330,7 +330,8 @@ ...@@ -330,7 +330,8 @@
"oldPasswordInputTipAgain": "请再次输入旧密码" "oldPasswordInputTipAgain": "请再次输入旧密码"
}, },
"request":{ "request":{
"error": "请求发送失败" "error": "请求发送失败",
"initError": "初始化失败,请关闭APP重试"
}, },
"deviceList":{ "deviceList":{
"model": "型号:", "model": "型号:",
......
...@@ -117,17 +117,7 @@ iot.navigator.getAllWebviw = function () { ...@@ -117,17 +117,7 @@ iot.navigator.getAllWebviw = function () {
} }
iot.navigator.fire = function (webview, eventType, data) { iot.navigator.fire = function (webview, eventType, data) {
if (webview) { mui.fire(webview, eventType, data);
if (typeof data === 'undefined') {
data = '';
} else if (typeof data === 'boolean' || typeof data === 'number') {
webview.evalJS("typeof mui!=='undefined'&&mui.receive('" + eventType + "'," + data + ")");
return;
} else if (typeof data === 'object' && Object.keys(data).length == 0) {
data = JSON.stringify(data || {}).replace(/\'/g, "\\u0027").replace(/\\/g, "\\u005c");
}
webview.evalJS('iot.navigator.receive("' + eventType + '","' + data + '")');
}
}; };
window.iot = iot; window.iot = iot;
......
...@@ -143,6 +143,7 @@ function deviceBind(self, lockId, relId){ ...@@ -143,6 +143,7 @@ function deviceBind(self, lockId, relId){
let data = response.data; let data = response.data;
if(data.success){ if(data.success){
uComponents.openAlert(self, Vue.t('addDevice.bindSuccess'), { uComponents.openAlert(self, Vue.t('addDevice.bindSuccess'), {
iot.navigator.fire(plus.webview.getWebviewById('device'),'returnPage',{});
text: Vue.t('dialog.confirm'), callback: function () { text: Vue.t('dialog.confirm'), callback: function () {
iot.navigator.openWindow({ iot.navigator.openWindow({
url: '../device/index.html', url: '../device/index.html',
......
...@@ -26,6 +26,7 @@ function init() { ...@@ -26,6 +26,7 @@ function init() {
}, },
mounted(){ mounted(){
resolve(this); resolve(this);
}, },
methods:{ methods:{
getTextWiFiName(){ getTextWiFiName(){
...@@ -285,6 +286,8 @@ function commLoadingButtonTap(self) { ...@@ -285,6 +286,8 @@ function commLoadingButtonTap(self) {
if(self.getStatus() == 1){ if(self.getStatus() == 1){
//绑定成功 //绑定成功
uComponents.hideCommLoading(self); uComponents.hideCommLoading(self);
iot.navigator.fire(plus.webview.getWebviewById('device'),'returnPage',{});
iot.navigator.openWindow({ iot.navigator.openWindow({
url: '../device/index.html', url: '../device/index.html',
id: 'device' id: 'device'
......
...@@ -1287,7 +1287,7 @@ function confirmButtonTap(self){ ...@@ -1287,7 +1287,7 @@ function confirmButtonTap(self){
}); });
} }
console.log('aaaa'); console.log('aaaa');
setTimeout(function (){ let time = setTimeout(function (){
console.log(self.getStatus()); console.log(self.getStatus());
if(self.getStatus() == 0){ if(self.getStatus() == 0){
console.log("timeout"); console.log("timeout");
...@@ -1295,6 +1295,7 @@ function confirmButtonTap(self){ ...@@ -1295,6 +1295,7 @@ function confirmButtonTap(self){
uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('remoteOpendoor.openDoorFailure')); uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('remoteOpendoor.openDoorFailure'));
uComponents.changeCommButtonText(self, Vue.t('remoteOpendoor.remoteOpendoorAgain')); uComponents.changeCommButtonText(self, Vue.t('remoteOpendoor.remoteOpendoorAgain'));
self.setStatus(2); self.setStatus(2);
window.clearTimeout(time);
} }
},config.remote_opendoor_timeout); },config.remote_opendoor_timeout);
} }
......
...@@ -311,6 +311,7 @@ function unbindDoorlockButtonTap(self){ ...@@ -311,6 +311,7 @@ function unbindDoorlockButtonTap(self){
//tap 隐藏提示框 //tap 隐藏提示框
function unbindStateDialogTap(self){ function unbindStateDialogTap(self){
self.setStateShowFlag(false); self.setStateShowFlag(false);
iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{});
if(self.getUnbindSucceess){ if(self.getUnbindSucceess){
iot.navigator.openWindow({ iot.navigator.openWindow({
url: '../device/index.html', url: '../device/index.html',
......
...@@ -104,6 +104,11 @@ function loginButtonTap(self){ ...@@ -104,6 +104,11 @@ function loginButtonTap(self){
// alert(error); // alert(error);
// console.log(err); // console.log(err);
// }) // })
iot.business.sds.checkSDSInit({
data: {},
success: (response) => {
//初始化成功
console.log(response);
iot.business.sds.login({ iot.business.sds.login({
data: { data: {
userinfo: {} userinfo: {}
...@@ -137,6 +142,26 @@ function loginButtonTap(self){ ...@@ -137,6 +142,26 @@ function loginButtonTap(self){
uComponents.hideLoading(self); 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, Vue.t('request.initError'));
uComponents.openAlert(self, Vue.t('request.initError'), {
text: Vue.t('dialog.confirm'), callback: function () {
iot.navigator.closeAll();
}
});
},
complete: () => {}
});
} }
function cloudsLogin(self, id){ function cloudsLogin(self, id){
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment