下载记录、钱包账单添加加载更多;监听键盘高度优化样式

This commit is contained in:
2025-10-01 08:10:01 +08:00
parent a06487ecdc
commit 1b05bd1da7
10 changed files with 140 additions and 63 deletions

View File

@@ -3,7 +3,7 @@ import { View, Text } from "@tarojs/components";
import "./index.scss";
import httpService from "@/services/httpService";
import Taro from "@tarojs/taro";
import Taro, { useReachBottom } from "@tarojs/taro";
interface BillRecord {
id: number;
@@ -28,14 +28,22 @@ const DownloadBillRecords: React.FC = () => {
limit: 20,
});
const [totalPages, setTotalPages] = useState(1);
useReachBottom(() => {
if (params.page < totalPages) {
setParams({ ...params, page: params.page + 1 });
}
});
useEffect(() => {
fetchRecords();
}, []);
}, [params]);
const fetchRecords = async () => {
try {
const response = await httpService.post<{ rows: BillRecord[] }>('/wallet/download_history', params);
setRecords(response.data.rows);
const response = await httpService.post<{ rows: BillRecord[], totalPages: number }>('/wallet/download_history', params);
setRecords([...records, ...response.data.rows]);
setTotalPages(response.data.totalPages);
} catch (error) {
console.log(error);
Taro.showToast({