|
@@ -1,14 +1,104 @@
|
|
|
-import React from "react";
|
|
|
-import styles from "./index.module.scss";
|
|
|
- function A1home() {
|
|
|
-
|
|
|
+import React, { useEffect, useRef, useState } from 'react'
|
|
|
+import styles from './index.module.scss'
|
|
|
+import history, { baseURL, isMobileFu, myData } from '@/utils/history'
|
|
|
+import { useSelector } from 'react-redux'
|
|
|
+import { RootState } from '@/store'
|
|
|
+import classNames from 'classnames'
|
|
|
+function A1home() {
|
|
|
+ const { visitSum } = useSelector((state: RootState) => state.A0Layout)
|
|
|
+
|
|
|
+ const [bacFlag, setBacFlag] = useState([false, false, false])
|
|
|
+
|
|
|
+ const timeRef = useRef(-1)
|
|
|
+
|
|
|
+ const [clickFlag, setClickFlag] = useState(false)
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ timeRef.current = window.setTimeout(() => {
|
|
|
+ setBacFlag([true, false, false])
|
|
|
+ timeRef.current = window.setTimeout(() => {
|
|
|
+ setBacFlag([true, true, false])
|
|
|
+ timeRef.current = window.setTimeout(() => {
|
|
|
+ setBacFlag([true, true, true])
|
|
|
+ timeRef.current = window.setTimeout(() => {
|
|
|
+ setClickFlag(true)
|
|
|
+ }, 2000)
|
|
|
+ }, 600)
|
|
|
+ }, 800)
|
|
|
+ }, 800)
|
|
|
+ return () => {
|
|
|
+ clearTimeout(timeRef.current)
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
+
|
|
|
return (
|
|
|
- <div className={styles.A1home}>
|
|
|
- <h1>A1home</h1>
|
|
|
+ <div
|
|
|
+ className={styles.A1home}
|
|
|
+ style={{
|
|
|
+ backgroundImage: `url(${baseURL + myData.home.bg})`
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {/* 初始化logo */}
|
|
|
+ <img className='A1baseLogo' src={baseURL + myData.home.logo} alt='' />
|
|
|
+
|
|
|
+ {/* 顶部浏览量 */}
|
|
|
+ <div className='leftTopLogo' v-show='!isMobile'>
|
|
|
+ <p>欢迎您的到来,您是第{visitSum}位参观者!</p>
|
|
|
+ <p>
|
|
|
+ <img src={baseURL + myData.home.yan} alt='' />
|
|
|
+ <span>{visitSum}</span>浏览量
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 主体 */}
|
|
|
+ <div className='A1main'>
|
|
|
+ {/* 左侧文字 */}
|
|
|
+ <div className='A1Left'>
|
|
|
+ <img src={baseURL + myData.home.logo} alt='' />
|
|
|
+ <div
|
|
|
+ className='A1LeftTxt mySorrl'
|
|
|
+ dangerouslySetInnerHTML={{ __html: myData.home.txt }}
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 右侧信息 */}
|
|
|
+ <div className='A1Right'>
|
|
|
+ {myData.home.arr.map((v, i) => (
|
|
|
+ <div
|
|
|
+ className={classNames('A1rRow', 'A1rRow' + i, bacFlag[i] ? 'A1rRowAc' : '')}
|
|
|
+ key={v.id}
|
|
|
+ onClick={() => history.push(`${v.path}${isMobileFu() ? 'M' : ''}`)}
|
|
|
+ >
|
|
|
+ <div className='A1rRowOne'>
|
|
|
+ {/* 反的 */}
|
|
|
+ <div
|
|
|
+ className='A1rRow1'
|
|
|
+ style={{ backgroundImage: `url(${baseURL}home/${v.id}F.png)` }}
|
|
|
+ ></div>
|
|
|
+
|
|
|
+ {/* 正常的 */}
|
|
|
+ <div
|
|
|
+ className='A1rRow2'
|
|
|
+ style={{ backgroundImage: `url(${baseURL}home/${v.id}.png)` }}
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 鼠标移入的 */}
|
|
|
+ <div
|
|
|
+ className='A1rRow3'
|
|
|
+ style={{ backgroundImage: `url(${baseURL}home/${v.id}Ac.png)` }}
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 主体遮罩 */}
|
|
|
+ {clickFlag ? null : <div className='A1mainMask'></div>}
|
|
|
</div>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-const MemoA1home = React.memo(A1home);
|
|
|
+const MemoA1home = React.memo(A1home)
|
|
|
|
|
|
-export default MemoA1home;
|
|
|
+export default MemoA1home
|