Commit df8e14b1 by 朱建香

#19前端传默认昵称

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