|
|
@@ -10,19 +10,30 @@ type InfoCardProps = {
|
|
|
text?: string
|
|
|
from: string
|
|
|
inset?: string
|
|
|
+ index: number
|
|
|
}
|
|
|
+type showLineType = {
|
|
|
+ index: number
|
|
|
+ isShow: boolean
|
|
|
+}[]
|
|
|
+
|
|
|
function Sinicize() {
|
|
|
const { myData } = useSelector((state: RootState) => state.A0Layout)
|
|
|
|
|
|
const [currentTab, setCurrentTab] = useState(0)
|
|
|
const [selectedTime, setSelectedTime] = useState(0)
|
|
|
const [isShowTip, setIsShowTip] = useState(false)
|
|
|
- const [currentImgIndex, setCurrentImgIndex] = useState(0)
|
|
|
- const [isShowLine, setIsShowLine] = useState(true)
|
|
|
+ const [isShowLine, setIsShowLine] = useState<showLineType>(
|
|
|
+ myData.sinicizeData[0].imgItems.map((item, index) => ({
|
|
|
+ index,
|
|
|
+ isShow: true
|
|
|
+ }))
|
|
|
+ )
|
|
|
+ console.log(isShowLine, 'isShowLine')
|
|
|
|
|
|
const originRef = useRef<HTMLDivElement>(null)
|
|
|
const sinicize1Ref = useRef<HTMLDivElement>(null)
|
|
|
- const ori_touchStartX = useRef<number>(0)
|
|
|
+ // const ori_touchStartX = useRef<number>(0)
|
|
|
|
|
|
// width 线的长度 inset 整体的定位 name 文字 direct 方向 left/right
|
|
|
const Label = ({
|
|
|
@@ -62,13 +73,17 @@ function Sinicize() {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- setIsShowLine(true)
|
|
|
- setCurrentImgIndex(0)
|
|
|
if (selectedTime === index) {
|
|
|
setSelectedTime(-1)
|
|
|
return
|
|
|
}
|
|
|
setSelectedTime(index)
|
|
|
+ setIsShowLine(
|
|
|
+ myData.sinicizeData[index].imgItems.map((item, index) => ({
|
|
|
+ index,
|
|
|
+ isShow: true
|
|
|
+ }))
|
|
|
+ )
|
|
|
|
|
|
// 点击时将对应年份项滚动到最左边
|
|
|
if (sinicize1Ref.current && originRef.current) {
|
|
|
@@ -102,10 +117,22 @@ function Sinicize() {
|
|
|
// ori_touchStartX.current = e.touches[0].clientY
|
|
|
// }
|
|
|
|
|
|
- const InfoCard = ({ time, location, text, from, inset }: InfoCardProps) => {
|
|
|
+ const InfoCard = ({ time, location, text, from, inset, index }: InfoCardProps) => {
|
|
|
return (
|
|
|
<div className={styles.InfoCard} style={{ inset: inset }}>
|
|
|
- <div className="cardClose" onClick={() => setIsShowLine(true)}>×</div>
|
|
|
+ <div
|
|
|
+ className='cardClose'
|
|
|
+ onClick={() =>
|
|
|
+ setIsShowLine(
|
|
|
+ isShowLine.map(item => ({
|
|
|
+ ...item,
|
|
|
+ isShow: item.index === index ? true : item.isShow
|
|
|
+ }))
|
|
|
+ )
|
|
|
+ }
|
|
|
+ >
|
|
|
+ ×
|
|
|
+ </div>
|
|
|
<div className='dotLeft'>
|
|
|
<img src={require('@/assets/img/A6_arrow.png')} alt='' />
|
|
|
</div>
|
|
|
@@ -156,27 +183,27 @@ function Sinicize() {
|
|
|
)}
|
|
|
{currentTab === 0 && (
|
|
|
<>
|
|
|
- <Label width={70} inset={'53px auto auto 360px'} name={'肉髻'} direct={'right'} />
|
|
|
+ <Label width={70} inset={'53px auto auto 340px'} name={'肉髻'} direct={'right'} />
|
|
|
<Label
|
|
|
- width={93}
|
|
|
- inset={'176px auto auto 339px'}
|
|
|
+ width={70}
|
|
|
+ inset={'176px auto auto 345px'}
|
|
|
name={'僧祇支'}
|
|
|
direct={'right'}
|
|
|
/>
|
|
|
- <Label width={68} inset={'300px auto auto 298px'} name={'衣摆'} direct={'right'} />
|
|
|
- <Label width={40} inset={'205px auto auto 528px'} name={'佛衣'} direct={'left'} />
|
|
|
- <Label width={40} inset={'70px auto auto 513px'} name={'头光'} direct={'left'} />
|
|
|
- <Label width={36} inset={'122px auto auto 532px'} name={'身光'} direct={'left'} />
|
|
|
+ <Label width={42} inset={'300px auto auto 306px'} name={'衣摆'} direct={'right'} />
|
|
|
+ <Label width={40} inset={'205px auto auto 547px'} name={'佛衣'} direct={'left'} />
|
|
|
+ <Label width={40} inset={'70px auto auto 532px'} name={'头光'} direct={'left'} />
|
|
|
+ <Label width={36} inset={'122px auto auto 550px'} name={'身光'} direct={'left'} />
|
|
|
</>
|
|
|
)}
|
|
|
|
|
|
{currentTab === 1 && (
|
|
|
<>
|
|
|
- <Label width={70} inset={'83px auto auto 360px'} name={'头光'} direct={'right'} />
|
|
|
- <Label width={93} inset={'181px auto auto 318px'} name={'披帛'} direct={'right'} />
|
|
|
- <Label width={68} inset={'272px auto auto 345px'} name={'天衣'} direct={'right'} />
|
|
|
- <Label width={40} inset={'93px auto auto 506px'} name={'头冠'} direct={'left'} />
|
|
|
- <Label width={36} inset={'129px auto auto 512px'} name={'宝缯'} direct={'left'} />
|
|
|
+ <Label width={51} inset={'83px auto auto 360px'} name={'头光'} direct={'right'} />
|
|
|
+ <Label width={51} inset={'181px auto auto 339px'} name={'披帛'} direct={'right'} />
|
|
|
+ <Label width={50} inset={'272px auto auto 345px'} name={'天衣'} direct={'right'} />
|
|
|
+ <Label width={40} inset={'93px auto auto 522px'} name={'头冠'} direct={'left'} />
|
|
|
+ <Label width={36} inset={'129px auto auto 530px'} name={'宝缯'} direct={'left'} />
|
|
|
</>
|
|
|
)}
|
|
|
|
|
|
@@ -207,74 +234,129 @@ function Sinicize() {
|
|
|
style={{ backgroundImage: `url(${sItem.bgPath})` }}
|
|
|
onClick={() => handleYearItemClick(index)}
|
|
|
>
|
|
|
- <div className='txt'>{sItem.time}</div>
|
|
|
+ <div className="yearContainner">
|
|
|
+ <div className='txt'>{sItem.time}</div>
|
|
|
+ <div className='front'>{sItem.desc}</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
+
|
|
|
<div className={`${selectedTime === index ? 'detailShow' : 'detailHide'}`}>
|
|
|
- <div className='left'>
|
|
|
- <div className='lTop'>{sItem.desc}</div>
|
|
|
- <div className='lContent'>
|
|
|
- <div className='lImgBox'>
|
|
|
- {/* <img
|
|
|
+ {selectedTime === index && (
|
|
|
+ <>
|
|
|
+ <div className='left'>
|
|
|
+ <div className='lTop'>{sItem.desc}</div>
|
|
|
+ <div className='lContent'>
|
|
|
+ <div className='lImgBox'>
|
|
|
+ {/* <img
|
|
|
src={isShowLine ? sItem.imgItems[0].srcLine : sItem.imgItems[0].src}
|
|
|
alt=''
|
|
|
/> */}
|
|
|
- <div style={{
|
|
|
- backgroundImage: `url(${isShowLine ? sItem.imgItems[0].srcLine : sItem.imgItems[0].src})`
|
|
|
- }} className={`pic ${isShowLine ? 'picLine' : ''}`} />
|
|
|
- {!isShowLine ? (
|
|
|
- <InfoCard
|
|
|
- time={sItem.imgItems[0].time}
|
|
|
- location={sItem.imgItems[0].title}
|
|
|
- text={sItem.imgItems[0].txt}
|
|
|
- from={sItem.imgItems[0].title}
|
|
|
- />
|
|
|
- ) : (
|
|
|
- <div className='point' onClick={() => setIsShowLine(false)}>
|
|
|
- <div className="pointTime">{sItem.imgItems[0].time}</div>
|
|
|
- <div className='pointTitle'>{sItem.imgItems[0].title}</div>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundImage: `url(${isShowLine[0].isShow
|
|
|
+ ? sItem.imgItems[0].srcLine
|
|
|
+ : sItem.imgItems[0].src
|
|
|
+ })`
|
|
|
+ }}
|
|
|
+ className={`pic ${isShowLine[0].isShow ? 'picLine' : ''}`}
|
|
|
+ />
|
|
|
+ {!isShowLine[0].isShow ? (
|
|
|
+ <InfoCard
|
|
|
+ time={sItem.imgItems[0].time}
|
|
|
+ location={sItem.imgItems[0].title}
|
|
|
+ text={sItem.imgItems[0].txt}
|
|
|
+ from={sItem.imgItems[0].title}
|
|
|
+ index={0}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <div
|
|
|
+ className='point'
|
|
|
+ onClick={() =>
|
|
|
+ setIsShowLine(
|
|
|
+ isShowLine.map(item => ({
|
|
|
+ ...item,
|
|
|
+ isShow: item.index === 0 ? false : item.isShow
|
|
|
+ }))
|
|
|
+ )
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div className='pointTime'>{sItem.imgItems[0].time}</div>
|
|
|
+ <div className='pointTitle'>{sItem.imgItems[0].title}</div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
- <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 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>
|
|
|
- </div>
|
|
|
- <div className='right'>
|
|
|
- <div className='RItems'>
|
|
|
- {sItem.imgItems.filter((i, index) => index !== 0).map((i, index) => (
|
|
|
- <div className='item' key={index}>
|
|
|
- {/* <div className='pic'>
|
|
|
+ <div className='right'>
|
|
|
+ <div className='RItems'>
|
|
|
+ {sItem.imgItems
|
|
|
+ .filter((i, index) => index !== 0)
|
|
|
+ .map((i, index2) => (
|
|
|
+ <div className='item' key={index2}>
|
|
|
+ {/* <div className='pic'>
|
|
|
<img src={i.src} alt='' />
|
|
|
</div> */}
|
|
|
- <div style={{
|
|
|
- backgroundImage: `url(${isShowLine ? i.srcLine : i.src})`
|
|
|
- }} className={`pic ${isShowLine ? 'picLine' : ''}`} />
|
|
|
- {!isShowLine ? (
|
|
|
- <InfoCard
|
|
|
- time={i.time}
|
|
|
- location={i.title}
|
|
|
- text={i.txt}
|
|
|
- from={i.title}
|
|
|
- />
|
|
|
- ) : (
|
|
|
- <div className='point' onClick={() => setIsShowLine(false)}>
|
|
|
- <div className="pointTime">{i.time}</div>
|
|
|
- <div className='pointTitle'>{i.title}</div>
|
|
|
- </div>
|
|
|
- )}
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundImage: `url(${isShowLine[index2 + 1].isShow ? i.srcLine : i.src
|
|
|
+ })`
|
|
|
+ }}
|
|
|
+ className={`pic ${isShowLine[index2 + 1].isShow ? 'picLine' : ''
|
|
|
+ }`}
|
|
|
+ />
|
|
|
+ {!isShowLine[index2 + 1].isShow ? (
|
|
|
+ <InfoCard
|
|
|
+ time={i.time}
|
|
|
+ location={i.title}
|
|
|
+ text={i.txt}
|
|
|
+ from={i.title}
|
|
|
+ index={index2}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <div
|
|
|
+ className='point'
|
|
|
+ onClick={() =>
|
|
|
+ setIsShowLine(
|
|
|
+ isShowLine.map(item => ({
|
|
|
+ ...item,
|
|
|
+ isShow: item.index === index2 + 1 ? false : item.isShow
|
|
|
+ }))
|
|
|
+ )
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div className='pointTime'>{i.time}</div>
|
|
|
+ <div className='pointTitle'>{i.title}</div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
</div>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
</div>
|
|
|
</div>
|
|
|
))}
|
|
|
+ <div className='yearItem'>
|
|
|
+ <div
|
|
|
+ className='year year-zongjie'
|
|
|
+ >
|
|
|
+ <div className="yearContainner">
|
|
|
+ <div className='txt'>{myData.sinicizeDataStatic.zongjie.title}</div>
|
|
|
+ <div className='front'>{myData.sinicizeDataStatic.zongjie.txt}</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|