import { intl } from '@/utils/intl'; import { useEffect } from 'react'; import { useModel } from 'umi'; import { Button } from 'antd'; import videojs from 'video.js'; import 'video.js/dist/video-js.css'; import NP from 'number-precision'; import { getLocale } from 'umi'; import EnStyles from './indexEn.less'; import ZhStyles from './indexZh.less'; const locale = getLocale(); const styles = locale === 'zh-CN' ? ZhStyles : EnStyles; export default function Welcome() { const { setCurrentStep, setErrorVisible, setErrorsList } = useModel('global'); let Video: any; const aspectRatio = NP.divide(2498, 3940).toFixed(10); const screenWidth = window.innerWidth * 1.3; let videoWidth = 0; let videoHeight = 0; if (screenWidth < 1040) { videoWidth = 1040; } else { videoWidth = screenWidth; } videoHeight = Math.ceil(NP.times(videoWidth, aspectRatio)); useEffect(() => { const welcomeVideo = document.querySelector('.welcome-video'); if (welcomeVideo) { Video = videojs(welcomeVideo, { controls: false, autoplay: true, loop: true, preload: 'auto', }); } return () => { Video.dispose(); }; }, []); return (