|
@@ -1,11 +1,10 @@
|
|
|
/* eslint-disable jsx-a11y/iframe-has-title */
|
|
|
-import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
|
+import React, { useEffect, useRef, useState } from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import { baseUrl } from "@/index";
|
|
|
import history from "@/utils/history";
|
|
|
-import { useSelector } from "react-redux";
|
|
|
-import { RootState } from "@/store";
|
|
|
import classNames from "classnames";
|
|
|
+import { InfoRowType } from "@/types";
|
|
|
|
|
|
const iconArr = [
|
|
|
{ id: 2, name: "放大" },
|
|
@@ -14,29 +13,11 @@ const iconArr = [
|
|
|
];
|
|
|
|
|
|
type Props = {
|
|
|
- type: "3" | "4";
|
|
|
- uid: string;
|
|
|
- cid: string;
|
|
|
+ info: InfoRowType;
|
|
|
+ type: "C2ArchitecInfo" | "D2BuildInfo";
|
|
|
};
|
|
|
|
|
|
-function ArcOrBuildInfo({ type, cid, uid }: Props) {
|
|
|
- // 建筑的数据
|
|
|
- const architec = useSelector(
|
|
|
- (state: RootState) => state.A0Layout.dataAll.architec
|
|
|
- );
|
|
|
-
|
|
|
- const info = useMemo(() => {
|
|
|
- // 筛选出 村 的信息
|
|
|
-
|
|
|
- const infoArr = architec[cid as "key"].data;
|
|
|
-
|
|
|
- const infoRes = infoArr.filter((v) => v.id === Number(uid))[0];
|
|
|
-
|
|
|
- // console.log(infoRes);
|
|
|
-
|
|
|
- return type === "3" ? infoRes : infoRes;
|
|
|
- }, [architec, cid, uid, type]);
|
|
|
-
|
|
|
+function ArcOrBuildInfo({ info, type }: Props) {
|
|
|
// 模型的ref
|
|
|
const ifrRefNew = useRef<any>(null);
|
|
|
|
|
@@ -53,6 +34,12 @@ function ArcOrBuildInfo({ type, cid, uid }: Props) {
|
|
|
// 点击对比
|
|
|
const [oldShow, setOldShow] = useState(false);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (oldShow) setOldFlag(true);
|
|
|
+ }, [oldShow]);
|
|
|
+
|
|
|
+ const [oldFlag, setOldFlag] = useState(false);
|
|
|
+
|
|
|
// 点击全屏
|
|
|
const [full, setFull] = useState(false);
|
|
|
|
|
@@ -101,17 +88,19 @@ function ArcOrBuildInfo({ type, cid, uid }: Props) {
|
|
|
>
|
|
|
<iframe
|
|
|
ref={ifrRefNew}
|
|
|
- src={`/model.html?m=${uid}&n=new`}
|
|
|
+ src={`/model.html?m=${info.id}&n=new&r=${type}`}
|
|
|
frameBorder="0"
|
|
|
></iframe>
|
|
|
{/* 进入室内按钮 */}
|
|
|
- <div
|
|
|
- hidden={full}
|
|
|
- className="C2rToScene"
|
|
|
- onClick={() => history.push(`/scene?id=${info.code}`)}
|
|
|
- >
|
|
|
- 进入室内
|
|
|
- </div>
|
|
|
+ {type === "C2ArchitecInfo" ? (
|
|
|
+ <div
|
|
|
+ hidden={full}
|
|
|
+ className="C2rToScene"
|
|
|
+ onClick={() => history.push(`/scene?id=${info.code}`)}
|
|
|
+ >
|
|
|
+ 进入室内
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
|
|
|
{/* 右侧的功能按钮 */}
|
|
|
<div className="C2rBtn">
|
|
@@ -156,8 +145,35 @@ function ArcOrBuildInfo({ type, cid, uid }: Props) {
|
|
|
</div>
|
|
|
|
|
|
{/* 点击对比打开的元素 */}
|
|
|
- <div className=""></div>
|
|
|
-
|
|
|
+ {oldFlag ? (
|
|
|
+ <div
|
|
|
+ className={classNames(
|
|
|
+ "C2openOld",
|
|
|
+ oldShow ? "C2openOldShow" : "",
|
|
|
+ info.isOld && info.isOld.loc === "横" ? "C2openOldShu" : ""
|
|
|
+ )}
|
|
|
+ >
|
|
|
+ <div className="C2openOldMain">
|
|
|
+ {info.isOld ? (
|
|
|
+ <>
|
|
|
+ <div className="C2openTit">{info.isOld.name}</div>
|
|
|
+ {/* 线 */}
|
|
|
+ <div className="C2openLine"></div>
|
|
|
+ {/* 模型或者图片 */}
|
|
|
+ {info.isOld.type === "model" ? (
|
|
|
+ <iframe
|
|
|
+ src={`/model.html?m=${info.id}&n=old&r=${type}`}
|
|
|
+ frameBorder="0"
|
|
|
+ ></iframe>
|
|
|
+ ) : (
|
|
|
+ <img src={`${baseUrl}/${type}/${info.id}/old.png`} alt="" />
|
|
|
+ )}
|
|
|
+ </>
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ <div className="C2openClose" onClick={() => setOldShow(false)}></div>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
</div>
|
|
|
);
|
|
|
}
|