|
|
@@ -1,6 +1,13 @@
|
|
|
import React, { useState, useRef } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import { myData } from '@/utils/http'
|
|
|
+
|
|
|
+type InfoCardProps = {
|
|
|
+ time: string
|
|
|
+ location: string
|
|
|
+ text?: string
|
|
|
+ from: string
|
|
|
+}
|
|
|
function Sinicize() {
|
|
|
const [currentTab, setCurrentTab] = useState(0)
|
|
|
const [selectedTime, setSelectedTime] = useState(0)
|
|
|
@@ -58,18 +65,33 @@ function Sinicize() {
|
|
|
}
|
|
|
|
|
|
// 处理触摸移动事件
|
|
|
- const handleOriTouchMove = (e: any) => {
|
|
|
- e.preventDefault()
|
|
|
- const deltaX = e.touches[0].clientY - ori_touchStartX.current
|
|
|
- if (originRef.current) {
|
|
|
- originRef.current.scrollLeft -= deltaX
|
|
|
- }
|
|
|
- ori_touchStartX.current = e.touches[0].clientY
|
|
|
- }
|
|
|
+ // const handleOriTouchMove = (e: any) => {
|
|
|
+ // e.preventDefault()
|
|
|
+ // const deltaX = e.touches[0].clientY - ori_touchStartX.current
|
|
|
+ // if (originRef.current) {
|
|
|
+ // originRef.current.scrollLeft -= deltaX
|
|
|
+ // }
|
|
|
+ // ori_touchStartX.current = e.touches[0].clientY
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // 处理触摸开始事件
|
|
|
+ // const handleTouchStart = (e: any) => {
|
|
|
+ // ori_touchStartX.current = e.touches[0].clientY
|
|
|
+ // }
|
|
|
|
|
|
- // 处理触摸开始事件
|
|
|
- const handleTouchStart = (e: any) => {
|
|
|
- ori_touchStartX.current = e.touches[0].clientY
|
|
|
+ const InfoCard = ({ time, location, text, from }: InfoCardProps) => {
|
|
|
+ return (
|
|
|
+ <div className={styles.InfoCard}>
|
|
|
+ <div className="dotLeft"></div>
|
|
|
+ <div className="main">
|
|
|
+ <div className="time"></div>
|
|
|
+ <div className="location"></div>
|
|
|
+ <div className="text"></div>
|
|
|
+ <div className="from"></div>
|
|
|
+ </div>
|
|
|
+ <div className="dotRight"></div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
@@ -78,8 +100,8 @@ function Sinicize() {
|
|
|
ref={originRef}
|
|
|
className={styles.Sinicize}
|
|
|
onWheel={handleWheel}
|
|
|
- onTouchMove={handleOriTouchMove}
|
|
|
- onTouchStart={handleTouchStart}
|
|
|
+ // onTouchMove={handleOriTouchMove}
|
|
|
+ // onTouchStart={handleTouchStart}
|
|
|
>
|
|
|
<div className='SinicizeScroll'>
|
|
|
<div ref={sinicize1Ref} className={styles.Sinicize1}>
|
|
|
@@ -166,31 +188,39 @@ function Sinicize() {
|
|
|
<div className='txt'>{sItem.time}</div>
|
|
|
</div>
|
|
|
<div className={`${selectedTime === index ? 'detailShow' : 'detailHide'}`}>
|
|
|
- <div className='left'>
|
|
|
- <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>
|
|
|
+ <div className="left">
|
|
|
+ <div className="lTop">{sItem.desc}</div>
|
|
|
+ <div className="lContent">
|
|
|
+ <div className="lImgBox">
|
|
|
+ <InfoCard
|
|
|
+ time={sItem.imgItems[0].title}
|
|
|
+ location={sItem.imgItems[0].title}
|
|
|
+ text={sItem.imgItems[0].txt}
|
|
|
+ from={sItem.imgItems[0].title}
|
|
|
+ />
|
|
|
+ <img src={sItem.imgItems[0].src} alt="" />
|
|
|
</div>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- <div className='right'>
|
|
|
- <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="lInfo">
|
|
|
+ {sItem.items.map((i, index) => (
|
|
|
+ <div className="item" key={index}>
|
|
|
+ <div className="lTitle">{i.title}</div>
|
|
|
+ <div className="lText">{i.txt}</div>
|
|
|
</div>
|
|
|
- )
|
|
|
- })}
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+ <div className="right">
|
|
|
+ <div className="RItems">
|
|
|
+ {
|
|
|
+ sItem.imgItems.map((i, index) => (
|
|
|
+ <div className="item" key={index}>
|
|
|
+ <div className="pic"><img src={i.src} alt="" /></div>
|
|
|
+ </div>
|
|
|
+ ))
|
|
|
+ }
|
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|