Commit a3f44d8c by 朱建香

0927

parent 0f6ec37a
...@@ -88,19 +88,24 @@ ...@@ -88,19 +88,24 @@
"followTitle": "关注服务号", "followTitle": "关注服务号",
"followCont1": "关注 “i智信” 微信服务号可随时随地掌握设备动态<br>再也不担心错过重要通知,赶紧按下方提示试试吧", "followCont1": "关注 “i智信” 微信服务号可随时随地掌握设备动态<br>再也不担心错过重要通知,赶紧按下方提示试试吧",
"followCont2": "1.保存二维码-2.用微信从<span>相册选取扫码</span>-3.关注", "followCont2": "1.保存二维码-2.用微信从<span>相册选取扫码</span>-3.关注",
"laterFollow": "稍后关注" "laterFollow": "稍后关注",
"newMsgDoorlock": "门锁最新消息",
"doorLockRinging": "门铃响了"
}, },
"opendoorRecord":{ "opendoorRecord":{
"noRecordTip": "暂无记录", "noRecordTip": "暂无记录",
"mode_0": "APP开门", "mode_0": "密码开门",
"mode_1": "指纹开门", "mode_1": "指纹开门",
"mode_2": "劫持指纹开门", "mode_2": "IC卡开门",
"mode_4": "IC卡开门" "mode_3": "遥控器开门",
"mode_4": "钥匙开门",
"mode_5": "劫持报警",
"mode_6": "app远程开门"
}, },
"alarmInfo":{ "alarmInfo":{
"noInfoTip": "暂无信息", "noInfoTip": "暂无信息",
"mode_0": "禁示报警", "mode_0": "防撬报警",
"mode_1": "防撬报警", "mode_1": "试错报警",
"mode_2": "欠电报警", "mode_2": "欠电报警",
"mode_3": "假锁报警" "mode_3": "假锁报警"
}, },
...@@ -112,7 +117,7 @@ ...@@ -112,7 +117,7 @@
}, },
"hijackRecord":{ "hijackRecord":{
"noRecordTip": "暂无记录", "noRecordTip": "暂无记录",
"mode_0": "劫持指纹开门" "mode_5": "劫持指纹报警"
}, },
"doorlockManage":{ "doorlockManage":{
"noDeviceTip": "暂无设备", "noDeviceTip": "暂无设备",
......
let uComponents = {}; export default {
"powerIcon":["&#xe6e5;", "&#xe62b;", "&#xe627;", "&#xe628;", "&#xe62a;", "&#xe629;"]
uComponents.changeGridList = function (vmObj, list) { }
vmObj.$refs.gridlist.changeList(list); \ No newline at end of file
};
uComponents.changeTimeline = function (vmObj, list) {
vmObj.$refs.timeline.changeList(list);
};
export {uComponents}
\ No newline at end of file
...@@ -11,7 +11,7 @@ const iot = new UIOT({ ...@@ -11,7 +11,7 @@ const iot = new UIOT({
lang: ['zh', 'en'], lang: ['zh', 'en'],
vue: Vue, vue: Vue,
i18n: VueI18n, i18n: VueI18n,
appId: '10003', appId: '10004',
wx: { wx: {
appId: '' appId: ''
}, },
......
...@@ -38,6 +38,12 @@ function init() { ...@@ -38,6 +38,12 @@ function init() {
setTextPassword(pwd){ setTextPassword(pwd){
this.textPassword = pwd; this.textPassword = pwd;
}, },
gettTextErrorTip(){
return this.textErrorTip;
},
setTextErrorTip(tip){
this.textErrorTip = tip;
},
getStatus(){ getStatus(){
return this.status; return this.status;
}, },
...@@ -144,63 +150,66 @@ function connectButtonTap(self){ ...@@ -144,63 +150,66 @@ function connectButtonTap(self){
// },3000); // },3000);
console.log(self.getTextWiFiName()); console.log(self.getTextWiFiName());
self.setTextPassword('macro_scope00'); // self.setTextPassword('macro_scope00');
console.log(self.getTextPassword()); console.log(self.getTextPassword());
iot.business.sds.findWifi({ if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){
data: { self.setTextErrorTip(Vue.t('wifiAdd.passwordInputTip'));
model: 'THM_LIVING_ELECTRICALBLANKET_TH_1507', }else{
ssid: "ugen-f", iot.business.sds.findWifi({
wifiPwd: 'macro_scope00', data: {
timeout: 20000 model: 'THM_LIVING_ELECTRICALBLANKET_TH_1507',
}, ssid: self.getTextWiFiName(),
success: (response) => { wifiPwd: self.getTextPassword(),
console.log("findWifi"); timeout: 20000
console.log(response); },
if(response.data == 'onProvisioning'){ success: (response) => {
//wifi链接中 console.log("findWifi");
uComponents.showCommLoading(self); console.log(response);
}else if(response.data == 'provisioned success'){ if(response.data == 'onProvisioning'){
//wifi连接成功,停止连接wifi //wifi链接中
// iot.business.sds.stopFindWifi({ uComponents.showCommLoading(self);
// success: (response) => {}, }else if(response.data == 'provisioned success'){
// error: (error) => {} //wifi连接成功,停止连接wifi
// }); // iot.business.sds.stopFindWifi({
} // success: (response) => {},
}, // error: (error) => {}
error: (error) => { // });
console.log(error); }
} },
}); error: (error) => {
iot.business.sds.findDevices({ console.log(error);
success: (response) => { }
console.log("findDevices"); });
console.log(response); iot.business.sds.findDevices({
if(response.data == "joined success"){ success: (response) => {
//连接成功 console.log("findDevices");
uComponents.changeCommLoadingStatusAndText(self, 1, '绑定成功'); console.log(response);
self.setStatus(1); if(response.data == "joined success"){
// //停止查找设备 //连接成功
iot.business.sds.stopFindDevices({ uComponents.changeCommLoadingStatusAndText(self, 1, '绑定成功');
success: (response) => {}, self.setStatus(1);
error: (error) => {} // //停止查找设备
}); iot.business.sds.stopFindDevices({
}else if(response.data == "fail"){ success: (response) => {},
//连接失败 error: (error) => {}
uComponents.changeCommLoadingStatusAndText(self, 2, '绑定失败'); });
self.setStatus(2); }else if(response.data == "fail"){
uComponents.changeCommButtonText('请重新绑定'); //连接失败
//停止查找设备 uComponents.changeCommLoadingStatusAndText(self, 2, '绑定失败');
iot.business.sds.stopFindDevices({ self.setStatus(2);
success: (response) => {}, uComponents.changeCommButtonText('请重新绑定');
error: (error) => {} //停止查找设备
}); iot.business.sds.stopFindDevices({
} success: (response) => {},
}, error: (error) => {}
error: (error) => { });
console.log(error); }
} },
}); error: (error) => {
console.log(error);
}
});
}
} }
//tap loading button //tap loading button
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
import moment from 'moment'; import moment from 'moment';
import {iot, uPublic, uComponents} from '../../public/public.js'; import {iot, uPublic, uComponents} from '../../public/public.js';
const PAGE_SIZE = 10;
iot.ready(init); iot.ready(init);
function init() { function init() {
...@@ -35,8 +36,8 @@ function init() { ...@@ -35,8 +36,8 @@ function init() {
getStartId(){ getStartId(){
return this.startId; return this.startId;
}, },
setStartId(){ setStartId(id){
this.startId; this.startId = id;
}, },
getDeviceId(){ getDeviceId(){
return this.deviceId; return this.deviceId;
...@@ -44,6 +45,9 @@ function init() { ...@@ -44,6 +45,9 @@ function init() {
setDeviceId(id){ setDeviceId(id){
this.deviceId = id; this.deviceId = id;
}, },
onListLoadTap(){
listLoadTap(this);
},
//tap < //tap <
onBackTap(){ onBackTap(){
backTap(); backTap();
...@@ -82,79 +86,56 @@ function initComponentsConfig() { ...@@ -82,79 +86,56 @@ function initComponentsConfig() {
} }
function resolve(self) { function resolve(self) {
// self.setDeviceId(iot.navigator.getExtras().deviceId); self.setDeviceId(iot.navigator.getExtras().deviceId);
self.setDeviceId(1); uComponents.showLoading(self);
let data = {record: [{"openId": 0,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, iot.business.api.sendCustom('lock/getHistoryRecord',
{"openId": 1,mode: 1,id: 1, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, {
{"openId": 2,mode: 2,id: 2, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, data: {
{"openId": 3,mode: 3,id: 3, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, device_id: self.getDeviceId(),
{"openId": 0,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, action: 2,
{"openId": 1,mode: 1,id: 1, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, start_id: self.getStartId(),
{"openId": 2,mode: 2,id: 2, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}]}; page_size: PAGE_SIZE
if(data){ },
let list = []; success: (response) => {
let record = data.record; console.log(response);
for(let i=0; i<record.length; i++){ let data = uPublic.checkResponseData(response.data);
list[i] = { if(data){
value: record[i].openId, let list = [];
leftImage: '../../resources/image/green_alarmInfo'+record[i].mode+'_icon.png', let record = data.record;
subtitle: Vue.t('alarmInfo.mode_'+record[i].mode+''), for(let i=0; i<record.length; i++){
// title: ('ID:'+record[i].id), list[i] = {
rightText: moment(record[i].time).format("YYYY.MM.DD HH:mm:ss") value: record[i].openId,
}; leftImage: '../../resources/image/green_alarmInfo'+record[i].mode+'_icon.png',
} subtitle: Vue.t('alarmInfo.mode_'+record[i].mode+''),
self.setList(self.getList().concat(list)); rightText: moment(record[i].time).format("YYYY.MM.DD HH:mm:ss")
if(record.length > 0){ };
self.setStartId(record[record.length-1].id); }
self.setList(self.getList().concat(list));
if(record.length > 0){
self.setStartId(record[record.length-1].id);
}
//更新列表数据
uComponents.changeList(self, self.getList());
}else{
}
uComponents.hideLoading(self);
},
error: (err) => {
uPublic.openRequestErrorAlert(self);
console.log(err);
},
complete: () => {
uComponents.hideLoading(self);
} }
//更新列表数据 });
uComponents.changeList(self, self.getList());
}else{
}
// iot.business.api.getRecorderList(
// {
// data: {
// lock_id: self.getDeviceId(),
// action: 2,
// start_id: self.getStartId(),
// page_size: PAGE_SIZE
// },
// success: (response) => {
// let data = uPublic.checkResponseData(response.data);
// data = [{"openId": 1,mode: 1,id: 1, time: '2017.08.0310:29:53'}];
// if(data){
// let list = [];
// let record = data.record;
// for(let i=0; i<record.length; i++){
// list[i] = {
// value: record[i].openId,
// leftImage: '../../resources/image/green_alarmInfo'+record[i].mode+'_icon.png',
// subtitle: Vue.t('alarmInfo.mode_'+record[i].mode+''),
// title: ('ID:'+record[i].id),
// rightText: moment(record[i].time).format("YYYY.MM.DD HH:mm:ss")
// };
// }
// self.setList(self.getList().concat(list));
// if(record.length > 0){
// self.setStartId(record[record.length-1].id);
// }
// //更新列表数据
// uComponents.changeList(self, self.getList());
// }else{
// }
// uComponents.hideLoading(self);
// },
// error: (err) => {
// uPublic.openRequestErrorAlert(self);
// console.log(err);
// },
// complete: () => {
//
// }
// });
} }
//tap < //tap <
function backTap(){ function backTap(){
iot.navigator.back(); iot.navigator.back();
}
//tap 点击加载更多
function listLoadTap(self) {
resolve(self);
} }
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
import moment from 'moment'; import moment from 'moment';
import {iot, uPublic, uComponents} from '../../public/public.js'; import {iot, uPublic, uComponents} from '../../public/public.js';
const PAGE_SIZE = 10;
iot.ready(init); iot.ready(init);
function init() { function init() {
...@@ -35,8 +36,8 @@ function init() { ...@@ -35,8 +36,8 @@ function init() {
getStartId(){ getStartId(){
return this.startId; return this.startId;
}, },
setStartId(){ setStartId(id){
this.startId; this.startId = id;
}, },
getDeviceId(){ getDeviceId(){
return this.deviceId; return this.deviceId;
...@@ -50,6 +51,9 @@ function init() { ...@@ -50,6 +51,9 @@ function init() {
setUserInfo(info){ setUserInfo(info){
this.userInfo = info; this.userInfo = info;
}, },
onListLoadTap(){
listLoadTap(this);
},
//tap < //tap <
onBackTap(){ onBackTap(){
backTap(); backTap();
...@@ -86,93 +90,68 @@ function initComponentsConfig() { ...@@ -86,93 +90,68 @@ function initComponentsConfig() {
} }
function resolve(self) { function resolve(self) {
// self.setDeviceId(iot.navigator.getExtras().deviceId); self.setDeviceId(iot.navigator.getExtras().deviceId);
self.setDeviceId(1); uComponents.showLoading(self);
let data = {record: [{"openId": 1,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, iot.business.api.sendCustom('lock/getHistoryRecord',
{"openId": 2,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, {
{"openId": 0,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, data: {
{"openId": 0,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, device_id: self.getDeviceId(),
{"openId": 0,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, action: 3,
{"openId": 0,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, start_id: self.getStartId(),
{"openId": 0,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}], page_size: PAGE_SIZE
info: [{"openId": 1,"mode": 0, "nickname": "测试用户01"}, },
{"openId": 2,"mode": 0, "nickname": "测试用户02"}] success: (response) => {
}; let data = uPublic.checkResponseData(response.data);
if(data){ if(data){
let list = []; console.log(data);
let record = data.record; let list = [];
if(data.hasOwnProperty('info')){ let record = data.record;
self.setUserInfo(data.info); if(data.hasOwnProperty('info')){
} self.setUserInfo(data.info);
for(let i=0; i<record.length; i++){ }
list[i] = { for(let i=0; i<record.length; i++){
value: record[i].openId, list[i] = {
leftImage: '../../resources/image/green_opendoor2_icon.png', value: record[i].openId,
subtitle: Vue.t('hijackRecord.mode_'+record[i].mode+''), leftImage: '../../resources/image/green_opendoor5_icon.png',
// title: ('ID:'+record[i].id), subtitle: Vue.t('hijackRecord.mode_'+record[i].mode+''),
rightText: moment(record[i].time).format("YYYY.MM.DD HH:mm:ss") // title: ('ID:'+record[i].id),
}; rightText: moment(record[i].time).format("YYYY.MM.DD HH:mm:ss")
for(let j=0; j<self.getUserInfo().length; j++){ };
if(record[i].openId == self.getUserInfo()[j].openId && record[i].mode == self.getUserInfo()[j].mode){ for(let j=0; j<self.getUserInfo().length; j++){
list[i].title = self.getUserInfo()[j].nickname == null ? '': self.getUserInfo()[j].nickname; if(record[i].openId == self.getUserInfo()[j].openId && record[i].mode == self.getUserInfo()[j].mode){
}else{ list[i].title = self.getUserInfo()[j].nickname == null ? '': self.getUserInfo()[j].nickname;
console.log(record[i].id); }else{
list[i].title = record[i].id == null ? '':"ID:"+record[i].id; console.log(record[i].id);
list[i].title = self.getUserInfo()[j].id == null ? '':"ID:"+self.getUserInfo()[j].id;
}
}
}
self.setList(self.getList().concat(list));
if(record.length > 0){
self.setStartId(record[record.length-1].id);
} }
//更新列表数据
uComponents.changeList(self, self.getList());
}else{
} }
uComponents.hideLoading(self);
},
error: (err) => {
uPublic.openRequestErrorAlert(self);
console.log(err);
},
complete: () => {
uComponents.hideLoading(self);
} }
self.setList(self.getList().concat(list)); });
if(record.length > 0){
self.setStartId(record[record.length-1].id);
}
//更新列表数据
uComponents.changeList(self, self.getList());
}else{
}
// iot.business.api.getRecorderList(
// {
// data: {
// lock_id: self.getDeviceId(),
// action: 2,
// start_id: self.getStartId(),
// page_size: PAGE_SIZE
// },
// success: (response) => {
// let data = uPublic.checkResponseData(response.data);
// data = [{"openId": 1,mode: 1,id: 1, time: '2017.08.0310:29:53'}];
// if(data){
// let list = [];
// let record = data.record;
// for(let i=0; i<record.length; i++){
// list[i] = {
// value: record[i].openId,
// leftImage: '../../resources/image/green_alarmInfo'+record[i].mode+'_icon.png',
// subtitle: Vue.t('alarmInfo.mode_'+record[i].mode+''),
// title: ('ID:'+record[i].id),
// rightText: moment(record[i].time).format("YYYY.MM.DD HH:mm:ss")
// };
// }
// self.setList(self.getList().concat(list));
// if(record.length > 0){
// self.setStartId(record[record.length-1].id);
// }
// //更新列表数据
// uComponents.changeList(self, self.getList());
// }else{
// }
// uComponents.hideLoading(self);
// },
// error: (err) => {
// uPublic.openRequestErrorAlert(self);
// console.log(err);
// },
// complete: () => {
//
// }
// });
} }
//tap < //tap <
function backTap(){ function backTap(){
iot.navigator.back(); iot.navigator.back();
}
//tap 点击加载更多
function listLoadTap(self) {
resolve(self);
} }
\ No newline at end of file
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved. * Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* 主控页面 * 主控页面
*/ */
import moment from 'moment';
import config from '../../public/config.js';
import {iot, uPublic, uComponents} from '../../public/public.js'; import {iot, uPublic, uComponents} from '../../public/public.js';
iot.ready(init); iot.ready(init);
...@@ -30,10 +31,92 @@ function init() { ...@@ -30,10 +31,92 @@ function init() {
activeFlag: true, activeFlag: true,
followShowFlag: false, followShowFlag: false,
//配置组件 //配置组件
componentsConfig: initComponentsConfig() componentsConfig: initComponentsConfig(),
//电量
batteryState: null,
//电量百分比
batteryPercent: 0,
//响铃时间
ringingTime: null,
//门铃是否响起
doorbellRingingFlag: true,
//远程开门是否开启
remoteOpendoorFlag: true,
//设备ID
deviceId: null
}, },
mounted(){ mounted(){
let self = this;
iot.navigator.closeAllBesidesItself(); iot.navigator.closeAllBesidesItself();
iot.business.sds.getDevicesByUser({
success: (response) => {
let data = uPublic.checkResponseData(response.data);
if(data){
let uuid = data[0].uuid;
self.deviceId = data[0].sn;
iot.business.sds.getDeviceStatus({
data: {
uuid: uuid
},
success: (response) => {
console.log(response);
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
}
});
iot.business.api.sendCustom('lock/getLockInfo',{
data: {
// device_id:"600194283588"
device_id: self.deviceId
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
console.log(data.info);
let newMsg = moment(data.info[0].time).format("YY.MM.DD HH:mm") + data.info[0].nickname + Vue.t('opendoorRecord.mode_'+data.info[0].mode+'')
uComponents.changeMarqueeText(self, newMsg);
}else{
}
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
}
});
}else{
}
},
error: (error) => {}
});
//注册监听上报
iot.business.sds.registerPushListener({
success: (response) => {
console.log(response);
if(response.hasOwnProperty('params')){
console.log(JSON.parse(response));
setDevceInfo(self, response.params);
}
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
}
});
let power = 5;
this.batteryPercent = power/5*100;
this.batteryState = config.powerIcon[power];
let newMsg = '2017.08.02 18:45 宝贝指纹开门';
// uComponents.changeMarqueeText(this, newMsg);
let time = new Date();
this.ringingTime = moment(time).format("HH:mm");
// getNewOpenDoorRecord(this);
}, },
methods:{ methods:{
getValueOpendoorRecord(){ getValueOpendoorRecord(){
...@@ -65,18 +148,48 @@ function init() { ...@@ -65,18 +148,48 @@ function init() {
}, },
setFollowShowFlag(boolean){ setFollowShowFlag(boolean){
this.followShowFlag = boolean; this.followShowFlag = boolean;
}, },
getBatteryState(){
return this.batteryState();
},
setBatteryState(number){
this.batteryState = number
},
getBatteryPercent(){
return this.batteryPercent;
},
setBatteryPercent(percent){
this.batteryPercent = percent;
},
getRingingTime(){
return this.ringingTime;
},
setRingingTime(time){
this.ringingTime = time
},
getDoorbellRingingFlag(){
return this.doorbellRingingFlag;
},
setDoorbellRingingFlag(boolean){
this.doorbellRingingFlag = boolean;
},
getRemoteOpendoorFlag(){
return this.remoteOpendoorFlag;
},
setRemoteOpendoorFlag(flag){
this.remoteOpendoorFlag = flag;
},
//tap 门锁管理 //tap 门锁管理
onDoorlockManageTap(){ onDoorlockManageTap(){
doorlockManageTap(); doorlockManageTap();
}, },
//tap 开门记录 //tap 开门记录
onOpendoorRecordTap(){ onOpendoorRecordTap(){
opendoorRecordTap(); opendoorRecordTap(this);
}, },
//tap 安全报警 //tap 安全报警
onSecurityAlarmTap(){ onSecurityAlarmTap(){
securityAlarmTap(); securityAlarmTap(this);
}, },
//tap 门锁用户 //tap 门锁用户
onDoorlockUserTap(){ onDoorlockUserTap(){
...@@ -88,7 +201,7 @@ function init() { ...@@ -88,7 +201,7 @@ function init() {
}, },
//tap 劫持报警 //tap 劫持报警
onHijackAlarmTap(){ onHijackAlarmTap(){
hijackAlarmTap(); hijackAlarmTap(this);
}, },
//tap 保存二维码到相册 //tap 保存二维码到相册
onSaveQRcodeButtonTap(){ onSaveQRcodeButtonTap(){
...@@ -189,6 +302,38 @@ function initComponentsConfig() { ...@@ -189,6 +302,38 @@ function initComponentsConfig() {
} }
} }
//设置设备信息
function setDevceInfo(self, data) {
self.setBatteryState(config.powerIcon[data.power]);
self.setBatteryPercent(data.power/5*100);
self.setRingingTime(moment(data.time).format("HH:mm"));
self.setDoorbellRingingFlag(data);
self.setRemoteOpendoorFlag(flag);
}
//获取最新开门记录
function getNewOpenDoorRecord(self){
iot.business.api.sendCustom('',{
data: {
uuid: 'uuid',
start_id: 0,
page_size: 0
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
uComponents.changeMarqueeText(self, data.message);
}
},
error: (error) => {
uPublic.openRequestErrorAlert(self);
console.log(error);
},
complete: () => {}
});
}
//tap 门锁管理 //tap 门锁管理
function doorlockManageTap(){ function doorlockManageTap(){
iot.navigator.openWindow({ iot.navigator.openWindow({
...@@ -198,24 +343,29 @@ function doorlockManageTap(){ ...@@ -198,24 +343,29 @@ function doorlockManageTap(){
} }
//tap 开门记录 //tap 开门记录
function opendoorRecordTap(){ function opendoorRecordTap(self){
iot.navigator.openWindow({ iot.navigator.openWindow({
url: './opendoorRecord.html', url: './opendoorRecord.html',
id: 'opendoorRecord' id: 'opendoorRecord',
extras: {
deviceId: self.deviceId
}
}); });
} }
//tap 安全报警 //tap 安全报警
function securityAlarmTap(){ function securityAlarmTap(self){
iot.navigator.openWindow({ iot.navigator.openWindow({
url: './alarmInfo.html', url: './alarmInfo.html',
id: 'alarmInfo' id: 'alarmInfo',
extras: {
deviceId: self.deviceId
}
}); });
} }
//tap 门锁用户 //tap 门锁用户
function doorlockUserTap(){ function doorlockUserTap(){
} }
//tap 远程开门 //tap 远程开门
...@@ -227,10 +377,13 @@ function remoteOpendoorTap(){ ...@@ -227,10 +377,13 @@ function remoteOpendoorTap(){
} }
//tap 劫持报警 //tap 劫持报警
function hijackAlarmTap(){ function hijackAlarmTap(self){
iot.navigator.openWindow({ iot.navigator.openWindow({
url: './hijackRecord.html', url: './hijackRecord.html',
id: 'hijackRecord' id: 'hijackRecord',
extras: {
deviceId: self.deviceId
}
}); });
} }
......
...@@ -36,8 +36,8 @@ function init() { ...@@ -36,8 +36,8 @@ function init() {
getStartId(){ getStartId(){
return this.startId; return this.startId;
}, },
setStartId(){ setStartId(id){
this.startId; this.startId = id;
}, },
getDeviceId(){ getDeviceId(){
return this.deviceId; return this.deviceId;
...@@ -51,6 +51,9 @@ function init() { ...@@ -51,6 +51,9 @@ function init() {
setDeviceId(id){ setDeviceId(id){
this.deviceId = id; this.deviceId = id;
}, },
onListLoadTap(){
listLoadTap(this);
},
//tap < //tap <
onBackTap(){ onBackTap(){
backTap(); backTap();
...@@ -65,16 +68,6 @@ function initComponentsConfig() { ...@@ -65,16 +68,6 @@ function initComponentsConfig() {
opendoorRecordList:{ opendoorRecordList:{
initParam: { initParam: {
class: 'custom-list', class: 'custom-list',
// list: [
// {value: 1, leftImage: '../../resources/image/green_opendoor0_icon.png', title:'', subtitle: '手机远程开门', rightText: '2017.08.0310:29:53'},
// {value: 2, leftImage: '../../resources/image/green_opendoor0_icon.png', title:'', subtitle: '手机远程开门', rightText: '2017.08.0310:27:56'},
// {value: 3, leftImage: '../../resources/image/green_opendoor1_icon.png', title:'ID:6', subtitle: '指纹开门', rightText: '2017.08.0310:25:47'},
// {value: 4, leftImage: '../../resources/image/green_opendoor0_icon.png', title:'', subtitle: '手机远程开门', rightText: '2017.07.3117:13:03',},
// {value: 5, leftImage: '../../resources/image/green_opendoor2_icon.png', title:'测试用户02', subtitle: '劫持指纹开门', rightText: '2017.07.3117:10:10'},
// {value: 6, leftImage: '../../resources/image/green_opendoor3_icon.png', title:'测试用户', subtitle: '密码开门', rightText: '2017.07.3117:09:59'},
// {value: 7, leftImage: '../../resources/image/green_opendoor2_icon.png', title:'ID:117', subtitle: '劫持指纹开门', rightText: '2017.07.3117:05:19'},
// {value: 8, leftImage: '../../resources/image/green_opendoor3_icon.png', title:'测试用户', subtitle: '密码开门', rightText: '2017.07.3117:03:50',}
// ],
list: [], list: [],
tip: Vue.t('opendoorRecord.noRecordTip') tip: Vue.t('opendoorRecord.noRecordTip')
} }
...@@ -94,63 +87,21 @@ function initComponentsConfig() { ...@@ -94,63 +87,21 @@ function initComponentsConfig() {
//调用接口获取开门记录 //调用接口获取开门记录
function resolve(self) { function resolve(self) {
// self.setDeviceId(iot.navigator.getExtras().deviceId); uComponents.showLoading(self);
self.setDeviceId(1); self.setDeviceId(iot.navigator.getExtras().deviceId);
console.log(new Date()); iot.business.api.sendCustom('lock/getHistoryRecord',
let data = {record: [{"openId": 0,mode: 0,id: 0, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, {
{"openId": 1,mode: 1,id: 1, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, data: {
{"openId": 2,mode: 2,id: 2, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, device_id: self.getDeviceId(),
{"openId": 4,mode: 4,id: 4, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, action: 0,
{"openId": 0,mode: 0,id: null, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, start_id: self.getStartId(),
{"openId": 1,mode: 1,id: null, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}, page_size: PAGE_SIZE
{"openId": 2,mode: 2,id: null, time: 'Thu Sep 21 2017 13:58:00 GMT+0800'}], },
info: [{"openId": 1,"mode": 1, "nickname": "测试用户01"}, success: (response) => {
{"openId": 2,"mode": 2, "nickname": "测试用户02"}] let data = uPublic.checkResponseData(response.data);
}; if(data){
console.log(data);
if(data){ let list = [];
let list = [];
let record = data.record;
if(data.hasOwnProperty('info')){
self.setUserInfo(data.info);
}
for(let i=0; i<record.length; i++){
list[i] = {
value: record[i].openId,
leftImage: '../../resources/image/green_opendoor'+record[i].mode+'_icon.png',
subtitle: Vue.t('opendoorRecord.mode_'+record[i].mode+''),
rightText: moment(record[i].time).format("YYYY.MM.DD HH:mm:ss")
};
for(let j=0; j<self.getUserInfo().length; j++){
if(record[i].openId == self.getUserInfo()[j].openId && record[i].mode == self.getUserInfo()[j].mode){
list[i].title = self.getUserInfo()[j].nickname == null ? '': self.getUserInfo()[j].nickname;
}else{
console.log(record[i].id);
list[i].title = record[i].id == null ? '':"ID:"+record[i].id;
}
}
}
self.setList(self.getList().concat(list));
if(record.length > 0){
self.setStartId(record[record.length-1].id);
}
//更新列表数据
uComponents.changeList(self, self.getList());
}else{
}
// iot.business.api.getRecorderList(
// {
// data: {
// lock_id: self.getDeviceId(),
// action: 2,
// start_id: self.getStartId(),
// page_size: PAGE_SIZE
// },
// success: (response) => {
// let data = uPublic.checkResponseData(response.data);
// data = [{"openId": 1,mode: 1,id: 1, time: '2017.08.0310:29:53'}];
// if(data){
// let list = [];
let record = data.record; let record = data.record;
if(data.hasOwnProperty('info')){ if(data.hasOwnProperty('info')){
self.setUserInfo(data.info); self.setUserInfo(data.info);
...@@ -166,8 +117,7 @@ function initComponentsConfig() { ...@@ -166,8 +117,7 @@ function initComponentsConfig() {
if(record[i].openId == self.getUserInfo()[j].openId && record[i].mode == self.getUserInfo()[j].mode){ if(record[i].openId == self.getUserInfo()[j].openId && record[i].mode == self.getUserInfo()[j].mode){
list[i].title = self.getUserInfo()[j].nickname == null ? '': self.getUserInfo()[j].nickname; list[i].title = self.getUserInfo()[j].nickname == null ? '': self.getUserInfo()[j].nickname;
}else{ }else{
console.log(record[i].id); list[i].title = self.getUserInfo()[j].id == null ? '':"ID:"+self.getUserInfo()[j].id;
list[i].title = record[i].id == null ? '':"ID:"+record[i].id;
} }
} }
} }
...@@ -177,18 +127,19 @@ function initComponentsConfig() { ...@@ -177,18 +127,19 @@ function initComponentsConfig() {
} }
//更新列表数据 //更新列表数据
uComponents.changeList(self, self.getList()); uComponents.changeList(self, self.getList());
// }else{ console.log("in");
// } }else{
// uComponents.hideLoading(self); }
// }, uComponents.hideLoading(self);
// error: (err) => { },
// uPublic.openRequestErrorAlert(self); error: (err) => {
// console.log(err); uPublic.openRequestErrorAlert(self);
// }, console.log(err);
// complete: () => { },
// complete: () => {
// } uComponents.hideLoading(self);
// }); }
});
} }
//tap < //tap <
...@@ -197,10 +148,6 @@ function backTap(){ ...@@ -197,10 +148,6 @@ function backTap(){
} }
//tap 点击加载更多 //tap 点击加载更多
//function loadTap(self) { function listLoadTap(self) {
// if(!self.getLoadFlag()){ resolve(self);
// resolve(self); }
// self.setLoadText(Vue.t('scroll.loading')); \ No newline at end of file
// self.setLoadFlag(true);
// }
//}
\ No newline at end of file
...@@ -25,6 +25,15 @@ function init() { ...@@ -25,6 +25,15 @@ function init() {
mounted(){ mounted(){
}, },
methods:{ methods:{
getTextPassword(){
return this.textPassword;
},
setTextPassword(pwd){
this.textPassword = pwd;
},
setTextErrorTip(tip){
this.textErrorTip = tip;
},
getTextLoading(){ getTextLoading(){
return this.textLoading; return this.textLoading;
}, },
...@@ -96,7 +105,8 @@ function initComponentsConfig() { ...@@ -96,7 +105,8 @@ function initComponentsConfig() {
} }
function passwordChange(self,text){ function passwordChange(self,text){
self.textPassword = text; self.setTextPassword(text);
self.setTextErrorTip('');
console.log('passwordChange: ' + self.textPassword); console.log('passwordChange: ' + self.textPassword);
} }
...@@ -107,23 +117,45 @@ function backTap(){ ...@@ -107,23 +117,45 @@ function backTap(){
//tap 确定 //tap 确定
function confirmButtonTap(self){ function confirmButtonTap(self){
uComponents.showCommstatusloading(self); console.log(self.getTextPassword());
setTimeout(function(){ if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){
self.setTextLoading(Vue.t('commstatusLoading.connectSuccess')); self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
setTimeout(function(){ }else{
//绑定成功 // iot.business.sds.setDeviceStatus({
self.setStatus(1); // data: {
self.setTextLoading(Vue.t('commstatusLoading.bindSuccess')); // uuid: 'uuid',
//绑定失败 // setParams: {
//self.setStatus(2); // 'OnOff_Power': {
//self.setTextLoading(Vue.t('commstatusLoading.bindFailed')); // 'value': '1'
//uComponents.changeCommstatusButtonText(self,Vue.t('btn.reBound')); // }
},3000); // }
},3000); // },
// success: (response) => {
// console.log(response);
// },
// error: (error) => {
// console.log(error);
// }
// });
}
// uComponents.showCommstatusloading(self);
// setTimeout(function(){
// self.setTextLoading(Vue.t('commstatusLoading.connectSuccess'));
// setTimeout(function(){
// //绑定成功
// self.setStatus(1);
// self.setTextLoading(Vue.t('commstatusLoading.bindSuccess'));
// //绑定失败
// //self.setStatus(2);
// //self.setTextLoading(Vue.t('commstatusLoading.bindFailed'));
// //uComponents.changeCommstatusButtonText(self,Vue.t('btn.reBound'));
// },3000);
// },3000);
} }
//tap loading button //tap loading button
function commstatusLoadingButtonTap(self) { function commstatusLoadingButtonTap(self) {
//绑定成功 //绑定成功
uComponents.hideCommstatusloading(self); uComponents.hideCommstatusloading(self);
iot.navigator.back(); iot.navigator.back();
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</ul> </ul>
<u-button :init-param="componentsConfig.connectButton.initParam" v-on:u-button-tap="onConnectButtonTap"></u-button> <u-button :init-param="componentsConfig.connectButton.initParam" v-on:u-button-tap="onConnectButtonTap"></u-button>
</div> </div>
<u-comm-loading ref="ucommstatusloading" :init-param="componentsConfig.ucommloading.initParam" v-on:u-commstatus-loading-tap="onCommstatusLoadingButtonTap()"> <u-comm-loading ref="ucommloading" :init-param="componentsConfig.ucommloading.initParam" v-on:u-comm-loading-tap="onCommLoadingButtonTap()">
<p class="loader"></p> <p class="loader"></p>
<p class="icon"></p> <p class="icon"></p>
</u-comm-loading> </u-comm-loading>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<v-touch tag="span" class="header-left icon" v-on:tap="onBackTap">&#xe611;</v-touch> <v-touch tag="span" class="header-left icon" v-on:tap="onBackTap">&#xe611;</v-touch>
<p>{{ $t('title.alarmInfo') }}</p> <p>{{ $t('title.alarmInfo') }}</p>
</div> </div>
<u-list ref="ulist" :init-param="componentsConfig.alarmInfoList.initParam"></u-list> <u-list ref="ulist" :init-param="componentsConfig.alarmInfoList.initParam" v-on:u-list-load-tap="onListLoadTap()"></u-list>
<u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog> <u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog>
<u-loading ref="uloading" :init-param="componentsConfig.loading.initParam"></u-loading> <u-loading ref="uloading" :init-param="componentsConfig.loading.initParam"></u-loading>
</div> </div>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<v-touch tag="span" class="header-left icon" v-on:tap="onBackTap">&#xe611;</v-touch> <v-touch tag="span" class="header-left icon" v-on:tap="onBackTap">&#xe611;</v-touch>
<p>{{ $t('title.hijackRecord') }}</p> <p>{{ $t('title.hijackRecord') }}</p>
</div> </div>
<u-list ref="ulist" :init-param="componentsConfig.hijackRecordList.initParam"></u-list> <u-list ref="ulist" :init-param="componentsConfig.hijackRecordList.initParam" v-on:u-list-load-tap="onListLoadTap()"></u-list>
<u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog> <u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog>
<u-loading ref="uloading" :init-param="componentsConfig.loading.initParam"></u-loading> <u-loading ref="uloading" :init-param="componentsConfig.loading.initParam"></u-loading>
</div> </div>
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<script type="text/javascript" src="../../lib/js/UIOT.js"></script> <script type="text/javascript" src="../../lib/js/UIOT.js"></script>
</head> </head>
<body ontouchstart=""> <body ontouchstart="">
<div id="app" v-cloak> <div id="app" v-cloak>
<div class="header"> <div class="header">
<v-touch tag="span" class="header-left icon" v-on:tap="onDoorlockManageTap">&#xe66f;</v-touch> <v-touch tag="span" class="header-left icon" v-on:tap="onDoorlockManageTap">&#xe66f;</v-touch>
...@@ -32,13 +31,13 @@ ...@@ -32,13 +31,13 @@
<p></p> <p></p>
</div> </div>
</div> </div>
<div class="doorbellTip"><span>17:30</span>门铃响了</div> <div class="doorbellTip" v-bind:class="[{active: doorbellRingingFlag}]"><span>{{ ringingTime }}</span>{{ $t('device.doorLockRinging') }}</div>
</div> </div>
<p class="batteryState"><span>&#xe629;</span>100%</p> <p class="batteryState"><span v-html="batteryState"></span>{{ batteryPercent }}%</p>
</div> </div>
<div class="deviceHandle"> <div class="deviceHandle">
<p class="title">门锁最新消息</p> <p class="title">{{ $t('device.newMsgDoorlock') }}</p>
<u-marquee :init-param="componentsConfig.marquee.initParam" :active="activeFlag"></u-marquee> <u-marquee ref="umarquee" :init-param="componentsConfig.marquee.initParam" :active="activeFlag"></u-marquee>
<div class="switchGroup"> <div class="switchGroup">
<div class="guoupRow"> <div class="guoupRow">
<!-- 开门记录 --> <!-- 开门记录 -->
...@@ -62,7 +61,7 @@ ...@@ -62,7 +61,7 @@
</div> </div>
<div class="guoupRow"> <div class="guoupRow">
<!-- 远程开门 --> <!-- 远程开门 -->
<div class="col-xs-6 remoteOpendoor"> <div class="col-xs-6 remoteOpendoor" :class="[{newMsg: remoteOpendoorFlag}]">
<u-switch :value="valueRemoteOpendoor" :init-param="componentsConfig.remoteOpendoorSwitch.initParam" v-on:u-switch-tap="onRemoteOpendoorTap"></u-switch> <u-switch :value="valueRemoteOpendoor" :init-param="componentsConfig.remoteOpendoorSwitch.initParam" v-on:u-switch-tap="onRemoteOpendoorTap"></u-switch>
</div> </div>
<!-- 门锁管理 --> <!-- 门锁管理 -->
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<v-touch tag="span" class="header-left icon" v-on:tap="onBackTap">&#xe611;</v-touch> <v-touch tag="span" class="header-left icon" v-on:tap="onBackTap">&#xe611;</v-touch>
<p>{{ $t('title.opendoorRecord') }}</p> <p>{{ $t('title.opendoorRecord') }}</p>
</div> </div>
<u-list ref="ulist" :init-param="componentsConfig.opendoorRecordList.initParam"></u-list> <u-list ref="ulist" :init-param="componentsConfig.opendoorRecordList.initParam" v-on:u-list-load-tap="onListLoadTap()"></u-list>
<u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog> <u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog>
<u-loading ref="uloading" :init-param="componentsConfig.loading.initParam"></u-loading> <u-loading ref="uloading" :init-param="componentsConfig.loading.initParam"></u-loading>
</div> </div>
......
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