import React, { useState } from 'react';
import './index.less';

// 数据底座URL
// const dataBaseUrl = 'https://10.1.214.173:8688/autoLogin';

const V2504DataBase: React.FC<{targetUrl: string}> = ({targetUrl}) => {
  const [loading, setLoading] = useState(true);

  const handleIframeLoad = () => {
    setLoading(false);
  };
  console.log(targetUrl)

  return (
    <div className="container">
      <iframe
        // src={`${targetUrl}?sourceUrl=${encodeURIComponent(window.location.href)}`}
        src={targetUrl}
        className="iframe"
        title="数据底座"
        onLoad={handleIframeLoad}
      />
      
      {loading && (
        <div className="loading">
          <div className="loadingIcon" />
          <span>加载中...</span>
        </div>
      )}
    </div>
  );
};

export default V2504DataBase;