import React, { useEffect, useState } from 'react'
import styles from './index.module.scss'
import { useParams } from 'react-router-dom'
import { myInfo } from '@/utils/history'
function A2scene() {
  const urlObjTemp: any = useParams()

  const [url, setUrl] = useState('')

  useEffect(() => {
    if (urlObjTemp.id) {
      const obj = myInfo.swArr.find(v => v.id === Number(urlObjTemp.id))
      if (obj && obj.link) {
        setUrl(obj.link)
        // // 新窗口打开页面
        // window.open(obj.link, '_blank')
      }
    }

    console.log(123, urlObjTemp.id)
  }, [urlObjTemp])

  return (
    <div className={styles.A2scene}>
      {url ? <iframe src={url} frameBorder='0' title='场景'></iframe> : null}
    </div>
  )
}

const MemoA2scene = React.memo(A2scene)

export default MemoA2scene
