/**
* v_wifiAddHelp.js
* Version: 0.1
* User: wy
* Date: 2017-09-07
* Copyright(c)  2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* 配置Wi-Fi页面
*/

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

iot.ready(init);
function init() {
    //通用 按钮、dialog、loading组件
    uPublic.componentsInit(['u-button','u-dialog','u-loading']);
    const app = new Vue({
        data:{            
            //配置组件
            componentsConfig: initComponentsConfig()     
        },
        mounted(){           
        },
        methods:{
            //tap <
            onBackTap(){
                backTap();
            },
            //tap 开始配置Wi-Fi
            onWifiAddButtonTap(){
                wifiAddButtonTap();   
            }                
        }   
    }).$mount('#app');
}

//配置组件参数
function initComponentsConfig() {
    return {
        //开始配置Wi-Fi button 参数
        wifiAddButton: {   
            initParam: {
                class: 'custom-help-button',
                text: Vue.t('btn.wifiAdd')
            }
        },
        dialog: {
            initParam: {
                class: 'custom-dialog'
            }
        },
        loading: {
            initParam: {
                class: 'custom-loading'
            }
        }                
    }
}

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

//tap 开始配置Wi-Fi
function wifiAddButtonTap(){
    iot.navigator.openWindow({
        url: './wifiAdd.html',
        id: 'wifiAdd'
    });  
//	iot.business.sds.wifiDeviceConfig({
//      success: function (response) {
//          console.log('wifiDeviceConfig success');
//          console.log(response);
//      },
//      error: function (error) {
//          console.log('wifiDeviceConfig error');
//          console.log(error);
//      }
// });
}