修改oss 路径
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { View, Text, Input, Button, Image } from "@tarojs/components";
|
||||
import Taro, { useDidShow, useReachBottom } from "@tarojs/taro";
|
||||
import React, { useEffect, useState, useCallback } from "react";
|
||||
import { View, Text, Input, Button, Image, ScrollView } from "@tarojs/components";
|
||||
import Taro, { useDidShow } from "@tarojs/taro";
|
||||
import "./index.scss";
|
||||
import { CommonPopup, EmptyState } from "@/components";
|
||||
import httpService from "@/services/httpService";
|
||||
@@ -109,16 +109,6 @@ const WalletPage: React.FC = () => {
|
||||
const pageConfig = currentPage.page?.config;
|
||||
const pageTitle = pageConfig?.navigationBarTitleText;
|
||||
|
||||
useReachBottom(() => {
|
||||
if (load_transactions_params.page >= totalPages) return;
|
||||
// 加载更多方法
|
||||
set_load_transactions_params((prev) => {
|
||||
return {
|
||||
...prev,
|
||||
page: prev.page + 1,
|
||||
};
|
||||
});
|
||||
});
|
||||
// 钱包信息状态
|
||||
const [wallet_info, set_wallet_info] = useState<WalletInfo>({
|
||||
balance: 0,
|
||||
@@ -158,6 +148,7 @@ const WalletPage: React.FC = () => {
|
||||
});
|
||||
|
||||
const [totalPages, setTotalPages] = useState(1);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
load_transactions();
|
||||
@@ -452,6 +443,33 @@ const WalletPage: React.FC = () => {
|
||||
setShowFilterPopup(true);
|
||||
};
|
||||
|
||||
// 下拉刷新:刷新钱包余额和交易记录
|
||||
const handle_refresh = useCallback(async () => {
|
||||
setRefreshing(true);
|
||||
try {
|
||||
await load_wallet_data();
|
||||
set_transactions([]);
|
||||
set_load_transactions_params((prev) => ({ ...prev, page: 1 }));
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: "刷新失败,请重试",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
} finally {
|
||||
setRefreshing(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 滚动到底部加载更多交易记录
|
||||
const handle_scroll_to_lower = useCallback(() => {
|
||||
if (load_transactions_params.page >= totalPages) return;
|
||||
set_load_transactions_params((prev) => ({
|
||||
...prev,
|
||||
page: prev.page + 1,
|
||||
}));
|
||||
}, [load_transactions_params.page, totalPages]);
|
||||
|
||||
const handleFilterCancel = () => {
|
||||
setShowFilterPopup(false);
|
||||
setFilterParams({
|
||||
@@ -488,6 +506,16 @@ const WalletPage: React.FC = () => {
|
||||
Taro.navigateBack();
|
||||
}}
|
||||
/>
|
||||
<ScrollView
|
||||
scrollY
|
||||
refresherBackground="#FAFAFA"
|
||||
refresherEnabled
|
||||
refresherTriggered={refreshing}
|
||||
onRefresherRefresh={handle_refresh}
|
||||
lowerThreshold={50}
|
||||
onScrollToLower={handle_scroll_to_lower}
|
||||
className="wallet_scroll"
|
||||
>
|
||||
{/* 钱包主卡片 */}
|
||||
<View
|
||||
className="wallet_main_card"
|
||||
@@ -649,6 +677,7 @@ const WalletPage: React.FC = () => {
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
{/* 提现弹窗 */}
|
||||
<CommonPopup
|
||||
|
||||
Reference in New Issue
Block a user