|
@@ -2,7 +2,7 @@ import { baseURL } from "@/utils/http";
|
|
import classNames from "classnames";
|
|
import classNames from "classnames";
|
|
import styles from "./index.module.scss";
|
|
import styles from "./index.module.scss";
|
|
import logoImg from "@/assets/img/logo.png";
|
|
import logoImg from "@/assets/img/logo.png";
|
|
-import { Input, Pagination, Select } from "antd";
|
|
|
|
|
|
+import { Input, Pagination } from "antd";
|
|
import {
|
|
import {
|
|
SearchOutlined,
|
|
SearchOutlined,
|
|
ExclamationOutlined,
|
|
ExclamationOutlined,
|
|
@@ -18,6 +18,15 @@ import {
|
|
} from "@/store/action/home";
|
|
} from "@/store/action/home";
|
|
import { RootState } from "@/store";
|
|
import { RootState } from "@/store";
|
|
import Model from "@/components/Model";
|
|
import Model from "@/components/Model";
|
|
|
|
+
|
|
|
|
+import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
|
+
|
|
|
|
+import { FreeMode, Mousewheel } from "swiper";
|
|
|
|
+// Import Swiper styles
|
|
|
|
+import "swiper/css";
|
|
|
|
+import "swiper/css/free-mode";
|
|
|
|
+import "swiper/css/mousewheel";
|
|
|
|
+
|
|
export default function Home() {
|
|
export default function Home() {
|
|
const dispatch = useDispatch();
|
|
const dispatch = useDispatch();
|
|
// 进页面获取后端文物数据
|
|
// 进页面获取后端文物数据
|
|
@@ -66,12 +75,16 @@ export default function Home() {
|
|
);
|
|
);
|
|
const { list, total } = modelInfo;
|
|
const { list, total } = modelInfo;
|
|
|
|
|
|
|
|
+ // 选中全部分类 或是年代
|
|
|
|
+ const [acSelect, setAcSelect] = useState(0);
|
|
|
|
+
|
|
// 分类
|
|
// 分类
|
|
const [sort, setSort] = useState(-1);
|
|
const [sort, setSort] = useState(-1);
|
|
// 分类下拉框改变
|
|
// 分类下拉框改变
|
|
const sortChangeFu = (value: number) => {
|
|
const sortChangeFu = (value: number) => {
|
|
setSort(value);
|
|
setSort(value);
|
|
};
|
|
};
|
|
|
|
+
|
|
// 年代
|
|
// 年代
|
|
const [ageSerach, setAgeSerach] = useState(-1);
|
|
const [ageSerach, setAgeSerach] = useState(-1);
|
|
// 年代下拉框改变
|
|
// 年代下拉框改变
|
|
@@ -144,48 +157,103 @@ export default function Home() {
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div className="mainBox">
|
|
<div className="mainBox">
|
|
- {/* 筛选的盒子 */}
|
|
|
|
- <div className="screenBox">
|
|
|
|
- {/* 输入框 */}
|
|
|
|
- <div className="search">
|
|
|
|
- <div className="searchBtn" onClick={searchBtnFu}></div>
|
|
|
|
- {value.length > 0 ? (
|
|
|
|
- <div className="searchClear" onClick={clearValueFu}>
|
|
|
|
- <CloseCircleOutlined />
|
|
|
|
- </div>
|
|
|
|
- ) : null}
|
|
|
|
-
|
|
|
|
- <Input
|
|
|
|
- maxLength={10}
|
|
|
|
- placeholder="请输入文物名称"
|
|
|
|
- value={value}
|
|
|
|
- onChange={(e) => setValue(e.target.value)}
|
|
|
|
- onKeyUp={(e) => searchKeyUpFu(e)}
|
|
|
|
- prefix={<SearchOutlined />}
|
|
|
|
- />
|
|
|
|
|
|
+ <div className="searchBox">
|
|
|
|
+ <div className="searchBoxTop">
|
|
|
|
+ <div
|
|
|
|
+ className={classNames(acSelect === 0 ? "active" : "")}
|
|
|
|
+ onClick={() => setAcSelect(0)}
|
|
|
|
+ >
|
|
|
|
+ 全部分类
|
|
|
|
+ </div>
|
|
|
|
+ <div
|
|
|
|
+ className={classNames(acSelect === 1 ? "active" : "")}
|
|
|
|
+ onClick={() => setAcSelect(1)}
|
|
|
|
+ >
|
|
|
|
+ 全部年代
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
+ {/* 选中出来的选项 */}
|
|
|
|
+ <div className="searchBoxAcBox">
|
|
|
|
+ <div className="searchBoxAcMain">
|
|
|
|
+ <Swiper
|
|
|
|
+ modules={[FreeMode, Mousewheel]}
|
|
|
|
+ hidden={acSelect !== 0}
|
|
|
|
+ className="appSw"
|
|
|
|
+ spaceBetween={0}
|
|
|
|
+ slidesPerView="auto"
|
|
|
|
+ freeMode={true}
|
|
|
|
+ mousewheel={true}
|
|
|
|
+ // onSlideChange={(e) => console.log("slide change", e)}
|
|
|
|
+ // onSwiper={(swiper) => (mySwiperRef.current = swiper)}
|
|
|
|
+ >
|
|
|
|
+ {sortList.map((v) => (
|
|
|
|
+ <SwiperSlide key={v.label}>
|
|
|
|
+ <div
|
|
|
|
+ onClick={() => sortChangeFu(v.value!)}
|
|
|
|
+ className={classNames(
|
|
|
|
+ "row",
|
|
|
|
+ sort === v.value ? "active" : ""
|
|
|
|
+ )}
|
|
|
|
+ >
|
|
|
|
+ {v.label}
|
|
|
|
+ </div>
|
|
|
|
+ </SwiperSlide>
|
|
|
|
+ ))}
|
|
|
|
+ </Swiper>
|
|
|
|
|
|
- {/* 分类下拉框 */}
|
|
|
|
- <div className="sortBox">
|
|
|
|
- <Select
|
|
|
|
- style={{ width: "100%" }}
|
|
|
|
- value={sort}
|
|
|
|
- onChange={sortChangeFu}
|
|
|
|
- options={sortList}
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
|
|
+ <Swiper
|
|
|
|
+ modules={[FreeMode, Mousewheel]}
|
|
|
|
+ hidden={acSelect !== 1}
|
|
|
|
+ className="appSw"
|
|
|
|
+ spaceBetween={0}
|
|
|
|
+ slidesPerView="auto"
|
|
|
|
+ freeMode={true}
|
|
|
|
+ mousewheel={true}
|
|
|
|
+ // onSlideChange={(e) => console.log("slide change", e)}
|
|
|
|
+ // onSwiper={(swiper) => (mySwiperRef.current = swiper)}
|
|
|
|
+ >
|
|
|
|
+ {ageList.map((v) => (
|
|
|
|
+ <SwiperSlide key={v.label}>
|
|
|
|
+ <div
|
|
|
|
+ onClick={() => ageChangeFu(v.value!)}
|
|
|
|
+ className={classNames(
|
|
|
|
+ "row",
|
|
|
|
+ ageSerach === v.value ? "active" : ""
|
|
|
|
+ )}
|
|
|
|
+ >
|
|
|
|
+ {v.label}
|
|
|
|
+ </div>
|
|
|
|
+ </SwiperSlide>
|
|
|
|
+ ))}
|
|
|
|
+ </Swiper>
|
|
|
|
|
|
- {/* 年代筛选下拉框 */}
|
|
|
|
- <div className="ageSeachBox">
|
|
|
|
- <Select
|
|
|
|
- style={{ width: "100%" }}
|
|
|
|
- value={ageSerach}
|
|
|
|
- onChange={ageChangeFu}
|
|
|
|
- options={ageList}
|
|
|
|
- />
|
|
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ {/* 输入框 */}
|
|
|
|
+ <div className="seatchinputBox">
|
|
|
|
+ <div className="search">
|
|
|
|
+ <div className="searchBtn" onClick={searchBtnFu}></div>
|
|
|
|
+ {value.length > 0 ? (
|
|
|
|
+ <div className="searchClear" onClick={clearValueFu}>
|
|
|
|
+ <CloseCircleOutlined />
|
|
|
|
+ </div>
|
|
|
|
+ ) : null}
|
|
|
|
+ <Input
|
|
|
|
+ maxLength={10}
|
|
|
|
+ placeholder="搜索关键词"
|
|
|
|
+ value={value}
|
|
|
|
+ onChange={(e) => setValue(e.target.value)}
|
|
|
|
+ onKeyUp={(e) => searchKeyUpFu(e)}
|
|
|
|
+ prefix={<SearchOutlined />}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <div className="rightBtn" onClick={searchBtnFu}>
|
|
|
|
+ 搜 索
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
+
|
|
{/* 页面渲染主体 */}
|
|
{/* 页面渲染主体 */}
|
|
<div className="modelBox" ref={modelBoxRef}>
|
|
<div className="modelBox" ref={modelBoxRef}>
|
|
{list && list.length > 0 ? (
|
|
{list && list.length > 0 ? (
|