feat(glt): 完善水票总数获取逻辑并优化用户体验
- 新增 normalizeTotal 函数处理多种数据格式的总数解析 - 支持通过 userId 参数查询指定用户的水票总数 - 添加多服务器地址尝试机制提高接口可用性 - 优化首页和用户中心页面的水票总数加载逻辑 - 修复水票页面滚动区域高度计算问题 - 移除自动跳转登录页面的定时器逻辑 - 个人中心页面支持下拉刷新统计数据 - 统一请求参数传递方式简化代码结构
This commit is contained in:
@@ -156,6 +156,14 @@ const UserTicketList = () => {
|
||||
const reloadLogs = async (isRefresh = true, keywords?: string) => {
|
||||
if (logLoading) return;
|
||||
|
||||
const userId = getUserId();
|
||||
if (!userId) {
|
||||
setLogList([]);
|
||||
setLogTotal(0);
|
||||
setLogHasMore(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRefresh) {
|
||||
setLogPage(1);
|
||||
setLogList([]);
|
||||
@@ -168,6 +176,7 @@ const UserTicketList = () => {
|
||||
const res = await pageGltUserTicketLog({
|
||||
page: currentPage,
|
||||
limit: PAGE_SIZE,
|
||||
userId,
|
||||
keywords: (keywords ?? searchValue) || undefined
|
||||
});
|
||||
|
||||
@@ -285,11 +294,11 @@ const UserTicketList = () => {
|
||||
|
||||
{/* 列表 */}
|
||||
<PullToRefresh onRefresh={handleRefresh} headHeight={60}>
|
||||
<View style={{ height: 'calc(100vh - 200px)', overflowY: 'auto' }} id="ticket-scroll">
|
||||
<View style={{ height: 'calc(100vh)', overflowY: 'auto' }} id="ticket-scroll">
|
||||
{activeTab === 'ticket' && ticketList.length === 0 && !ticketLoading ? (
|
||||
<View
|
||||
className="flex flex-col justify-center items-center"
|
||||
style={{ height: 'calc(100vh - 260px)' }}
|
||||
style={{ height: 'calc(100vh - 160px)' }}
|
||||
>
|
||||
<Empty
|
||||
description="暂无水票"
|
||||
@@ -299,7 +308,7 @@ const UserTicketList = () => {
|
||||
) : activeTab === 'log' && logList.length === 0 && !logLoading ? (
|
||||
<View
|
||||
className="flex flex-col justify-center items-center"
|
||||
style={{ height: 'calc(100vh - 260px)' }}
|
||||
style={{ height: 'calc(100vh - 160px)' }}
|
||||
>
|
||||
<Empty description="暂无核销记录" style={{ backgroundColor: 'transparent' }} />
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user