"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var React = _interopRequireWildcard(require("react"));
require("./index.scss");
var _childrenNodeHandle = require("../../utils/children-node-handle");
var _excluded = ["list", "icon", "images", "undoneLabel", "completeLabel", "children"];
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var Status = /*#__PURE__*/function (Status) {
  Status[Status["undone"] = 0] = "undone";
  Status[Status["complete"] = 1] = "complete";
  return Status;
}(Status || {});
var IntegralTask = function IntegralTask(_ref) {
  var list = _ref.list,
    icon = _ref.icon,
    images = _ref.images,
    undoneLabel = _ref.undoneLabel,
    completeLabel = _ref.completeLabel,
    children = _ref.children,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  console.log(images, 'images');
  images = images || [];
  return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
    className: "integral-task__container"
  }, otherProps), list && list.length ? list.map(function (item, index) {
    return /*#__PURE__*/React.createElement("div", {
      className: "integral-task__container__item"
    }, /*#__PURE__*/React.createElement("div", {
      className: "integral-task__container__item__left"
    }, (0, _childrenNodeHandle.convertChildren)(children, 'image-left', {
      src: images[index % images.length],
      className: 'integral-task__container__item__left__img'
    }), /*#__PURE__*/React.createElement("div", {
      className: "integral-task__container__item__left__content"
    }, (0, _childrenNodeHandle.convertChildren)(children, 'title', {
      children: item.name,
      className: 'integral-task__container__item__left__content__title'
    }), /*#__PURE__*/React.createElement("div", {
      className: "integral-task__container__item__left__content__integral"
    }, icon ? (0, _childrenNodeHandle.convertChildren)(children, 'image-icon', {
      src: icon,
      className: 'integral-task__container__item__left__content__integral--icon'
    }) : '', (0, _childrenNodeHandle.convertChildren)(children, 'integral', {
      children: item.integral + ' 积分',
      className: 'integral-task__container__item__left__content__integral--number'
    })))), /*#__PURE__*/React.createElement("div", {
      className: "integral-task__container__item__right"
    }, (0, _childrenNodeHandle.convertChildren)(children, 'button2', {
      children: item.integral + ' 积分',
      name: item.status === Status.undone ? undoneLabel : completeLabel,
      color: Status[item.status]
    })));
  }) : '暂无数据');
};
var _default = exports["default"] = IntegralTask;