Commit b1749b58 by wjd

Merge branch 'zjx' into 'debug'

Zjx

See merge request iot-project-js/doorlock!19
parents 30090028 01567d70
...@@ -141,6 +141,8 @@ ...@@ -141,6 +141,8 @@
"openDoorFailure": "远程开门失败", "openDoorFailure": "远程开门失败",
"remoteTimeout": "远程开门超时", "remoteTimeout": "远程开门超时",
"remoteOpendoorAgain": "请尝试重试", "remoteOpendoorAgain": "请尝试重试",
"offlineTip": "设备已离线,收到远程开门请求后,请尽快处理",
"textlengthTip": "密码长度为6~12位数字",
"error": { "error": {
"noPasswordTip": "远程密码不能为空" "noPasswordTip": "远程密码不能为空"
} }
...@@ -193,9 +195,9 @@ ...@@ -193,9 +195,9 @@
}, },
"wifiAdd": { "wifiAdd": {
"unbindWifiTip": "当前无Wi-Fi", "unbindWifiTip": "当前无Wi-Fi",
"wifiBinding": "配网中", "wifiBinding": "正在连接网络...",
"wifiBindSuccess": "Wi-Fi连接成功,正在激活设备", "wifiBindSuccess": "Wi-Fi连接成功,正在激活设备...",
"deviceActivating": "Wi-Fi连接成功,正在激活设备", "deviceActivating": "Wi-Fi连接成功,正在激活设备...",
"deviceActivateSuccess":"激活成功", "deviceActivateSuccess":"激活成功",
"deviceActivateFailure":"激活失败", "deviceActivateFailure":"激活失败",
"bindTimeout":"连接超时", "bindTimeout":"连接超时",
...@@ -204,6 +206,7 @@ ...@@ -204,6 +206,7 @@
"remindCont1": "1. 请确保Wi-Fi信号良好", "remindCont1": "1. 请确保Wi-Fi信号良好",
"remindCont2": "2. 本产品暂不支持5GHz无线网络", "remindCont2": "2. 本产品暂不支持5GHz无线网络",
"noticeTip": "检测到您还未开启通知,将无法及时<br>接收安全推送", "noticeTip": "检测到您还未开启通知,将无法及时<br>接收安全推送",
"countDownText": "{0}s",
"error": { "error": {
} }
...@@ -241,7 +244,7 @@ ...@@ -241,7 +244,7 @@
"unbind": "未绑定" "unbind": "未绑定"
}, },
"addUser":{ "addUser":{
"nameInputTip": "请输入您想添加的用户名", "nameInputTip": "请为门锁用户创建显示昵称",
"addUserSuccess": "添加用户成功", "addUserSuccess": "添加用户成功",
"addUserFailure": "添加用户失败", "addUserFailure": "添加用户失败",
"error": { "error": {
...@@ -284,7 +287,7 @@ ...@@ -284,7 +287,7 @@
}, },
"unlockInfo":{ "unlockInfo":{
"bindUnlockInfo": "已关联的开锁信息", "bindUnlockInfo": "已关联的开锁信息",
"noInfoTip": "当前无绑定开锁ID,请添加", "noInfoTip": "尚未关联开锁信息",
"passwordOpenDoor": "密码", "passwordOpenDoor": "密码",
"fingerprintOpenDoor": "指纹", "fingerprintOpenDoor": "指纹",
"ICcardOpenDoor": "IC卡", "ICcardOpenDoor": "IC卡",
......
...@@ -141,6 +141,8 @@ ...@@ -141,6 +141,8 @@
"openDoorFailure": "远程开门失败", "openDoorFailure": "远程开门失败",
"remoteTimeout": "远程开门超时", "remoteTimeout": "远程开门超时",
"remoteOpendoorAgain": "请尝试重试", "remoteOpendoorAgain": "请尝试重试",
"offlineTip": "设备已离线,收到远程开门请求后,请尽快处理",
"textlengthTip": "密码长度为6~12位数字",
"error": { "error": {
"noPasswordTip": "远程密码不能为空" "noPasswordTip": "远程密码不能为空"
} }
...@@ -193,9 +195,9 @@ ...@@ -193,9 +195,9 @@
}, },
"wifiAdd": { "wifiAdd": {
"unbindWifiTip": "当前无Wi-Fi", "unbindWifiTip": "当前无Wi-Fi",
"wifiBinding": "配网中", "wifiBinding": "正在连接网络...",
"wifiBindSuccess": "Wi-Fi连接成功,正在激活设备", "wifiBindSuccess": "Wi-Fi连接成功,正在激活设备...",
"deviceActivating": "Wi-Fi连接成功,正在激活设备", "deviceActivating": "Wi-Fi连接成功,正在激活设备...",
"deviceActivateSuccess":"激活成功", "deviceActivateSuccess":"激活成功",
"deviceActivateFailure":"激活失败", "deviceActivateFailure":"激活失败",
"bindTimeout":"连接超时", "bindTimeout":"连接超时",
...@@ -204,6 +206,7 @@ ...@@ -204,6 +206,7 @@
"remindCont1": "1. 请确保Wi-Fi信号良好", "remindCont1": "1. 请确保Wi-Fi信号良好",
"remindCont2": "2. 本产品暂不支持5GHz无线网络", "remindCont2": "2. 本产品暂不支持5GHz无线网络",
"noticeTip": "检测到您还未开启通知,将无法及时<br>接收安全推送", "noticeTip": "检测到您还未开启通知,将无法及时<br>接收安全推送",
"countDownText": "{0}s",
"error": { "error": {
} }
...@@ -241,7 +244,7 @@ ...@@ -241,7 +244,7 @@
"unbind": "未绑定" "unbind": "未绑定"
}, },
"addUser":{ "addUser":{
"nameInputTip": "请输入您想添加的用户名", "nameInputTip": "请为门锁用户创建显示昵称",
"addUserSuccess": "添加用户成功", "addUserSuccess": "添加用户成功",
"addUserFailure": "添加用户失败", "addUserFailure": "添加用户失败",
"error": { "error": {
...@@ -284,7 +287,7 @@ ...@@ -284,7 +287,7 @@
}, },
"unlockInfo":{ "unlockInfo":{
"bindUnlockInfo": "已关联的开锁信息", "bindUnlockInfo": "已关联的开锁信息",
"noInfoTip": "当前无绑定开锁ID,请添加", "noInfoTip": "尚未关联开锁信息",
"passwordOpenDoor": "密码", "passwordOpenDoor": "密码",
"fingerprintOpenDoor": "指纹", "fingerprintOpenDoor": "指纹",
"ICcardOpenDoor": "IC卡", "ICcardOpenDoor": "IC卡",
......
...@@ -27,13 +27,15 @@ export default { ...@@ -27,13 +27,15 @@ export default {
"model": "USMARTLOCK_SECURITY_SMARTDOOR_SMART_LOCK", "model": "USMARTLOCK_SECURITY_SMARTDOOR_SMART_LOCK",
"GET_MSG_INTERVAL": 5000, "GET_MSG_INTERVAL": 5000,
"wifi_add_timeout": 150000, "wifi_add_timeout": 150000,
"add_wifi_timeout": 60,
"active_device_timeout": 30,
//门铃晃动间隔时间 //门铃晃动间隔时间
"await_time": 3000, "await_time": 3000,
//门铃晃动次数 //门铃晃动次数
"shake_times": 3, "shake_times": 3,
//门锁晃动总时间 //门锁晃动总时间
"ring_time": 12000, "ring_time": 12000,
"remote_opendoor_timeout": 30000, "remote_opendoor_timeout": 15000,
//二维码失效时间 //二维码失效时间
"qrcode_timeout": 600000, "qrcode_timeout": 600000,
"remote_timeout": 120, "remote_timeout": 120,
...@@ -41,7 +43,8 @@ export default { ...@@ -41,7 +43,8 @@ export default {
"maxlength": 16 "maxlength": 16
}, },
"password":{ "password":{
"maxlength": 6 "maxlength": 12,
"minlength": 6
}, },
"ringBell_timeout": 300, "ringBell_timeout": 300,
"intervalTime": 3, "intervalTime": 3,
......
export default { export default {
"url": "https://cloud.iot.u-gen.net/", "url": "https://cloud.iot.u-gen.net/",
// "url": "http://192.168.2.96:20000",
"model": "UGEN_SECURITY_SMARTDOOR_YJ2017" "model": "UGEN_SECURITY_SMARTDOOR_YJ2017"
// "model": "USMARTLOCK_SECURITY_SMARTDOOR_SMART_LOCK"
} }
\ No newline at end of file
...@@ -39,6 +39,9 @@ function init() { ...@@ -39,6 +39,9 @@ function init() {
self.noticeTipShowFlag = !iot.native.isNotifycationOpen(); self.noticeTipShowFlag = !iot.native.isNotifycationOpen();
scanCodeSuccess(self); scanCodeSuccess(self);
}); });
plus.key.addEventListener('backbutton',function(){
iot.utils.closeScanBarcode(self.barcode);
},false);
}, },
methods:{ methods:{
//tap < //tap <
...@@ -73,9 +76,8 @@ function initComponentsConfig() { ...@@ -73,9 +76,8 @@ function initComponentsConfig() {
//tap < //tap <
function backTap(self){ function backTap(self){
iot.navigator.back();
console.log(self.barcode);
iot.utils.closeScanBarcode(self.barcode); iot.utils.closeScanBarcode(self.barcode);
iot.navigator.aback();
} }
function openScanCode(self){ function openScanCode(self){
...@@ -246,7 +248,8 @@ function scanCodeFailue(self){ ...@@ -246,7 +248,8 @@ function scanCodeFailue(self){
"class": 'custom-process-button', 'text': Vue.t('addDevice.reBindDevice'), 'callback': () => { "class": 'custom-process-button', 'text': Vue.t('addDevice.reBindDevice'), 'callback': () => {
//激活失败 //激活失败
uComponents.hideProcess(self); uComponents.hideProcess(self);
uComponents.showProcess(self, 0, Vue.t('addDevice.loading')); iot.utils.closeScanBarcode(self.barcode);
// uComponents.showProcess(self, 0, Vue.t('addDevice.loading'));
openScanCode(self); openScanCode(self);
} }
}]); }]);
......
...@@ -24,7 +24,11 @@ function init() { ...@@ -24,7 +24,11 @@ function init() {
//配置组件 //配置组件
componentsConfig: initComponentsConfig(), componentsConfig: initComponentsConfig(),
noticeTipShowFlag: false, noticeTipShowFlag: false,
timeout: null timeout: null,
countDownText: config.add_wifi_timeout,
wifiAddSuccess: false,
activeSuccess: false,
activing: false
}, },
mounted(){ mounted(){
resolve(this); resolve(this);
...@@ -148,6 +152,23 @@ function backTap(){ ...@@ -148,6 +152,23 @@ function backTap(){
//tap 连接 //tap 连接
function connectButtonTap(self){ function connectButtonTap(self){
self.countDownText = config.add_wifi_timeout;
self.activing = false;
let countDown = setInterval(() => {
self.countDownText --;
if((self.countDownText <= 0) && (self.wifiAddSuccess == false)){
window.clearInterval(countDown);
addFailue(self);
// iot.business.sds.stopFindWIFI({
// success: (response) => {},
// error: (error) => {}
// });
iot.business.sds.stopFindDevices({
success: (response) => {},
error: (error) => {}
});
}
},1000);
if(self.getTextWiFiName() == null || self.getTextWiFiName().trim() == ''){ if(self.getTextWiFiName() == null || self.getTextWiFiName().trim() == ''){
self.setTextErrorTip(Vue.t('wifiAdd.unbindWifiTip')); self.setTextErrorTip(Vue.t('wifiAdd.unbindWifiTip'));
}else if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){ }else if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){
...@@ -204,6 +225,7 @@ function connectButtonTap(self){ ...@@ -204,6 +225,7 @@ function connectButtonTap(self){
iot.business.sds.findDevices({ iot.business.sds.findDevices({
success: (response) => { success: (response) => {
console.log('findDevices'); console.log('findDevices');
console.log(response);
if(window.iotDebug){ if(window.iotDebug){
iotDebug.push('end: 找设备'+JSON.stringify(response)); iotDebug.push('end: 找设备'+JSON.stringify(response));
} }
...@@ -218,6 +240,23 @@ function connectButtonTap(self){ ...@@ -218,6 +240,23 @@ function connectButtonTap(self){
if (window.iotDebug) { if (window.iotDebug) {
iotDebug.upload(iot,'激活中'); iotDebug.upload(iot,'激活中');
} }
self.wifiAddSuccess = true;
if(self.activing == false){
self.countDownText = config.active_device_timeout;
window.clearInterval(countDown);
countDown = setInterval(() => {
self.countDownText --;
if((self.countDownText <= 0) && (self.activeSuccess == false)){
window.clearInterval(countDown);
addFailue(self);
iot.business.sds.stopFindDevices({
success: (response) => {},
error: (error) => {}
});
}
},1000);
self.activing = true;
}
uComponents.showProcess(self, 0, Vue.t('wifiAdd.deviceActivating')); uComponents.showProcess(self, 0, Vue.t('wifiAdd.deviceActivating'));
}else if(response.data == "joined success"){ }else if(response.data == "joined success"){
if(window.iotDebug){ if(window.iotDebug){
...@@ -227,7 +266,27 @@ function connectButtonTap(self){ ...@@ -227,7 +266,27 @@ function connectButtonTap(self){
iotDebug.upload(iot,'激活成功'); iotDebug.upload(iot,'激活成功');
} }
let deviceId = response.info.sn; let deviceId = response.info.sn;
unbind(self, deviceId, productId); // unbind(self, deviceId, productId);
bind(self, deviceId, productId);
iot.business.sds.setDeviceStatus({
data: {
uuid: response.info.uuid,
setParams: {
'action': {
'value': 'regiserSuccess'
}
}
},
success: (response) => {
//激活成功
console.log(response);
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
},
complete(){}
});
}else if(response.data == "fail"){ }else if(response.data == "fail"){
//连接失败 //连接失败
if(window.iotDebug){ if(window.iotDebug){
...@@ -256,15 +315,15 @@ function connectButtonTap(self){ ...@@ -256,15 +315,15 @@ function connectButtonTap(self){
} }
}); });
} }
self.timeout = setTimeout(function (){ // self.timeout = setTimeout(function (){
console.log("timeout"); // console.log("timeout");
window.clearTimeout(self.timeout); // window.clearTimeout(self.timeout);
addFailue(self); // addFailue(self);
iot.business.sds.stopFindDevices({ // iot.business.sds.stopFindDevices({
success: (response) => {}, // success: (response) => {},
error: (error) => {} // error: (error) => {}
}); // });
},config.wifi_add_timeout); // },config.wifi_add_timeout);
} }
//云端绑定之前先解绑 //云端绑定之前先解绑
...@@ -313,6 +372,7 @@ function bind(self, deviceId, productId){ ...@@ -313,6 +372,7 @@ function bind(self, deviceId, productId){
let data = response.data; let data = response.data;
if(data.success){ if(data.success){
addSuccess(self); addSuccess(self);
self.activeSuccess = true;
} }
if(window.iotDebug){ if(window.iotDebug){
iotDebug.push('end: 绑定成功'+JSON.stringify(response)); iotDebug.push('end: 绑定成功'+JSON.stringify(response));
......
...@@ -15,6 +15,8 @@ import {iot, uPublic, uComponents} from '../../public/public.js'; ...@@ -15,6 +15,8 @@ import {iot, uPublic, uComponents} from '../../public/public.js';
import uloop from '../../public/uloop.js'; import uloop from '../../public/uloop.js';
import unotify from '../../public/unotify.js'; import unotify from '../../public/unotify.js';
const ON_LINE = 'on';
const OFF_LINE = 'off';
iot.ready(init); iot.ready(init);
function init() { function init() {
uPublic.closeSlideBack(); uPublic.closeSlideBack();
...@@ -89,7 +91,7 @@ function init() { ...@@ -89,7 +91,7 @@ function init() {
//最新消息 //最新消息
newMsg: [], newMsg: [],
//是否第一次获取门锁信息 //是否第一次获取门锁信息
isFirstGetLockInfo: true, // isFirstGetLockInfo: true,
opendoorRecordFlag: false, opendoorRecordFlag: false,
securityAlarmFlag: false, securityAlarmFlag: false,
hijackAlarmFlag: false, hijackAlarmFlag: false,
...@@ -107,7 +109,8 @@ function init() { ...@@ -107,7 +109,8 @@ function init() {
//门铃总计时器 //门铃总计时器
timeout: null, timeout: null,
//远程开门计时器 //远程开门计时器
remoteTime: null remoteTime: null,
boolPasswordMinlength: false
}, },
mounted(){ mounted(){
//显示loading //显示loading
...@@ -117,7 +120,7 @@ function init() { ...@@ -117,7 +120,7 @@ function init() {
//获取设备信息 //获取设备信息
getDevices(this); getDevices(this);
//注册监听上报 //注册监听上报
registerPushListener(this); // registerPushListener(this);
unotify.getCid((response) => { unotify.getCid((response) => {
console.log(response); console.log(response);
},(error) => { },(error) => {
...@@ -129,12 +132,18 @@ function init() { ...@@ -129,12 +132,18 @@ function init() {
//获取设备信息 //获取设备信息
getDevices(self); getDevices(self);
//注册监听上报 //注册监听上报
registerPushListener(self); // registerPushListener(self);
if(event.detail.needClose){ if(event.detail.needClose){
iot.navigator.closeAllBesidesItself(); iot.navigator.closeAllBesidesItself();
} }
}); });
// ringBell(self);
// setTimeout(() => {
// ringBell(self);
// setTimeout(() =>{
// ringBell(self);
// },1000);
// },1000);
}, },
methods:{ methods:{
setValueRemoteOpendoor(value){ setValueRemoteOpendoor(value){
...@@ -224,12 +233,12 @@ function init() { ...@@ -224,12 +233,12 @@ function init() {
setUuid(){ setUuid(){
this.uuid = id; this.uuid = id;
}, },
getIsFirstGetLockInfo(){ // getIsFirstGetLockInfo(){
return this.isFirstGetLockInfo; // return this.isFirstGetLockInfo;
}, // },
setIsFirstGetLockInfo(flag){ // setIsFirstGetLockInfo(flag){
this.isFirstGetLockInfo = flag // this.isFirstGetLockInfo = flag
}, // },
getLockId(){ getLockId(){
return this.lockId; return this.lockId;
}, },
...@@ -326,6 +335,9 @@ function init() { ...@@ -326,6 +335,9 @@ function init() {
//tap 停止闪铃 //tap 停止闪铃
onStopDoorbellRing(){ onStopDoorbellRing(){
stopDoorbellRing(this); stopDoorbellRing(this);
},
onPasswordMatchlength(value){
passwordMatchlength(this, value);
} }
} }
}).$mount('#app'); }).$mount('#app');
...@@ -421,7 +433,8 @@ function initComponentsConfig() { ...@@ -421,7 +433,8 @@ function initComponentsConfig() {
class: 'custom-text', class: 'custom-text',
icon: '&#xe64d;', icon: '&#xe64d;',
placeholder: Vue.t('remoteOpendoor.passwordInputTip'), placeholder: Vue.t('remoteOpendoor.passwordInputTip'),
maxlength: config.password.maxlength maxlength: config.password.maxlength,
minlength: config.password.minlength
} }
}, },
ucommloading: { ucommloading: {
...@@ -533,10 +546,10 @@ function getLockInfoSuccess(self, data){ ...@@ -533,10 +546,10 @@ function getLockInfoSuccess(self, data){
self.setLockId(data.lock_id); self.setLockId(data.lock_id);
self.setRole(data.role); self.setRole(data.role);
//判断是否第一次获取门锁信息 //判断是否第一次获取门锁信息
if(self.isFirstGetLockInfo){ // if(self.isFirstGetLockInfo){
getDeviceStatus(self); getDeviceStatus(self);
self.setIsFirstGetLockInfo(false); // self.setIsFirstGetLockInfo(false);
} // }
//存储最后一条历史记录的ID //存储最后一条历史记录的ID
let historyId = null let historyId = null
historyId = data.info.historyId ? data.info.historyId : null; historyId = data.info.historyId ? data.info.historyId : null;
...@@ -591,6 +604,10 @@ function getDeviceStatus(self){ ...@@ -591,6 +604,10 @@ function getDeviceStatus(self){
let data = uPublic.checkResponseData(response.data); let data = uPublic.checkResponseData(response.data);
if(data){ if(data){
setBatteryPercentAndIcon(self, data.BatteryPercentage.value); setBatteryPercentAndIcon(self, data.BatteryPercentage.value);
iot.storage.setMap('onLineState', data.onlineState.value, (response) => {
console.log(res);
}, () => {});
registerPushListener(self);
} }
}, },
error: (error) => { error: (error) => {
...@@ -806,10 +823,12 @@ function registerPushListener(self){ ...@@ -806,10 +823,12 @@ function registerPushListener(self){
} }
//sds消息处理方法 //sds消息处理方法
function sdsDataPorcessing(self, data){ async function sdsDataPorcessing(self, data){
let onlineState = await iot.storage.getMap('onLineState');
console.log(data); console.log(data);
//设置电量百分比和icon //设置电量百分比和icon
setBatteryPercentAndIcon(self, data.BatteryPercentage.value); setBatteryPercentAndIcon(self, data.BatteryPercentage.value);
if(onlineState == data.onlineState.value){
switch(data.action.value){ switch(data.action.value){
case 'notify': case 'notify':
switch(data.notify_type.value){ switch(data.notify_type.value){
...@@ -847,13 +866,18 @@ function sdsDataPorcessing(self, data){ ...@@ -847,13 +866,18 @@ function sdsDataPorcessing(self, data){
} }
break; break;
} }
}else{
iot.storage.setMap('onLineState', data.onlineState.value, (response) => {
console.log(res);
}, () => {});
}
} }
//设置电量百分比、电量icon //设置电量百分比、电量icon
function setBatteryPercentAndIcon(self, value){ function setBatteryPercentAndIcon(self, value){
console.log('setBatteryPercentAndIcon'+value); console.log('setBatteryPercentAndIcon'+value);
self.setBatteryPercent(value); self.setBatteryPercent(value);
let state = 0; let state = 5;
if(value >= 10){ if(value >= 10){
//向上取整 //向上取整
state = config.powerIcon[Math.ceil(value/20)]; state = config.powerIcon[Math.ceil(value/20)];
...@@ -906,51 +930,79 @@ function setRemoteOpenDoorLoading(self, status, text, buttonText){ ...@@ -906,51 +930,79 @@ function setRemoteOpenDoorLoading(self, status, text, buttonText){
//响铃动画和铃声设置 //响铃动画和铃声设置
function ringBell(self){ function ringBell(self){
window.clearInterval(self.time); // window.clearInterval(self.time);
window.clearTimeout(self.timeout); // window.clearTimeout(self.timeout);
let i = 0; // let i = 0;
simpleRingBell(self,i); // simpleRingBell(self,i);
self.setRingTime(config.ring_time); // self.setRingTime(config.ring_time);
self.time = setInterval(function(){ // self.time = setInterval(function(){
i++; // i++;
simpleRingBell(self,i); // simpleRingBell(self,i);
},config.await_time*2); // },config.await_time*2);
} if(self.getDoorbellRingingFlag() === false){
//铃声和动画循环一遍
function simpleRingBell(self,i){
window.clearTimeout(self.timeout);
self.setDoorbellRingingFlag(true); self.setDoorbellRingingFlag(true);
let p = plus.audio.createPlayer(config.audioUrl); let p = plus.audio.createPlayer(config.audioUrl);
self.timeout = setTimeout(() => {
p = plus.audio.createPlayer(config.audioUrl);
p.play( function () { p.play( function () {
console.log( "Audio play success!" ); console.log( "Audio play success!" );
}, function ( e ) { }, function ( e ) {
console.log( "Audio play error: " + e.message ); console.log( "Audio play error: " + e.message );
}); });
self.timeout = setTimeout(function(){ console.log(self.timeout);
self.timeout = setTimeout(() => {
console.log("in2");
p = plus.audio.createPlayer(config.audioUrl); p = plus.audio.createPlayer(config.audioUrl);
p.play( function () { p.play( function () {
console.log( "Audio play success!" ); console.log( "Audio play success!" );
}, function ( e ) { }, function ( e ) {
console.log( "Audio play error: " + e.message ); console.log( "Audio play error: " + e.message );
}); });
window.clearTimeout(self.timeout); console.log(self.timeout);
self.timeout = setTimeout(function(){ self.timeout = setTimeout(() => {
self.setDoorbellRingingFlag(false); self.setDoorbellRingingFlag(false);
window.clearTimeout(self.timeout); console.log(self.timeout);
if(i>=1){ },1500);
window.clearInterval(self.time); },2000);
} },500);
},config.await_time*3/5);
if(i>=1){
window.clearInterval(self.time);
}
},config.await_time*2/5);
if(i>=1){
window.clearInterval(self.time);
} }
} }
//铃声和动画循环一遍
//function simpleRingBell(self,i){
// window.clearTimeout(self.timeout);
// self.setDoorbellRingingFlag(true);
// let p = plus.audio.createPlayer(config.audioUrl);
// p.play( function () {
// console.log( "Audio play success!" );
// }, function ( e ) {
// console.log( "Audio play error: " + e.message );
// });
//
// self.timeout = setTimeout(function(){
// p = plus.audio.createPlayer(config.audioUrl);
// p.play( function () {
// console.log( "Audio play success!" );
// }, function ( e ) {
// console.log( "Audio play error: " + e.message );
// });
// window.clearTimeout(self.timeout);
// self.timeout = setTimeout(function(){
// self.setDoorbellRingingFlag(false);
// window.clearTimeout(self.timeout);
// if(i>=1){
// window.clearInterval(self.time);
// }
// },1500);
// if(i>=1){
// window.clearInterval(self.time);
// }
// },500);
// if(i>=1){
// window.clearInterval(self.time);
// }
//}
function pushAction(self, msg) { function pushAction(self, msg) {
var payload = msg.payload; var payload = msg.payload;
if (typeof payload == 'string') { if (typeof payload == 'string') {
...@@ -1070,10 +1122,32 @@ function doorlockUserTap(self){ ...@@ -1070,10 +1122,32 @@ function doorlockUserTap(self){
//tap 远程开门 //tap 远程开门
function remoteOpendoorTap(self){ function remoteOpendoorTap(self){
iot.business.sds.getDeviceStatus({
data: {
uuid: self.uuid
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
if(data.onlineState.value == ON_LINE){
if(self.valueRemoteOpendoor){ if(self.valueRemoteOpendoor){
self.setTextPassword(''); self.setTextPassword('');
self.setRemoteOpendoorShowFlag(true); self.setRemoteOpendoorShowFlag(true);
} }
}else{
uComponents.openAlert(self, Vue.t('remoteOpendoor.offlineTip'), {
text: Vue.t('dialog.confirm'), callback: function () {
}
});
}
}
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
}
});
} }
//tap 门锁管理 //tap 门锁管理
...@@ -1121,19 +1195,35 @@ function passwordChange(self,text){ ...@@ -1121,19 +1195,35 @@ function passwordChange(self,text){
console.log('passwordChange: ' + self.textPassword); console.log('passwordChange: ' + self.textPassword);
} }
//获取远程密码是否达到最小长度
function passwordMatchlength(self, bool) {
console.log(bool);
self.boolPasswordMinlength = bool;
}
//tap 确定(远程开门密码) //tap 确定(远程开门密码)
function confirmButtonTap(self){ function confirmButtonTap(self){
iot.business.sds.getDeviceStatus({
data: {
uuid: self.uuid
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
if(data.onlineState.value == ON_LINE){
if(self.boolPasswordMinlength){
if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){ if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){
self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip')); self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
}else{ }else{
uComponents.showCommLoading(self); uComponents.showCommLoading(self);
setRemoteOpenDoorLoading(self, 0, Vue.t('remoteOpendoor.loading')); setRemoteOpenDoorLoading(self, 0, Vue.t('remoteOpendoor.loading'));
let keyIv = crypto.enkey(self.mac.replace(/:/g,'')); let keyIv = crypto.enkey(self.mac.replace(/:/g,''));
// console.log(keyIv); // console.log(keyIv);
let pwd = crypto.encode(self.getTextPassword(), keyIv); let pwd = crypto.encode(self.getTextPassword(), keyIv);
// console.log(pwd); // console.log(pwd);
// let msg = crypto.decode(pwd, keyIv); // let msg = crypto.decode(pwd, keyIv);
// console.log(msg); // console.log(msg);
iot.business.sds.setDeviceStatus({ iot.business.sds.setDeviceStatus({
data: { data: {
uuid: self.getUuid(), uuid: self.getUuid(),
...@@ -1169,6 +1259,25 @@ function confirmButtonTap(self){ ...@@ -1169,6 +1259,25 @@ function confirmButtonTap(self){
setRemoteOpenDoorLoading(self, 2, Vue.t('remoteOpendoor.remoteTimeout'), Vue.t('remoteOpendoor.remoteOpendoorAgain')); setRemoteOpenDoorLoading(self, 2, Vue.t('remoteOpendoor.remoteTimeout'), Vue.t('remoteOpendoor.remoteOpendoorAgain'));
} }
},config.remote_opendoor_timeout); },config.remote_opendoor_timeout);
}else{
uComponents.openAlert(self, Vue.t('remoteOpendoor.textlengthTip'), {
text: Vue.t('dialog.confirm'), callback: function () {
}
});
}
}else{
uComponents.openAlert(self, Vue.t('remoteOpendoor.offlineTip'), {
text: Vue.t('dialog.confirm'), callback: function () {
}
});
}
}else{}
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
}
});
} }
//tap comm-loading ‘确认’ //tap comm-loading ‘确认’
......
...@@ -256,15 +256,52 @@ ...@@ -256,15 +256,52 @@
} }
} }
.u-process{
.u-process-content{
.loader{
&:before{
.transform(translateZ(0) scale(0.7));
}
}
}
}
.u-process.u-process-status-0{
.u-process-content{
.loading{
position: relative;
.loading-text{
position: absolute;
left: 0;
top: 0;
font-size: 16px;
line-height: 3.750em;
width: 100%;
text-align: center;
}
}
}
}
.u-process.u-process-status-1{ .u-process.u-process-status-1{
.u-process-content{ .u-process-content{
top: 200px; top: 200px;
.loading{
.loading-text{
display: none;
}
}
} }
} }
.u-process.u-process-status-2{ .u-process.u-process-status-2{
.u-process-content{ .u-process-content{
top: 200px; top: 200px;
.loading{
.loading-text{
display: none;
}
}
} }
} }
...@@ -1122,6 +1122,11 @@ p { ...@@ -1122,6 +1122,11 @@ p {
} }
} }
.u-process-content .loader:before {
-webkit-transform: translateZ(0) scale(0.7);
transform: translateZ(0) scale(0.7);
}
.scanContent { .scanContent {
position: fixed; position: fixed;
top: 1.173rem; top: 1.173rem;
...@@ -1197,10 +1202,37 @@ p { ...@@ -1197,10 +1202,37 @@ p {
background-color: transparent; background-color: transparent;
} }
.u-process .u-process-content .loader:before {
-webkit-transform: translateZ(0) scale(0.7);
transform: translateZ(0) scale(0.7);
}
.u-process.u-process-status-0 .u-process-content .loading {
position: relative;
}
.u-process.u-process-status-0 .u-process-content .loading .loading-text {
position: absolute;
left: 0;
top: 0;
font-size: 0.427rem;
line-height: 3.750em;
width: 100%;
text-align: center;
}
.u-process.u-process-status-1 .u-process-content { .u-process.u-process-status-1 .u-process-content {
top: 5.333rem; top: 5.333rem;
} }
.u-process.u-process-status-1 .u-process-content .loading .loading-text {
display: none;
}
.u-process.u-process-status-2 .u-process-content { .u-process.u-process-status-2 .u-process-content {
top: 5.333rem; top: 5.333rem;
} }
.u-process.u-process-status-2 .u-process-content .loading .loading-text {
display: none;
}
\ No newline at end of file
...@@ -48,7 +48,10 @@ ...@@ -48,7 +48,10 @@
<p class="icon"></p> <p class="icon"></p>
</u-comm-loading> --> </u-comm-loading> -->
<u-process ref="uprocess" :init-param="componentsConfig.processLoading.initParam"> <u-process ref="uprocess" :init-param="componentsConfig.processLoading.initParam">
<div class="loading">
<p class="loader"></p> <p class="loader"></p>
<p class="loading-text">{{ $t('wifiAdd.countDownText',[countDownText]) }}</p>
</div>
<p class="icon"></p> <p class="icon"></p>
<p class="noticeContent" v-show = "noticeTipShowFlag"> <p class="noticeContent" v-show = "noticeTipShowFlag">
<span>&#xe637;</span> <span>&#xe637;</span>
......
...@@ -104,7 +104,8 @@ ...@@ -104,7 +104,8 @@
<div class="content"> <div class="content">
<div class="inputBox"> <div class="inputBox">
<u-text :init-param="componentsConfig.passwordInput.initParam" :text="textPassword" <u-text :init-param="componentsConfig.passwordInput.initParam" :text="textPassword"
v-on:u-text-change="onPasswordChange(arguments[0])"></u-text> v-on:u-text-change="onPasswordChange(arguments[0])"
v-on:u-text-match-minlength="onPasswordMatchlength(arguments[0])"></u-text>
<p class="errorTip" v-if="textErrorTip">{{ textErrorTip }}</p> <p class="errorTip" v-if="textErrorTip">{{ textErrorTip }}</p>
</div> </div>
<u-button :init-param="componentsConfig.confirmButton.initParam" v-on:u-button-tap="onConfirmButtonTap"></u-button> <u-button :init-param="componentsConfig.confirmButton.initParam" v-on:u-button-tap="onConfirmButtonTap"></u-button>
......
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