import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["list", "icon", "images", "undoneLabel", "completeLabel", "children"];
import * as React from 'react';
import "./index.scss";
import { convertChildren } from "../../utils/children-node-handle";
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 = _objectWithoutPropertiesLoose(_ref, _excluded);
  console.log(images, 'images');
  images = images || [];
  return /*#__PURE__*/React.createElement("div", _extends({
    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"
    }, 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"
    }, 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 ? convertChildren(children, 'image-icon', {
      src: icon,
      className: 'integral-task__container__item__left__content__integral--icon'
    }) : '', 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"
    }, convertChildren(children, 'button2', {
      children: item.integral + ' 积分',
      name: item.status === Status.undone ? undoneLabel : completeLabel,
      color: Status[item.status]
    })));
  }) : '暂无数据');
};
export default IntegralTask;