Commit a14204ca by 朱建香

1013首页修改

parent 3302bbd5
......@@ -108,6 +108,7 @@
"newMsgDoorlock": "门锁最新消息",
"doorLockRinging": "门铃响了",
"defaultNewMsg": "您尚未绑定门锁",
"noNewMsg": "门锁休息中",
"bindDoorlock": "绑定门锁"
},
"opendoorRecord":{
......@@ -237,14 +238,18 @@
"unbindFailue": "解绑失败",
"guideStep1Tip1": "邀请绑定成功",
"guideStep1Tip2": "(可查看开门记录,报警记录等<br>相关门锁信息)",
"guideStep3Tip": "绑定后看可了解<br>该用户的开门情况"
"guideStep3Tip": "绑定后看可了解<br>该用户的开门情况",
"deleteSuccess": "删除成功",
"deleteFailure": "删除失败"
},
"editName":{
"nameInputTip": "请输入设备名称",
"nickNameInputTip": "请输入用户名",
"editNameSuccess": "修改名称成功",
"editNameFailue": "修改名称失败",
"error": {
"nameCanNotBeBlank": "设备名称不能为空"
"nameCanNotBeBlank": "设备名称不能为空",
"nicknameCanNotBeBlank": "用户名不能为空"
}
},
"inviteBind":{
......
......@@ -86,11 +86,9 @@ function init() {
uuid: self.uuid
},
success: (response) => {
console.log(response);
let data = response.data;
self.setBatteryPercent(data.battery.value);
self.setBatteryState(config.powerIcon[Math.round(data.battery.value/20)]);
setDevceInfo(self, data);
},
error: (error) => {
......@@ -161,13 +159,13 @@ function init() {
uPublic.openRequestErrorAlert(self);
}
});
let power = 5;
this.batteryPercent = power/5*100;
this.batteryState = config.powerIcon[power];
// 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");
// let time = new Date();
// this.ringingTime = moment(time).format("HH:mm");
},
methods:{
getValueOpendoorRecord(){
......@@ -395,7 +393,8 @@ function getLockInfo(self){
self.newMsg = moment(data.info[0].time).format("YY.MM.DD HH:mm") + data.info[0].nickname + Vue.t('opendoorRecord.'+config.openDoorMode[data.info[0].mode]+'');
uComponents.changeMarqueeText(self, self.newMsg);
}else{
uComponents.changeMarqueeText(self, Vue.t('device.noNewMsg'));
self.setRingingTime(null);
}
},
error: (error) => {
......@@ -500,7 +499,8 @@ function doorlockUserTap(self){
// url: '../doorlockUsers/index.html',
// id: 'doorlockUsers',
// extras: {
// deviceId: self.deviceId
// deviceId: self.deviceId,
// uuid: self.getUuid()
// }
// });
// }
......
......@@ -24,7 +24,7 @@ function init() {
bindShowFlag: true,
unbindShowFlag: false,
stateShowFlag: false,
guideShowFlag: true,
guideShowFlag: false,
guideStep1ShowFlag: false,
guideStep2ShowFlag: false,
guideStep3ShowFlag: false,
......@@ -36,9 +36,13 @@ function init() {
mounted(){
this.extras = iot.navigator.getExtras();
console.log(this.extras);
showGuide(this);
setUserInfo(this);
window.addEventListener('returnPage',function(event){
console.log("returnPage");
getDoorlockInfo(self);
});
// showGuide(this);
// checkFirstAddUser(this);
// getUserInfo(this);
},
methods:{
getBindShowFlag(){
......@@ -94,11 +98,11 @@ function init() {
backTap();
},
onEditNameTap(){
editNameTap();
editNameTap(this);
},
//tap 邀请绑定
onBindTap(){
bindTap();
bindTap(this);
},
//tap 解绑
onUnbindButtonTap(){
......@@ -106,7 +110,7 @@ function init() {
},
//tap 绑定开锁信息
onBindUnlockInfoTap(){
bindUnlockInfoTap();
bindUnlockInfoTap(this);
},
//tap 历史开门记录
onOpendoorRecordTap(){
......@@ -192,6 +196,7 @@ function checkFirstAddUser(self){
//显示动画
async function showGuide(self){
self.setGuideShowFlag(true);
try{
let time =await sleep(1000);
self.setGuideStep1ShowFlag(true);
......@@ -210,6 +215,19 @@ async function showGuide(self){
}
}
async function nextGuide(self){
try{
let time = await sleep(1000);
self.setGuideStep3ShowFlag(true),
time = await sleep(1000);
self.setGuideStep4ShowFlag(true);
}
catch (err){
console.log(err);
}
}
function sleep(time){
return new Promise(function(resolve, reject){
setTimeout(()=>{
......@@ -218,20 +236,16 @@ function sleep(time){
})
}
function getUserInfo(self){
iot.business.api.sendCustom('user/getUserInfo',{
data: {
id: self.extras.userId
},
success: (response) => {
console.log(response);
},
error: (error) => {
console.log(error);
},
complete: () => {}
})
//设置用户信息
function setUserInfo(self){
self.userInfo = {
image: self.extras.role == 0 ? '../../resources/image/green_admin_icon.png' : self.extras.user_id == null ? '../../resources/image/gray_unbindHead_icon.png' : '../../resources/image/green_bindhead_icon.png',
role: self.extras.role,
title: self.extras.nickname,
subtitle: self.extras.username
}
self.setBindShowFlag(self.extras.userId ? false : true);
self.setUnbindShowFlag(self.extras.userId ? true : false);
}
//tap <
......@@ -239,27 +253,36 @@ function backTap(){
iot.navigator.back();
}
function editNameTap(){
//修改用户名称
function editNameTap(self){
iot.navigator.openWindow({
url: './editName.html',
id: 'editName'
id: 'editName',
extras: {
id: self.extras.id,
nickname: self.extras.nickname
}
});
}
//tap 邀请绑定
function bindTap(){
function bindTap(self){
iot.navigator.openWindow({
url: './inviteBind.html',
id: 'inviteBind'
id: 'inviteBind',
extras: {
uuid: self.extras.uuid
}
});
}
//tap 解绑
function unbindButtonTap(self){
uComponents.openConfirm(self, Vue.t('doorlockUsers.unbindDialogTip'),
uComponents.openConfirm(self, Vue.t('doorlockUser.unbindDialogTip'),
{text: Vue.t('dialog.cancel'), callback: function () {}},
{text: Vue.t('dialog.unbind'), callback: function () {
self.setStateShowFlag(true);
}}
);
}
......@@ -271,10 +294,13 @@ function unbindStateDialogTap(self){
}
//tap 绑定开锁信息
function bindUnlockInfoTap(){
function bindUnlockInfoTap(self){
iot.navigator.openWindow({
url: './unlockInfo.html',
id: 'unlockInfo'
id: 'unlockInfo',
extras: {
id: self.extras.id
}
});
}
......@@ -288,9 +314,11 @@ function opendoorRecordTap(){
//tap 删除该用户
function deleteUserButtonTap(self){
uComponents.openConfirm(self, Vue.t('doorlockUsers.deleteUserDialogTip'),
uComponents.openConfirm(self, Vue.t('doorlockUser.deleteUserDialogTip'),
{text: Vue.t('dialog.cancel'), callback: function () {}},
{text: Vue.t('dialog.delete'), callback: function () {}}
{text: Vue.t('dialog.delete'), callback: function () {
deleteUser();
}}
);
}
......@@ -298,12 +326,42 @@ function deleteUserButtonTap(self){
function nextButtonTap(self){
self.setGuideStep1ShowFlag(false);
self.setGuideStep2ShowFlag(false);
// self.setGuideStep3ShowFlag(true);
// self.setGuideStep4ShowFlag(true);
nextGuide(self);
}
//tap 我知道了
function iSeeButtonTap(self){
self.setGuideShowFlag(false);
}
//删除用户
function deleteUser(){
uComponents.showLoading(self);
iot.business.api.sendCustom('user/deleteUser',{
data: {
id: self.extras.id
},
success: (response) => {
console.log(response);
uComponents.openAlert(self, Vue.t('doorlockUser.deleteSuccess'), {
text: Vue.t('btn.confirm'), callback: function () {
iot.navigator.openWindow({
url: '../doorlockUsers/index.html',
id: 'doorlockUsers'
});
}
});
},
error: (err) => {
console.log(err);
uComponents.openAlert(self, Vue.t('doorlockUser.deleteFailure'), {
text: Vue.t('btn.confirm'), callback: function () {
}
});
},
complete: () => {
uComponents.hideLoading(self);
}
});
}
......@@ -15,14 +15,28 @@ function init() {
uPublic.componentsInit(['u-text','u-dialog','u-loading']);
const app = new Vue({
data:{
textName: '我是个用户二号',
textName: iot.navigator.getExtras().nickname,
textErrorTip: null,
//配置组件
componentsConfig: initComponentsConfig()
componentsConfig: initComponentsConfig(),
extras: {}
},
mounted(){
this.extras = iot.navigator.getExtras();
},
methods:{
getTextName(){
return this.textName;
},
setTextName(text){
this.textName = text;
},
getTextErrorTip(){
return this.textErrorTip;
},
setTextErrorTip(tip){
this.textErrorTip = tip;
},
//tap <
onBackTap(){
backTap();
......@@ -44,7 +58,7 @@ function initComponentsConfig() {
nameInput: {
initParam: {
class: 'custom-editName-text',
placeholder: Vue.t('editName.nameInputTip')
placeholder: Vue.t('editName.nickNameInputTip')
}
},
dialog: {
......@@ -66,11 +80,52 @@ function backTap(){
}
//tap 保存
function saveTap(){
function saveTap(self){
iot.navigator.back();
if(self.getTextName() == null || self.getTextName().trim() == ''){
self.setTextErrorTip(Vue.t('editName.nameCanNotNull'));
}else{
uComponents.showLoading(self);
iot.business.api.sendCustom('user/editUsername',{
data: {
device_id: self.extras.deviceId,
nickname: self.getTextName()
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
uComponents.openAlert(self, Vue.t('editName.nicknameCanNotBeBlank'), {
text: Vue.t('btn.confirm'), callback: function () {
let opener = plus.webview.currentWebview().opener();
let view = plus.webview.getWebviewById(opener.id);
console.log(view);
iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{});
console.log('returnPage');
iot.navigator.back();
}
});
}
},
error: (error) => {
console.log(error);
uComponents.hideLoading(self);
uComponents.openAlert(self, Vue.t('editName.editNameFailue'), {
text: Vue.t('btn.confirm'), callback: function () {
let opener = plus.webview.currentWebview().opener();
iot.navigator.back();
}
});
},
complete: () => {
uComponents.hideLoading(self);
}
});
}
}
function nameChange(self,text){
self.textName = text;
self.setTextErrorTip(null);
console.log('nameChange: ' + self.textName);
}
\ No newline at end of file
......@@ -25,7 +25,9 @@ function init() {
loadText: 'loading',
pagesize: 10,
tip: '无数据',
extras: {}
extras: {},
userListData: [],
startId: 0
},
mounted(){
this.extras = iot.navigator.getExtras();
......@@ -49,6 +51,18 @@ function init() {
setLoadShowFlag(number){
this.loadShowFlag = (number >= this.pagesize);
},
getUserListData(){
return this.userListData;
},
setUserListData(data){
this.userListData = data;
},
getStartId(){
return this.startId;
},
setStartId(id){
this.startId = id;
},
onSwipeLeftRow(index){
swipeLeftRow(this, index);
},
......@@ -98,31 +112,59 @@ function getUserList(self){
},
success: (response) => {
console.log(response);
let data = [ { id: 2,
device_id: 'B0F89310D509',
user_id: 2,
role: 0,
nickname: '用户1',
username: '测试1' },
{ id: 3,
device_id: 'B0F89310D509',
user_id: 1,
role: 1,
nickname: '用户2',
username: '测试2' },
{ id: 4,
device_id: 'B0F89310D509',
user_id: null,
role: 1,
nickname: '用户3' },
{ id: 5,
device_id: 'B0F89310D509',
user_id: null,
role: 1,
nickname: '用户4' },
{ id: 6,
device_id: 'B0F89310D509',
user_id: null,
role: 1,
nickname: '用户5' } ];
// let data = uPublic.checkResponseData(response.data);
// if(data){
// let list = [];
// for(let i = 0; i < data.length ; i++){
// list[i] = {
// value: data.userId,
// role: data.role,
// image: data.role == 0 ? '../../resources/image/green_admin_icon.png' : data.name == null ? '../../resources/image/gray_unbindHead_icon.png' : '../../resources/image/green_bindhead_icon.png',
// title: data.nickname,
// subTitle: data.name
// }
// }
let list = [{value: 1, role: 0, image: '../../resources/image/green_admin_icon.png', title: '我是用户', subtitle: "MM"},
{value: 1, role: 1, image: '../../resources/image/green_bindhead_icon.png', title: '我是用户', subtitle: "MM"}];
console.log(data);
if(data){
let list = [];
for(let i = 0; i < data.length ; i++){
list[i] = {
value: data[i].id,
role: data[i].role,
image: data[i].role == 0 ? '../../resources/image/green_admin_icon.png' : data[i].user_id == null ? '../../resources/image/gray_unbindHead_icon.png' : '../../resources/image/green_bindhead_icon.png',
title: data[i].nickname,
subtitle: data[i].username
}
}
self.setUserListData(self.getUserList().concat(data));
self.setUserList(self.getUserList().concat(list));
console.log(self.getUserList());
// if(data.length > 0){
// self.setStartId(data[data.length-1].id);
// }
// }
if(data.length > 0){
self.setStartId(data[data.length-1].id);
}
}
},
error: (error) => {
console.log(error);
uPublic.openRequestErrorAlert(self);
// uPublic.openRequestErrorAlert(self);
},
complete: () => {
uComponents.hideLoading(self);
......@@ -156,6 +198,15 @@ function onTapUserList(self, listIndex) {
iot.navigator.openWindow({
url: './doorlockUser.html',
id: 'doorlockUser',
extras: {
id: self.getUserListData()[listIndex].id,
userId: self.getUserListData()[listIndex].user_id,
nickname: self.getUserListData()[listIndex].nickname,
username: self.getUserListData()[listIndex].username,
deviceId: self.getUserListData()[listIndex].device_id,
role: self.getUserListData()[listIndex].role,
uuid: self.extras.uuid
}
});
if (self.userListIndex != null) {
self.userListIndex = null;
......
......@@ -7,6 +7,7 @@
* 邀请绑定页面
*/
let QRCode = require('qrcode');
import {iot, uPublic, uComponents} from '../../public/public.js';
iot.ready(init);
......@@ -16,18 +17,34 @@ function init() {
const app = new Vue({
data:{
//配置组件
componentsConfig: initComponentsConfig()
componentsConfig: initComponentsConfig(),
extras: [],
uuid: null,
qrCodeDisabled: false
},
mounted(){
this.extras = iot.navigator.getExtras();
console.log(this.extras);
this.setUuid(this.extras.uuid);
qrcodeButtonTap(this);
},
methods:{
getUuid(){
return this.uuid;
},
setUuid(id){
this.uuid = id;
},
setQrCodeDisabled(boolean){
this.qrCodeDisabled = boolean;
},
//tap <
onBackTap(){
backTap();
},
//tap 重新生成二维码
onQRcodeButtonTap(){
qrcodeButtonTap();
qrcodeButtonTap(this);
}
}
}).$mount('#app');
......@@ -62,6 +79,40 @@ function backTap(){
}
//tap 重新生成二维码
function qrcodeButtonTap(){
alert('重新生成二维码');
function qrcodeButtonTap(self){
uComponents.showLoading(self);
iot.business.sds.saveqr({
data: {
uuid: self.getUuid()
},
success: (response) => {
let data = uPublic.checkResponseData(response.data);
if(data){
let qrKey = response.data.qrKey;
let qr = self.$refs.qrcode;
QRCode.toCanvas(qr, qrKey, {
scale: 5,
margin: 2
},(error) => {
if (error) {
console.log(error)
} else {
console.log('success');
uComponents.hideLoading(self);
qr.style.width = "5.280rem";
qr.style.height = "5.280rem";
console.log(qr.style);
setTimeout(() => {
self.setQrCodeDisabled(true);
},1000*60*10);
}
});
}else{}
},
error: (error) => {
console.log(error);
//请求失败
uPublic.openRequestErrorAlert(self);
}
});
}
\ No newline at end of file
......@@ -26,8 +26,17 @@ function init() {
componentsConfig: initComponentsConfig()
},
mounted(){
this.extras = iot.navigator.getExtras();
//获取已绑定的开锁信息
getBindedLockInfo(this);
},
methods:{
getUnlockInfoList(){
return this.unlockInfoList;
},
setUnlockInfoList(list){
this.unlockInfoList = list
},
//tap <
onBackTap(){
backTap();
......@@ -80,3 +89,35 @@ function tapLoad(){
//再次发送获取用户列表请求
}
}
//获取已绑定的开锁信息
function getBindedLockInfo(self){
uComponents.showLoading(self);
iot.business.api.sendCustom('lock/getBindedInfo',{
data: {
id: self.extras.id
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
console.log(data);
let list = [];
for(let i=0; i<record.length; i++){
list[i] = {
};
}
self.setUnlockInfoList(self.getUnlockInfoList().concat(list));
//更新列表数据
uComponents.changeList(self, self.getList());
}else{}
},
error: (err) => {
console.log(err);
},
complete: () => {
uComponents.hideLoading(self);
}
});
}
webpackJsonp([26],{
/***/ 136:
/***/ 155:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -89,7 +89,7 @@ function wifiAddTap() {
/***/ 255:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(136);
module.exports = __webpack_require__(155);
/***/ })
......
webpackJsonp([25],{
/***/ 137:
/***/ 156:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -114,7 +114,7 @@ function openScanCode(self) {
/***/ 256:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(137);
module.exports = __webpack_require__(156);
/***/ })
......
webpackJsonp([24],{
/***/ 138:
/***/ 157:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -286,7 +286,7 @@ function commLoadingButtonTap(self) {
/***/ 257:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(138);
module.exports = __webpack_require__(157);
/***/ })
......
webpackJsonp([23],{
/***/ 139:
/***/ 158:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -94,7 +94,7 @@ function wifiAddButtonTap() {
/***/ 258:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(139);
module.exports = __webpack_require__(158);
/***/ })
......
webpackJsonp([5],{
webpackJsonp([6],{
/***/ 140:
/***/ 159:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -60,7 +60,7 @@ function init() {
/***/ }),
/***/ 196:
/***/ 197:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -255,7 +255,7 @@ function bindButtonTap(self) {
/***/ }),
/***/ 197:
/***/ 198:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -374,7 +374,7 @@ function boundUserTap(self) {
/***/ }),
/***/ 198:
/***/ 199:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -502,7 +502,7 @@ function userListButtonTap(self, value, buttonValue) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(196),
__webpack_require__(197),
/* template */
__webpack_require__(249),
/* scopeId */
......@@ -537,7 +537,7 @@ module.exports = Component.exports
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(197),
__webpack_require__(198),
/* template */
__webpack_require__(247),
/* scopeId */
......@@ -572,7 +572,7 @@ module.exports = Component.exports
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(198),
__webpack_require__(199),
/* template */
__webpack_require__(232),
/* scopeId */
......@@ -2870,14 +2870,14 @@ if (inBrowser && window.Vue) {
}
module.exports = VueRouter;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(126)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(132)))
/***/ }),
/***/ 259:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(140);
module.exports = __webpack_require__(159);
/***/ })
......
......@@ -33,7 +33,7 @@
<p></p>
</div>
</div>
<div class="doorbellTip"><span>17:30</span>门铃响了</div>
<div class="doorbellTip"><span>{{ ringingTime }}</span>{{ doorbellRingingFlag ? $t('device.doorLockRinging'):'' }}</div>
</div>
<p class="batteryState"><span v-html="batteryState"></span>{{ batteryPercent }}%</p>
</div>
......
webpackJsonp([22],{
/***/ 145:
/***/ 164:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -176,7 +176,7 @@ function confirmButtonTap(self) {
/***/ 264:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(145);
module.exports = __webpack_require__(164);
/***/ })
......
webpackJsonp([21],{
/***/ 146:
/***/ 165:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -154,7 +154,7 @@ function saveTap(self) {
/***/ 265:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(146);
module.exports = __webpack_require__(165);
/***/ })
......
webpackJsonp([7],{
webpackJsonp([8],{
/***/ 147:
/***/ 166:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -8,7 +8,7 @@ webpackJsonp([7],{
var _public = __webpack_require__(2);
var _components = __webpack_require__(201);
var _components = __webpack_require__(202);
/**
* v_index.js
......@@ -238,7 +238,7 @@ function unbindStateDialogTap(self) {
/***/ }),
/***/ 201:
/***/ 202:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -264,7 +264,7 @@ exports.projectMethods = projectMethods;
/***/ 266:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(147);
module.exports = __webpack_require__(166);
/***/ })
......
This source diff could not be displayed because it is too large. You can view the blob instead.
webpackJsonp([20],{
/***/ 149:
/***/ 168:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -97,7 +97,7 @@ function addButtonTap() {
/***/ 268:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(149);
module.exports = __webpack_require__(168);
/***/ })
......
webpackJsonp([19],{
/***/ 150:
/***/ 169:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -147,7 +147,7 @@ function confirmButtonTap(self) {
/***/ 269:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(150);
module.exports = __webpack_require__(169);
/***/ })
......
webpackJsonp([18],{
/***/ 152:
/***/ 171:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -22,14 +22,30 @@ function init() {
_public.uPublic.componentsInit(['u-text', 'u-dialog', 'u-loading']);
var app = new Vue({
data: {
textName: '我是个用户二号',
textName: _public.iot.navigator.getExtras().nickname,
textErrorTip: null,
//配置组件
componentsConfig: initComponentsConfig()
componentsConfig: initComponentsConfig(),
extras: {}
},
mounted: function mounted() {
this.extras = _public.iot.navigator.getExtras();
},
mounted: function mounted() {},
methods: {
getTextName: function getTextName() {
return this.textName;
},
setTextName: function setTextName(text) {
this.textName = text;
},
getTextErrorTip: function getTextErrorTip() {
return this.textErrorTip;
},
setTextErrorTip: function setTextErrorTip(tip) {
this.textErrorTip = tip;
},
//tap <
onBackTap: function onBackTap() {
backTap();
......@@ -52,7 +68,7 @@ function initComponentsConfig() {
nameInput: {
initParam: {
class: 'custom-editName-text',
placeholder: Vue.t('editName.nameInputTip')
placeholder: Vue.t('editName.nickNameInputTip')
}
},
dialog: {
......@@ -74,12 +90,53 @@ function backTap() {
}
//tap 保存
function saveTap() {
function saveTap(self) {
_public.iot.navigator.back();
if (self.getTextName() == null || self.getTextName().trim() == '') {
self.setTextErrorTip(Vue.t('editName.nameCanNotNull'));
} else {
_public.uComponents.showLoading(self);
_public.iot.business.api.sendCustom('user/editUsername', {
data: {
device_id: self.extras.deviceId,
nickname: self.getTextName()
},
success: function success(response) {
console.log(response);
var data = _public.uPublic.checkResponseData(response.data);
if (data) {
_public.uComponents.openAlert(self, Vue.t('editName.nicknameCanNotBeBlank'), {
text: Vue.t('btn.confirm'), callback: function callback() {
var opener = plus.webview.currentWebview().opener();
var view = plus.webview.getWebviewById(opener.id);
console.log(view);
_public.iot.navigator.fire(plus.webview.currentWebview().opener(), 'returnPage', {});
console.log('returnPage');
_public.iot.navigator.back();
}
});
}
},
error: function error(_error) {
console.log(_error);
_public.uComponents.hideLoading(self);
_public.uComponents.openAlert(self, Vue.t('editName.editNameFailue'), {
text: Vue.t('btn.confirm'), callback: function callback() {
var opener = plus.webview.currentWebview().opener();
_public.iot.navigator.back();
}
});
},
complete: function complete() {
_public.uComponents.hideLoading(self);
}
});
}
}
function nameChange(self, text) {
self.textName = text;
self.setTextErrorTip(null);
console.log('nameChange: ' + self.textName);
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))
......@@ -89,7 +146,7 @@ function nameChange(self, text) {
/***/ 271:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(152);
module.exports = __webpack_require__(171);
/***/ })
......
webpackJsonp([17],{
/***/ 153:
/***/ 172:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Vue) {
var _config = __webpack_require__(124);
var _config = __webpack_require__(126);
var _config2 = _interopRequireDefault(_config);
......@@ -38,7 +38,9 @@ function init() {
loadText: 'loading',
pagesize: 10,
tip: '无数据',
extras: {}
extras: {},
userListData: [],
startId: 0
},
mounted: function mounted() {
this.extras = _public.iot.navigator.getExtras();
......@@ -63,6 +65,18 @@ function init() {
setLoadShowFlag: function setLoadShowFlag(number) {
this.loadShowFlag = number >= this.pagesize;
},
getUserListData: function getUserListData() {
return this.userListData;
},
setUserListData: function setUserListData(data) {
this.userListData = data;
},
getStartId: function getStartId() {
return this.startId;
},
setStartId: function setStartId(id) {
this.startId = id;
},
onSwipeLeftRow: function onSwipeLeftRow(index) {
swipeLeftRow(this, index);
},
......@@ -112,30 +126,55 @@ function getUserList(self) {
},
success: function success(response) {
console.log(response);
var data = [{ id: 2,
device_id: 'B0F89310D509',
user_id: 2,
role: 0,
nickname: '用户1',
username: '测试1' }, { id: 3,
device_id: 'B0F89310D509',
user_id: 1,
role: 1,
nickname: '用户2',
username: '测试2' }, { id: 4,
device_id: 'B0F89310D509',
user_id: null,
role: 1,
nickname: '用户3' }, { id: 5,
device_id: 'B0F89310D509',
user_id: null,
role: 1,
nickname: '用户4' }, { id: 6,
device_id: 'B0F89310D509',
user_id: null,
role: 1,
nickname: '用户5' }];
// let data = uPublic.checkResponseData(response.data);
// if(data){
// let list = [];
// for(let i = 0; i < data.length ; i++){
// list[i] = {
// value: data.userId,
// role: data.role,
// image: data.role == 0 ? '../../resources/image/green_admin_icon.png' : data.name == null ? '../../resources/image/gray_unbindHead_icon.png' : '../../resources/image/green_bindhead_icon.png',
// title: data.nickname,
// subTitle: data.name
// }
// }
var list = [{ value: 1, role: 0, image: '../../resources/image/green_admin_icon.png', title: '我是用户', subtitle: "MM" }, { value: 1, role: 1, image: '../../resources/image/green_bindhead_icon.png', title: '我是用户', subtitle: "MM" }];
console.log(data);
if (data) {
var list = [];
for (var i = 0; i < data.length; i++) {
list[i] = {
value: data[i].id,
role: data[i].role,
image: data[i].role == 0 ? '../../resources/image/green_admin_icon.png' : data[i].user_id == null ? '../../resources/image/gray_unbindHead_icon.png' : '../../resources/image/green_bindhead_icon.png',
title: data[i].nickname,
subtitle: data[i].username
};
}
self.setUserListData(self.getUserList().concat(data));
self.setUserList(self.getUserList().concat(list));
console.log(self.getUserList());
// if(data.length > 0){
// self.setStartId(data[data.length-1].id);
// }
// }
if (data.length > 0) {
self.setStartId(data[data.length - 1].id);
}
}
},
error: function error(_error) {
console.log(_error);
_public.uPublic.openRequestErrorAlert(self);
// uPublic.openRequestErrorAlert(self);
},
complete: function complete() {
_public.uComponents.hideLoading(self);
......@@ -168,7 +207,16 @@ function swipeRightRow(self) {
function _onTapUserList(self, listIndex) {
_public.iot.navigator.openWindow({
url: './doorlockUser.html',
id: 'doorlockUser'
id: 'doorlockUser',
extras: {
id: self.getUserListData()[listIndex].id,
userId: self.getUserListData()[listIndex].user_id,
nickname: self.getUserListData()[listIndex].nickname,
username: self.getUserListData()[listIndex].username,
deviceId: self.getUserListData()[listIndex].device_id,
role: self.getUserListData()[listIndex].role,
uuid: self.extras.uuid
}
});
if (self.userListIndex != null) {
self.userListIndex = null;
......@@ -204,7 +252,7 @@ function _changeUserList(self, list) {
/***/ 272:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(153);
module.exports = __webpack_require__(172);
/***/ })
......
......@@ -27,7 +27,9 @@
<div class="content">
<ul class="inviteBind">
<li>
<p></p>
<p>
<canvas ref="qrcode"></canvas>
</p>
</li>
<li>{{ $t('inviteBind.title') }}</li>
<li>{{ $t('inviteBind.cont1') }}</li>
......
webpackJsonp([15],{
webpackJsonp([16],{
/***/ 155:
/***/ 174:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -31,9 +31,20 @@ function init() {
//配置组件
componentsConfig: initComponentsConfig()
},
mounted: function mounted() {},
mounted: function mounted() {
this.extras = _public.iot.navigator.getExtras();
//获取已绑定的开锁信息
getBindedLockInfo(this);
},
methods: {
getUnlockInfoList: function getUnlockInfoList() {
return this.unlockInfoList;
},
setUnlockInfoList: function setUnlockInfoList(list) {
this.unlockInfoList = list;
},
//tap <
onBackTap: function onBackTap() {
backTap();
......@@ -87,6 +98,36 @@ function tapLoad() {
//再次发送获取用户列表请求
}
}
//获取已绑定的开锁信息
function getBindedLockInfo(self) {
_public.uComponents.showLoading(self);
_public.iot.business.api.sendCustom('lock/getBindedInfo', {
data: {
id: self.extras.id
},
success: function success(response) {
console.log(response);
var data = _public.uPublic.checkResponseData(response.data);
if (data) {
console.log(data);
var list = [];
for (var i = 0; i < record.length; i++) {
list[i] = {};
}
self.setUnlockInfoList(self.getUnlockInfoList().concat(list));
//更新列表数据
_public.uComponents.changeList(self, self.getList());
} else {}
},
error: function error(err) {
console.log(err);
},
complete: function complete() {
_public.uComponents.hideLoading(self);
}
});
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))
/***/ }),
......@@ -94,7 +135,7 @@ function tapLoad() {
/***/ 274:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(155);
module.exports = __webpack_require__(174);
/***/ })
......
webpackJsonp([14],{
webpackJsonp([15],{
/***/ 156:
/***/ 175:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -159,7 +159,7 @@ function confirmButtonTap() {
/***/ 275:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(156);
module.exports = __webpack_require__(175);
/***/ })
......
webpackJsonp([13],{
webpackJsonp([14],{
/***/ 157:
/***/ 176:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -193,7 +193,7 @@ function cloudsLogin(self, id) {
/***/ 276:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(157);
module.exports = __webpack_require__(176);
/***/ })
......
webpackJsonp([12],{
webpackJsonp([13],{
/***/ 158:
/***/ 177:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -181,7 +181,7 @@ function forgetPasswordTap() {
/***/ 277:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(158);
module.exports = __webpack_require__(177);
/***/ })
......
webpackJsonp([11],{
webpackJsonp([12],{
/***/ 159:
/***/ 178:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -162,7 +162,7 @@ function registerButtonTap() {
/***/ 278:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(159);
module.exports = __webpack_require__(178);
/***/ })
......
webpackJsonp([10],{
webpackJsonp([11],{
/***/ 160:
/***/ 179:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -124,7 +124,7 @@ function nicknameChange(self, text) {
/***/ 279:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(160);
module.exports = __webpack_require__(179);
/***/ })
......
webpackJsonp([9],{
webpackJsonp([10],{
/***/ 161:
/***/ 180:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -97,7 +97,7 @@ function backTap() {
/***/ 280:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(161);
module.exports = __webpack_require__(180);
/***/ })
......
webpackJsonp([8],{
webpackJsonp([9],{
/***/ 162:
/***/ 181:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
......@@ -152,7 +152,7 @@ function logoutButtonTap(self) {
/***/ 281:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(162);
module.exports = __webpack_require__(181);
/***/ })
......
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