Commit 6ccb82b6 by 朱建香

1201

parent 79571d4b
......@@ -22,7 +22,6 @@ function init() {
showLoginButtonFlag: true
},
mounted(){
// loginButtonTap(this);
if(window.iotDebug){
iotDebug.push('start: Debug');
}
......@@ -32,18 +31,13 @@ function init() {
if (plus.os.name == 'Android') {
iot.permission.checkPermission(['READ_EXTERNAL_STORAGE'], function (res) {
console.log('success', res);
// var clientInfo = plus.push.getClientInfo();
// self.setClientId(clientInfo.clientid);
loginButtonTap(self);
}, function (err) {
console.log('error', err);
});
}else{
console.log("start login");
loginButtonTap(self);
}
// loginButtonTap(this);
},
methods:{
getShowLoginButtonFlag(){
......@@ -102,19 +96,17 @@ function loginButtonTap(self){
// },(err)=>{
// console.log(err);
// })
alert('login');
iot.business.sds.login({
data: {
userinfo: {}
},
success: (response) => {
alert("response");
// alert(JSON.stringify(response));
console.log(response);
if(window.iotDebug){
iotDebug.push('end: SDSloginSuccees');
}
// console.log(response);
// alert(JSON.stringify(response));
// alert(JSON.stringify(response));
var data = uPublic.checkResponseData(response.data);
if(data){
self.setShowLoginButtonFlag(false);
......@@ -122,26 +114,19 @@ function loginButtonTap(self){
console.log("sds登陆成功了");
cloudsLogin(self, data.UserID);
}
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
}else{
}
},
error: (error) => {
console.log(error);
alert("error");
// alert(JSON.stringify(error));
if(window.iotDebug){
iotDebug.push('end: sds登陆失败'+JSON.stringify(error));
}
if (window.iotDebug) {
iotDebug.upload(iot,'sds登陆失败');
}
// //请求失败
//// uPublic.openRequestErrorAlert(self);
},
complete: () => {
uComponents.hideLoading(self);
......@@ -171,22 +156,15 @@ function cloudsLogin(self, id){
id: 'device'
});
plus.navigator.closeSplashscreen();
// uPublic.openWindow({
// url: '../device/index.html',
// id: 'device',
// styles: {
// 'background': 'transparent'
// }
// });
},
error: (error) => {
console.log(error);
// if(window.iotDebug){
// iotDebug.push('end: 云端登陆失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'云端登陆失败');
// }
if(window.iotDebug){
iotDebug.push('end: 云端登陆失败'+JSON.stringify(error));
}
if (window.iotDebug) {
iotDebug.upload(iot,'云端登陆失败');
}
uPublic.openRequestErrorAlert(self);
},
complete: () => {
......
......@@ -29,7 +29,6 @@ function init() {
showLoginButtonFlag: true
},
mounted: function mounted() {
// loginButtonTap(this);
if (window.iotDebug) {
iotDebug.push('start: Debug');
}
......@@ -39,18 +38,13 @@ function init() {
if (plus.os.name == 'Android') {
_public.iot.permission.checkPermission(['READ_EXTERNAL_STORAGE'], function (res) {
console.log('success', res);
// var clientInfo = plus.push.getClientInfo();
// self.setClientId(clientInfo.clientid);
loginButtonTap(self);
}, function (err) {
console.log('error', err);
});
} else {
console.log("start login");
loginButtonTap(self);
}
// loginButtonTap(this);
},
methods: {
......@@ -110,19 +104,17 @@ function loginButtonTap(self) {
// },(err)=>{
// console.log(err);
// })
alert('login');
_public.iot.business.sds.login({
data: {
userinfo: {}
},
success: function success(response) {
alert("response");
// alert(JSON.stringify(response));
console.log(response);
if (window.iotDebug) {
iotDebug.push('end: SDSloginSuccees');
}
// console.log(response);
// alert(JSON.stringify(response));
// alert(JSON.stringify(response));
var data = _public.uPublic.checkResponseData(response.data);
if (data) {
self.setShowLoginButtonFlag(false);
......@@ -130,24 +122,17 @@ function loginButtonTap(self) {
console.log("sds登陆成功了");
cloudsLogin(self, data.UserID);
}
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
} else {}
},
error: function error(_error) {
console.log(_error);
alert("error");
// alert(JSON.stringify(error));
if (window.iotDebug) {
iotDebug.push('end: sds登陆失败' + JSON.stringify(_error));
}
if (window.iotDebug) {
iotDebug.upload(_public.iot, 'sds登陆失败');
}
// //请求失败
//// uPublic.openRequestErrorAlert(self);
},
complete: function complete() {
_public.uComponents.hideLoading(self);
......@@ -177,22 +162,15 @@ function cloudsLogin(self, id) {
id: 'device'
});
plus.navigator.closeSplashscreen();
// uPublic.openWindow({
// url: '../device/index.html',
// id: 'device',
// styles: {
// 'background': 'transparent'
// }
// });
},
error: function error(_error2) {
console.log(_error2);
// if(window.iotDebug){
// iotDebug.push('end: 云端登陆失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'云端登陆失败');
// }
if (window.iotDebug) {
iotDebug.push('end: 云端登陆失败' + JSON.stringify(_error2));
}
if (window.iotDebug) {
iotDebug.upload(_public.iot, '云端登陆失败');
}
_public.uPublic.openRequestErrorAlert(self);
},
complete: function complete() {
......
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