|
|
@@ -1,7 +1,7 @@
|
|
|
-import React, { useMemo } from "react";
|
|
|
+import React, { useCallback, useMemo } from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import { useSelector } from "react-redux";
|
|
|
-import store, { RootState } from "@/store";
|
|
|
+import { RootState } from "@/store";
|
|
|
import { baseURL } from "@/utils/http";
|
|
|
import backImg from "@/assets/img/back.png";
|
|
|
import history from "@/utils/history";
|
|
|
@@ -11,6 +11,7 @@ import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
import { Navigation } from "swiper";
|
|
|
import "swiper/css";
|
|
|
import "swiper/css/navigation";
|
|
|
+import { ImageViewer } from "antd-mobile";
|
|
|
|
|
|
function A4IntroM() {
|
|
|
const data = useSelector((state: RootState) => state.A0Layout.dataAll.Home);
|
|
|
@@ -28,6 +29,26 @@ function A4IntroM() {
|
|
|
return dom;
|
|
|
}, [dataRes.imgNum]);
|
|
|
|
|
|
+ const lookArr = useCallback(() => {
|
|
|
+ const arr = [] as string[];
|
|
|
+
|
|
|
+ imgArr.forEach((v, i) => {
|
|
|
+ arr.push(`${baseURL}/4Intro/pc/${i + 1}.jpg`);
|
|
|
+ });
|
|
|
+
|
|
|
+ return arr;
|
|
|
+ }, [imgArr]);
|
|
|
+
|
|
|
+ const lookBigImgFu = useCallback(
|
|
|
+ (i: number) => {
|
|
|
+ ImageViewer.Multi.show({
|
|
|
+ images: lookArr(),
|
|
|
+ defaultIndex: i,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ [lookArr]
|
|
|
+ );
|
|
|
+
|
|
|
return (
|
|
|
<div
|
|
|
className={styles.A4IntroM}
|
|
|
@@ -75,18 +96,23 @@ function A4IntroM() {
|
|
|
// onSlideChange={() => console.log("slide change")}
|
|
|
// onSwiper={(swiper) => console.log(swiper)}
|
|
|
>
|
|
|
- {imgArr.map((v) => (
|
|
|
- <SwiperSlide key={v}>
|
|
|
+ {imgArr.map((v, i) => (
|
|
|
+ <SwiperSlide
|
|
|
+ key={v}
|
|
|
+ onClick={
|
|
|
+ () => lookBigImgFu(i)
|
|
|
+
|
|
|
+ // store.dispatch({
|
|
|
+ // type: "layout/lookBigImg",
|
|
|
+ // payload: {
|
|
|
+ // show: true,
|
|
|
+ // url: lookArr(),
|
|
|
+ // current: i,
|
|
|
+ // },
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ >
|
|
|
<img
|
|
|
- onClick={() =>
|
|
|
- store.dispatch({
|
|
|
- type: "layout/lookBigImg",
|
|
|
- payload: {
|
|
|
- show: true,
|
|
|
- url: `${baseURL}/4Intro/pc/${v + 1}.jpg`,
|
|
|
- },
|
|
|
- })
|
|
|
- }
|
|
|
className="swImg"
|
|
|
src={`${baseURL}/4Intro/pc/${v + 1}.jpg`}
|
|
|
alt=""
|