webpackJsonp([18],{

/***/ 174:
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Vue) {

var _public = __webpack_require__(2);

_public.iot.ready(init); /**
                         * v_unlockInfo.js
                         * Version: 0.1
                         * User: wy
                         * Date: 2017-10-09
                         * Copyright(c)  2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
                         * 绑定开锁信息页面
                         */

function init() {
    //通用 list、dialog、loading组件
    _public.uPublic.componentsInit(['u-list', 'u-dialog', 'u-loading']);
    var app = new Vue({
        data: {
            //配置组件
            componentsConfig: initComponentsConfig()
        },
        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();
            },

            //tap 添加
            onAddTap: function onAddTap() {
                addTap();
            }
        }
    }).$mount('#app');
}

//配置组件参数
function initComponentsConfig() {
    return {
        unlockInfoList: {
            initParam: {
                class: 'custom-unlockInfo-list',
                list: [{ title: '指纹1', rightText: 'ID:123456' }, { title: '指纹2', rightText: 'ID:123456' }],
                tip: Vue.t('unlockInfo.noInfoTip')
            }
        },
        dialog: {
            initParam: {
                class: 'custom-dialog'
            }
        },
        loading: {
            initParam: {
                class: 'custom-loading'
            }
        }
    };
}

//tap <
function backTap() {
    _public.iot.navigator.back();
}

//tap 添加 
function addTap() {
    _public.iot.navigator.openWindow({
        url: './addUnlockInfo.html',
        id: 'addUnlockInfo'
    });
}

//点击加载更多
function tapLoad() {
    if (!self.loadFlag) {
        self.loadText = Vue.t('scroll.loading');
        self.loadFlag = true;
        //再次发送获取用户列表请求
    }
}

//获取已绑定的开锁信息
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"]))

/***/ }),

/***/ 275:
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(174);


/***/ })

},[275]);
//# sourceMappingURL=unlockInfo.js.map