Commit be878c42 by 朱建香

1024

parent 3604e554
......@@ -378,15 +378,15 @@ function getLockInfo(self){
// self.setBatteryState(config.powerIcon[Math.round(data.battery/20)]);
//判断云端是否绑定
if(data.lock_id){
setValueOfSwitch(self, 1);
self.setLockId(data.lock_id);
self.setRole(data.role);
getDeviceStatus(self);
console.log(data.info);
if(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);
setValueOfSwitch(self, 1);
if(self.isFirstGetLockInfo){
getDeviceStatus(self);
self.setIsFirstGetLockInfo(false);
}
}else{
......
......@@ -104,101 +104,14 @@ function loginButtonTap(self){
}
//云端登陆
function cloudsLogin(self, id){
iot.business.user.autoLogin({
success: (response) => {
console.log("autoLogin");
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
uComponents.hideLoading(self);
iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
}else{
}
},
error: (error) => {
console.log(error);
iot.business.user.login({
data: {
username: id,
pwd: id,
},
success: (response) => {
console.log("login");
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
uComponents.hideLoading(self);
iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
}else{
}
},
error: (error) => {
console.log(error);
//不存在此用户
// if(code == 10002){
//用户注册
iot.business.user.reg({
data: {
username: id,
pwd: id,
vcode: id
},
success: (response) => {
console.log("regist");
console.log(response);
//注册成功
let data = uPublic.checkResponseData(response.data);
if(data){
uComponents.hideLoading(self);
iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
}else{
}
},
error: (error) => {
console.log(error);
//注册失败
uComponents.openAlert(self, Vue.t('login.failure'), {
text: Vue.t('dialog.confirm'), callback: function () {
plus.webview.currentWebview().reload();
}
});
},
complete: () => {}
});
// }
//请求失败
uPublic.openRequestErrorAlert(self);
},
complete: () => {}
});
},
complete: () => {}
});
//
}
//function cloudsLogin(self, id){
// uComponents.showLoading(self);
// iot.business.user.simpleLogin({
// data: {
// username: id
// },
// success: (response) => {
// let data = uPublic.checkResponseData(response.data);
// iot.business.user.autoLogin({
// success: (response) => {
// console.log("autoLogin");
// console.log(response);
// let data = uPublic.checkResponseData(response.data);
// if(data){
// uComponents.hideLoading(self);
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
......@@ -206,13 +119,100 @@ function cloudsLogin(self, id){
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// uPublic.openRequestErrorAlert(self);
// },
// complete: () => {
// uComponents.hideLoading(self);
// }
// },
// error: (error) => {
// console.log(error);
// iot.business.user.login({
// data: {
// username: id,
// pwd: id,
// },
// success: (response) => {
// console.log("login");
// console.log(response);
// let data = uPublic.checkResponseData(response.data);
// if(data){
// uComponents.hideLoading(self);
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// //不存在此用户
//// if(code == 10002){
// //用户注册
// iot.business.user.reg({
// data: {
// username: id,
// pwd: id,
// vcode: id
// },
// success: (response) => {
// console.log("regist");
// console.log(response);
// //注册成功
// let data = uPublic.checkResponseData(response.data);
// if(data){
// uComponents.hideLoading(self);
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// //注册失败
// uComponents.openAlert(self, Vue.t('login.failure'), {
// text: Vue.t('dialog.confirm'), callback: function () {
// plus.webview.currentWebview().reload();
// }
// });
// },
// complete: () => {}
// });
//// }
// //请求失败
// uPublic.openRequestErrorAlert(self);
// },
// complete: () => {}
// });
// },
// complete: () => {}
// });
//}
\ No newline at end of file
////
//}
function cloudsLogin(self, id){
uComponents.showLoading(self);
iot.business.user.simpleLogin({
data: {
username: id
},
success: (response) => {
let data = uPublic.checkResponseData(response.data);
if(data){
iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
}else{
}
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
},
complete: () => {
uComponents.hideLoading(self);
}
});
}
\ No newline at end of file
......@@ -16276,15 +16276,15 @@ function getLockInfo(self) {
// self.setBatteryState(config.powerIcon[Math.round(data.battery/20)]);
//判断云端是否绑定
if (data.lock_id) {
setValueOfSwitch(self, 1);
self.setLockId(data.lock_id);
self.setRole(data.role);
getDeviceStatus(self);
console.log(data.info);
if (data.info) {
self.newMsg = (0, _moment2.default)(data.info[0].time).format("YY.MM.DD HH:mm") + data.info[0].nickname + Vue.t('opendoorRecord.' + _config2.default.openDoorMode[data.info[0].mode] + '');
_public.uComponents.changeMarqueeText(self, self.newMsg);
setValueOfSwitch(self, 1);
if (self.isFirstGetLockInfo) {
getDeviceStatus(self);
self.setIsFirstGetLockInfo(false);
}
} else {
......
......@@ -110,14 +110,101 @@ function loginButtonTap(self) {
}
//云端登陆
//function cloudsLogin(self, id){
// iot.business.user.autoLogin({
// success: (response) => {
// console.log("autoLogin");
// console.log(response);
// let data = uPublic.checkResponseData(response.data);
// if(data){
// uComponents.hideLoading(self);
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// iot.business.user.login({
// data: {
// username: id,
// pwd: id,
// },
// success: (response) => {
// console.log("login");
// console.log(response);
// let data = uPublic.checkResponseData(response.data);
// if(data){
// uComponents.hideLoading(self);
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// //不存在此用户
//// if(code == 10002){
// //用户注册
// iot.business.user.reg({
// data: {
// username: id,
// pwd: id,
// vcode: id
// },
// success: (response) => {
// console.log("regist");
// console.log(response);
// //注册成功
// let data = uPublic.checkResponseData(response.data);
// if(data){
// uComponents.hideLoading(self);
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// //注册失败
// uComponents.openAlert(self, Vue.t('login.failure'), {
// text: Vue.t('dialog.confirm'), callback: function () {
// plus.webview.currentWebview().reload();
// }
// });
// },
// complete: () => {}
// });
//// }
// //请求失败
// uPublic.openRequestErrorAlert(self);
// },
// complete: () => {}
// });
// },
// complete: () => {}
// });
////
//}
function cloudsLogin(self, id) {
_public.iot.business.user.autoLogin({
_public.uComponents.showLoading(self);
_public.iot.business.user.simpleLogin({
data: {
username: id
},
success: function success(response) {
console.log("autoLogin");
console.log(response);
var data = _public.uPublic.checkResponseData(response.data);
if (data) {
_public.uComponents.hideLoading(self);
_public.iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
......@@ -126,96 +213,13 @@ function cloudsLogin(self, id) {
},
error: function error(_error3) {
console.log(_error3);
_public.iot.business.user.login({
data: {
username: id,
pwd: id
},
success: function success(response) {
console.log("login");
console.log(response);
var data = _public.uPublic.checkResponseData(response.data);
if (data) {
_public.uComponents.hideLoading(self);
_public.iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
} else {}
},
error: function error(_error4) {
console.log(_error4);
//不存在此用户
// if(code == 10002){
//用户注册
_public.iot.business.user.reg({
data: {
username: id,
pwd: id,
vcode: id
},
success: function success(response) {
console.log("regist");
console.log(response);
//注册成功
var data = _public.uPublic.checkResponseData(response.data);
if (data) {
_public.uComponents.hideLoading(self);
_public.iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
} else {}
},
error: function error(_error5) {
console.log(_error5);
//注册失败
_public.uComponents.openAlert(self, Vue.t('login.failure'), {
text: Vue.t('dialog.confirm'), callback: function callback() {
plus.webview.currentWebview().reload();
}
});
},
complete: function complete() {}
});
// }
//请求失败
_public.uPublic.openRequestErrorAlert(self);
},
complete: function complete() {}
});
_public.uPublic.openRequestErrorAlert(self);
},
complete: function complete() {}
complete: function complete() {
_public.uComponents.hideLoading(self);
}
});
//
}
//function cloudsLogin(self, id){
// uComponents.showLoading(self);
// iot.business.user.simpleLogin({
// data: {
// username: id
// },
// success: (response) => {
// let data = uPublic.checkResponseData(response.data);
// if(data){
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// uPublic.openRequestErrorAlert(self);
// },
// complete: () => {
// uComponents.hideLoading(self);
// }
// });
//}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))
/***/ }),
......
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