webpackJsonp([16],{

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

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

var _public = __webpack_require__(4);

_public.iot.ready(init); /**
                         * v_login.js
                         * Version: 0.1
                         * User: wy
                         * Date: 2017-09-06
                         * Copyright(c)  2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
                         * 登录页面
                         */

function init() {
    //通用 input、按钮、dialog、loading组件
    _public.uPublic.componentsInit(['u-text', 'u-button', 'u-dialog', 'u-loading']);
    var app = new Vue({
        data: {
            numberTel: null,
            textPassword: null,
            textErrorTip: null,
            //配置组件
            componentsConfig: initComponentsConfig()
        },
        mounted: function mounted() {
            _public.iot.business.sds.init({
                data: {
                    oa: true
                },
                success: function success(response) {
                    console.log(response);
                    _public.iot.business.user.login({
                        data: {
                            sds: true
                        },
                        success: function success(response) {
                            console.log(response);
                            var data = _public.uPublic.checkResponseData(response.data);
                            if (data) {
                                _public.iot.business.user.login({
                                    data: {
                                        username: data.UserId,
                                        pwd: data.UserId
                                    },
                                    success: function success(response) {
                                        var data = _public.uPublic.checkResponseData(response.data);
                                        if (data) {
                                            _public.iot.navigator.openWindow({
                                                url: '../device/index.html',
                                                id: 'device'
                                            });
                                        } else {}
                                    },
                                    error: function error(_error) {},
                                    complete: function complete() {}
                                });
                            } else {}
                        },
                        error: function error(_error2) {
                            console.log(_error2);
                        },
                        complete: function complete() {}
                    });
                },
                error: function error(_error3) {
                    console.log(_error3);
                }
            });
        },

        methods: {
            onTelChange: function onTelChange(number) {
                telChange(this, number);
            },
            onPasswordChange: function onPasswordChange(text) {
                passwordChange(this, text);
            },

            //tap 登录
            onLoginButtonTap: function onLoginButtonTap() {
                loginButtonTap();
            },

            //tap 快速注册
            onRegisterTap: function onRegisterTap() {
                registerTap();
            },

            //tap 忘记密码
            onForgetPasswordTap: function onForgetPasswordTap() {
                forgetPasswordTap();
            }
        }
    }).$mount('#app');
}

//配置组件参数
function initComponentsConfig() {
    return {
        telInput: {
            initParam: {
                class: 'custom-text',
                icon: '&#xe6e8;',
                placeholder: Vue.t('login.telInputTip'),
                maxlength: 11,
                minlength: 11
            }
        },
        passwordInput: {
            initParam: {
                class: 'custom-password-text',
                icon: '&#xe64d;',
                placeholder: Vue.t('login.passwordInputTip'),
                type: 'password'
            }
        },
        //登录 button 参数
        loginButton: {
            initParam: {
                class: 'custom-button',
                text: Vue.t('btn.login')
            }
        },
        dialog: {
            initParam: {
                class: 'custom-dialog'
            }
        },
        loading: {
            initParam: {
                class: 'custom-loading'
            }
        }
    };
}

function telChange(self, number) {
    self.numberTel = number;
    console.log('telChange: ' + self.numberTel);
}

function passwordChange(self, text) {
    self.textPassword = text;
    console.log('passwordChange: ' + self.textPassword);
}

//tap 登录
function loginButtonTap() {
    _public.iot.navigator.openWindow({
        url: '../device/index.html',
        id: 'device'
    });
}

//tap 快速注册
function registerTap() {}

//  iot.navigator.openWindow({
//      url: './register.html',
//      id: 'register'
//  });


//tap 忘记密码
function forgetPasswordTap() {
    _public.iot.navigator.openWindow({
        url: './forgetPassword.html',
        id: 'forgetPassword'
    });
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)["default"]))

/***/ }),

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

module.exports = __webpack_require__(218);


/***/ })

},[315]);
//# sourceMappingURL=login.js.map