Commit 314b404f by 朱建香

2017/12/22

1.首页代码规范优化
parent 6049e46b
...@@ -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;
......
...@@ -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();
}); });
......
...@@ -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
} }
}); });
} }
......
...@@ -40,7 +40,7 @@ function init() { ...@@ -40,7 +40,7 @@ function init() {
setTextPassword(pwd){ setTextPassword(pwd){
this.textPassword = pwd; this.textPassword = pwd;
}, },
gettTextErrorTip(){ 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
...@@ -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
...@@ -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,7 +83,8 @@ function initComponentsConfig() { ...@@ -82,7 +83,8 @@ function initComponentsConfig() {
} }
} }
function resolve(self) { // 获取历史记录
function resolve(self) {
self.setDeviceId(iot.navigator.getExtras().deviceId); self.setDeviceId(iot.navigator.getExtras().deviceId);
uComponents.showLoading(self); uComponents.showLoading(self);
iot.business.api.sendCustom('lock/getHistoryRecord', iot.business.api.sendCustom('lock/getHistoryRecord',
...@@ -93,18 +95,13 @@ function initComponentsConfig() { ...@@ -93,18 +95,13 @@ function initComponentsConfig() {
start_id: self.getStartId(), start_id: self.getStartId(),
page_size: PAGE_SIZE page_size: PAGE_SIZE
}, },
success: (response) => { success: async (response) => {
console.log(response); console.log(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('notifyTime', moment(record[0].time).unix(), (res) => { self.flag = await uPublic.upDateRead('notify', moment(record[0].time).unix());
// console.log(res);
// self.flag = false;
// }, () => {
// });
uPublic.upDateRead('notify');
} }
} }
let data = uPublic.checkResponseData(response.data); let data = uPublic.checkResponseData(response.data);
...@@ -131,25 +128,20 @@ function initComponentsConfig() { ...@@ -131,25 +128,20 @@ 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: () => {
uComponents.hideLoading(self); 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");
......
...@@ -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");
......
...@@ -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,12 +165,6 @@ function getPersonalHistory(self, id){ ...@@ -173,12 +165,6 @@ function getPersonalHistory(self, id){
}, },
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: () => {
...@@ -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){
......
...@@ -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();
......
...@@ -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());
} }
...@@ -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({
......
...@@ -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 }
}); });
......
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