|
@@ -20,6 +20,7 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
const { myData, myLangue } = useSelector((state: RootState) => state.A0Layout)
|
|
const { myData, myLangue } = useSelector((state: RootState) => state.A0Layout)
|
|
|
|
|
|
|
|
const [selectedTab, setSelectedTab] = useState(0)
|
|
const [selectedTab, setSelectedTab] = useState(0)
|
|
|
|
|
+ const [isOpenTrans, setIsOpenTrans] = useState(false)
|
|
|
const selectedTabRef = useRef(0)
|
|
const selectedTabRef = useRef(0)
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -60,6 +61,7 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
}, [selectedTab, setIsShowMzmTitle, setIsShowTabBar])
|
|
}, [selectedTab, setIsShowMzmTitle, setIsShowTabBar])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
|
+ if (selectedTab === 0) setIsOpenTrans(false)
|
|
|
localStorage.setItem('selectedBeiwen', selectedTab.toString())
|
|
localStorage.setItem('selectedBeiwen', selectedTab.toString())
|
|
|
}, [selectedTab])
|
|
}, [selectedTab])
|
|
|
|
|
|
|
@@ -167,12 +169,12 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
OriContent.removeEventListener('touchstart', e => {
|
|
OriContent.removeEventListener('touchstart', e => {
|
|
|
handleStart(e, originStartX)
|
|
handleStart(e, originStartX)
|
|
|
})
|
|
})
|
|
|
- OriContent.removeEventListener('touchmove', handlerOri) // 保持参数一致
|
|
|
|
|
|
|
+ OriContent.removeEventListener('touchmove', handlerOri)
|
|
|
OriContent.removeEventListener('scroll', handleOriScroll)
|
|
OriContent.removeEventListener('scroll', handleOriScroll)
|
|
|
TransContent.removeEventListener('touchstart', e => {
|
|
TransContent.removeEventListener('touchstart', e => {
|
|
|
handleStart(e, translateStartX)
|
|
handleStart(e, translateStartX)
|
|
|
})
|
|
})
|
|
|
- TransContent.removeEventListener('touchmove', handlerTrans) // 保持参数一致
|
|
|
|
|
|
|
+ TransContent.removeEventListener('touchmove', handlerTrans)
|
|
|
TransContent.removeEventListener('scroll', handleTransScroll)
|
|
TransContent.removeEventListener('scroll', handleTransScroll)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -190,16 +192,25 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
define: string
|
|
define: string
|
|
|
inset: string
|
|
inset: string
|
|
|
}) => {
|
|
}) => {
|
|
|
- const dragFlag = useRef(false) // 新增拖拽标志位
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const dragFlag = useRef(false)
|
|
|
const handleClick = () => {
|
|
const handleClick = () => {
|
|
|
- if (dragFlag.current) return // 如果是拖拽操作则直接返回
|
|
|
|
|
|
|
+ if (dragFlag.current) return
|
|
|
setActiveAId(index)
|
|
setActiveAId(index)
|
|
|
setShowTooltip(index)
|
|
setShowTooltip(index)
|
|
|
- const tooltip = document.querySelector('.ant-tooltip') as HTMLElement
|
|
|
|
|
- if (isMobiileFu() && tooltip) tooltip.style.inset = inset
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ console.log(inset, 'inset')
|
|
|
|
|
+ const tooltip = document.querySelector('.ant-tooltip') as HTMLElement
|
|
|
|
|
+ if (tooltip && isMobiileFu() && showTooltip === index) {
|
|
|
|
|
+ // tooltip.style.setProperty('inset', inset, 'important');
|
|
|
|
|
+ tooltip.style.inset = inset + '!important'
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 100);
|
|
|
|
|
+
|
|
|
|
|
+ }, [index, inset])
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<Tooltip
|
|
<Tooltip
|
|
|
title={
|
|
title={
|
|
@@ -229,10 +240,10 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
}
|
|
}
|
|
|
getPopupContainer={() => document.body.querySelector('#root') as HTMLElement}
|
|
getPopupContainer={() => document.body.querySelector('#root') as HTMLElement}
|
|
|
open={showTooltip === index}
|
|
open={showTooltip === index}
|
|
|
- trigger='click'
|
|
|
|
|
|
|
+ trigger='contextMenu'
|
|
|
placement='topLeft'
|
|
placement='topLeft'
|
|
|
- align={{ offset: [-45, 0] }}
|
|
|
|
|
- arrow={false}
|
|
|
|
|
|
|
+ align={{ offset: [-25, -10] }}
|
|
|
|
|
+ // arrow={false}
|
|
|
>
|
|
>
|
|
|
<a
|
|
<a
|
|
|
key={index}
|
|
key={index}
|
|
@@ -244,8 +255,6 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
// 只有非拖拽操作才处理
|
|
// 只有非拖拽操作才处理
|
|
|
handleClick()
|
|
handleClick()
|
|
|
}
|
|
}
|
|
|
- e.preventDefault()
|
|
|
|
|
- e.stopPropagation()
|
|
|
|
|
}}
|
|
}}
|
|
|
onClick={handleClick}
|
|
onClick={handleClick}
|
|
|
>
|
|
>
|
|
@@ -338,8 +347,15 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
[setBottomTxt, setIsShowMzmTitle]
|
|
[setBottomTxt, setIsShowMzmTitle]
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- const gaiShuEn = 'The inscription on the Cheng Zhe Stele consists of 31 lines of regular script,<br/>with 45 characters per line at maximum.<br/>The characters are approximately 2 cm in size, set within square grids, totaling 1,404 characters.<br/>No formal title of the stele is engraved. <br/>The entire text praises the historical achievements of the Cheng family.'
|
|
|
|
|
- const gaiShu = '程哲碑碑文,31行楷书,满行45字,<br/>字径约2厘米,带方界格,总计1404字;<br/>无正式碑名,通篇颂德程氏家族的历史功绩。'
|
|
|
|
|
|
|
+ // 原文 | 译文 的背景
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ callIframeFu('setStepBgActive', isOpenTrans ? 1 : 0)
|
|
|
|
|
+ }, [isOpenTrans])
|
|
|
|
|
+
|
|
|
|
|
+ const gaiShuEn =
|
|
|
|
|
+ 'The inscription on the Cheng Zhe Stele consists of 31 lines of regular script,<br/>with 45 characters per line at maximum.<br/>The characters are approximately 2 cm in size, set within square grids, totaling 1,404 characters.<br/>No formal title of the stele is engraved. <br/>The entire text praises the historical achievements of the Cheng family.'
|
|
|
|
|
+ const gaiShu =
|
|
|
|
|
+ '程哲碑碑文,31行楷书,满行45字,<br/>字径约2厘米,带方界格,总计1404字;<br/>无正式碑名,通篇颂德程氏家族的历史功绩。'
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div
|
|
<div
|
|
@@ -347,50 +363,26 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
id='modalTxt'
|
|
id='modalTxt'
|
|
|
>
|
|
>
|
|
|
<div className='modalTxtContainner'>
|
|
<div className='modalTxtContainner'>
|
|
|
- <div className='topBar'>
|
|
|
|
|
- <div className='beie' hidden={selectedTab !== 0}>
|
|
|
|
|
- <img src={require('@/assets/img/beie.png')} alt='' />
|
|
|
|
|
- <div className='txt songFont' onClick={handleBeie}>
|
|
|
|
|
- {myLangue === 'EN' ? 'forehead' : '碑额'}
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
|
|
|
- {modalTxtTab.map((item, index) => (
|
|
|
|
|
- <div
|
|
|
|
|
- key={item.key}
|
|
|
|
|
- className={`tab${index}`}
|
|
|
|
|
- onClick={() => handleTabClick(item.key, myData.readDetail[index]?.mzmtz?.title)}
|
|
|
|
|
- >
|
|
|
|
|
- <img
|
|
|
|
|
- src={require(`@/assets/img/btn_ModalTxt_bg${selectedTab === item.key ? '_ac' : ''
|
|
|
|
|
- }.png`)}
|
|
|
|
|
- alt=''
|
|
|
|
|
- />
|
|
|
|
|
- <div className={`tabNub songFont ${selectedTab === item.key ? 'tabNubAc' : ''}`}>
|
|
|
|
|
- {item.sonTxt}
|
|
|
|
|
- </div>
|
|
|
|
|
- <div
|
|
|
|
|
- className={classNames('txt songFont', selectedTab === item.key ? 'txtAc' : '')}
|
|
|
|
|
- style={{ opacity: selectedTab === item.key || selectedTab === 0 ? '1' : '0' }}
|
|
|
|
|
- >
|
|
|
|
|
- {myLangue === 'EN' ? item.nameEn : item.name}
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- ))}
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
|
|
|
- <div
|
|
|
|
|
|
|
+ {!isOpenTrans && <div
|
|
|
className='intro'
|
|
className='intro'
|
|
|
id='introContent'
|
|
id='introContent'
|
|
|
style={{
|
|
style={{
|
|
|
opacity: selectedTab !== 0 ? '1' : '0',
|
|
opacity: selectedTab !== 0 ? '1' : '0',
|
|
|
- height: selectedTab !== 0 ? '15%' : '5%'
|
|
|
|
|
|
|
+ height: selectedTab !== 0 ? '78%' : '0%',
|
|
|
|
|
+ width: selectedTab !== 0 ? '100%' : '0%'
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
- {selectedTab !== 0 && myData.readDetail[selectedTab - 1].intro}
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div className="intro_title songFont">
|
|
|
|
|
+ {selectedTab !== 0 && modalTxtTab[selectedTab - 1].name}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="intro_txt"> {selectedTab !== 0 && myData.readDetail[selectedTab - 1].intro}</div>
|
|
|
|
|
+
|
|
|
|
|
+ <div className="intro_btn" onClick={() => setIsOpenTrans(true)}>原文 | 译文</div>
|
|
|
|
|
+ </div>}
|
|
|
|
|
|
|
|
- {selectedTab !== 0 && (
|
|
|
|
|
|
|
+ {/* {selectedTab !== 0 && (
|
|
|
<div className='detailTxt'>
|
|
<div className='detailTxt'>
|
|
|
<div className='left'>
|
|
<div className='left'>
|
|
|
<div className='title'>原文</div>
|
|
<div className='title'>原文</div>
|
|
@@ -411,18 +403,58 @@ function ModalTxt({ setIsShowTabBar, setIsShowMzmTitle, setBottomTxt }: Props, r
|
|
|
></div>
|
|
></div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- )}
|
|
|
|
|
|
|
+ )} */}
|
|
|
|
|
|
|
|
{selectedTab === 0 && (
|
|
{selectedTab === 0 && (
|
|
|
<div className='content'>
|
|
<div className='content'>
|
|
|
<div className='title songFontc'>
|
|
<div className='title songFontc'>
|
|
|
{myLangue === 'EN' ? 'Overview of the Inscription' : '碑文概述'}
|
|
{myLangue === 'EN' ? 'Overview of the Inscription' : '碑文概述'}
|
|
|
</div>
|
|
</div>
|
|
|
- <div className='text' dangerouslySetInnerHTML={{ __html: myLangue === 'EN' ? gaiShuEn : gaiShu }}>
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ className='text'
|
|
|
|
|
+ dangerouslySetInnerHTML={{ __html: myLangue === 'EN' ? gaiShuEn : gaiShu }}
|
|
|
|
|
+ ></div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
|
|
+ <div className='topBar'>
|
|
|
|
|
+ <div className='beie' hidden={selectedTab !== 0}>
|
|
|
|
|
+ <img src={require('@/assets/img/beie.png')} alt='' />
|
|
|
|
|
+ <div className='txt songFont' onClick={handleBeie}>
|
|
|
|
|
+ {myLangue === 'EN' ? 'forehead' : '碑额'}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- )}
|
|
|
|
|
|
|
+
|
|
|
|
|
+ {modalTxtTab.map((item, index) => (
|
|
|
|
|
+ <div
|
|
|
|
|
+ key={item.key}
|
|
|
|
|
+ className={`tab${index}`}
|
|
|
|
|
+ onClick={() => handleTabClick(item.key, myData.readDetail[index]?.mzmtz?.title)}
|
|
|
|
|
+ >
|
|
|
|
|
+ <img
|
|
|
|
|
+ src={require(`@/assets/img/btn_ModalTxt_bg${selectedTab === item.key ? '_ac' : ''
|
|
|
|
|
+ }.png`)}
|
|
|
|
|
+ alt=''
|
|
|
|
|
+ />
|
|
|
|
|
+ <div className={`tabNub songFont ${selectedTab === item.key ? 'tabNubAc' : ''}`}>
|
|
|
|
|
+ {item.sonTxt}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div
|
|
|
|
|
+ className={classNames('txt songFont', selectedTab === item.key ? 'txtAc' : '')}
|
|
|
|
|
+ style={{ opacity: selectedTab === 0 ? '1' : '0' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ {myLangue === 'EN' ? item.nameEn : item.name}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ {(isOpenTrans && selectedTab !== 0) && <div className="translateModal">
|
|
|
|
|
+ <div className="txtWithTrans" onTouchMove={() => setShowTooltip(-1)}> {CommentText({
|
|
|
|
|
+ str: myData.readDetail[selectedTab - 1].translate_v2,
|
|
|
|
|
+ index: selectedTab - 1
|
|
|
|
|
+ })}</div>
|
|
|
|
|
+ </div>}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|