feat: 添加日历批量操作与客户端时区感知功能,优化前端 UI 交互体验
This commit is contained in:
@@ -22,7 +22,7 @@ abstract class ApiException implements Exception {
|
||||
(data['detail'] ?? data['message'] ?? data['error'])?.toString() ??
|
||||
'请求失败';
|
||||
} else {
|
||||
detail = '请求失败';
|
||||
detail = _networkErrorMessage(error);
|
||||
}
|
||||
|
||||
final localized = _localizeError(detail, statusCode);
|
||||
@@ -57,6 +57,21 @@ abstract class ApiException implements Exception {
|
||||
}
|
||||
return detail;
|
||||
}
|
||||
|
||||
static String _networkErrorMessage(DioException error) {
|
||||
if (error.type == DioExceptionType.connectionTimeout ||
|
||||
error.type == DioExceptionType.sendTimeout ||
|
||||
error.type == DioExceptionType.receiveTimeout) {
|
||||
return '网络超时,请确认手机与服务端在同一网络后重试';
|
||||
}
|
||||
|
||||
if (error.type == DioExceptionType.connectionError ||
|
||||
error.type == DioExceptionType.unknown) {
|
||||
return '无法连接服务器。请在 iPhone 设置中为本应用开启“无线数据(WLAN与蜂窝网络)”,并确认本地网络权限已开启。';
|
||||
}
|
||||
|
||||
return '请求失败';
|
||||
}
|
||||
}
|
||||
|
||||
class ServerException extends ApiException {
|
||||
|
||||
Reference in New Issue
Block a user