|
@@ -1,16 +1,28 @@
|
|
|
-import React, { useState } from 'react'
|
|
|
|
|
|
|
+import React, { useState, useRef } from 'react'
|
|
|
import isMobile from '../../utils/isMobile'
|
|
import isMobile from '../../utils/isMobile'
|
|
|
// import A5Mobile from '../A5Mobile'
|
|
// import A5Mobile from '../A5Mobile'
|
|
|
import A1home from '../A1home'
|
|
import A1home from '../A1home'
|
|
|
import styles from './index.module.scss'
|
|
import styles from './index.module.scss'
|
|
|
function A0base() {
|
|
function A0base() {
|
|
|
const [show, setShow] = useState(true)
|
|
const [show, setShow] = useState(true)
|
|
|
|
|
+ const videoRef = useRef<HTMLVideoElement>(null)
|
|
|
|
|
+ const handleClick = () => {
|
|
|
|
|
+ if (videoRef.current && isMobile()) {
|
|
|
|
|
+ //是否正在播放
|
|
|
|
|
+ if (videoRef.current.paused) {
|
|
|
|
|
+ console.log('播放')
|
|
|
|
|
+ videoRef.current.play()
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.A0base}>
|
|
<div className={styles.A0base}>
|
|
|
{/* 初始封面 */}
|
|
{/* 初始封面 */}
|
|
|
<A1home show={show} />
|
|
<A1home show={show} />
|
|
|
- <div className='initPic' style={{ display: show ? 'flex' : 'none' }}>
|
|
|
|
|
|
|
+ <div className='initPic' style={{ display: show ? 'flex' : 'none' }} onClick={handleClick}>
|
|
|
<video
|
|
<video
|
|
|
|
|
+ ref={videoRef}
|
|
|
autoPlay
|
|
autoPlay
|
|
|
muted
|
|
muted
|
|
|
loop
|
|
loop
|