|
|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useMemo, useState } from "react";
|
|
|
+import React, { useEffect, useMemo, useState } from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import { envUrl } from "@/utils/env";
|
|
|
import ImgLoding from "@/components/ImgLoding";
|
|
|
@@ -12,7 +12,6 @@ type Props = {
|
|
|
};
|
|
|
|
|
|
function ImgLook({ closeFu, imgId }: Props) {
|
|
|
-
|
|
|
const list = useMemo(() => {
|
|
|
let arr = [] as tab1IObjType;
|
|
|
arr = Reflect.get(tab1IObj, imgId) || [];
|
|
|
@@ -21,17 +20,38 @@ function ImgLook({ closeFu, imgId }: Props) {
|
|
|
|
|
|
const [code, setCode] = useState("");
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (imgId === 3) {
|
|
|
+ // 海战馆,默认移动到中间
|
|
|
+ const dom = document.querySelector("#ImgLook") as HTMLDivElement;
|
|
|
+
|
|
|
+ const imgDom = document.querySelector("#tab1ImgId") as HTMLImageElement;
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ if (dom && imgDom) {
|
|
|
+ console.log(123, imgDom.clientWidth);
|
|
|
+
|
|
|
+ const num = imgDom.clientWidth * 0.3;
|
|
|
+ dom.scrollLeft = num;
|
|
|
+ }
|
|
|
+ }, 50);
|
|
|
+ }
|
|
|
+ }, [imgId]);
|
|
|
+
|
|
|
return (
|
|
|
- <div className={styles.ImgLook}>
|
|
|
+ <div className={styles.ImgLook} id="ImgLook">
|
|
|
{/* 大图片加载中 */}
|
|
|
<ImgLoding id={imgId} />
|
|
|
|
|
|
- <img
|
|
|
- className="tab1Iimg"
|
|
|
- onLoad={() => imgLodingFu(imgId)}
|
|
|
- src={`${envUrl}/App/main1/bg${imgId}.jpg`}
|
|
|
- alt=""
|
|
|
- />
|
|
|
+ <div className="tab1IBox">
|
|
|
+ <img
|
|
|
+ id="tab1ImgId"
|
|
|
+ className="tab1Iimg"
|
|
|
+ onLoad={() => imgLodingFu(imgId)}
|
|
|
+ src={`${envUrl}/App/main1/bg${imgId}.jpg`}
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
|
|
|
{/* 返回按钮 */}
|
|
|
<div className="tab1Iback" onClick={closeFu}>
|