|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useEffect, useRef, useState } from 'react'
|
|
|
+import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import { HomeDataRow, myData, myUrl } from '@/utils/history'
|
|
|
import classNmaes from 'classnames'
|
|
@@ -9,22 +9,8 @@ function A1home() {
|
|
|
|
|
|
const [moveId, setMoveId] = useState(0)
|
|
|
|
|
|
- const timeRef = useRef(-1)
|
|
|
-
|
|
|
- const [time, setTime] = useState(false)
|
|
|
- const timeValRef = useRef(false)
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- timeValRef.current = time
|
|
|
- }, [time])
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- if (moveId) {
|
|
|
- timeRef.current = window.setInterval(() => {
|
|
|
- setTime(!timeValRef.current)
|
|
|
- }, 500)
|
|
|
- } else clearInterval(timeRef.current)
|
|
|
- }, [moveId])
|
|
|
+ // apng动画展示
|
|
|
+ const [apng, setApng] = useState(false)
|
|
|
|
|
|
useEffect(() => {
|
|
|
const urlAll = window.location.href
|
|
@@ -37,8 +23,10 @@ function A1home() {
|
|
|
setMoveId(id)
|
|
|
|
|
|
setTimeout(() => {
|
|
|
- setMoveId(0)
|
|
|
- }, 5000)
|
|
|
+ // setMoveId(0)
|
|
|
+ setApng(true)
|
|
|
+ // console.log('xxxx')
|
|
|
+ }, 1500)
|
|
|
|
|
|
domRef.current.scrollTo({
|
|
|
top: (index - 1) * 190,
|
|
@@ -52,10 +40,19 @@ function A1home() {
|
|
|
// 打开详情
|
|
|
const [open, setOpen] = useState({} as HomeDataRow)
|
|
|
|
|
|
+ // 终止动画
|
|
|
+ const stopMoveFu = useCallback(() => {
|
|
|
+ // setMoveId(0)
|
|
|
+ setApng(false)
|
|
|
+ }, [])
|
|
|
+
|
|
|
return (
|
|
|
<div
|
|
|
className={styles.A1home}
|
|
|
style={{ backgroundImage: `url(${myUrl + myData.homeBg})` }}
|
|
|
+ onTouchEnd={() => {
|
|
|
+ stopMoveFu()
|
|
|
+ }}
|
|
|
>
|
|
|
<div className='homeTitleImg'>
|
|
|
<img src={myUrl + myData.homeTitleImg} alt='' />
|
|
@@ -66,13 +63,21 @@ function A1home() {
|
|
|
<div
|
|
|
onClick={() => {
|
|
|
setOpen(v)
|
|
|
- setMoveId(0)
|
|
|
+ stopMoveFu()
|
|
|
}}
|
|
|
className={classNmaes('A1row', moveId === v.id ? 'A1rowAcMove' : '')}
|
|
|
key={v.id}
|
|
|
>
|
|
|
<div className='A1Rimg'>
|
|
|
- <img src={myUrl + v.cover} alt='' />
|
|
|
+ <img className='A1Rimg_1' src={myUrl + v.cover} alt='' />
|
|
|
+ <img
|
|
|
+ className={classNmaes(
|
|
|
+ 'A1Rimg_2',
|
|
|
+ moveId === v.id && apng ? 'A1Rimg_2Ac' : ''
|
|
|
+ )}
|
|
|
+ src={myUrl + 'img/200.png'}
|
|
|
+ alt=''
|
|
|
+ />
|
|
|
</div>
|
|
|
<div className='A1Rtxt'>
|
|
|
<div
|