Commit 9b83a9ab by 朱建香

1113

parent 2856b73b
......@@ -38,4 +38,5 @@ export default {
"remote_opendoor_timeout": 30000,
//二维码失效时间
"qrcode_timeout": 6000,
"remote_timeout": 300
}
\ No newline at end of file
......@@ -87,7 +87,8 @@ uPublic.checkResponseData = function (data) {
uPublic.openWindow = function (params){
console.log("innnnn");
var wv = plus.webview.create(params.url, params.id, { styles: params.styles || {} }, { IOTData: params.extras });
var wv = plus.webview.create(params.url, params.id, {styles: params.styles || {} }, { IOTData: params.extras });
console.log(wv);
wv.addEventListener('titleUpdate', function(){
wv.show('slide-in-right');
});
......
......@@ -154,7 +154,10 @@ function connectButtonTap(self){
console.log(response);
console.log(JSON.stringify(response));
if(window.iotDebug){
iotDebug.push('end: findWifi'+JSON.stringify(response));
iotDebug.push('end: findWifi');
}
if(window.iotDebug){
iotDebug.push('end: '+JSON.stringify(response));
}
if (window.iotDebug) {
iotDebug.upload(iot);
......@@ -162,7 +165,7 @@ function connectButtonTap(self){
if(response.data == 'onProvisioning'){
//wifi链接中
if(window.iotDebug){
iotDebug.push('end: 开始配网');
iotDebug.push('end: 配网中'+JSON.stringify(response));
}
if (window.iotDebug) {
iotDebug.upload(iot);
......@@ -171,7 +174,7 @@ function connectButtonTap(self){
uComponents.changeCommLoadingStatusAndText(self, 0, Vue.t('wifiAdd.wifiBinding'));
}else if(response.data == 'provisioned success'){
if(window.iotDebug){
iotDebug.push('end: 配网成功');
iotDebug.push('end: 配网成功'+JSON.stringify(response));
}
if (window.iotDebug) {
iotDebug.upload(iot);
......@@ -207,7 +210,7 @@ function connectButtonTap(self){
let productId = iot.navigator.getExtras().model;
if(response.data == "onJoining"){
if(window.iotDebug){
iotDebug.push('end: 激活中');
iotDebug.push('end: 激活中'+JSON.stringify(response));
}
if (window.iotDebug) {
iotDebug.upload(iot);
......@@ -215,7 +218,7 @@ function connectButtonTap(self){
uComponents.changeCommLoadingStatusAndText(self, 0, Vue.t('wifiAdd.deviceActivating'));
}else if(response.data == "joined success"){
if(window.iotDebug){
iotDebug.push('end: 激活成功');
iotDebug.push('end: 激活成功'+JSON.stringify(response));
}
if (window.iotDebug) {
iotDebug.upload(iot);
......@@ -226,7 +229,7 @@ function connectButtonTap(self){
}else if(response.data == "fail"){
//连接失败
if(window.iotDebug){
iotDebug.push('end: 激活失败');
iotDebug.push('end: 激活失败'+JSON.stringify(response));
}
if (window.iotDebug) {
iotDebug.upload(iot);
......@@ -244,7 +247,7 @@ function connectButtonTap(self){
error: (error) => {
console.log(error);
if(window.iotDebug){
iotDebug.push('end: findDevicesError'+JSON.stringify(response));
iotDebug.push('end: findDevicesError'+JSON.stringify(error));
}
if (window.iotDebug) {
iotDebug.upload(iot);
......@@ -294,9 +297,24 @@ function unbind(self, deviceId, productId){
success: (response) => {
console.log(response);
bind(self, deviceId, productId);
if(window.iotDebug){
iotDebug.push('end: findDevicesError'+JSON.stringify(response));
}
if (window.iotDebug) {
iotDebug.upload(iot);
}
},
error: (error) => {
console.log(error);
uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('wifiAdd.deviceActivateFailure'));
uComponents.changeCommButtonText(self, Vue.t('addDevice.reBindDevice'));
self.setStatus(2);
if(window.iotDebug){
iotDebug.push('end: findDevicesError'+JSON.stringify(error));
}
if (window.iotDebug) {
iotDebug.upload(iot);
}
},
complete: () => {
}
......@@ -319,12 +337,24 @@ function bind(self, deviceId, productId){
uComponents.changeCommButtonText(self, Vue.t('btn.confirm'));
self.setStatus(1);
}
if(window.iotDebug){
iotDebug.push('end: findDevicesError'+JSON.stringify(response));
}
if (window.iotDebug) {
iotDebug.upload(iot);
}
},
error: (error) => {
console.log(error);
uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('wifiAdd.deviceActivateFailure'));
uComponents.changeCommButtonText(self, Vue.t('addDevice.reBindDevice'));
self.setStatus(2);
if(window.iotDebug){
iotDebug.push('end: findDevicesError'+JSON.stringify(error));
}
if (window.iotDebug) {
iotDebug.upload(iot);
}
},
complete: () => {}
});
......
......@@ -21,17 +21,17 @@ function init() {
const app = new Vue({
data:{
//开门记录
valueOpendoorRecord: 1,
valueOpendoorRecord: 0,
//安全报警
valueSecurityAlarm: 1,
valueSecurityAlarm: 0,
//门锁用户
valueDoorlockUser: 1,
valueDoorlockUser: 0,
//劫持报警
valueHijackAlarm: 1,
valueHijackAlarm: 0,
//远程开门
valueRemoteOpendoor: 0,
//门锁管理
valueDoorlockManage: 1,
valueDoorlockManage: 0,
//开门记录
opendoorRecordDisabledFlag: false,
//安全报警
......@@ -124,7 +124,6 @@ function init() {
uPublic.openRequestErrorAlert(self);
}
});
},
methods:{
setValueRemoteOpendoor(value){
......@@ -522,6 +521,11 @@ function setValueOfSwitch(self, flag){
self.setDoorlockUserDisabledFlag(flag);
self.setHijackAlarmDisabledFlag(flag);
self.setDoorlockManageDisabledFlag(flag);
self.valueOpendoorRecord = !flag;
self.valueSecurityAlarm = !flag;
self.valueDoorlockUser = !flag;
self.valueHijackAlarm = !flag;
self.valueDoorlockManage = !flag;
}
function getDeviceStatus(self){
......@@ -626,7 +630,10 @@ function setDevceInfo(self, data) {
// self.setRemoteOpendoorFlag(true);
let now = moment();
let time = moment(data.time.value, "YY-MM-DD-hh-mm-ss");
if(now.diff(time,'hours') < 24){
console.log(now);
console.log(time);
console.log(now.diff(time,'seconds'));
if(now.diff(time,'seconds') < config.remote_timeout){
self.setValueRemoteOpendoor(true);
self.setRemoteOpendoorDisabledFlag(false);
}
......@@ -702,13 +709,30 @@ function pushAction(self, msg) {
}
function notificationListener(self) {
// if (plus.os.name == 'Android') {
// setInterval(function () {
// var pushMsgArray = plus.push.getAllMessage();
// if (pushMsgArray) {
// var pushMsgLength = pushMsgArray.length;
// if (pushMsgLength) {
// var pushMsg = pushMsgArray[(pushMsgArray.length - 1)];
// pushAction(pushMsg);
// plus.push.clear();
// }
// }
// }, 5000);
// }
// 从系统消息中心点击消息启动应用事件
plus.push.addEventListener('click', function (msg) {
console.log("收到了click");
pushAction(self, msg);
alert("click"+JSON.stringify(msg));
}, false);
// 应用从推送服务器接收到推送消息事件
plus.push.addEventListener('receive', function (msg) {
console.log("收到了receive");
pushAction(self, msg);
alert("receive"+JSON.stringify(msg));
// plus.push.createMessage(msg.content, msg.payload);
}, false);
}
......@@ -736,6 +760,12 @@ function myInfoTap(self){
'background': 'transparent'
}
});
// let wv = plus.webview.create( '../myInfo/index.html', 'myInfo',{subNViews:[{id:'subnview1',styles:{top:'0px',width: '100px',height:'100px',backgroundColor:'#FF0000'}}],background:'#ff0000',top:'100px',bottom:'0px'});
// wv.show();
// plus.webview.create('new.html', 'new', {'titleNView':{'backgroundcolor':'#FFFFFF','titletext':'标题栏','titlecolor':'#FF0000'}});
}
//tap 绑定门锁
......@@ -749,7 +779,7 @@ function bindDoorlockTap(){
//tap 门锁管理
function doorlockManageTap(self){
// if(self.getValueDoorlockManage() == 1){
if(self.valueDoorlockManage){
iot.navigator.openWindow({
url: '../doorlockManage/index.html',
id: 'doorlockManage',
......@@ -760,12 +790,12 @@ function doorlockManageTap(self){
lockId: self.getLockId()
}
});
// }
}
}
//tap 开门记录
function opendoorRecordTap(self){
if(self.openTime != null){
if(self.openTime != null && self.valueOpendoorRecord){
self.opendoorRecordFlag = false;
setRecordTime('openTime', self.openTime.toISOString());
}
......@@ -780,7 +810,7 @@ function opendoorRecordTap(self){
//tap 安全报警
function securityAlarmTap(self){
if(self.notifyTime != null){
if(self.notifyTime != null && self.valueSecurityAlarm){
self.securityAlarmFlag = false;
setRecordTime('notifyTime', self.notifyTime.toISOString());
}
......@@ -795,7 +825,7 @@ function securityAlarmTap(self){
//tap 门锁用户
function doorlockUserTap(self){
// if(self.getValueDoorlockUser() == 1){
if(self.valueDoorlockUser){
iot.navigator.openWindow({
url: '../doorlockUsers/index.html',
id: 'doorlockUsers',
......@@ -806,12 +836,12 @@ function doorlockUserTap(self){
role: self.getRole(),
}
});
// }
}
}
//tap 远程开门
function remoteOpendoorTap(self){
// if(self.getValueRemoteOpendoor() == 1){
// if(self.valueRemoteOpendoor){
// iot.navigator.openWindow({
// url: './remoteOpendoor.html',
// id: 'remoteOpendoor',
......@@ -821,14 +851,16 @@ function remoteOpendoorTap(self){
// }
// });
// }
self.setRemoteOpendoorShowFlag(true);
self.setValueRemoteOpendoor(false);
self.setRemoteOpendoorDisabledFlag(true);
if(self.valueRemoteOpendoor){
self.setRemoteOpendoorShowFlag(true);
self.setValueRemoteOpendoor(false);
self.setRemoteOpendoorDisabledFlag(true);
}
}
//tap 劫持报警
function hijackAlarmTap(self){
if(self.alarmTime != null){
if(self.alarmTime != null && self.valueHijackAlarm){
self.hijackAlarmFlag = false;
setRecordTime('alarmTime', self.alarmTime.toISOString());
}
......
......@@ -399,7 +399,22 @@ function cancelTap(self){
function confirmTap(self){
self.setUnbindShowDialog(false);
unbind(self);
iot.business.sds.unbindDevice({
data: {
uuid: self.extras.uuid
},
success: (response) => {
console.log(response);
unbind(self);
},
error: (error) => {
console.log(error)
},
complete: () => {
}
});
// unbind(self);
}
function isClearSwitchTap(self, value){
......
......@@ -8,6 +8,7 @@
*/
let QRCode = require('qrcode');
import config from '../../public/config.js';
import {iot, uPublic, uComponents} from '../../public/public.js';
iot.ready(init);
......
......@@ -9594,6 +9594,7 @@ uPublic.checkResponseData = function (data) {
uPublic.openWindow = function (params) {
console.log("innnnn");
var wv = plus.webview.create(params.url, params.id, { styles: params.styles || {} }, { IOTData: params.extras });
console.log(wv);
wv.addEventListener('titleUpdate', function () {
wv.show('slide-in-right');
});
......@@ -9959,7 +9960,8 @@ exports.default = {
"ring_time": 30000,
"remote_opendoor_timeout": 30000,
//二维码失效时间
"qrcode_timeout": 6000
"qrcode_timeout": 6000,
"remote_timeout": 300
};
/***/ }),
......
......@@ -414,7 +414,20 @@ function cancelTap(self) {
function confirmTap(self) {
self.setUnbindShowDialog(false);
unbind(self);
_public.iot.business.sds.unbindDevice({
data: {
uuid: self.extras.uuid
},
success: function success(response) {
console.log(response);
unbind(self);
},
error: function error(_error3) {
console.log(_error3);
},
complete: function complete() {}
});
// unbind(self);
}
function isClearSwitchTap(self, value) {
......
......@@ -34,14 +34,14 @@
<img class="userInfo-subimage" v-if="userInfo.image && userInfo.role != 0" v-bind:src="userInfo.image">
{{ $t('doorlockUser.name') }}<span class="userInfo-name" v-if="userInfo.subtitle">{{ userInfo.subtitle }}</span>
<v-touch tag="span" class="userInfo-toBind" v-show="bindShowFlag && !role" v-on:tap="onBindTap">{{ $t('doorlockUser.inviteBind') }}</v-touch>
<u-button :init-param="componentsConfig.unbindButton.initParam" v-on:u-button-tap="onUnbindButtonTap" v-show="unbindShowFlag && !role"></u-button>
<u-button :init-param="componentsConfig.unbindButton.initParam" v-on:u-button-tap="onUnbindButtonTap" v-show="(unbindShowFlag && !role && userInfo.role != 0)"></u-button>
</p>
</div>
</li>
<v-touch tag="li" v-on:tap="onBindUnlockInfoTap">{{ $t('doorlockUser.bindUnlockInfo') }}</v-touch>
<v-touch tag="li" v-on:tap="onOpendoorRecordTap">{{ $t('doorlockUser.opendoorRecord') }}</v-touch>
</ul>
<u-button :init-param="componentsConfig.deleteUserButton.initParam" v-on:u-button-tap="onDeleteUserButtonTap" v-show="!role"></u-button>
<u-button :init-param="componentsConfig.deleteUserButton.initParam" v-on:u-button-tap="onDeleteUserButtonTap" v-show="!role && userInfo.role != 0"></u-button>
</div>
<transition name="fade">
<v-touch tag="div" class="unbindState-dialog" v-show="stateShowFlag" v-on:tap="onUnbindStateDialogTap">
......
......@@ -3094,8 +3094,14 @@ if (true) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Vue) {
var _config = __webpack_require__(127);
var _config2 = _interopRequireDefault(_config);
var _public = __webpack_require__(4);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* v_inviteBind.js
* Version: 0.1
......@@ -3227,7 +3233,7 @@ function qrcodeButtonTap(self) {
});
setTimeout(function () {
self.setQrCodeDisabled(true);
}, config.qrcode_timeout);
}, _config2.default.qrcode_timeout);
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)["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