webpackJsonp([25],{

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

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

var _public = __webpack_require__(2);

_public.iot.ready(init); /**
                         * v_scanCodeAdd.js
                         * Version: 0.1
                         * User: wy
                         * Date: 2017-09-07
                         * Copyright(c)  2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
                         * 扫描绑定设备页面
                         */

function init() {
				//通用 dialog、loading组件
				_public.uPublic.componentsInit(['u-dialog', 'u-loading']);
				var app = new Vue({
								data: {
												//配置组件
												componentsConfig: initComponentsConfig()
								},
								mounted: function mounted() {
												openScanCode(this);
								},

								methods: {
												//tap <
												onBackTap: function onBackTap() {
																backTap();
												}
								}
				}).$mount('#app');
}

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

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

function openScanCode(self) {
				_public.iot.utils.scanBarcode({
								data: {
												id: 'bcid',
												styles: {
																frameColor: '#00ffff',
																scanbarColor: '#00ffff',
																background: '#242b35'
												}
								},
								success: function success(response) {
												var data = _public.uPublic.checkResponseData(response.data);
												if (data) {
																//扫描成功
																var qrKey = data.result;
																//绑定设备
																_public.iot.business.sds.scanqr({
																				data: {
																								qrKey: qrKey
																				},
																				success: function success(response) {
																								var data = _public.uPublic.checkResponseData(response.data);
																								if (data) {
																												console.log(response);
																												_public.uComponents.openAlert(self, Vue.t('addDevice.bindSuccess'), {
																																text: Vue.t('btn.confirm'), callback: function callback() {
																																				_public.iot.navigator.openWindow({
																																								url: '../device/',
																																								id: 'device'
																																				});
																																}
																												});
																								} else {}
																				},
																				error: function error(_error) {
																								//请求失败
																								_public.uPublic.openRequestErrorAlert(self);
																				}
																});
												} else {}
								},
								error: function error(_error2) {
												console.log(_error2);
												//请求失败
												_public.uPublic.openRequestErrorAlert(self);
								}
				});
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))

/***/ }),

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

module.exports = __webpack_require__(137);


/***/ })

},[253]);
//# sourceMappingURL=scanCodeAdd.js.map