|
@@ -3,12 +3,7 @@ import styles from './index.module.scss'
|
|
|
import classNames from 'classnames'
|
|
import classNames from 'classnames'
|
|
|
import http from '@/utils/http'
|
|
import http from '@/utils/http'
|
|
|
import { useHistory } from 'react-router-dom'
|
|
import { useHistory } from 'react-router-dom'
|
|
|
-import taohuanyuan from './image/D_taohuayuan.png'
|
|
|
|
|
-import taohuanyuanMobile from './image/M_D_taohuayuan.png'
|
|
|
|
|
-import xingtong from './image/D_xingtong.png'
|
|
|
|
|
-import xingtongMobile from './image/M_D_xingtong.png'
|
|
|
|
|
-import xuni from './image/D_xuni.png'
|
|
|
|
|
-import address from './image/D_address.png'
|
|
|
|
|
|
|
+import StartVideo from './component/startVideo'
|
|
|
import like from './image/icon_like.png'
|
|
import like from './image/icon_like.png'
|
|
|
import share from './image/icon_share.png'
|
|
import share from './image/icon_share.png'
|
|
|
import intro from './image/icon_intro.png'
|
|
import intro from './image/icon_intro.png'
|
|
@@ -43,47 +38,47 @@ const imgArrTemp2 = [
|
|
|
{ src: 'nan-6.jpg', title: '会议室' }
|
|
{ src: 'nan-6.jpg', title: '会议室' }
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
-function Diagram({
|
|
|
|
|
- imgSrc,
|
|
|
|
|
- left,
|
|
|
|
|
- top,
|
|
|
|
|
- addressLeft,
|
|
|
|
|
- addressTop,
|
|
|
|
|
- text,
|
|
|
|
|
- handleClick,
|
|
|
|
|
- textLeft,
|
|
|
|
|
- textTop
|
|
|
|
|
-}: {
|
|
|
|
|
- imgSrc: any
|
|
|
|
|
- left: number
|
|
|
|
|
- top: number
|
|
|
|
|
- addressLeft: number
|
|
|
|
|
- addressTop: number
|
|
|
|
|
- textLeft?: number
|
|
|
|
|
- textTop?: number
|
|
|
|
|
- text: string
|
|
|
|
|
- handleClick: () => void
|
|
|
|
|
-}) {
|
|
|
|
|
- console.log(imgSrc)
|
|
|
|
|
- console.log(taohuanyuan)
|
|
|
|
|
- return (
|
|
|
|
|
- <div
|
|
|
|
|
- className={classNames(styles.diagram, isMobile() && styles.diagramMobile)}
|
|
|
|
|
- style={{ left: `${left}%`, top: `${top}%` }}
|
|
|
|
|
- >
|
|
|
|
|
- <img className='diagram-img' src={imgSrc} onClick={handleClick} alt='' />
|
|
|
|
|
- {isMobile() && (
|
|
|
|
|
- <div className='diagram-text' style={{ left: `${textLeft}%`, top: `${textTop}%` }}>
|
|
|
|
|
- {text}
|
|
|
|
|
- </div>
|
|
|
|
|
- )}
|
|
|
|
|
- <div className='diagram-address' style={{ left: `${addressLeft}%`, top: `${addressTop}%` }}>
|
|
|
|
|
- <img src={address} alt='' />
|
|
|
|
|
- {!isMobile() && <div className='diagram-text'>{text}</div>}
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- )
|
|
|
|
|
-}
|
|
|
|
|
|
|
+// function Diagram({
|
|
|
|
|
+// imgSrc,
|
|
|
|
|
+// left,
|
|
|
|
|
+// top,
|
|
|
|
|
+// addressLeft,
|
|
|
|
|
+// addressTop,
|
|
|
|
|
+// text,
|
|
|
|
|
+// handleClick,
|
|
|
|
|
+// textLeft,
|
|
|
|
|
+// textTop
|
|
|
|
|
+// }: {
|
|
|
|
|
+// imgSrc: any
|
|
|
|
|
+// left: number
|
|
|
|
|
+// top: number
|
|
|
|
|
+// addressLeft: number
|
|
|
|
|
+// addressTop: number
|
|
|
|
|
+// textLeft?: number
|
|
|
|
|
+// textTop?: number
|
|
|
|
|
+// text: string
|
|
|
|
|
+// handleClick: () => void
|
|
|
|
|
+// }) {
|
|
|
|
|
+// console.log(imgSrc)
|
|
|
|
|
+// console.log(taohuanyuan)
|
|
|
|
|
+// return (
|
|
|
|
|
+// <div
|
|
|
|
|
+// className={classNames(styles.diagram, isMobile() && styles.diagramMobile)}
|
|
|
|
|
+// style={{ left: `${left}%`, top: `${top}%` }}
|
|
|
|
|
+// >
|
|
|
|
|
+// <img className='diagram-img' src={imgSrc} onClick={handleClick} alt='' />
|
|
|
|
|
+// {isMobile() && (
|
|
|
|
|
+// <div className='diagram-text' style={{ left: `${textLeft}%`, top: `${textTop}%` }}>
|
|
|
|
|
+// {text}
|
|
|
|
|
+// </div>
|
|
|
|
|
+// )}
|
|
|
|
|
+// <div className='diagram-address' style={{ left: `${addressLeft}%`, top: `${addressTop}%` }}>
|
|
|
|
|
+// <img src={address} alt='' />
|
|
|
|
|
+// {!isMobile() && <div className='diagram-text'>{text}</div>}
|
|
|
|
|
+// </div>
|
|
|
|
|
+// </div>
|
|
|
|
|
+// )
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
function Layout({ setIsFloor }: { setIsFloor: (isFloor: boolean) => void }) {
|
|
function Layout({ setIsFloor }: { setIsFloor: (isFloor: boolean) => void }) {
|
|
|
const history = useHistory()
|
|
const history = useHistory()
|
|
@@ -122,6 +117,7 @@ function Layout({ setIsFloor }: { setIsFloor: (isFloor: boolean) => void }) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function A0Base() {
|
|
function A0Base() {
|
|
|
|
|
+ const [isEnd, setIsEnd] = useState(false)
|
|
|
const [showIntro, setShowIntro] = useState(false)
|
|
const [showIntro, setShowIntro] = useState(false)
|
|
|
const [isFloor, setIsFloor] = useState(false)
|
|
const [isFloor, setIsFloor] = useState(false)
|
|
|
const [isPreview, setIsPreview] = useState<[boolean, string]>([false, ''])
|
|
const [isPreview, setIsPreview] = useState<[boolean, string]>([false, ''])
|
|
@@ -140,8 +136,26 @@ function A0Base() {
|
|
|
setShowIntro(isShow)
|
|
setShowIntro(isShow)
|
|
|
}
|
|
}
|
|
|
const handleShareClick = () => {
|
|
const handleShareClick = () => {
|
|
|
- navigator.clipboard.writeText(window.location.href)
|
|
|
|
|
- message.success('链接已复制到剪贴板')
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (window.isSecureContext && navigator.clipboard) {
|
|
|
|
|
+ navigator.clipboard.writeText(window.location.href).then(() => {
|
|
|
|
|
+ message.success('链接已复制到剪贴板')
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 回退到旧方法
|
|
|
|
|
+ const textArea = document.createElement('textarea')
|
|
|
|
|
+ textArea.value = window.location.href
|
|
|
|
|
+ document.body.appendChild(textArea)
|
|
|
|
|
+ textArea.select()
|
|
|
|
|
+ document.execCommand('copy')
|
|
|
|
|
+ document.body.removeChild(textArea)
|
|
|
|
|
+ message.success('链接已复制到剪贴板')
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.error('复制失败:', err)
|
|
|
|
|
+ // 可提示用户手动复制
|
|
|
|
|
+ message.error('浏览器不支持自动复制,请手动复制当前链接')
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
const handleLikeClick = () => {
|
|
const handleLikeClick = () => {
|
|
|
if (isLike) return
|
|
if (isLike) return
|
|
@@ -154,63 +168,74 @@ function A0Base() {
|
|
|
}, 2000)
|
|
}, 2000)
|
|
|
}
|
|
}
|
|
|
return (
|
|
return (
|
|
|
- <div
|
|
|
|
|
- className={classNames(styles.A0base, isMobile() && styles.A0baseMobile)}
|
|
|
|
|
- style={{
|
|
|
|
|
- backgroundImage: isFloor
|
|
|
|
|
- ? isMobile()
|
|
|
|
|
- ? `url(${require('./image/M_bg_floor.png')})`
|
|
|
|
|
- : `url(${require('./image/bg_floor.png')})`
|
|
|
|
|
- : isMobile()
|
|
|
|
|
- ? `url(${require('./image/M_bg_map.png')})`
|
|
|
|
|
- : `url(${require('./image/bg_map.png')})`
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- {isFloor && !showIntro && <Layout setIsFloor={setIsFloor} />}
|
|
|
|
|
- {showIntro &&
|
|
|
|
|
- (isFloor ? (
|
|
|
|
|
- <Intro handleIntroClick={handleIntroClick} />
|
|
|
|
|
- ) : (
|
|
|
|
|
- <MapIntro handleIntroClick={handleIntroClick} />
|
|
|
|
|
- ))}
|
|
|
|
|
|
|
+ <>
|
|
|
|
|
+ {!isEnd ? (
|
|
|
|
|
+ <StartVideo setIsEnd={setIsEnd} />
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <div
|
|
|
|
|
+ className={classNames(styles.A0base, isMobile() && styles.A0baseMobile)}
|
|
|
|
|
+ style={{
|
|
|
|
|
+ backgroundImage: isFloor
|
|
|
|
|
+ ? isMobile()
|
|
|
|
|
+ ? `url(${require('./image/M_bg_floor.png')})`
|
|
|
|
|
+ : `url(${require('./image/bg_floor.png')})`
|
|
|
|
|
+ : isMobile()
|
|
|
|
|
+ ? `url(${require('./image/M_bg_map.png')})`
|
|
|
|
|
+ : `url(${require('./image/bg_map.png')})`
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ {isFloor && !showIntro && <Layout setIsFloor={setIsFloor} />}
|
|
|
|
|
+ {showIntro &&
|
|
|
|
|
+ (isFloor ? (
|
|
|
|
|
+ <Intro handleIntroClick={handleIntroClick} />
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <MapIntro handleIntroClick={handleIntroClick} />
|
|
|
|
|
+ ))}
|
|
|
|
|
|
|
|
- <Panoramic
|
|
|
|
|
- setIsFloor={setIsFloor}
|
|
|
|
|
- setIsPreview={setIsPreview}
|
|
|
|
|
- isDisolay={!isFloor && !isPreview[0]}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <Panoramic
|
|
|
|
|
+ setIsFloor={setIsFloor}
|
|
|
|
|
+ setIsPreview={setIsPreview}
|
|
|
|
|
+ isDisolay={!isFloor && !isPreview[0]}
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
- {isPreview[0] && (
|
|
|
|
|
- <Preview
|
|
|
|
|
- imgArr={isPreview[1] === 'baoan' ? imgArrTemp : imgArrTemp2}
|
|
|
|
|
- setIsPreview={setIsPreview}
|
|
|
|
|
- type={isPreview[1]}
|
|
|
|
|
- />
|
|
|
|
|
- )}
|
|
|
|
|
- <div
|
|
|
|
|
- className='A0_iconBar'
|
|
|
|
|
- style={{ display: isPreview[0] || (isMobile() && showIntro) ? 'none' : 'flex' }}
|
|
|
|
|
- >
|
|
|
|
|
- <div className='A0_icon' onClick={() => handleLikeClick()}>
|
|
|
|
|
|
|
+ {isPreview[0] && (
|
|
|
|
|
+ <Preview
|
|
|
|
|
+ imgArr={isPreview[1] === 'baoan' ? imgArrTemp : imgArrTemp2}
|
|
|
|
|
+ setIsPreview={setIsPreview}
|
|
|
|
|
+ type={isPreview[1]}
|
|
|
|
|
+ />
|
|
|
|
|
+ )}
|
|
|
<div
|
|
<div
|
|
|
- className={classNames(isLike ? 'addLikeAc' : '', 'addLike')}
|
|
|
|
|
- style={{ opacity: !isLike ? 0 : 1 }}
|
|
|
|
|
|
|
+ className='A0_iconBar'
|
|
|
|
|
+ style={{ display: isPreview[0] || (isMobile() && showIntro) ? 'none' : 'flex' }}
|
|
|
>
|
|
>
|
|
|
- +1
|
|
|
|
|
|
|
+ <div className='A0_icon' onClick={() => handleLikeClick()}>
|
|
|
|
|
+ <div
|
|
|
|
|
+ className={classNames(isLike ? 'addLikeAc' : '', 'addLike')}
|
|
|
|
|
+ style={{ opacity: !isLike ? 0 : 1 }}
|
|
|
|
|
+ >
|
|
|
|
|
+ +1
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <img className='A0_icon_like' src={like} alt='' />
|
|
|
|
|
+ <div>{likeCount}次赞</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className='A0_icon'>
|
|
|
|
|
+ <img
|
|
|
|
|
+ className='A0_icon_intro'
|
|
|
|
|
+ onClick={() => setShowIntro(true)}
|
|
|
|
|
+ src={intro}
|
|
|
|
|
+ alt=''
|
|
|
|
|
+ />
|
|
|
|
|
+ <div>简介</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className='A0_icon' onClick={() => handleShareClick()}>
|
|
|
|
|
+ <img className='A0_icon_share' src={share} alt='' />
|
|
|
|
|
+ <div>分享</div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- <img className='A0_icon_like' src={like} alt='' />
|
|
|
|
|
- <div>{likeCount}次赞</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className='A0_icon'>
|
|
|
|
|
- <img className='A0_icon_intro' onClick={() => setShowIntro(true)} src={intro} alt='' />
|
|
|
|
|
- <div>简介</div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
- <div className='A0_icon' onClick={() => handleShareClick()}>
|
|
|
|
|
- <img className='A0_icon_share' src={share} alt='' />
|
|
|
|
|
- <div>分享</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ )}
|
|
|
|
|
+ </>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|