/**
* v_index.js
* Version: 0.1
* User: wy
* Date: 2017-09-07
* 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']);
    uPublic.closeSlideBack();
    const app = new Vue({
        data:{            
            //配置组件
            componentsConfig: initComponentsConfig()     
        },
        mounted(){           
        },
        methods:{
            //tap <
            onBackTap(){
                backTap();
            },
            //tap 扫描绑定设备
            onScanAddTap(){
                scanAddTap();
            },
            //tap 配置Wi-Fi
            onWifiAddTap(){
                wifiAddTap(); 
            }                  
        }   
    }).$mount('#app');
}

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

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

//tap 扫描绑定设备
function scanAddTap(){
//  iot.navigator.openWindow({
//      url: './scanCodeAdd.html',
//      id: 'scanCodeAdd'
//  });
	mui.openWindow({
        url: './scanCodeAdd.html',
        id: 'scanCodeAdd',
        show: {
        	aniShow: "none"
        },
        waiting: {
        	autoShow: false
        }
    });
}

//tap 配置Wi-Fi
function wifiAddTap(){
    iot.navigator.openWindow({
        url: './wifiAddHelp.html',
        id: 'wifiAddHelp'
    });
}