"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof = require("@babel/runtime/helpers/typeof");

Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")), _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")), _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")), _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")), _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")), _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")), _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")), _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")), _react = _interopRequireWildcard(require("react")), _propTypes = _interopRequireDefault(require("prop-types")), _SectionCell = _interopRequireDefault(require("./SectionCell")), _SearchSectionArea = _interopRequireDefault(require("./SearchSectionArea")), _sectionService = require("./../../../services/sectionService");

function _getRequireWildcardCache(e) {
  if ("function" != typeof WeakMap) return null;
  var t = new WeakMap, r = new WeakMap;
  return (_getRequireWildcardCache = function(e) {
    return e ? r : t;
  })(e);
}

function _interopRequireWildcard(e, t) {
  if (!t && e && e.__esModule) return e;
  if (null === e || "object" !== _typeof(e) && "function" != typeof e) return {
    default: e
  };
  var r = _getRequireWildcardCache(t);
  if (r && r.has(e)) return r.get(e);
  var i = {}, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var n in e) if ("default" !== n && Object.prototype.hasOwnProperty.call(e, n)) {
    var s = a ? Object.getOwnPropertyDescriptor(e, n) : null;
    s && (s.get || s.set) ? Object.defineProperty(i, n, s) : i[n] = e[n];
  }
  return i.default = e, r && r.set(e, i), i;
}

function _createSuper(e) {
  var t = _isNativeReflectConstruct();
  return function() {
    var r, i = (0, _getPrototypeOf2.default)(e);
    if (t) {
      var a = (0, _getPrototypeOf2.default)(this).constructor;
      r = Reflect.construct(i, arguments, a);
    } else r = i.apply(this, arguments);
    return (0, _possibleConstructorReturn2.default)(this, r);
  };
}

function _isNativeReflectConstruct() {
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  if (Reflect.construct.sham) return !1;
  if ("function" == typeof Proxy) return !0;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))), 
    !0;
  } catch (e) {
    return !1;
  }
}

require("./sectionList.scss");

var SectionList = function(e) {
  (0, _inherits2.default)(r, e);
  var t = _createSuper(r);
  function r(e) {
    var i;
    return (0, _classCallCheck2.default)(this, r), i = t.call(this, e), (0, _defineProperty2.default)((0, 
    _assertThisInitialized2.default)(i), "getSectionContent", (function(e) {
      var t = [];
      return e && e.map((function(e) {
        t.push(_react.default.createElement(_SectionCell.default, {
          content: e
        }));
      })), t;
    })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(i), "getSectionData", (function() {
      var e = i.param;
      void 0 !== e ? (0, _extends2.default)(e, {
        isRecommend: !0
      }) : e = {
        isRecommend: !0
      }, (0, _sectionService.getSectionsByParamAction)(e).then((function(e) {
        i.setState({
          lastList: e.last,
          recommendList: e.recommend
        });
      }));
    })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(i), "setSearchParam", (function(e) {
      i.param = e, i.getSectionData(), i.getRecommendSectionData();
    })), (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(i), "showMoreUpdate", (function() {})), 
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(i), "showMoreCommend", (function() {})), 
    i.state = {}, i;
  }
  return (0, _createClass2.default)(r, [ {
    key: "componentWillMount",
    value: function() {}
  }, {
    key: "componentDidMount",
    value: function() {
      this.getSectionData();
    }
  }, {
    key: "componentWillReceiveProps",
    value: function(e) {}
  }, {
    key: "componentWillUnmount",
    value: function() {}
  }, {
    key: "render",
    value: function() {
      var e = this.state, t = e.lastList, r = e.recommendList;
      return _react.default.createElement("div", {
        className: "section-list-root"
      }, _react.default.createElement(_SearchSectionArea.default, {
        setSearchParam: this.setSearchParam
      }), _react.default.createElement("div", {
        className: "section-list-body"
      }, _react.default.createElement("div", {
        className: "section-list-lastest"
      }, _react.default.createElement("div", {
        className: "section-list-lastest-text"
      }, "最近更新"), _react.default.createElement("div", {
        className: "section-list-lastest-more"
      }, _react.default.createElement("img", {
        src: require("./../../../assets/iot/section/more.png"),
        alt: ""
      }), _react.default.createElement("div", {
        className: "section-list-lastest-more-text",
        onClick: this.showMoreUpdate
      }, "更多"))), _react.default.createElement("div", {
        className: "section-list-recommend"
      }, _react.default.createElement("div", {
        className: "section-list-recommend-text"
      }, "精品推荐"), _react.default.createElement("div", {
        className: "section-list-recommend-more"
      }, _react.default.createElement("img", {
        src: require("./../../../assets/iot/section/more.png"),
        alt: ""
      }), _react.default.createElement("div", {
        className: "section-list-recommend-more-text",
        onClick: this.showMoreCommend
      }, "更多"))), _react.default.createElement("div", {
        className: "section-list-lastest-content"
      }, this.getSectionContent(t)), _react.default.createElement("div", {
        className: "section-list-recommend-content"
      }, this.getSectionContent(r))));
    }
  } ]), r;
}(_react.Component);

SectionList.displayName = "SectionList", SectionList.propTypes = {};

var _default = SectionList;

exports.default = _default;