|
@@ -1,7 +1,7 @@
|
|
|
import { ScrollView, View, Image, Text } from "@tarojs/components";
|
|
|
|
|
|
import Taro, { useDidShow } from "@tarojs/taro";
|
|
|
-import { useEffect, useState } from "react";
|
|
|
+import { useEffect, useRef, useState } from "react";
|
|
|
|
|
|
import { TCorrectionItem } from "@/types/correction";
|
|
|
import { getCorrectionList } from "@/service/correction";
|
|
@@ -18,9 +18,8 @@ import { isSuccess } from "@/utils";
|
|
|
export interface Iprops {
|
|
|
entId?: number|string
|
|
|
setTotalCount: (count: number) => void;
|
|
|
- setData: (value: any[])=> void
|
|
|
}
|
|
|
-const Index = ({entId, setData, setTotalCount}:Iprops) => {
|
|
|
+const Index = ({entId, setTotalCount}:Iprops) => {
|
|
|
|
|
|
const { showModal } = useModalStore();
|
|
|
|
|
@@ -31,20 +30,15 @@ const Index = ({entId, setData, setTotalCount}:Iprops) => {
|
|
|
|
|
|
|
|
|
const {data, list, loadMore, pageIndex, mutate } = useLoadMoreInfinite<TCorrectionItem[]>(
|
|
|
- createKey(`api/v1/my/correction/list${entId}`, 10, [entId]),
|
|
|
+ createKey(`api/v1/my/correction/list${entId}`, 20, [entId]),
|
|
|
fetcher);
|
|
|
|
|
|
const onScrollToUpper = async () => {
|
|
|
console.log('toUpper')
|
|
|
loadMore()
|
|
|
}
|
|
|
- console.log('pageIndex', pageIndex, list)
|
|
|
- useEffect(() => {
|
|
|
- if(pageIndex === 1){
|
|
|
- console.log('setData', entId)
|
|
|
- setData(list);
|
|
|
- }
|
|
|
- }, [entId]);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
useDidShow(()=> {
|
|
|
mutate(undefined, { revalidate: true });
|