下载记录、钱包账单添加加载更多;监听键盘高度优化样式
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
|
||||
|
||||
.records-container {
|
||||
padding-bottom: 50px;
|
||||
|
||||
.record-item {
|
||||
padding: 16px 0;
|
||||
|
||||
@@ -58,7 +60,10 @@
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
position: fixed;
|
||||
bottom: 40px;
|
||||
width: calc(100% - 40px);
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
background-color: #FFFFFF;
|
||||
padding: 20px 0;
|
||||
}
|
||||
}
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user