Commit 669e0628 by jenny

Merge branch 'zjx' into 'master'

Zjx

See merge request iot-project-js/doorlock!7
parents d66ebf1a 8ceb76ba
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"forgetPassword": "忘记密码", "forgetPassword": "忘记密码",
"device": "U智锁", "device": "U智锁",
"opendoorRecord": "开门记录", "opendoorRecord": "开门记录",
"alarmInfo": "报警信息", "alarmInfo": "报警记录",
"remoteOpendoor": "远程开门", "remoteOpendoor": "远程开门",
"hijackRecord": "劫持记录", "hijackRecord": "劫持记录",
"doorlockManage": "门锁管理", "doorlockManage": "门锁管理",
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"forgetPassword": "忘记密码", "forgetPassword": "忘记密码",
"device": "U智锁", "device": "U智锁",
"opendoorRecord": "开门记录", "opendoorRecord": "开门记录",
"alarmInfo": "报警信息", "alarmInfo": "报警记录",
"remoteOpendoor": "远程开门", "remoteOpendoor": "远程开门",
"hijackRecord": "劫持记录", "hijackRecord": "劫持记录",
"doorlockManage": "门锁管理", "doorlockManage": "门锁管理",
......
...@@ -108,6 +108,45 @@ uPublic.closeSlideBack = function (){ ...@@ -108,6 +108,45 @@ uPublic.closeSlideBack = function (){
}); });
} }
//logout退出
uPublic.logout = function(opts){
iot.business.user.logout({
data: opts.data,
success: (response) => {
console.log("sdsLogout:"+response);
var sdsResponse = response;
iot.business.api.send('user/logout',{
data: {
key: ['clienId']
},
success: (response) => {
console.log("logout"+response)
iot.business.websql.delMaps(['utoken', 'userinfo'], (response) => {
iot.storage.delMaps(['notifyTime','alarmTime','openTime'], (response) => {
console.log("clearMap"+response);
opts.success(sdsResponse);
}, (error) => {
opts.error(error);
});
}, (error) => {
opts.error(error);
});
},
error: (error) => {
opts.error(error);
},
complete: () => {
opts.complete();
}
}, true, false);
},
error: (error) => {
opts.error(error);
},
complete: () => {}
});
}
iot.ready(() => { iot.ready(() => {
uPublic.recalc(); uPublic.recalc();
}); });
...@@ -147,15 +186,20 @@ iot.navigator.trigger = function (element, eventType, eventData) { ...@@ -147,15 +186,20 @@ iot.navigator.trigger = function (element, eventType, eventData) {
}; };
iot.navigator.closeAllBesidesItself = function () { iot.navigator.closeAllBesidesItself = function () {
setTimeout(function () {
var wvs = plus.webview.all(); var wvs = plus.webview.all();
var curWb = plus.webview.currentWebview(); var page = plus.webview.currentWebview();
for (var i = 0; i < wvs.length-1; i++) { for (var i = 0; i < wvs.length; i++) {
if (wvs[i].id != curWb.id) { if (wvs[i].id != page.id && wvs[i]) {
wvs[i].close(); // wvs[i].close();
plus.webview.close(wvs[i],"none",0,{});
} }
} }
var wvs = plus.webview.all();
}, 500);
} }
iot.navigator.closeAll = function (){ iot.navigator.closeAll = function (){
var wvs = plus.webview.all(); var wvs = plus.webview.all();
var curWb = plus.webview.currentWebview(); var curWb = plus.webview.currentWebview();
...@@ -165,9 +209,13 @@ iot.navigator.closeAll = function (){ ...@@ -165,9 +209,13 @@ iot.navigator.closeAll = function (){
} }
iot.ready(function(){ iot.ready(function(){
// plus.key.addEventListener('backbutton',iot.navigator.aback,false); plus.key.addEventListener('backbutton',iot.navigator.aback,false);
}) })
iot.navigator.aback = function(){
mui.back();
}
var __back__first = null; var __back__first = null;
mui.back = function(){ mui.back = function(){
...@@ -223,20 +271,22 @@ mui.back = function(){ ...@@ -223,20 +271,22 @@ mui.back = function(){
} }
} }
iot.navigator.getCurrentWebView = function (){ iot.navigator.getCurrentWebView = function (){
return plus.webview.currentWebview(); return plus.webview.currentWebview();
} }
function requestsend(url, opts, i){
opts.success(i);
}
function clearTime(interval, timeout){
window.clearInterval(interval);
window.clearTimeout(timeout);
}
//function requestsend(url, opts, i){
// let data = [0,0,0,0,0,0,0,1,0,0,0];
// opts.success(data[i]);
//}
//
//function clearTime(interval, timeout){
// window.clearInterval(interval);
// window.clearTimeout(timeout);
//}
//
//uComponents.loop = function(request, timeout, interval, fincb, stopcondition){ //uComponents.loop = function(request, timeout, interval, fincb, stopcondition){
// var handle = null; // var handle = null;
// var time = null; // var time = null;
...@@ -246,7 +296,22 @@ function clearTime(interval, timeout){ ...@@ -246,7 +296,22 @@ function clearTime(interval, timeout){
// var intervalcb = interval.opts; // var intervalcb = interval.opts;
// var flag = true; // var flag = true;
// var i = 0; // var i = 0;
// // time = setTimeout(function(){
// clearTime(handle, time);
// intervalcb.error('timeout');
// fincb.error('timeout');
// },timeout);
// //一开始执行一次,发送一次请求
// requestsend(url, {
// data: {},
// success: (response) => {
// intervalcb.success(response);
// if(stopcondition(response)){
// //首次请求结果符合条件的话,结束整个方法
// fincb.success(response);
// clearTime(handle, time);
// }else{
// //首次请求结果不符合条件的话,每隔intervalTime时间发送请求
// handle = setInterval(() => { // handle = setInterval(() => {
// i++; // i++;
// console.log(i); // console.log(i);
...@@ -263,20 +328,32 @@ function clearTime(interval, timeout){ ...@@ -263,20 +328,32 @@ function clearTime(interval, timeout){
// flag = true; // flag = true;
// }, // },
// error: (error) => { // error: (error) => {
// intervalcb.success(response); // intervalcb.error(error);
// fincb.success(error); // fincb.error(error);
// clearTime(handle, time); // clearTime(handle, time);
// }, // },
// complete: {} // complete: {}
// }, i); // }, i);
// } // }
// },intervalTime); // },intervalTime);
// // }
// time = setTimeout(function(){ // },
// error: (error) => {
// intervalcb.error(error);
// fincb.error(error);
// clearTime(handle, time); // clearTime(handle, time);
// },timeout); // },
// complete: {}
// }, 0);
//
//} //}
// //
////传递的参数依次是:
////1.request: 请求参数(数据类型: map,包括:url、header等);
////2.timeout: 整个方法的超时时间;
////3.interval: 发送请求的间隔时间、callback;
////4.fincb: 整个方法的callback;
////5.stopcondition: 请求停止所要符合的条件
//uComponents.loop({url:'getLockInfo',opts: { //uComponents.loop({url:'getLockInfo',opts: {
// success: (response) => { // success: (response) => {
// console.log(response); // console.log(response);
...@@ -284,14 +361,14 @@ function clearTime(interval, timeout){ ...@@ -284,14 +361,14 @@ function clearTime(interval, timeout){
// error: (error) => { // error: (error) => {
// console.log(error); // console.log(error);
// } // }
//}}, 10000, { //}}, 8000, {
// delay: 1000, // delay: 1000,
// opts: { // opts: {
// success: (response) => { // success: (response) => {
// console.log('intervalcbSuccess:'+response); // console.log('intervalcbSuccess:'+response);
// }, // },
// error: (error) => { // error: (error) => {
// console.log(error); // console.log('intervalcbSuccess:'+error);
// } // }
// } // }
//}, { //}, {
...@@ -299,10 +376,10 @@ function clearTime(interval, timeout){ ...@@ -299,10 +376,10 @@ function clearTime(interval, timeout){
// console.log('fincbSuccess:'+response); // console.log('fincbSuccess:'+response);
// }, // },
// error: (error) => { // error: (error) => {
// console.log(error); // console.log('fincbError'+error);
// } // }
//}, (response) => { //}, (response) => {
// if(response == 5){ // if(response == 1){
// return true; // return true;
// }else{ // }else{
// return false; // return false;
......
...@@ -3,12 +3,19 @@ ...@@ -3,12 +3,19 @@
* unotify * unotify
*/ */
class unotify{ class unotify{
//在一个周期内获取cid
static async getCid(successCallback, errorCallback){ static async getCid(successCallback, errorCallback){
var a = null; var cid = null;
try{ try{
a = await this.getCidPeriotic(3); //利用promise,直到执行完代码再获取cid
cid = await this.getCidPeriotic(3);
//获取后,在缓存中存储cid
if(typeof successCallback == 'function'){ if(typeof successCallback == 'function'){
successCallback(a); iot.storage.setMap('clientId', cid, (res) => {
console.log("已成功保存cid"+cid);
successCallback(cid);
}, () => {
});
} }
} }
catch (err){ catch (err){
...@@ -18,6 +25,7 @@ class unotify{ ...@@ -18,6 +25,7 @@ class unotify{
} }
} }
} }
//周期性获取cid,周期可调整
static getCidPeriotic(times){ static getCidPeriotic(times){
var self = this; var self = this;
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
...@@ -26,14 +34,16 @@ class unotify{ ...@@ -26,14 +34,16 @@ class unotify{
var handle = null; var handle = null;
i++; i++;
cid = self.getCidOnce(i); cid = self.getCidOnce(i);
if(cid != null || i >= times){ console.log("第"+i+"次"+"获取的cid为"+cid);
if(cid != null && cid != 'null' || i >= times){
window.clearInterval(handle); window.clearInterval(handle);
resolve(cid); resolve(cid);
}else{ }else{
handle = setInterval(function(){ handle = setInterval(function(){
i++; i++;
cid = self.getCidOnce(i); cid = self.getCidOnce(i);
if(cid != null || i >= times){ console.log("第"+i+"次"+"获取的cid为"+cid);
if(cid != null && cid != 'null' || i >= times){
window.clearInterval(handle); window.clearInterval(handle);
resolve(cid); resolve(cid);
} }
...@@ -41,13 +51,51 @@ class unotify{ ...@@ -41,13 +51,51 @@ class unotify{
} }
}); });
} }
//单次获取cid
static getCidOnce(i){ static getCidOnce(i){
var clientInfo = plus.push.getClientInfo(); var clientInfo = plus.push.getClientInfo();
if(clientInfo && clientInfo.hasOwnProperty('clientid') && clientInfo.clientid){ if(clientInfo && clientInfo.hasOwnProperty('clientid') && clientInfo.clientid){
// if(i == 6){
return(clientInfo.clientid); return(clientInfo.clientid);
// }else{
// return(null);
// }
}else{ }else{
return(null); return(null);
} }
} }
//长期不断循环获取cid,并更新cid
// static async getCid(successCallback, errorCallback){
// var cid = null;
// var oldCid = null;
// try{
// cid = await this.getCidPeriotic(9);
// if(cid != null && cid != oldCid){
// successCallback('cid updateSuccess');
// iot.business.api.send('user/updateCid',{
// data: {
// clienId: cid
// },
// success: (response) => {
// if(typeof successCallback == 'function'){
// uccessCallback('cid updateSuccess');
// }
// },
// error: (error) => {
// console.log(error);
// errorCallback(error);
// }
// }, true, false);
// }else{
// successCallback('cid not updated');
// }
// }
// catch (err){
// console.log(err);
// if(typeof errorCallback == 'function'){
// errorCallback(err);
// }
// }
// }
} }
export default unotify; export default unotify;
\ No newline at end of file
...@@ -13,6 +13,7 @@ iot.ready(init); ...@@ -13,6 +13,7 @@ iot.ready(init);
function init() { function init() {
//通用 list、dialog、loading组件 //通用 list、dialog、loading组件
uPublic.componentsInit(['u-list','u-dialog','u-loading']); uPublic.componentsInit(['u-list','u-dialog','u-loading']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
//配置组件 //配置组件
......
...@@ -13,6 +13,7 @@ iot.ready(init); ...@@ -13,6 +13,7 @@ iot.ready(init);
function init() { function init() {
//通用 dialog、loading组件 //通用 dialog、loading组件
uPublic.componentsInit(['u-dialog','u-loading']); uPublic.componentsInit(['u-dialog','u-loading']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
//配置组件 //配置组件
......
...@@ -14,6 +14,7 @@ function init() { ...@@ -14,6 +14,7 @@ function init() {
console.log("init" + new Date().getTime()); console.log("init" + new Date().getTime());
//通用 dialog、loading组件 //通用 dialog、loading组件
uPublic.componentsInit(['u-dialog','u-loading']); uPublic.componentsInit(['u-dialog','u-loading']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
//配置组件 //配置组件
......
...@@ -135,7 +135,7 @@ function passwordChange(self,text){ ...@@ -135,7 +135,7 @@ function passwordChange(self,text){
console.log('passwordChange: ' + self.textPassword); console.log('passwordChange: ' + self.textPassword);
} }
iot.navigator.aback = 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();
} }
......
...@@ -13,6 +13,7 @@ iot.ready(init); ...@@ -13,6 +13,7 @@ iot.ready(init);
function init() { function init() {
//通用 按钮、dialog、loading组件 //通用 按钮、dialog、loading组件
uPublic.componentsInit(['u-button','u-dialog','u-loading']); uPublic.componentsInit(['u-button','u-dialog','u-loading']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
//配置组件 //配置组件
......
...@@ -149,7 +149,7 @@ function backTap(){ ...@@ -149,7 +149,7 @@ function backTap(){
iot.navigator.aback(); iot.navigator.aback();
} }
iot.navigator.aback = 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");
iot.navigator.back(); iot.navigator.back();
......
...@@ -170,7 +170,7 @@ function backTap(){ ...@@ -170,7 +170,7 @@ function backTap(){
iot.navigator.aback(); iot.navigator.aback();
} }
iot.navigator.aback = 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");
iot.navigator.back(); iot.navigator.back();
......
...@@ -15,9 +15,12 @@ import {iot, uPublic, uComponents} from '../../public/public.js'; ...@@ -15,9 +15,12 @@ import {iot, uPublic, uComponents} from '../../public/public.js';
iot.ready(init); iot.ready(init);
function init() { function init() {
uPublic.closeSlideBack();
//通用 图片轮播、跑马灯、开关、按钮、dialog、loading组件 //通用 图片轮播、跑马灯、开关、按钮、dialog、loading组件
uPublic.componentsInit(['u-carousel','u-marquee','u-switch','u-button','u-dialog','u-loading','u-text','u-comm-loading']); uPublic.componentsInit(['u-carousel','u-marquee','u-switch','u-button','u-dialog','u-loading','u-text','u-comm-loading']);
if(iot.navigator.getExtras().needClose){
iot.navigator.closeAllBesidesItself();
}
const app = new Vue({ const app = new Vue({
data:{ data:{
//开门记录 //开门记录
...@@ -101,9 +104,9 @@ function init() { ...@@ -101,9 +104,9 @@ function init() {
remoteTime: null remoteTime: null
}, },
mounted(){ mounted(){
uComponents.showLoading(this);
notificationListener(this); notificationListener(this);
let self = this; let self = this;
iot.navigator.closeAllBesidesItself();
//获取设备信息 //获取设备信息
getDevices(this); getDevices(this);
//注册监听上报 //注册监听上报
...@@ -482,6 +485,7 @@ function getDevices(self){ ...@@ -482,6 +485,7 @@ function getDevices(self){
self.hijackAlarmFlag = false; self.hijackAlarmFlag = false;
self.setRemoteOpendoorDisabledFlag(true); self.setRemoteOpendoorDisabledFlag(true);
self.setValueRemoteOpendoor(0); self.setValueRemoteOpendoor(0);
uComponents.hideLoading(self);
} }
}, },
error: (error) => { error: (error) => {
...@@ -493,7 +497,8 @@ function getDevices(self){ ...@@ -493,7 +497,8 @@ function getDevices(self){
iotDebug.upload(iot,'获取设备信息'); iotDebug.upload(iot,'获取设备信息');
} }
uPublic.openRequestErrorAlert(self); uPublic.openRequestErrorAlert(self);
} },
complete: () => {}
}); });
} }
...@@ -714,6 +719,7 @@ function getLockInfo(self){ ...@@ -714,6 +719,7 @@ function getLockInfo(self){
console.log(error); console.log(error);
}, },
complete: () => { complete: () => {
uComponents.hideLoading(self);
} }
}); });
} }
......
...@@ -107,7 +107,7 @@ function backTap(){ ...@@ -107,7 +107,7 @@ function backTap(){
iot.navigator.aback(); iot.navigator.aback();
} }
iot.navigator.aback = 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");
iot.navigator.back(); iot.navigator.back();
......
...@@ -262,7 +262,7 @@ function backTap(){ ...@@ -262,7 +262,7 @@ function backTap(){
iot.navigator.aback(); iot.navigator.aback();
} }
iot.navigator.aback = 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");
iot.navigator.back(); iot.navigator.back();
......
...@@ -14,6 +14,7 @@ iot.ready(init); ...@@ -14,6 +14,7 @@ iot.ready(init);
function init() { function init() {
//通用 按钮、dialog、loading组件 //通用 按钮、dialog、loading组件
uPublic.componentsInit(['u-button','u-dialog','u-loading']); uPublic.componentsInit(['u-button','u-dialog','u-loading']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
//配置组件 //配置组件
......
...@@ -290,7 +290,7 @@ function sleep(time){ ...@@ -290,7 +290,7 @@ function sleep(time){
}) })
} }
iot.navigator.aback = 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();
} }
......
...@@ -292,7 +292,7 @@ function setUserInfo(self, data){ ...@@ -292,7 +292,7 @@ function setUserInfo(self, data){
self.setUnbindShowFlag(data.user_id ? true : false); self.setUnbindShowFlag(data.user_id ? true : false);
} }
iot.navigator.aback = function(){ mui.back = function(){
let opener = plus.webview.currentWebview().opener(); let opener = plus.webview.currentWebview().opener();
if(opener.id == 'addUser'){ if(opener.id == 'addUser'){
opener.close(); opener.close();
......
...@@ -209,7 +209,7 @@ function backTap(){ ...@@ -209,7 +209,7 @@ function backTap(){
iot.navigator.aback(); iot.navigator.aback();
} }
iot.navigator.aback = 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");
iot.navigator.back(); iot.navigator.back();
......
...@@ -77,8 +77,12 @@ function initComponentsConfig() { ...@@ -77,8 +77,12 @@ function initComponentsConfig() {
//tap < //tap <
function backTap(){ function backTap(){
iot.navigator.aback();
}
mui.back = function(){
iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{}); iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{});
console.log('returnPage'); console.log("fire");
iot.navigator.back(); iot.navigator.back();
} }
......
...@@ -13,6 +13,7 @@ iot.ready(init); ...@@ -13,6 +13,7 @@ iot.ready(init);
function init() { function init() {
//通用 input、按钮、dialog、loading组件 //通用 input、按钮、dialog、loading组件
uPublic.componentsInit(['u-text','u-button','u-dialog','u-loading']); uPublic.componentsInit(['u-text','u-button','u-dialog','u-loading']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
numberTel: null, numberTel: null,
......
...@@ -15,6 +15,10 @@ function init() { ...@@ -15,6 +15,10 @@ function init() {
//通用 dialog、loading组件 //通用 dialog、loading组件
uPublic.componentsInit(['u-dialog','u-loading','u-button']); uPublic.componentsInit(['u-dialog','u-loading','u-button']);
uPublic.closeSlideBack(); uPublic.closeSlideBack();
//是否需要关闭其他页面
if(iot.navigator.getExtras().needClose){
iot.navigator.closeAllBesidesItself();
}
const app = new Vue({ const app = new Vue({
data:{ data:{
//配置组件 //配置组件
...@@ -193,7 +197,10 @@ function cloudsLogin(self, id){ ...@@ -193,7 +197,10 @@ function cloudsLogin(self, id){
iot.business.websql.setMaps(infoArray, () =>{ iot.business.websql.setMaps(infoArray, () =>{
iot.navigator.openWindow({ iot.navigator.openWindow({
url: '../device/index.html', url: '../device/index.html',
id: 'device' id: 'device',
extras: {
needClose: true
}
}); });
}, (error) => { }, (error) => {
console.log(error); console.log(error);
......
...@@ -13,6 +13,7 @@ iot.ready(init); ...@@ -13,6 +13,7 @@ iot.ready(init);
function init() { function init() {
//通用 input、按钮、dialog、loading组件 //通用 input、按钮、dialog、loading组件
uPublic.componentsInit(['u-text','u-button','u-dialog','u-loading']); uPublic.componentsInit(['u-text','u-button','u-dialog','u-loading']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
numberTel: null, numberTel: null,
......
...@@ -13,6 +13,7 @@ iot.ready(init); ...@@ -13,6 +13,7 @@ iot.ready(init);
function init() { function init() {
//通用 input、按钮、dialog、loading组件 //通用 input、按钮、dialog、loading组件
uPublic.componentsInit(['u-text','u-button','u-dialog','u-loading']); uPublic.componentsInit(['u-text','u-button','u-dialog','u-loading']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
numberTel: null, numberTel: null,
......
...@@ -108,7 +108,7 @@ function saveTap(self){ ...@@ -108,7 +108,7 @@ function saveTap(self){
} }
} }
iot.navigator.aback = 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();
} }
......
...@@ -13,6 +13,7 @@ iot.ready(init); ...@@ -13,6 +13,7 @@ iot.ready(init);
function init() { function init() {
//通用 dialog、loading组件 //通用 dialog、loading组件
uPublic.componentsInit(['u-dialog','u-loading','u-text']); uPublic.componentsInit(['u-dialog','u-loading','u-text']);
uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
//配置组件 //配置组件
......
...@@ -108,12 +108,6 @@ function getInfo(self){ ...@@ -108,12 +108,6 @@ function getInfo(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: () => {}
...@@ -125,49 +119,55 @@ function logoutButtonTap(self){ ...@@ -125,49 +119,55 @@ function logoutButtonTap(self){
uComponents.openConfirm(self, Vue.t('myInfo.logoutDialogTip'), uComponents.openConfirm(self, Vue.t('myInfo.logoutDialogTip'),
{text: Vue.t('dialog.cancel'), callback: function () {}}, {text: Vue.t('dialog.cancel'), callback: function () {}},
{text: Vue.t('dialog.confirm'), callback: function () { {text: Vue.t('dialog.confirm'), callback: function () {
// uPublic.logout({
// data: {
// sds: true
// },
// success: (response) => {
// console.log(response);
// iot.navigator.openWindow({
// url: '../login/index.html',
// id: 'login',
// extras: {
// needClose: true
// }
// });
// },
// error: (error) => {
// console.log(error);
// },
// complete: () => {}
// });
iot.business.user.logout({ iot.business.user.logout({
data: { data: {},
sds: true
},
success: (response) => { success: (response) => {
console.log("sdsLogout:"+response);
let sdsResponse = response;
iot.business.websql.delMaps(['utoken', 'userinfo'], (response) => { iot.business.websql.delMaps(['utoken', 'userinfo'], (response) => {
console.log(response); iot.storage.delMaps(['notifyTime','alarmTime','openTime'], (response) => {
console.log("clearMap"+response);
//打开首页
iot.navigator.openWindow({
url: '../login/index.html',
id: 'login',
extras: {
needClose: true
}
});
}, (error) => { }, (error) => {
console.log(error); console.log(error);
// if(window.iotDebug){
// iotDebug.push('end: 清除tocken失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'清除tocken失败');
// }
uPublic.openRequestErrorAlert(self); uPublic.openRequestErrorAlert(self);
}); });
iot.storage.delMaps(['notifyTime','alarmTime','openTime'], (response) => { }, (error) => {
console.log(response); console.log(error);
}, () => { uPublic.openRequestErrorAlert(self);
});
iot.navigator.openWindow({
url: '../login/index.html',
id: 'login'
}); });
let wvs = plus.webview.all();
for (var i = 0; i < wvs.length-1; i++) {
plus.webview.close(wvs[i]);
}
}, },
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: () => {}
console.log("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