|
@@ -7,7 +7,7 @@ import { Input, Pagination } from "antd";
|
|
|
|
|
|
import { SearchOutlined } from "@ant-design/icons";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
-import { A2_APIgetGoodsList, A2_APIgetSelectData } from "@/store/action/A2Main";
|
|
|
+import { A2_APIgetGoodsList, A2_APIgetTopClass } from "@/store/action/A2Main";
|
|
|
import { RootState } from "@/store";
|
|
|
import { envUrl } from "@/utils/env";
|
|
|
import ImageLazy from "@/components/ImageLazy";
|
|
@@ -34,7 +34,7 @@ function Tab4() {
|
|
|
// 发送请求参数
|
|
|
const [getData, setGetData] = useState<A2getGoodsDataType>({
|
|
|
dictAge: "",
|
|
|
- dictTexture: "",
|
|
|
+ dictTexture: "全部",
|
|
|
searchKey: "",
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
@@ -47,7 +47,13 @@ function Tab4() {
|
|
|
|
|
|
let searchKey = "";
|
|
|
if (inpValueRef.current) searchKey = inpValueRef.current.input.value;
|
|
|
- dispatch(A2_APIgetGoodsList({ ...getData, searchKey }));
|
|
|
+ dispatch(
|
|
|
+ A2_APIgetGoodsList({
|
|
|
+ ...getData,
|
|
|
+ searchKey,
|
|
|
+ dictTexture: getData.dictTexture === "全部" ? "" : getData.dictTexture,
|
|
|
+ })
|
|
|
+ );
|
|
|
}, [dispatch, getData]);
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -64,15 +70,12 @@ function Tab4() {
|
|
|
}, [inpValue]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
- // 发送请求拿到下拉框数据
|
|
|
- // dispatch(A2_APIgetSelectData("age"));
|
|
|
- dispatch(A2_APIgetSelectData("texture"));
|
|
|
- }, [dispatch]);
|
|
|
+ // 发送请求拿到顶部筛选数据
|
|
|
+ dispatch(A2_APIgetTopClass(getData.type === "img" ? "2d" : "3d"));
|
|
|
+ }, [dispatch, getData.type]);
|
|
|
|
|
|
// 获取下拉数据
|
|
|
- const selectData = useSelector(
|
|
|
- (state: RootState) => state.A2Main.selectData.texture
|
|
|
- );
|
|
|
+ const selectData = useSelector((state: RootState) => state.A2Main.selectData);
|
|
|
|
|
|
// 从仓库获取数据
|
|
|
const goodsList = useSelector((state: RootState) => state.A2Main.goodsList);
|
|
@@ -94,7 +97,14 @@ function Tab4() {
|
|
|
"tab4Top1",
|
|
|
v.id === getData.type ? "tab4Top1Ac" : ""
|
|
|
)}
|
|
|
- onClick={() => setGetData({ ...getData, type: v.id, pageNum: 1 })}
|
|
|
+ onClick={() =>
|
|
|
+ setGetData({
|
|
|
+ ...getData,
|
|
|
+ type: v.id,
|
|
|
+ pageNum: 1,
|
|
|
+ dictTexture: "全部",
|
|
|
+ })
|
|
|
+ }
|
|
|
>
|
|
|
{v.name}
|
|
|
</div>
|
|
@@ -137,21 +147,21 @@ function Tab4() {
|
|
|
// onSwiper={(swiper) => (mySwiperRef.current = swiper)}
|
|
|
>
|
|
|
{selectData.map((v) => (
|
|
|
- <SwiperSlide key={v.label}>
|
|
|
+ <SwiperSlide key={v}>
|
|
|
<div
|
|
|
onClick={(e) =>
|
|
|
setGetData({
|
|
|
...getData,
|
|
|
- dictTexture: v.value as string,
|
|
|
+ dictTexture: v as string,
|
|
|
pageNum: 1,
|
|
|
})
|
|
|
}
|
|
|
className={classNames(
|
|
|
"row",
|
|
|
- getData.dictTexture === v.value ? "active" : ""
|
|
|
+ getData.dictTexture === v ? "active" : ""
|
|
|
)}
|
|
|
>
|
|
|
- <span>{v.label}</span>
|
|
|
+ <span>{v}</span>
|
|
|
</div>
|
|
|
</SwiperSlide>
|
|
|
))}
|