|
|
@@ -1,8 +1,6 @@
|
|
|
import React, { useState, useRef } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
-import { isPc, myData } from '@/utils/http'
|
|
|
-import classNames from 'classnames'
|
|
|
-
|
|
|
+import { myData } from '@/utils/http'
|
|
|
function Sinicize() {
|
|
|
const [currentTab, setCurrentTab] = useState(0)
|
|
|
const [selectedTime, setSelectedTime] = useState(0)
|
|
|
@@ -26,10 +24,7 @@ function Sinicize() {
|
|
|
direct: string
|
|
|
}) => {
|
|
|
return (
|
|
|
- <div
|
|
|
- className={classNames(styles.label, isPc ? '' : styles.labelMo)}
|
|
|
- style={{ inset: inset }}
|
|
|
- >
|
|
|
+ <div className={styles.label} style={{ inset: inset }}>
|
|
|
{direct === 'left' ? <div className='arrowL' style={{ width: width + 'px' }} /> : null}
|
|
|
<div className='btn'>{name}</div>
|
|
|
{direct === 'right' ? <div className='arrowR' style={{ width: width + 'px' }} /> : null}
|
|
|
@@ -64,7 +59,7 @@ function Sinicize() {
|
|
|
|
|
|
// 处理触摸移动事件
|
|
|
const handleOriTouchMove = (e: any) => {
|
|
|
- // e.preventDefault()
|
|
|
+ e.preventDefault()
|
|
|
const deltaX = e.touches[0].clientY - ori_touchStartX.current
|
|
|
if (originRef.current) {
|
|
|
originRef.current.scrollLeft -= deltaX
|
|
|
@@ -81,16 +76,13 @@ function Sinicize() {
|
|
|
<>
|
|
|
<div
|
|
|
ref={originRef}
|
|
|
- className={classNames(styles.Sinicize, isPc ? '' : styles.SinicizeMo)}
|
|
|
+ className={styles.Sinicize}
|
|
|
onWheel={handleWheel}
|
|
|
onTouchMove={handleOriTouchMove}
|
|
|
onTouchStart={handleTouchStart}
|
|
|
>
|
|
|
<div className='SinicizeScroll'>
|
|
|
- <div
|
|
|
- ref={sinicize1Ref}
|
|
|
- className={classNames(styles.Sinicize1, isPc ? '' : styles.Sinicize1Mo)}
|
|
|
- >
|
|
|
+ <div ref={sinicize1Ref} className={styles.Sinicize1}>
|
|
|
<div className='back' onClick={() => window.location.replace('#/ybwx?tab=1')}>
|
|
|
<img src={require('@/assets/img/btn_back.png')} alt='' />
|
|
|
</div>
|
|
|
@@ -101,7 +93,9 @@ function Sinicize() {
|
|
|
<div className='line1'>
|
|
|
<img src={require('@/assets/img/A6_sinicize_line2.png')} draggable='false' alt='' />
|
|
|
</div>
|
|
|
- <div className='t2'>{myData.sinicizeDataStatic.desc}</div>
|
|
|
+ <div className='t2'>
|
|
|
+ {myData.sinicizeDataStatic.desc}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div className={`zhufo ${currentTab === 0 ? 'active' : ''}`}>
|
|
|
<img src={require('@/assets/img/A6_sinicize_zhufo.png')} draggable='false' alt='' />{' '}
|
|
|
@@ -144,21 +138,23 @@ function Sinicize() {
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div className={classNames(styles.Sinicize2, isPc ? '' : styles.Sinicize2Mo)}>
|
|
|
+ <div className={styles.Sinicize2}>
|
|
|
<div className='scroll'>
|
|
|
- {myData.sinicizeData.map((item, index) => (
|
|
|
+ {myData.sinicizeData.map((sItem, index) => (
|
|
|
<div className='yearItem' key={index}>
|
|
|
<div
|
|
|
className='year'
|
|
|
- style={{ backgroundImage: `url(${item.bgPath})` }}
|
|
|
+ style={{ backgroundImage: `url(${sItem.bgPath})` }}
|
|
|
onClick={() => handleYearItemClick(index)}
|
|
|
>
|
|
|
- <div className='txt'>{item.time}</div>
|
|
|
+ <div className='txt'>{sItem.time}</div>
|
|
|
</div>
|
|
|
<div className={`${selectedTime === index ? 'detailShow' : 'detailHide'}`}>
|
|
|
<div className='left'>
|
|
|
- <div className='desc'>{item.desc}</div>
|
|
|
- {item.items.map((item, index) => (
|
|
|
+ <div className='desc'>
|
|
|
+ {sItem.desc}
|
|
|
+ </div>
|
|
|
+ {sItem.items.map((item, index) => (
|
|
|
<div className='txtItem' key={index}>
|
|
|
<div className='title'>{item.title}</div>
|
|
|
<div className='txt'>{item.txt}</div>
|
|
|
@@ -166,39 +162,19 @@ function Sinicize() {
|
|
|
))}
|
|
|
</div>
|
|
|
<div className='right'>
|
|
|
- <div className='title'>
|
|
|
- {myData.sinicizeData[index].imgItems[currentImgIndex].title}
|
|
|
- </div>
|
|
|
- <div className='pic'>
|
|
|
- <img
|
|
|
- src={myData.sinicizeData[index].imgItems[currentImgIndex].src}
|
|
|
- alt=''
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div className='txt'>
|
|
|
- {myData.sinicizeData[index].imgItems[currentImgIndex].txt}
|
|
|
- </div>
|
|
|
- <div className='iconContainner'>
|
|
|
- {item.imgItems.map((i, index) => {
|
|
|
+ <div className='title'>{sItem.imgItems[currentImgIndex]?.title || ''}</div>
|
|
|
+ <div className='pic'><img src={sItem.imgItems[currentImgIndex]?.src || ''} alt="" /></div>
|
|
|
+ <div className="txt">{sItem.imgItems[currentImgIndex]?.txt || ''}</div>
|
|
|
+ <div className="iconContainner">
|
|
|
+ {sItem.imgItems.map((i, index) => {
|
|
|
return (
|
|
|
- <div
|
|
|
- className='icon'
|
|
|
- key={index}
|
|
|
- onClick={() => {
|
|
|
- setCurrentImgIndex(index)
|
|
|
- }}
|
|
|
- >
|
|
|
- <img
|
|
|
- src={require(`@/assets/img/A6_sincize_detailIcon${
|
|
|
- currentImgIndex === index ? '_ac' : ''
|
|
|
- }.png`)}
|
|
|
- draggable='false'
|
|
|
- alt=''
|
|
|
- />
|
|
|
+ <div className='icon' key={index} onClick={() => { setCurrentImgIndex(index) }}>
|
|
|
+ <img src={require(`@/assets/img/A6_sincize_detailIcon${currentImgIndex === index ? '_ac' : ''}.png`)} draggable='false' alt='' />
|
|
|
</div>
|
|
|
)
|
|
|
})}
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -208,14 +184,11 @@ function Sinicize() {
|
|
|
</div>
|
|
|
</div>
|
|
|
{isShowTip && (
|
|
|
- <div
|
|
|
- className={classNames(styles.tip, isPc ? '' : styles.tipMo)}
|
|
|
- onClick={() => {
|
|
|
- setTimeout(() => {
|
|
|
- setIsShowTip(false)
|
|
|
- }, 1500)
|
|
|
- }}
|
|
|
- >
|
|
|
+ <div className={styles.tip} onClick={() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ setIsShowTip(false)
|
|
|
+ }, 1500);
|
|
|
+ }}>
|
|
|
<div className='gesture'>
|
|
|
<img src={require('@/assets/img/A6_sinicize_gesture.png')} draggable='false' alt='' />{' '}
|
|
|
<div className='txt'>向右滑动查看造像中国化的演变</div>{' '}
|