Commit a3f44d8c by 朱建香

0927

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