Parcourir la source

fix:add more

ZhaoJun il y a 1 an
Parent
commit
d5c725d2a1
1 fichiers modifiés avec 26 ajouts et 27 suppressions
  1. 26 27
      src/pages/TaskManage/Detail/TaskList/TaskList.tsx

+ 26 - 27
src/pages/TaskManage/Detail/TaskList/TaskList.tsx

@@ -60,7 +60,6 @@ const TaskList: React.FC<IPropsType> = (props) => {
     pageSize: 20,
     currentPage: 2,
   });
-
   const { run: getList, loading: loadData } = useRequest(getMandateList, {
     defaultParams: [
       {
@@ -70,7 +69,7 @@ const TaskList: React.FC<IPropsType> = (props) => {
         currentPage: mandatePage.current,
       },
     ],
-    onSuccess: (data, params)=>{},
+
     formatResult: (result) => {
       console.log(mandatePage);
       if (result.data.pagination.current === 1) {
@@ -160,34 +159,34 @@ const TaskList: React.FC<IPropsType> = (props) => {
 
   const loadMoreData = () => {
     getList(currentParams);
-    console.log(currentParams);
-    setCurrentParams({
-      ...currentParams,
-      currentPage: currentParams.currentPage+1
-    })
+    if (mandateList.length < mandatePage.total) {
+      setCurrentParams({
+        ...currentParams,
+        currentPage: currentParams.currentPage + 1,
+      });
+    }
   };
 
-  const loadMoreMandate =
-    !loadData  ? (
-      <div
-        style={{
-          textAlign: 'center',
-          marginTop: 12,
-          height: 32,
-          lineHeight: '32px',
-          fontSize: '28px',
-        }}
+  const loadMoreMandate = !loadData ? (
+    <div
+      style={{
+        textAlign: 'center',
+        marginTop: 12,
+        height: 32,
+        lineHeight: '32px',
+        fontSize: '28px',
+      }}
+    >
+      <Button
+        type="text"
+        size="large"
+        style={{ fontSize: '28px', height: '56px', width: '160px' }}
+        onClick={loadMoreData}
       >
-        <Button
-          type="text"
-          size="large"
-          style={{ fontSize: '28px', height: '56px', width: '160px' }}
-          onClick={loadMoreData}
-        >
-          加载更多
-        </Button>
-      </div>
-    ) : null;
+        加载更多
+      </Button>
+    </div>
+  ) : null;
 
   const goTaskDetail = (mandate: IMandateType) => {
     navigate(