/* eslint-disable jsx-a11y/iframe-has-title */ import React, { useMemo, useRef, useState } from "react"; import styles from "./index.module.scss"; import { baseUrl } from "@/index"; import { InfoRowType } from "@/types"; import history from "@/utils/history"; import { SwapRightOutlined } from "@ant-design/icons"; import classNames from "classnames"; const iconArr = [ { id: 2, name: "放大" }, { id: 3, name: "缩小" }, { id: 4, name: "复位" }, ]; type Props = { info: InfoRowType; type: "C2ArchitecInfo" | "D2BuildInfo"; }; function ArcOrBuildInfoM({ info, type }: Props) { // 模型的ref const ifrRefNew = useRef(null); const modelChangeFu = (val: number) => { const dom = ifrRefNew.current; if (dom && dom.contentWindow && dom.contentWindow.webview) { if (val === 2) dom.contentWindow.webview.zoomIn(); // 放大 else if (val === 3) dom.contentWindow.webview.zoomOut(); // 缩小 else dom.contentWindow.webview.resetView(); // 复位 } }; // 文字介绍 const [txtShow, setTxtShow] = useState(false); // 全屏 const [full, setFull] = useState(false); // 是否没有大场景也没有构件 const isFullBox = useMemo(() => { let flag = false; if ( !info.code && (!info.isBuild || (info.isBuild && info.isBuild.length === 0)) ) { flag = true; } return flag; }, [info.code, info.isBuild]); return (
{/* 返回按钮 */}
history.go(-1)} hidden={full}>
{/* 主体模型 */}
{/* 名字 */}
{info.name}
{/* 模型 */} {/* 右侧按钮 */}
{/* 打开介绍 */} {iconArr.map((v) => (
modelChangeFu(v.id)} className={`AMtopBtnRow AMtopBtnRow${v.id}`} key={v.id} >
))} {/* 全屏 */}
{/* 底部按钮 */} {/* 文字介绍 */}

简介 {/* 右侧关闭按钮 */} setTxtShow(false)} className="AMtxtClose" src={`${baseUrl}/C2ArchitecInfo/icon_cancel.png`} alt="" />

); } const MemoArcOrBuildInfoM = React.memo(ArcOrBuildInfoM); export default MemoArcOrBuildInfoM;