|
@@ -1,10 +1,11 @@
|
|
|
import { useEffect, useState } from "react";
|
|
|
import ItemCard from "@/components/ItemCard";
|
|
|
-import { Input, Empty, Spin } from "antd";
|
|
|
+import { Input, Empty, Spin, Pagination } from "antd";
|
|
|
import { GetAppPublicList } from "@/api/appStore";
|
|
|
import { useRequest } from "umi";
|
|
|
import { INDUSTRIE_OPTIONS, APPLICATION_SCENARIOS_OPTIONS } from "@/constants";
|
|
|
import noDataImg from "@/assets/no-data.svg";
|
|
|
+import "@/style/index.less";
|
|
|
|
|
|
type SceneItem = {
|
|
|
label: string;
|
|
@@ -25,11 +26,12 @@ export default function Home() {
|
|
|
const [search, setSearch] = useState("");
|
|
|
const [industryFilter, setIndustryFilter] = useState("all");
|
|
|
const [sceneFilter, setSceneFilter] = useState("recommend");
|
|
|
+ const [currentPage, setCurrentPage] = useState(1);
|
|
|
const { data, run, loading } = useRequest(GetAppPublicList, {
|
|
|
defaultParams: [
|
|
|
{
|
|
|
currentPage: 1,
|
|
|
- pageSize: 1000,
|
|
|
+ pageSize: 20,
|
|
|
filters: [
|
|
|
{ name: "isDel", value: 0 },
|
|
|
{ name: "isOnMarket", value: 1 },
|
|
@@ -39,9 +41,10 @@ export default function Home() {
|
|
|
});
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ setCurrentPage(1);
|
|
|
run({
|
|
|
currentPage: 1,
|
|
|
- pageSize: 1000,
|
|
|
+ pageSize: 20,
|
|
|
filters: [
|
|
|
{ name: "isDel", value: 0 },
|
|
|
{ name: "isOnMarket", value: 1 },
|
|
@@ -58,6 +61,27 @@ export default function Home() {
|
|
|
});
|
|
|
}, [industryFilter, sceneFilter, search]);
|
|
|
|
|
|
+ const handleChangePage = (page: number) => {
|
|
|
+ setCurrentPage(page);
|
|
|
+ run({
|
|
|
+ currentPage: page,
|
|
|
+ pageSize: 20,
|
|
|
+ filters: [
|
|
|
+ { name: "isDel", value: 0 },
|
|
|
+ { name: "isOnMarket", value: 1 },
|
|
|
+ { name: "name", value: search },
|
|
|
+ {
|
|
|
+ name: "industries",
|
|
|
+ value: industryFilter === "all" ? "" : industryFilter,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "applicationScenarios",
|
|
|
+ value: sceneFilter === "recommend" ? "" : sceneFilter,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
const handleToAppDetail = (id: string) => {
|
|
|
window.open(`#/detail/application/${id}`, "_blank");
|
|
|
};
|
|
@@ -111,21 +135,27 @@ export default function Home() {
|
|
|
</div>
|
|
|
|
|
|
<div className="relative flex flex-1 pb-6 flex-col overflow-auto bg-gray-100 shrink-0 grow mt-4 relative">
|
|
|
- <nav
|
|
|
- className="grid content-start shrink-0 gap-4 px-6 sm:px-12"
|
|
|
- style={{ gridTemplateColumns: "repeat(3,minmax(0,1fr))" }}
|
|
|
- >
|
|
|
+ <nav className="style_appList grid content-start shrink-0 gap-4 px-6 sm:px-12">
|
|
|
{(data?.result?.model || []).map((item: any, index: number) => (
|
|
|
<ItemCard data={item} key={index} onClick={handleToAppDetail} />
|
|
|
))}
|
|
|
</nav>
|
|
|
+
|
|
|
+ <Pagination
|
|
|
+ className="mt-6"
|
|
|
+ align="center"
|
|
|
+ hideOnSinglePage
|
|
|
+ current={currentPage}
|
|
|
+ total={data?.result?.totalCount || 0}
|
|
|
+ onChange={handleChangePage}
|
|
|
+ />
|
|
|
|
|
|
{!data?.result.model.length && !loading && (
|
|
|
<Empty description="暂无数据" image={noDataImg} />
|
|
|
)}
|
|
|
-
|
|
|
+
|
|
|
<div className="h-200px w-full absolute left-0 top0 flex items-center justify-center pointer-events-none">
|
|
|
- <Spin spinning={loading}/>
|
|
|
+ <Spin spinning={loading} />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|