diff --git a/frontend/asset_assistant/lib/pages/country_home.dart b/frontend/asset_assistant/lib/pages/country_home.dart index 1f1d962..5575a50 100644 --- a/frontend/asset_assistant/lib/pages/country_home.dart +++ b/frontend/asset_assistant/lib/pages/country_home.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:dio/dio.dart'; +import 'dart:developer'; // 引入日志工具 // 国家数据模型 class Country { @@ -71,6 +72,8 @@ class _CountryHomePageState extends State { _showErrorDialog('获取失败', response.data['message'] ?? '未知错误'); } } catch (e) { + // 添加网络异常日志 + log('获取国家列表网络异常', error: e, stackTrace: StackTrace.current); _showErrorDialog('网络错误', e.toString()); } finally { setState(() { @@ -112,6 +115,8 @@ class _CountryHomePageState extends State { _showErrorDialog('创建失败', response.data['message'] ?? '未知错误'); } } catch (e) { + // 添加网络异常日志 + log('创建国家网络异常', error: e, stackTrace: StackTrace.current); _showErrorDialog('网络错误', e.toString()); } finally { setState(() { @@ -141,6 +146,8 @@ class _CountryHomePageState extends State { _showErrorDialog('更新失败', response.data['message'] ?? '未知错误'); } } catch (e) { + // 添加网络异常日志 + log('更新国家网络异常', error: e, stackTrace: StackTrace.current); _showErrorDialog('网络错误', e.toString()); } finally { setState(() { @@ -174,6 +181,8 @@ class _CountryHomePageState extends State { _showErrorDialog('删除失败', response.data['message'] ?? '未知错误'); } } catch (e) { + // 添加网络异常日志 + log('删除国家网络异常', error: e, stackTrace: StackTrace.current); _showErrorDialog('网络错误', e.toString()); } finally { setState(() {