"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var React = _interopRequireWildcard(require("react"));
var _indexModule = _interopRequireDefault(require("./index.module.scss"));
var _qrcode = _interopRequireDefault(require("qrcode.react"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
// import { comPanyImgPost } from '../../../api/base'

var bottomLogo = function bottomLogo(bottomLogoProps) {
  var _QRimg$, _QRimg$2, _QRimg$3;
  // const { bgColor, isBgColor, qrcodeValue, QRImg, logoImg } = bottomLogoProps;
  var bgColor = bottomLogoProps.bgColor,
    isBgColor = bottomLogoProps.isBgColor,
    QRImg = bottomLogoProps.QRImg,
    logoImg = bottomLogoProps.logoImg;
  // eslint-disable-next-line react-hooks/rules-of-hooks
  var _useState = (0, React.useState)([{
      id: "",
      value: "",
      size: null,
      fgColor: ""
    }]),
    QRimg = _useState[0],
    setQRimg = _useState[1];
  // eslint-disable-next-line react-hooks/rules-of-hooks
  (0, React.useEffect)(function () {
    imgAdd();
  }, [QRImg]);
  function imgAdd() {
    return _imgAdd.apply(this, arguments);
  }
  function _imgAdd() {
    _imgAdd = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
      var QRarr;
      return _regenerator["default"].wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            // console.log("这是qrimg",QRImg)
            QRarr = [];
            QRarr.push(QRImg);
            setQRimg([].concat(QRarr));

            // 组件是不是和设置器设置全局的时候，不互通。
            // global.liveCode.qrCode.code = QRImg.value
            // global.liveCode.logoImg = logoImg
            // console.log("sadsd", QRImg)
            // if (qrcodeValue) {
            //   const obj1 = qrcodeValue?.response?.longS;
            //   const obj1Id = qrcodeValue?.valueId
            //   const data = {
            //     b: "/comp/0/3",
            //     c: obj1,
            //     h: "comp",
            //     i: 3,
            //     j: 1,
            //     k: 1,
            //     l: obj1Id
            //   }
            //   if (obj1 && obj1Id) {
            //     await comPanyImgPost(data)
            //   }
            // }
          case 3:
          case "end":
            return _context.stop();
        }
      }, _callee);
    }));
    return _imgAdd.apply(this, arguments);
  }
  var mainStyle = {
    backgroundColor: isBgColor ? bgColor : ''
  };
  var imgStyle = {
    width: "100%",
    height: "100%"
  };
  return /*#__PURE__*/React.createElement("div", {
    style: (0, _extends2["default"])({}, mainStyle)
  }, /*#__PURE__*/React.createElement("div", {
    className: _indexModule["default"].bottom
  }, /*#__PURE__*/React.createElement("div", {
    className: _indexModule["default"].qrcode
  }, /*#__PURE__*/React.createElement(_qrcode["default"], {
    id: (_QRimg$ = QRimg[0]) === null || _QRimg$ === void 0 ? void 0 : _QRimg$.id,
    value: (_QRimg$2 = QRimg[0]) === null || _QRimg$2 === void 0 ? void 0 : _QRimg$2.value // value参数为生成二维码的链接 我这里是由后端返回
    ,
    size: 80 // 二维码的宽高尺寸
    ,
    fgColor: (_QRimg$3 = QRimg[0]) === null || _QRimg$3 === void 0 ? void 0 : _QRimg$3.fgColor // 二维码的颜色
  })), /*#__PURE__*/React.createElement("div", {
    className: _indexModule["default"]['cross-line']
  }), /*#__PURE__*/React.createElement("div", {
    className: _indexModule["default"].logo
  }, /*#__PURE__*/React.createElement("img", {
    src: logoImg,
    alt: "",
    style: (0, _extends2["default"])({}, imgStyle)
  }))), /*#__PURE__*/React.createElement("div", {
    className: _indexModule["default"]['bottom-message']
  }, "\u957F\u6309\u4E8C\u7EF4\u7801\u83B7\u5F97\u4E13\u5C5E\u5BA2\u6237\u7ECF\u7406\u652F\u6301"));
};
var _default = bottomLogo;
exports["default"] = _default;