webpackJsonp([22],{

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

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

var _public = __webpack_require__(2);

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /**
                                                                                                                                                                                                                  * v_remoteOpendoor.js
                                                                                                                                                                                                                  * Version: 0.1
                                                                                                                                                                                                                  * User: wy
                                                                                                                                                                                                                  * Date: 2017-09-06
                                                                                                                                                                                                                  * Copyright(c)  2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
                                                                                                                                                                                                                  * 远程开门页面
                                                                                                                                                                                                                  */

_public.iot.ready(init);
function init() {
    var _methods;

    //通用 input、按钮、dialog、loading组件
    _public.uPublic.componentsInit(['u-text', 'u-button', 'u-commstatus-loading', 'u-dialog', 'u-loading']);
    var app = new Vue({
        data: {
            textPassword: null,
            textErrorTip: null,
            textLoading: 'loading...',
            status: 0,
            //配置组件
            componentsConfig: initComponentsConfig(),
            //设备uuid
            uuid: null
        },
        mounted: function mounted() {
            resolve(this);
        },

        methods: (_methods = {
            getTextPassword: function getTextPassword() {
                return this.textPassword;
            },
            setTextPassword: function setTextPassword(pwd) {
                this.textPassword = pwd;
            },
            setTextErrorTip: function setTextErrorTip(tip) {
                this.textErrorTip = tip;
            },
            getTextLoading: function getTextLoading() {
                return this.textLoading;
            },
            setTextLoading: function setTextLoading(text) {
                this.textLoading = text;
            },
            getStatus: function getStatus() {
                return this.status;
            },
            setStatus: function setStatus(value) {
                this.status = value;
            },
            onPasswordChange: function onPasswordChange(text) {
                passwordChange(this, text);
            }
        }, _defineProperty(_methods, 'onPasswordChange', function onPasswordChange(text) {
            passwordChange(this, text);
        }), _defineProperty(_methods, 'getUuid', function getUuid() {
            return this.uuid;
        }), _defineProperty(_methods, 'setUuid', function setUuid(id) {
            this.uuid = id;
        }), _defineProperty(_methods, 'onBackTap', function onBackTap() {
            backTap();
        }), _defineProperty(_methods, 'onConfirmButtonTap', function onConfirmButtonTap() {
            confirmButtonTap(this);
        }), _methods)
    }).$mount('#app');
}

//配置组件参数
function initComponentsConfig() {
    return {
        passwordInput: {
            initParam: {
                class: 'custom-text',
                icon: '&#xe64d;',
                placeholder: Vue.t('remoteOpendoor.passwordInputTip')
            }
        },
        //确定 button 参数
        confirmButton: {
            initParam: {
                class: 'custom-button',
                text: Vue.t('btn.confirm')
            }
        },
        dialog: {
            initParam: {
                class: 'custom-dialog'
            }
        },
        loading: {
            initParam: {
                class: 'custom-loading'
            }
        },
        ucommstatusloading: {
            initParam: {
                class: 'custom-commstatus-loading',
                buttonText: Vue.t('btn.confirm')
            }
        }
    };
}

function resolve(self) {
    var extras = _public.iot.navigator.getExtras();
    self.setUuid(extras.uuid);
    console.log(self.getUuid());
}

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

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

//tap 确定
function confirmButtonTap(self) {
    console.log(self.getTextPassword());
    if (self.getTextPassword() == null || self.getTextPassword().trim() == '') {
        self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
    } else {
        _public.uComponents.showLoading(self);
        _public.iot.business.sds.setDeviceStatus({
            data: {
                uuid: self.getUuid(),
                setParams: {
                    'lock_action': {
                        'value': '0'
                        //		            'remote_open_door': {
                        //		                'value': self.getTextPassword()
                        //		            }
                    } }
            },
            success: function success(response) {
                console.log(response);
                _public.uComponents.openAlert(self, Vue.t('remoteOpendoor.openDoorSuccess'), {
                    text: Vue.t('dialog.confirm'), callback: function callback() {
                        //返回首页
                        _public.iot.navigator.back();
                    }
                });
            },
            error: function error(_error) {
                console.log(_error);
                _public.uComponents.openAlert(self, Vue.t('remoteOpendoor.openDoorFailure'), {
                    text: Vue.t('dialog.confirm'), callback: function callback() {}
                });
            },
            complete: function complete() {
                _public.uComponents.hideLoading(self);
            }
        });
    }
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))

/***/ }),

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

module.exports = __webpack_require__(145);


/***/ })

},[264]);
//# sourceMappingURL=remoteOpendoor.js.map