import _extends from "@babel/runtime/helpers/extends";
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import * as React from 'react';
import { useEffect, useState } from 'react';
import styles from "./index.module.scss";
// import { comPanyImgPost } from '../../../api/base'
import QRCode from 'qrcode.react';
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 = useState([{
      id: "",
      value: "",
      size: null,
      fgColor: ""
    }]),
    QRimg = _useState[0],
    setQRimg = _useState[1];
  // eslint-disable-next-line react-hooks/rules-of-hooks
  useEffect(function () {
    imgAdd();
  }, [QRImg]);
  function imgAdd() {
    return _imgAdd.apply(this, arguments);
  }
  function _imgAdd() {
    _imgAdd = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
      var QRarr;
      return _regeneratorRuntime.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: _extends({}, mainStyle)
  }, /*#__PURE__*/React.createElement("div", {
    className: styles.bottom
  }, /*#__PURE__*/React.createElement("div", {
    className: styles.qrcode
  }, /*#__PURE__*/React.createElement(QRCode, {
    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: styles['cross-line']
  }), /*#__PURE__*/React.createElement("div", {
    className: styles.logo
  }, /*#__PURE__*/React.createElement("img", {
    src: logoImg,
    alt: "",
    style: _extends({}, imgStyle)
  }))), /*#__PURE__*/React.createElement("div", {
    className: styles['bottom-message']
  }, "\u957F\u6309\u4E8C\u7EF4\u7801\u83B7\u5F97\u4E13\u5C5E\u5BA2\u6237\u7ECF\u7406\u652F\u6301"));
};
export default bottomLogo;