fix(transfer): 修复转让记录 API 路径与参数不匹配

- API 路径: /transfers/my → /transfers(后端无 /my 子路由)
- 分页参数: page/pageSize → limit/offset(匹配后端 DTO)
- 转让记录页显示具体错误信息便于调试

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-01 23:35:09 -08:00
parent cb9953047f
commit d5d61f4f68
2 changed files with 15 additions and 4 deletions

View File

@ -13,7 +13,7 @@ import '../network/api_client.dart';
// - POST /transfers // - POST /transfers
// - POST /transfers/:no/confirm // - POST /transfers/:no/confirm
// - POST /transfers/:no/cancel // - POST /transfers/:no/cancel
// - GET /transfers/my // - GET /transfers
// - GET /transfers/:no // - GET /transfers/:no
// //
// === PlantingService === // === PlantingService ===
@ -309,10 +309,10 @@ class TransferService {
try { try {
debugPrint('[TransferService] 获取转让记录: role=$role'); debugPrint('[TransferService] 获取转让记录: role=$role');
final response = await _apiClient.get( final response = await _apiClient.get(
'/transfers/my', '/transfers',
queryParameters: { queryParameters: {
'page': page, 'limit': pageSize,
'pageSize': pageSize, 'offset': (page - 1) * pageSize,
if (role != null) 'role': role, if (role != null) 'role': role,
}, },
); );

View File

@ -211,6 +211,17 @@ class _TransferListPageState extends ConsumerState<TransferListPage>
'加载失败', '加载失败',
style: const TextStyle(color: Color(0xFF5D4037), fontSize: 16), style: const TextStyle(color: Color(0xFF5D4037), fontSize: 16),
), ),
const SizedBox(height: 4),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Text(
_errorMessage ?? '',
style: const TextStyle(color: Color(0xFF999999), fontSize: 11),
textAlign: TextAlign.center,
maxLines: 5,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(height: 8), const SizedBox(height: 8),
GestureDetector( GestureDetector(
onTap: _loadData, onTap: _loadData,