Commit df8e14b1 by 朱建香

#19前端传默认昵称

#22首次进入不可点
远程开门超时判断
#28ios下发激活指令
parent 6f160b2d
......@@ -75,6 +75,7 @@
"register": "快速注册",
"forgetPassword": "忘记密码",
"failure": "登陆失败",
"defaultUser": "用户{0}",
"error": {
"telNull": "请输入手机号",
"passWordNull": "请输入密码"
......@@ -255,6 +256,7 @@
"name": "昵称:",
"inviteBind": "邀请绑定",
"bindUnlockInfo": "关联开锁信息",
"editUsername": "编辑用户昵称",
"opendoorRecord": "历史开门记录",
"unbindDialogTip": "<span></span>解绑后,该用户不能对门锁下的信息进行查看",
"deleteUserDialogTip": "删除后,用户对应的开锁id取消关联,同时失去信息查看权限。",
......@@ -332,7 +334,8 @@
"logoutDialogTip": "确定要退出系统吗?"
},
"editNickname": {
"nickNameInputTip": "请输入昵称"
"nickNameInputTip": "请输入昵称",
"nickNameTypeTip": "请输入中文、字母和数字"
},
"editPassword": {
"newPasswordInputTip": "请输入新密码",
......
......@@ -75,7 +75,7 @@
"register": "快速注册",
"forgetPassword": "忘记密码",
"failure": "登陆失败",
"defaultUser": "user{0}",
"defaultUser": "用户{0}",
"error": {
"telNull": "请输入手机号",
"passWordNull": "请输入密码"
......
......@@ -101,6 +101,45 @@ uPublic.checkString = function (text){
}
}
uPublic.getCompleteDeviceInfo = function iOSbindToUgen(vmobj, inCompleteInfo){
let target = inCompleteInfo.model;
let nickname = target;
let product_id = target;
let deviceInfo = null
console.log("调用SDS云获取设备列表,getSDSDevice.....");
iot.business.device.getList({
data: {
sds: true
},
success: (response) => {
console.log("sds云返回设备数据。。。↓↓");
console.log(response);
response.data.map((item,index)=>{
console.log("展示sds设备...");
console.log(item);
if (item.sn == inCompleteInfo.sn) {
console.log("匹配到了sn一致...");
deviceInfo = {
mac:item.sn,
device_id:item.uuid,
nickname:nickname,
product_id:product_id
};
}
})
},
error: (err) => {
console.log(err);
return false;
},
complete: () => {
}
});
return deviceInfo;
}
uPublic.openWindow = function (params){
console.log("innnnn");
var wv = plus.webview.create(params.url, params.id, {styles: params.styles || {} }, { IOTData: params.extras });
......
......@@ -159,10 +159,6 @@ function connectButtonTap(self){
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) => {}
......@@ -219,7 +215,8 @@ function connectButtonTap(self){
if (window.iotDebug) {
iotDebug.upload(iot,'配网失败');
}
uPublic.openRequestErrorAlert(self);
self.wifiAddSuccess = true;
addFailue(self);
}
});
iot.business.sds.findDevices({
......@@ -232,7 +229,6 @@ function connectButtonTap(self){
if (window.iotDebug) {
iotDebug.upload(iot,'找设备');
}
let productId = defaultConfig.model;
if(response.data == "onJoining"){
if(window.iotDebug){
iotDebug.push('end: 激活中'+JSON.stringify(response));
......@@ -265,28 +261,7 @@ function connectButtonTap(self){
if (window.iotDebug) {
iotDebug.upload(iot,'激活成功');
}
let deviceId = response.info.sn;
// 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(){}
});
joinedSuccess(self, response);
}else if(response.data == "fail"){
//连接失败
if(window.iotDebug){
......@@ -311,7 +286,8 @@ function connectButtonTap(self){
if (window.iotDebug) {
iotDebug.upload(iot);
}
uPublic.openRequestErrorAlert(self);
self.activeSuccess = true;
addFailue(self);
}
});
}
......@@ -326,6 +302,73 @@ function connectButtonTap(self){
// },config.wifi_add_timeout);
}
function joinedSuccess(self, response){
let deviceId = response.info.sn;
let uuid = null;
let productId = defaultConfig.model;
if(response.info.uuid){
uuid = response.info.uuid;
sendDeviceStatus(self, deviceId, productId, uuid);
}else{
let target = response.info.model;
let nickname = target;
let product_id = target;
iot.business.device.getList({
data: {
sds: true
},
success: (response) => {
console.log("sds云返回设备数据。。。↓↓");
console.log(response);
response.data.map((item,index)=>{
console.log("展示sds设备...");
console.log(item);
if (item.sn == deviceId) {
console.log("匹配到了sn一致...");
let deviceInfo = {
mac:item.sn,
device_id:item.uuid,
nickname:nickname,
product_id:product_id
};
uuid = deviceInfo.device_id;
sendDeviceStatus(self, deviceId, productId, uuid);
}
});
},
error: (error) => {
console.log(error);
},
complete: () => {}
});
}
}
function sendDeviceStatus(self, deviceId, productId, uuid){
iot.business.sds.setDeviceStatus({
data: {
uuid: uuid,
setParams: {
'action': {
'value': 'registerSuccess'
}
}
},
success: (response) => {
//激活成功
bind(self, deviceId, productId);
console.log(response);
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
self.activeSuccess = true;
uComponents.hideProcess(self);
},
complete(){}
});
}
//云端绑定之前先解绑
function unbind(self, deviceId, productId){
console.log(deviceId);
......@@ -389,6 +432,7 @@ function bind(self, deviceId, productId){
if (window.iotDebug) {
iotDebug.upload(iot,'绑定失败');
}
self.activeSuccess = true;
addFailue(self);
},
complete: () => {}
......
......@@ -479,6 +479,7 @@ function getDevices(self){
iotDebug.upload(iot,'获取设备信息');
}
uPublic.openRequestErrorAlert(self);
uComponents.hideLoading(self);
},
complete: () => {}
});
......@@ -863,6 +864,15 @@ async function sdsDataPorcessing(self, data){
//远程开门失败
setRemoteOpenDoorLoading(self, 2, Vue.t('remoteOpendoor.openDoorFailure'), Vue.t('remoteOpendoor.remoteOpendoorAgain'));
break;
case '6':
//远程开门超时
uComponents.openAlert(self, Vue.t('remoteOpendoor.remoteTimeout'), {
text: Vue.t('dialog.confirm'), callback: function () {
self.setValueRemoteOpendoor(false);
self.setRemoteOpendoorDisabledFlag(true);
}
});
break;
}
break;
}
......@@ -1251,6 +1261,7 @@ function confirmButtonTap(self){
iotDebug.upload(iot,'远程开门密码下发失败');
}
uPublic.openRequestErrorAlert(self);
uComponents.hideCommLoading(self);
},
complete(){
}
......@@ -1282,6 +1293,7 @@ function confirmButtonTap(self){
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
uComponents.hideCommLoading(self);
}
});
}
......
......@@ -31,7 +31,8 @@ function init() {
imageSrc: '../../resources/image/green_unbindSuccess_icon.png',
textBindTip: Vue.t('doorlockUser.unbindSuccess'),
role: null,
info: null
info: null,
isFirstAddUser: true
},
mounted(){
this.extras = iot.navigator.getExtras();
......@@ -42,6 +43,12 @@ function init() {
getUserInfo(self);
});
getUserInfo(this);
let opener = plus.webview.currentWebview().opener();
if(opener.id == 'addUser'){
self.isFirstAddUser = true;
}else{
self.isFirstAddUser = false;
}
},
methods:{
getBindShowFlag(){
......@@ -376,14 +383,13 @@ function unbindButtonTap(self){
uComponents.openConfirm(self, Vue.t('doorlockUser.unbindDialogTip'),
{text: Vue.t('dialog.cancel'), callback: function () {}},
{text: Vue.t('dialog.unbind'), callback: function () {
// alert(self.extras.account);
// iot.business.sds.unbindByManager({
// data: {
// uuid: self.extras.uuid,
// destAuid: self.extras.account
// },
// success: (response) => {
//// alert(JSON.stringify(response));
iot.business.sds.unbindByManager({
data: {
uuid: self.extras.uuid,
destAuid: self.info.auids
},
success: (response) => {
console.log(response);
iot.business.api.sendCustom('lock/unbindUser',{
data: {
user_id: self.getInfo().user_id,
......@@ -392,18 +398,11 @@ function unbindButtonTap(self){
},
success: (response) => {
console.log(response);
// alert(JSON.stringify(response));
self.setStateShowFlag(true);
getUserInfo(self);
},
error: (error) => {
console.log(error);
// if(window.iotDebug){
// iotDebug.push('end: 解绑失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'解绑失败');
// }
uPublic.openRequestErrorAlert(self);
self.setImageSrc('../../resources/image/green_unbindFail_icon.png');
self.setTextBindTip(Vue.t('doorlockUser.unbindFailue'));
......@@ -413,24 +412,17 @@ function unbindButtonTap(self){
uComponents.hideLoading(self);
}
});
// },
// error: (error) => {
// console.log(error);
// alert(error);
//// if(window.iotDebug){
//// iotDebug.push('end: sds解绑普通用户失败'+JSON.stringify(error));
//// }
//// if (window.iotDebug) {
//// iotDebug.upload(iot,'sds解绑普通用户失败');
//// }
// uPublic.openRequestErrorAlert(self);
// self.setImageSrc('../../resources/image/green_unbindFail_icon.png');
// self.setTextBindTip(Vue.t('doorlockUser.unbindFailue'));
// self.setStateShowFlag(true);
// },
// complete: () => {
// }
// });
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
self.setImageSrc('../../resources/image/green_unbindFail_icon.png');
self.setTextBindTip(Vue.t('doorlockUser.unbindFailue'));
self.setStateShowFlag(true);
},
complete: () => {
}
});
}}
);
}
......@@ -498,63 +490,49 @@ function iSeeButtonTap(self){
//删除用户
function deleteUser(self){
uComponents.showLoading(self);
// iot.business.sds.unbindByManager({
// data: {
// uuid: self.extras.uuid,
// destAuid: self.extras.account
// },
// success: (response) => {
//// alert(JSON.stringify(response));
iot.business.api.sendCustom('lock/delLockUser',{
data: {
rel_id: self.extras.id,
user_id: self.getInfo().user_id,
device_sn: self.getInfo().device_id,
device_id: self.extras.lockId
},
success: (response) => {
console.log(response);
if(response.data.success){
uComponents.openAlert(self, Vue.t('doorlockUser.deleteSuccess'), {
text: Vue.t('btn.confirm'), callback: function () {
iot.navigator.aback();
}
});
}
},
error: (error) => {
console.log(error);
// if(window.iotDebug){
// iotDebug.push('end: 删除用户失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'删除用户失败');
// }
uComponents.openAlert(self, Vue.t('doorlockUser.deleteFailure'), {
text: Vue.t('btn.confirm'), callback: function () {
}
});
},
complete: () => {
uComponents.hideLoading(self);
}
});
// },
// error: (error) => {
// console.log(error);
// alert(error);
//// if(window.iotDebug){
//// iotDebug.push('end: sds解绑普通用户失败'+JSON.stringify(error));
//// }
//// if (window.iotDebug) {
//// iotDebug.upload(iot,'sds解绑普通用户失败');
//// }
// uPublic.openRequestErrorAlert(self);
// self.setImageSrc('../../resources/image/green_unbindFail_icon.png');
// self.setTextBindTip(Vue.t('doorlockUser.unbindFailue'));
// self.setStateShowFlag(true);
// },
// complete: () => {
// }
// });
iot.business.sds.unbindByManager({
data: {
uuid: self.extras.uuid,
destAuid: self.info.auids
},
success: (response) => {
iot.business.api.sendCustom('lock/delLockUser',{
data: {
rel_id: self.extras.id,
user_id: self.getInfo().user_id,
device_sn: self.getInfo().device_id,
device_id: self.extras.lockId
},
success: (response) => {
console.log(response);
if(response.data.success){
uComponents.openAlert(self, Vue.t('doorlockUser.deleteSuccess'), {
text: Vue.t('btn.confirm'), callback: function () {
iot.navigator.aback();
}
});
}
},
error: (error) => {
console.log(error);
uComponents.openAlert(self, Vue.t('doorlockUser.deleteFailure'), {
text: Vue.t('btn.confirm'), callback: function () {
}
});
},
complete: () => {
uComponents.hideLoading(self);
}
});
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
self.setImageSrc('../../resources/image/green_unbindFail_icon.png');
self.setTextBindTip(Vue.t('doorlockUser.unbindFailue'));
self.setStateShowFlag(true);
},
complete: () => {
}
});
}
......@@ -174,49 +174,46 @@ function cloudsLogin(self, id){
if (window.iotDebug) {
iotDebug.upload(iot,'登陆流程时间');
}
console.log(response);
var data = uPublic.checkResponseData(response.data);
var infoArray = [];
if(data){
//判断是否有昵称
if(data.nickname == '' || data.nickname.trim() == ''){
iot.business.user.setInfo({
data: {
nickname: Vue.t('login.defaultUser',[data.username.substr(10,3)]),
head: ''
},
success: (response) => {
if(response.data = 'success'){
iot.navigator.aback();
}
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
},
complete: () => {
uComponents.hideLoading(self);
}
});
}
infoArray.push(['utoken', data.utoken]);
infoArray.push(['userinfo', data]);
iot.business.websql.setMaps(infoArray, () =>{
iot.navigator.openWindow({
url: '../device/index.html',
id: 'device',
styles: {
popGesture: 'none'
},
extras: {
needClose: true
}
});
}, (error) => {
console.log(error);
});
plus.navigator.closeSplashscreen();
}
//更新tocken userinfo
iot.business.user.handleLoginSuccess({
success: (response) => {
if(response && data.nickname == '' || data.nickname == null || data.nickname.trim() == ''){
iot.business.user.setInfo({
data: {
nickname: Vue.t('login.defaultUser',[data.username.substr(10,3)]),
head: ''
},
success: (response) => {
console.log(response);
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
},
complete: () => {
uComponents.hideLoading(self);
}
});
}
iot.navigator.openWindow({
url: '../device/index.html',
id: 'device',
styles: {
popGesture: 'none'
},
extras: {
needClose: true
}
});
plus.navigator.closeSplashscreen();
},
error: (error) => {
console.log(error);
}
}, response);
}
},
error: (error) => {
console.log(error);
......
......@@ -35,10 +35,10 @@
<u-button :init-param="componentsConfig.unbindButton.initParam" v-on:u-button-tap="onUnbindButtonTap" v-show="(unbindShowFlag && !role && userInfo.role != 0)"></u-button>
</li>
<v-touch tag="li" v-on:tap="onBindUnlockInfoTap">{{ $t('doorlockUser.bindUnlockInfo') }}</v-touch>
<v-touch tag="li" v-bind:class="[{disabled: bindShowFlag}]" v-on:tap="onEditNameTap">{{ $t('doorlockUser.editUsername') }}</v-touch>
<v-touch tag="li" v-bind:class="[{disabled: bindShowFlag}]" v-on:tap="onOpendoorRecordTap">{{ $t('doorlockUser.opendoorRecord') }}</v-touch>
<v-touch tag="li" v-bind:class="[{disabled: isFirstAddUser}]" v-on:tap="onEditNameTap">{{ $t('doorlockUser.editUsername') }}</v-touch>
<v-touch tag="li" v-bind:class="[{disabled: isFirstAddUser}]" v-on:tap="onOpendoorRecordTap">{{ $t('doorlockUser.opendoorRecord') }}</v-touch>
</ul>
<u-button :disabled="bindShowFlag" :init-param="componentsConfig.deleteUserButton.initParam" v-on:u-button-tap="onDeleteUserButtonTap" v-show="!role && userInfo.role != 0"></u-button>
<u-button :disabled="isFirstAddUser" :init-param="componentsConfig.deleteUserButton.initParam" v-on:u-button-tap="onDeleteUserButtonTap" v-show="!role && userInfo.role != 0"></u-button>
</div>
<transition name="fade">
<v-touch tag="div" class="unbindState-dialog" v-show="stateShowFlag" v-on:tap="onUnbindStateDialogTap">
......
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