Commit 16f1a28b by 朱建香

1017

parent a14204ca
...@@ -14,5 +14,5 @@ export default { ...@@ -14,5 +14,5 @@ export default {
1: "trialAlarm", 1: "trialAlarm",
2: "powerAlarm", 2: "powerAlarm",
3: "fackLockAlram" 3: "fackLockAlram"
} },
} }
\ No newline at end of file
...@@ -205,4 +205,9 @@ iot.navigator.aback =function(){ ...@@ -205,4 +205,9 @@ iot.navigator.aback =function(){
} }
} }
iot.navigator.getCurrentWebView = function (){
return plus.webview.currentWebview();
}
export {iot, uPublic, uComponents} export {iot, uPublic, uComponents}
\ No newline at end of file
...@@ -35,7 +35,7 @@ function init() { ...@@ -35,7 +35,7 @@ function init() {
//配置组件 //配置组件
componentsConfig: initComponentsConfig(), componentsConfig: initComponentsConfig(),
//电量 //电量
batteryState: 5, batteryState: null,
//电量百分比 //电量百分比
batteryPercent: 100, batteryPercent: 100,
//响铃时间 //响铃时间
...@@ -87,9 +87,12 @@ function init() { ...@@ -87,9 +87,12 @@ function init() {
}, },
success: (response) => { success: (response) => {
let data = response.data; let data = response.data;
// self.setBatteryPercent(data.BatteryPercentage.value);
// self.setBatteryState(config.powerIcon[Math.round(data.BatteryPercentage.value/20)]);
console.log(data.battery);
self.setBatteryPercent(data.battery.value); self.setBatteryPercent(data.battery.value);
self.setBatteryState(config.powerIcon[Math.round(data.battery.value/20)]); self.setBatteryState(config.powerIcon[Math.round(data.battery.value/20)]);
setDevceInfo(self, data); // setDevceInfo(self, data);
}, },
error: (error) => { error: (error) => {
console.log(error); console.log(error);
...@@ -108,7 +111,7 @@ function init() { ...@@ -108,7 +111,7 @@ function init() {
error: (error) => {} error: (error) => {}
}); });
console.log("in"); console.log(1);
//注册监听上报 //注册监听上报
iot.business.sds.registerPushListener({ iot.business.sds.registerPushListener({
success: (response) => { success: (response) => {
...@@ -118,40 +121,6 @@ function init() { ...@@ -118,40 +121,6 @@ function init() {
let data = JSON.parse(response); let data = JSON.parse(response);
console.log(data); console.log(data);
setDevceInfo(self, data.params.data); setDevceInfo(self, data.params.data);
// console.log(moment(data.time, "YY-MM-DD-hh-mm-ss").format("HH:mm"));
// switch(data.action){
// case 'lock_log':
// self.setBatteryPercent(data.battery);
// self.setBatteryState(config.powerIcon[Math.round(data.battery/20)]);
// //user_type: 0:密码用户 1:指纹用户 2:卡用户 3:遥控器 4:钥匙
// //uid: 用户id
// //time
// if(lock_action == 0){
// //再次获取最新记录
// getLockInfo(self);
// }
// break;
// case 'notify':
// self.setBatteryPercent(data.battery);
// self.setBatteryState(config.powerIcon[Math.round(data.battery/20)]);
// if(data.notify_type == 3){
// self.setDoorbellRingingFlag(true);
// setTimeout(() => {
// self.setDoorbellRingingFlag(false);
// self.setRingingTime(moment(data.time, "YY-MM-DD-hh-mm-ss").format("HH:mm"));
// },3000);
// }else if(data.notify_type == 4){
// self.setRemoteOpendoorFlag(true);
// }
// break;
// case 'status':
// self.setBatteryPercent(data.battery);
// self.setBatteryState(config.powerIcon[Math.round(data.battery/20)]);
// break;
// case 'openDoor':
//
// break;
// }
} }
}, },
error: (error) => { error: (error) => {
...@@ -159,13 +128,12 @@ function init() { ...@@ -159,13 +128,12 @@ function init() {
uPublic.openRequestErrorAlert(self); uPublic.openRequestErrorAlert(self);
} }
}); });
// let power = 5;
// this.batteryPercent = power/5*100; let wv = iot.navigator.getCurrentWebView();
// this.batteryState = config.powerIcon[power]; console.log(wv);
// let newMsg = '2017.08.02 18:45 宝贝指纹开门'; wv.setStyle({
// uComponents.changeMarqueeText(this, newMsg); background: 'rgb(0,0,0)'
// let time = new Date(); });
// this.ringingTime = moment(time).format("HH:mm");
}, },
methods:{ methods:{
getValueOpendoorRecord(){ getValueOpendoorRecord(){
...@@ -407,29 +375,22 @@ function getLockInfo(self){ ...@@ -407,29 +375,22 @@ function getLockInfo(self){
//设置设备信息 //设置设备信息
function setDevceInfo(self, data) { function setDevceInfo(self, data) {
console.log("监听到了"); console.log("监听到了");
// data = {
// "battery": {"value": "32"},
// "lock_action": {"value": "0"},
// "notify_type": {"value": "4"},
// "time": {"value": "122324433221"}
// }
console.log(data); console.log(data);
self.setBatteryPercent(data.battery.value); self.setBatteryPercent(data.BatteryPercentage.value);
self.setBatteryState(config.powerIcon[Math.round(data.battery.value/20)]); self.setBatteryState(config.powerIcon[Math.round(data.BatteryPercentage.value/20)]);
if(data.lock_action.value == 0){
//再次获取最新记录
console.log("有最新的开门记录");
getLockInfo(self);
}
if(data.hasOwnProperty('notify_type')){ if(data.hasOwnProperty('notify_type')){
if(data.notify_type.value == 3){
self.setDoorbellRingingFlag(true); self.setDoorbellRingingFlag(true);
setTimeout(() => { setTimeout(() => {
self.setDoorbellRingingFlag(false); self.setDoorbellRingingFlag(false);
self.setRingingTime(moment(data.time.value, "YY-MM-DD-hh-mm-ss").format("HH:mm")); self.setRingingTime(moment(data.time.value, "YY-MM-DD-hh-mm-ss").format("HH:mm"));
},3000); },3000);
}else if(data.notify_type.value == 4){ }
self.setRemoteOpendoorFlag(true); if(data.hasOwnProperty('lock_log') && (data.lock_action.value == '1' || data.lock_action.value == '4')){
console.log("有最新的开门记录");
getLockInfo(self);
if(data.lock_action.value == '4'){
console.log("远程开门成功");
// self.setRemoteOpendoorFlag(true);
} }
} }
} }
...@@ -452,18 +413,19 @@ function bindDoorlockTap(){ ...@@ -452,18 +413,19 @@ function bindDoorlockTap(){
}); });
} }
//tap 门锁管理 //tap 门锁管理
function doorlockManageTap(self){ function doorlockManageTap(self){
if(self.getValueDoorlockManage() == 1){ // if(self.getValueDoorlockManage() == 1){
iot.navigator.openWindow({ // iot.navigator.openWindow({
url: '../doorlockManage/index.html', // url: '../doorlockManage/index.html',
id: 'doorlockManage', // id: 'doorlockManage',
extras: { // extras: {
deviceId: self.deviceId, // deviceId: self.deviceId,
uuid: self.getUuid() // uuid: self.getUuid()
} // }
}); // });
} // }
} }
//tap 开门记录 //tap 开门记录
...@@ -494,16 +456,16 @@ function securityAlarmTap(self){ ...@@ -494,16 +456,16 @@ function securityAlarmTap(self){
//tap 门锁用户 //tap 门锁用户
function doorlockUserTap(self){ function doorlockUserTap(self){
// if(self.getValueDoorlockUser() == 1){ if(self.getValueDoorlockUser() == 1){
// iot.navigator.openWindow({ iot.navigator.openWindow({
// url: '../doorlockUsers/index.html', url: '../doorlockUsers/index.html',
// id: 'doorlockUsers', id: 'doorlockUsers',
// extras: { extras: {
// deviceId: self.deviceId, deviceId: self.deviceId,
// uuid: self.getUuid() uuid: self.getUuid()
// } }
// }); });
// } }
} }
//tap 远程开门 //tap 远程开门
......
...@@ -137,12 +137,12 @@ function confirmButtonTap(self){ ...@@ -137,12 +137,12 @@ function confirmButtonTap(self){
data: { data: {
uuid: self.getUuid(), uuid: self.getUuid(),
setParams: { setParams: {
'lock_action': { 'action': {
'value': '0' 'value': 'openDoor'
}
'remote_open_door': {
'value': self.getTextPassword()
} }
// 'remote_open_door': {
// 'value': self.getTextPassword()
// }
} }
}, },
success: (response) => { success: (response) => {
......
...@@ -17,12 +17,21 @@ function init() { ...@@ -17,12 +17,21 @@ function init() {
data:{ data:{
recordSelectIndex: 0, recordSelectIndex: 0,
recordSelectList: [], recordSelectList: [],
waysOpenDoor: [{mode: 0, text: '指纹'},{mode: 1, text: '密码'},{mode: 2, text: 'IC卡'},{mode: 3, text: '钥匙'},{mode: 4, text: '劫持指纹'},{mode: 5, text: '远程开门'},{mode: 5, text: '远程开门'}],
selectedMode: 0,
//配置组件 //配置组件
componentsConfig: initComponentsConfig() componentsConfig: initComponentsConfig()
}, },
mounted(){ mounted(){
resolve(this);
}, },
methods:{ methods:{
getSelectedMode(){
return this.selectedMode;
},
setSelectedMode(mode){
this.selectedMode = mode
},
//tap < //tap <
onBackTap(){ onBackTap(){
backTap(); backTap();
...@@ -33,6 +42,9 @@ function init() { ...@@ -33,6 +42,9 @@ function init() {
//tap 添加 //tap 添加
onAddButtonTap(){ onAddButtonTap(){
addButtonTap(); addButtonTap();
},
onSelectOpenDoorModeTap(index){
selectOpenDoorModeTap(this, index);
} }
} }
}).$mount('#app'); }).$mount('#app');
...@@ -72,6 +84,10 @@ function initComponentsConfig() { ...@@ -72,6 +84,10 @@ function initComponentsConfig() {
} }
} }
function resolve(self){
getTodayReccordByMode(self,self.getSelectedMode());
}
//tap < //tap <
function backTap(){ function backTap(){
iot.navigator.back(); iot.navigator.back();
...@@ -86,3 +102,12 @@ function recordSelectChange(self, value) { ...@@ -86,3 +102,12 @@ function recordSelectChange(self, value) {
function addButtonTap(){ function addButtonTap(){
iot.navigator.back(); iot.navigator.back();
} }
function selectOpenDoorModeTap(self, index){
self.setSelectedMode(index);
getTodayReccordByMode(self,index);
}
function getTodayReccordByMode(self, mode){
}
...@@ -26,6 +26,8 @@ function init() { ...@@ -26,6 +26,8 @@ function init() {
console.log("in"); console.log("in");
getInfo(self); getInfo(self);
}); });
let wv = iot.navigator.getCurrentWebView();
console.log(wv);
}, },
methods:{ methods:{
//tap 修改昵称 //tap 修改昵称
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</div> </div>
<div class="doorbellTip"><span>{{ ringingTime }}</span>{{ doorbellRingingFlag ? $t('device.doorLockRinging'):'' }}</div> <div class="doorbellTip"><span>{{ ringingTime }}</span>{{ doorbellRingingFlag ? $t('device.doorLockRinging'):'' }}</div>
</div> </div>
<p class="batteryState"><span v-html="batteryState"></span>{{ batteryPercent }}%</p> <p class="batteryState"><span v-html="batteryState"></span><span>{{ batteryPercent }}%</span></p>
</div> </div>
<v-touch tag="div" v-show="!uuid" class="bindDoorlock" v-on:tap="onBindDoorlockTap"> <v-touch tag="div" v-show="!uuid" class="bindDoorlock" v-on:tap="onBindDoorlockTap">
<p>{{ $t('device.bindDoorlock') }}</p> <p>{{ $t('device.bindDoorlock') }}</p>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
webpackJsonp([22],{ webpackJsonp([26],{
/***/ 164: /***/ 223:
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports) {
"use strict"; "use strict";
/* WEBPACK VAR INJECTION */(function(Vue) { throw new Error("Module build failed: SyntaxError: D:/git_zhu/doorlock/dev/src/view/device/v_remoteOpendoor.js: Unexpected token, expected , (143:14)\n\n\u001b[0m \u001b[90m 141 | \u001b[39m\t\t \t\t\u001b[32m'value'\u001b[39m\u001b[33m:\u001b[39m \u001b[32m'openDoor'\u001b[39m\n \u001b[90m 142 | \u001b[39m\t\t \t}\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 143 | \u001b[39m\t\t \u001b[32m'remote_open_door'\u001b[39m\u001b[33m:\u001b[39m {\n \u001b[90m | \u001b[39m\t\t \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 144 | \u001b[39m\t\t \u001b[32m'value'\u001b[39m\u001b[33m:\u001b[39m self\u001b[33m.\u001b[39mgetTextPassword()\n \u001b[90m 145 | \u001b[39m\t\t }\n \u001b[90m 146 | \u001b[39m\t\t }\u001b[0m\n");
var _public = __webpack_require__(2);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /**
* v_remoteOpendoor.js
* Version: 0.1
* User: wy
* Date: 2017-09-06
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* 远程开门页面
*/
_public.iot.ready(init);
function init() {
var _methods;
//通用 input、按钮、dialog、loading组件
_public.uPublic.componentsInit(['u-text', 'u-button', 'u-commstatus-loading', 'u-dialog', 'u-loading']);
var app = new Vue({
data: {
textPassword: null,
textErrorTip: null,
textLoading: 'loading...',
status: 0,
//配置组件
componentsConfig: initComponentsConfig(),
//设备uuid
uuid: null
},
mounted: function mounted() {
resolve(this);
},
methods: (_methods = {
getTextPassword: function getTextPassword() {
return this.textPassword;
},
setTextPassword: function setTextPassword(pwd) {
this.textPassword = pwd;
},
setTextErrorTip: function setTextErrorTip(tip) {
this.textErrorTip = tip;
},
getTextLoading: function getTextLoading() {
return this.textLoading;
},
setTextLoading: function setTextLoading(text) {
this.textLoading = text;
},
getStatus: function getStatus() {
return this.status;
},
setStatus: function setStatus(value) {
this.status = value;
},
onPasswordChange: function onPasswordChange(text) {
passwordChange(this, text);
}
}, _defineProperty(_methods, 'onPasswordChange', function onPasswordChange(text) {
passwordChange(this, text);
}), _defineProperty(_methods, 'getUuid', function getUuid() {
return this.uuid;
}), _defineProperty(_methods, 'setUuid', function setUuid(id) {
this.uuid = id;
}), _defineProperty(_methods, 'onBackTap', function onBackTap() {
backTap();
}), _defineProperty(_methods, 'onConfirmButtonTap', function onConfirmButtonTap() {
confirmButtonTap(this);
}), _methods)
}).$mount('#app');
}
//配置组件参数
function initComponentsConfig() {
return {
passwordInput: {
initParam: {
class: 'custom-text',
icon: '&#xe64d;',
placeholder: Vue.t('remoteOpendoor.passwordInputTip')
}
},
//确定 button 参数
confirmButton: {
initParam: {
class: 'custom-button',
text: Vue.t('btn.confirm')
}
},
dialog: {
initParam: {
class: 'custom-dialog'
}
},
loading: {
initParam: {
class: 'custom-loading'
}
},
ucommstatusloading: {
initParam: {
class: 'custom-commstatus-loading',
buttonText: Vue.t('btn.confirm')
}
}
};
}
function resolve(self) {
var extras = _public.iot.navigator.getExtras();
self.setUuid(extras.uuid);
console.log(self.getUuid());
}
function passwordChange(self, text) {
self.setTextPassword(text);
self.setTextErrorTip('');
console.log('passwordChange: ' + self.textPassword);
}
//tap <
function backTap() {
_public.iot.navigator.back();
}
//tap 确定
function confirmButtonTap(self) {
console.log(self.getTextPassword());
if (self.getTextPassword() == null || self.getTextPassword().trim() == '') {
self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
} else {
_public.uComponents.showLoading(self);
_public.iot.business.sds.setDeviceStatus({
data: {
uuid: self.getUuid(),
setParams: {
'lock_action': {
'value': '0'
// 'remote_open_door': {
// 'value': self.getTextPassword()
// }
} }
},
success: function success(response) {
console.log(response);
_public.uComponents.openAlert(self, Vue.t('remoteOpendoor.openDoorSuccess'), {
text: Vue.t('dialog.confirm'), callback: function callback() {
//返回首页
_public.iot.navigator.back();
}
});
},
error: function error(_error) {
console.log(_error);
_public.uComponents.openAlert(self, Vue.t('remoteOpendoor.openDoorFailure'), {
text: Vue.t('dialog.confirm'), callback: function callback() {}
});
},
complete: function complete() {
_public.uComponents.hideLoading(self);
}
});
}
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))
/***/ }), /***/ }),
/***/ 264: /***/ 264:
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(164); module.exports = __webpack_require__(223);
/***/ }) /***/ })
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -28,11 +28,14 @@ ...@@ -28,11 +28,14 @@
<div class="opendoorMode"> <div class="opendoorMode">
<p class="title">{{ $t('addUnlockInfo.opendoorMode') }}</p> <p class="title">{{ $t('addUnlockInfo.opendoorMode') }}</p>
<ul> <ul>
<li class="active">{{ $t('addUnlockInfo.fingerprint') }}</li> <v-touch tag="li" v-bind:class="{active: item.mode == selectedMode}" v-for="item in waysOpenDoor" v-on:tap="onSelectOpenDoorModeTap(item.mode)">
{{ item.text }}
</v-touch>
<!--<li class="active">{{ $t('addUnlockInfo.fingerprint') }}</li>
<li>{{ $t('addUnlockInfo.password') }}</li> <li>{{ $t('addUnlockInfo.password') }}</li>
<li>{{ $t('addUnlockInfo.icCard') }}</li> <li>{{ $t('addUnlockInfo.icCard') }}</li>
<li>{{ $t('addUnlockInfo.key') }}</li> <li>{{ $t('addUnlockInfo.key') }}</li>
<li>{{ $t('addUnlockInfo.hijackFingerprint') }}</li> <li>{{ $t('addUnlockInfo.hijackFingerprint') }}</li>-->
</ul> </ul>
</div> </div>
<div class="opendoorRecord"> <div class="opendoorRecord">
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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