webpackJsonp([27],{

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

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

var _public = __webpack_require__(4);

_public.iot.ready(init); /**
                         * v_deviceList.js
                         * Version: 0.1
                         * User: wy
                         * Date: 2017-11-03
                         * Copyright(c)  2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
                         * 产品型号页面
                         */

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

        methods: {
            getDeviceList: function getDeviceList() {
                return this.deviceList;
            },
            setDeviceList: function setDeviceList(list) {
                this.deviceList = list;
            },

            //tap <
            onBackTap: function onBackTap() {
                backTap();
            },
            onDeviceListRowTap: function onDeviceListRowTap(value) {
                deviceListRowTap(this, value);
            }
        }
    }).$mount('#app');
}

//配置组件参数
function initComponentsConfig() {
    var model = Vue.t('deviceList.model');
    return {
        deviceList: {
            initParam: {
                class: 'custom-device-list',
                list: [],
                tip: ''
            }
        },
        dialog: {
            initParam: {
                class: 'custom-dialog'
            }
        },
        loading: {
            initParam: {
                class: 'custom-loading'
            }
        }
    };
}

function getDeviceList(self) {
    _public.iot.business.sds.getProductList({
        success: function success(response) {
            console.log(response);
            var list = [];
            var data = response.data;
            self.setDeviceList(data);
            for (var i = 0; i < data.length; i++) {
                list[i] = {
                    leftImage: data[i].icon,
                    title: data[i].deviceName,
                    subtitle: Vue.t('deviceList.model') + data[i].model,
                    rightIcon: '&#xe6a7;'
                };
            }
            _public.uComponents.changeList(self, list);
        },
        error: function error(_error) {}
    });
}

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

function deviceListRowTap(self, value) {
    console.log(self.getDeviceList()[value].model);
    _public.iot.navigator.openWindow({
        url: './wifiAddHelp.html',
        id: 'wifiAddHelp',
        extras: {
            model: self.getDeviceList()[value].model
        }
    });
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)["default"]))

/***/ }),

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

module.exports = __webpack_require__(196);


/***/ })

},[294]);
//# sourceMappingURL=deviceList.js.map