"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireWildcard(require("react"));
var _antd = require("antd");
var _util = require("../../../util");
var _vmInfoCollection = _interopRequireDefault(require("../../../vm-info-collection"));
var _index = require("../../index");
var _api = require("../../api");
var _config = require("../../config");
require("./index.less");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
var Info = function Info() {
  var _useContext = (0, _react.useContext)(_index.RestaurantContext),
    id = _useContext.id;
  var _BasicService$info = _api.BasicService.info({
      id: id
    }),
    data = _BasicService$info.basicInfo;
  var dataSource = _config.BASIC_FIELDS.map(function (item) {
    return Object.assign(Object.assign({}, item), {
      value: data === null || data === void 0 ? void 0 : data[item.key],
      render: item.key === 'photoIds' ? function () {
        var photos = JSON.parse(data.photoIds || '[]');
        return /*#__PURE__*/_react["default"].createElement("div", {
          style: {
            whiteSpace: 'break-spaces'
          }
        }, photos.map(function (item) {
          return /*#__PURE__*/_react["default"].createElement(_antd.Image, {
            width: 80,
            height: 80,
            key: item.id,
            src: "/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id=".concat(item.id, "&token=").concat((0, _util.getUrlPara)('token')),
            preview: {
              src: "/cloudFile/common/downloadFile?id=".concat(item.id, "&token=").concat((0, _util.getUrlPara)('token'))
            }
          });
        }));
      } : undefined
    });
  });
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: dataSource,
    horizontal: true,
    width: "50%",
    ellipsis: true
  }));
};
var _default = exports["default"] = Info;
//# sourceMappingURL=Info.js.map
