|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useCallback, useMemo, useState } from 'react'
|
|
|
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import { VisitHotDataType } from '@/types'
|
|
|
import classNames from 'classnames'
|
|
@@ -27,6 +27,16 @@ function Hot2({ closeFu, data, name }: Props) {
|
|
|
setFlooInd(ind)
|
|
|
}, [])
|
|
|
|
|
|
+ const videoRef = useRef<HTMLVideoElement>(null)
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (acData.type && acData.type === 'video') {
|
|
|
+ setTimeout(() => {
|
|
|
+ if (videoRef.current) videoRef.current.play()
|
|
|
+ }, 100)
|
|
|
+ }
|
|
|
+ }, [acData.type])
|
|
|
+
|
|
|
return (
|
|
|
<div id='HotOpCss' className={styles.Hot2}>
|
|
|
<div className='h2Main' style={{ backgroundImage: `url(${baseURL}visit/hot2bj.png)` }}>
|
|
@@ -39,13 +49,25 @@ function Hot2({ closeFu, data, name }: Props) {
|
|
|
|
|
|
<div className={classNames('h2TuWen', data.length <= 1 ? 'h2TuWenDuo' : '')}>
|
|
|
{/* 图片 */}
|
|
|
- {acData.type && acData.type === 'model' ? (
|
|
|
+ {acData.type ? (
|
|
|
<div className='H2model' style={{ height: acData.txt ? '200px' : '280px' }}>
|
|
|
- <iframe
|
|
|
- title={name}
|
|
|
- src={`${baseURL}modelLoding/model.html?u=${acData.imgArr[0]}`}
|
|
|
- frameBorder='0'
|
|
|
- ></iframe>
|
|
|
+ {acData.type === 'model' ? (
|
|
|
+ <iframe
|
|
|
+ title={name}
|
|
|
+ src={`${baseURL}modelLoding/model.html?u=${acData.imgArr[0]}`}
|
|
|
+ frameBorder='0'
|
|
|
+ ></iframe>
|
|
|
+ ) : (
|
|
|
+ <video
|
|
|
+ ref={videoRef}
|
|
|
+ src={baseURL + acData.imgArr[0]}
|
|
|
+ controls
|
|
|
+ playsInline
|
|
|
+ muted
|
|
|
+ webkit-playsinline='true'
|
|
|
+ x5-video-player-type='h5'
|
|
|
+ ></video>
|
|
|
+ )}
|
|
|
</div>
|
|
|
) : (
|
|
|
acData.imgArr.map((url, index) => <LazyImg src={baseURL + url} key={index} />)
|