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

import {iot, uPublic, uComponents} from '../../public/public.js';

iot.ready(init);
function init() {
    //通用 dialog、loading组件
    uPublic.componentsInit(['u-dialog','u-loading']);
    const app = new Vue({
        data:{ 
            unlockInfoList: [{value: 1, title: '指纹1', rightText: 123456},
                             {value: 2, title: '指纹2', rightText: 123456}],
            loadShowFlag: false,
            loadFlag: false,
            loadText: Vue.t('scroll.clickToLoadMore'),
            pagesize: 10,
            tip: Vue.t('unlockInfo.noInfoTip'),                                   
            //配置组件
            componentsConfig: initComponentsConfig()   
        },
        mounted(){           
        },
        methods:{
            //tap <
            onBackTap(){
                backTap();
            },
            //tap 添加
            onAddTap(){
                addTap();
            }, 
            onTapLoad(){
                tapLoad();
            }                          
        }   
    }).$mount('#app');
}

//配置组件参数
function initComponentsConfig() {
    return {
        dialog: {
            initParam: {
                class: 'custom-dialog'
            }
        },
        loading: {
            initParam: {
                class: 'custom-loading'
            }
        }               
    }
}

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

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

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