webpackJsonp([17],{

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

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

var _public = __webpack_require__(4);

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

function init() {
				//通用 dialog、loading组件
				_public.uPublic.componentsInit(['u-dialog', 'u-loading', 'u-button']);
				var app = new Vue({
								data: {
												//配置组件
												componentsConfig: initComponentsConfig(),
												clientId: null
								},
								mounted: function mounted() {
												var clientInfo = plus.push.getClientInfo();
												this.setClientId(clientInfo.clientid);
								},

								methods: {
												onLoginButtonTap: function onLoginButtonTap() {
																loginButtonTap(this);
												},
												getClientId: function getClientId() {
																return this.clientId;
												},
												setClientId: function setClientId(id) {
																this.clientId = id;
												}
								}
				}).$mount('#app');
}

//配置组件参数
function initComponentsConfig() {
				return {
								//登录 button 参数
								loginButton: {
												initParam: {
																class: 'custom-guide-button',
																text: Vue.t('btn.guideLogin')
												}
								},
								dialog: {
												initParam: {
																class: 'custom-dialog'
												}
								},
								loading: {
												initParam: {
																class: 'custom-loading'
												}
								}
				};
}

function loginButtonTap(self) {
				_public.uComponents.showLoading(self);
				_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) {
																								if (data.hasOwnProperty('UserID')) {
																												cloudsLogin(self, data.UserID);
																								}
																								//			    		iot.navigator.openWindow({
																								//					        url: '../device/index.html',
																								//					        id: 'device'
																								//					    });
																				} else {}
																},
																error: function error(_error) {
																				console.log(_error);
																				//请求失败
																				//					uPublic.openRequestErrorAlert(self);
																},
																complete: function complete() {
																				_public.uComponents.hideLoading(self);
																}
												});
								},
								error: function error(_error2) {
												console.log(_error2);
												//请求失败
												_public.uPublic.openRequestErrorAlert(self);
								}
				});
}

function cloudsLogin(self, id) {
				//	uComponents.showLoading(self);
				_public.iot.business.user.simpleLogin({
								data: {
												username: id,
												clienId: self.getClientId()
								},
								success: function success(response) {
												//			iot.navigator.openWindow({
												//		        url: '../device/index.html',
												//		        id: 'device',
												//		        styles: {
												//		        	'background': 'transparent'
												//		        }
												//		    });
												_public.uPublic.openWindow({
																url: '../device/index.html',
																id: 'device',
																styles: {
																				'background': 'transparent'
																}
												});
												//		    uPublic.openWindow({
												//		    	url: '../device/index.html',
												//		        id: 'device',
												//		        styles: {
												//		        	'background': 'transparent'
												//		        }
												//		    });
								},
								error: function error(_error3) {
												console.log(_error3);
												_public.uPublic.openRequestErrorAlert(self);
								},
								complete: function complete() {
												//			uComponents.hideLoading(self);
								}
				});
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)["default"]))

/***/ }),

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

module.exports = __webpack_require__(217);


/***/ })

},[314]);
//# sourceMappingURL=index.js.map