| | |
| | | const [orderData, setOrderData] = useState<any>({}); // 订单数据 |
| | | const [isLogin, setIsLogin] = useState(false); // 是否登录 |
| | | const [overlayAnchorBottom, setOverlayAnchorBottom] = useState<number | null>(null); // 浮层初始化锚点(距底部) |
| | | const overlayAnchorInitedRef = useRef(false); // 浮层锚点是否已初始化 |
| | | const { |
| | | boxHeight, |
| | | originOpacity, |
| | |
| | | |
| | | // 初始化浮层锚点:固定在 content-box 顶部上方 32px |
| | | const initOverlayAnchor = () => { |
| | | if (overlayAnchorInitedRef.current) return; |
| | | // content-box 高度受 banner 数量影响:多 banner 复用 boxHeight,单 banner 走渲染后实测高度 |
| | | if (bannerList.length > 1) { |
| | | const bottom = Math.max(0, Number(boxHeight) + 115); |
| | | const bottom = Math.max(0, 280 + 32); |
| | | if (bottom <= 0) return; |
| | | setOverlayAnchorBottom(bottom); |
| | | overlayAnchorInitedRef.current = true; |
| | | return; |
| | | } |
| | | const query = Taro.createSelectorQuery(); |
| | | query.select('.content-box').boundingClientRect(); |
| | | query.exec((res) => { |
| | | if (overlayAnchorInitedRef.current) return; |
| | | const rect = res?.[0]; |
| | | const height = Number(rect?.height); |
| | | if (!Number.isFinite(height) || height <= 0) return; |
| | | const bottom = Math.max(0, height + 115); |
| | | const bottom = Math.max(0, height + 32); |
| | | setOverlayAnchorBottom(bottom); |
| | | overlayAnchorInitedRef.current = true; |
| | | }); |
| | | }; |
| | | |
| | |
| | | }); |
| | | }, 80); |
| | | return () => clearTimeout(timer); |
| | | }, [bannerList.length, tripStatus, boxHeight]); |
| | | }, [bannerList.length, tripStatus]); |
| | | |
| | | // 处理点击地图 marker |
| | | const handleMarkerTap = (e: any) => { |
| | |
| | | maintainBounce={maintainBounce} |
| | | hotfixEndText={hotfixEndText} |
| | | anchorBottom={overlayAnchorBottom ?? undefined} |
| | | opacity={originOpacity} |
| | | isDragging={isDragging.current} |
| | | onShowPrivacy={() => setShowPrivacy(true)} |
| | | onOpenSetting={handleOpenSetting} |
| | | onViewOperatingArea={handleViewOperatingArea} |