|
@@ -0,0 +1,127 @@
|
|
|
|
+import React, { useCallback, useState } from "react";
|
|
|
|
+import styles from "./index.module.scss";
|
|
|
|
+import LogoImg from "@/assets/img/logo.png";
|
|
|
|
+import classNames from "classnames";
|
|
|
|
+import SwiperCom from "./SwiperCom";
|
|
|
|
+import VideoBox from "./VideoBox";
|
|
|
|
+import { A2SwType } from "@/types";
|
|
|
|
+
|
|
|
|
+const incoArr = [
|
|
|
|
+ {
|
|
|
|
+ id: 1,
|
|
|
|
+ data: [
|
|
|
|
+ {
|
|
|
|
+ id: 1,
|
|
|
|
+ name: "虎门销烟1-1",
|
|
|
|
+ path: "",
|
|
|
|
+ info: {
|
|
|
|
+ title: "视频66666",
|
|
|
|
+ txt: "撒大苏打撒旦111111111111111111111111111111111111111111撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦撒大苏打撒旦11111",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: 2,
|
|
|
|
+ name: "虎门销烟1-1",
|
|
|
|
+ path: "",
|
|
|
|
+ info: {
|
|
|
|
+ title: "视频66666",
|
|
|
|
+ txt: "撒大苏打撒旦11111111111111111111111111111111111111111111111",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: 3,
|
|
|
|
+ name: "虎门销烟1-1",
|
|
|
|
+ path: "",
|
|
|
|
+ info: {
|
|
|
|
+ title: "视频66666",
|
|
|
|
+ txt: "撒大苏打撒旦11111111111111111111111111111111111111111111111",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: 2,
|
|
|
|
+ data: [
|
|
|
|
+ { id: 1, name: "虎门销烟2-111111111111111111111111111111", path: "" },
|
|
|
|
+ { id: 2, name: "虎门销烟2-1", path: "" },
|
|
|
|
+ { id: 3, name: "虎门销烟2-1", path: "" },
|
|
|
|
+ { id: 4, name: "虎门销烟2-111111111111111111111111111111", path: "" },
|
|
|
|
+ { id: 5, name: "虎门销烟2-1", path: "" },
|
|
|
|
+ { id: 6, name: "虎门销烟2-1", path: "" },
|
|
|
|
+ { id: 7, name: "虎门销烟2-111111111111111111111111111111", path: "" },
|
|
|
|
+ { id: 8, name: "虎门销烟2-1", path: "" },
|
|
|
|
+ { id: 9, name: "虎门销烟2-1", path: "" },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: 3,
|
|
|
|
+ data: [
|
|
|
|
+ { id: 1, name: "虎门销烟3-1", path: "" },
|
|
|
|
+ { id: 2, name: "虎门销烟3-1", path: "" },
|
|
|
|
+ { id: 3, name: "虎门销烟3-1", path: "" },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ { id: 4 },
|
|
|
|
+ { id: 5 },
|
|
|
|
+];
|
|
|
|
+
|
|
|
|
+function A2Main() {
|
|
|
|
+ // 传给轮播图的数据
|
|
|
|
+ const [swData, setSwData] = useState<A2SwType[]>([]);
|
|
|
|
+
|
|
|
|
+ // 底部选中的状态
|
|
|
|
+ const [type, setType] = useState(0);
|
|
|
|
+ const typeChangeFu = useCallback((item: any) => {
|
|
|
|
+ setSwData(item.data);
|
|
|
|
+ setType(item.id);
|
|
|
|
+ }, []);
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <div className={styles.A2Main}>
|
|
|
|
+ {/* 左上方logo */}
|
|
|
|
+ <div className="logo">
|
|
|
|
+ <img src={LogoImg} alt="" />
|
|
|
|
+ </div>
|
|
|
|
+ {/* 底部轮播图 */}
|
|
|
|
+ <div
|
|
|
|
+ className={classNames(
|
|
|
|
+ "swBox",
|
|
|
|
+ [1, 2, 3].includes(type) ? "swBox1" : "",
|
|
|
|
+ [4, 5].includes(type) ? "swBox2" : ""
|
|
|
|
+ )}
|
|
|
|
+ >
|
|
|
|
+ <div className="swBoxMain">
|
|
|
|
+ <div className="top">
|
|
|
|
+ {incoArr.map((v) => (
|
|
|
|
+ <div
|
|
|
|
+ onClick={() => typeChangeFu(v)}
|
|
|
|
+ className={classNames(
|
|
|
|
+ "row",
|
|
|
|
+ `row${v.id}`,
|
|
|
|
+ type === v.id ? `rowAc${v.id}` : ""
|
|
|
|
+ )}
|
|
|
|
+ key={v.id}
|
|
|
|
+ ></div>
|
|
|
|
+ ))}
|
|
|
|
+ {/* 展开收起按钮 */}
|
|
|
|
+ <div
|
|
|
|
+ className={classNames("openIcon")}
|
|
|
|
+ hidden={!type}
|
|
|
|
+ onClick={() => setType(0)}
|
|
|
|
+ ></div>
|
|
|
|
+ </div>
|
|
|
|
+ {/* 轮播图主体 */}
|
|
|
|
+ {[1, 2, 3].includes(type) ? (
|
|
|
|
+ <SwiperCom type={type} data={swData} />
|
|
|
|
+ ) : null}
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ {/* 历史播放视频 */}
|
|
|
|
+ <VideoBox />
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const MemoA2Main = React.memo(A2Main);
|
|
|
|
+
|
|
|
|
+export default MemoA2Main;
|