From d43be5986c54b03e27b182aee3a27c1a7e84cb86 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 8 Apr 2021 17:36:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=8A=A5=E4=BA=8B?= =?UTF-8?q?=E4=BF=9D=E4=BF=AE=20=E6=B4=BE=E5=8D=95=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=9C=AA=E7=9F=A5=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=E5=8D=87=E7=BA=A7dio=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/splash/splash_page.dart | 1 + .../fixer_department_page.dart | 10 +++-- lib/utils/network/manage_func.dart | 2 +- lib/utils/network/net_util.dart | 22 +++++----- pubspec.lock | 42 +++++++++---------- pubspec.yaml | 6 +-- 6 files changed, 43 insertions(+), 40 deletions(-) diff --git a/lib/ui/splash/splash_page.dart b/lib/ui/splash/splash_page.dart index 1cbcfaa..6f6ef71 100644 --- a/lib/ui/splash/splash_page.dart +++ b/lib/ui/splash/splash_page.dart @@ -13,6 +13,7 @@ import 'package:amap_map_fluttify/amap_map_fluttify.dart'; import 'package:get/get.dart' hide Response; import 'package:hive/hive.dart'; import 'package:hive_flutter/hive_flutter.dart'; +import 'package:jpush_flutter/jpush_flutter.dart'; import 'package:power_logger/power_logger.dart'; // Project imports: diff --git a/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart b/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart index 051a9dd..931fe44 100644 --- a/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart +++ b/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart @@ -38,7 +38,7 @@ class _FixerDepartmentPageState extends State { List _fixerItems = []; bool get canDispatch { - if (_reportModel?.operato==null) { + if (_reportModel?.operato == null) { return false; } else if (_reportModel.type == -1) { return false; @@ -48,6 +48,8 @@ class _FixerDepartmentPageState extends State { return false; } else if (_reportModel.workOrderTypeDetail == -1) { return false; + } else if (_reportModel.remark == null) { + return false; } return true; } @@ -127,9 +129,9 @@ class _FixerDepartmentPageState extends State { child: Text( '立即派单', style: TextStyle( - color: _pickedFixers.isEmpty - ? AppStyle.minorTextColor - : AppStyle.primaryTextColor, + color: canDispatch + ? AppStyle.primaryTextColor + : AppStyle.minorTextColor, fontSize: 32.w, fontWeight: FontWeight.bold, ), diff --git a/lib/utils/network/manage_func.dart b/lib/utils/network/manage_func.dart index 7f1de03..526e615 100644 --- a/lib/utils/network/manage_func.dart +++ b/lib/utils/network/manage_func.dart @@ -41,7 +41,7 @@ class ManageFunc { ///派单 static Future repairDispatch(DispatchReportModel model) async { BaseModel baseModel = - await NetUtil().get(API.manage.repairDispatch, params: { + await NetUtil().post(API.manage.repairDispatch, params: { 'dispatchListId': model.dispatchListId, 'workOrderType': model.workOrderTyoe, 'workOrderTypeDetail': model.workOrderTypeDetail, diff --git a/lib/utils/network/net_util.dart b/lib/utils/network/net_util.dart index 971e2bc..0be030f 100644 --- a/lib/utils/network/net_util.dart +++ b/lib/utils/network/net_util.dart @@ -34,14 +34,14 @@ class NetUtil { ); if (_dio == null) _dio = Dio(options); dio.interceptors.add(InterceptorsWrapper( - onRequest: (RequestOptions options) async => options, - onResponse: (Response response) async { + onRequest: (RequestOptions options,RequestInterceptorHandler handler) async => handler.next(options), + onResponse: (Response response,ResponseInterceptorHandler handler) async { LoggerData.addData(response); - return response; + return handler.next(response); }, - onError: (DioError error) async { + onError: (DioError error,ErrorInterceptorHandler handler) async { _parseErr(error); - return error; + return handler.next(error); }, )); } @@ -154,17 +154,17 @@ class NetUtil { } switch (err.type) { - case DioErrorType.CONNECT_TIMEOUT: - case DioErrorType.SEND_TIMEOUT: - case DioErrorType.RECEIVE_TIMEOUT: + case DioErrorType.connectTimeout: + case DioErrorType.sendTimeout: + case DioErrorType.receiveTimeout: _makeToast('连接超时'); break; - case DioErrorType.RESPONSE: + case DioErrorType.response: _makeToast('服务器出错'); break; - case DioErrorType.CANCEL: + case DioErrorType.cancel: break; - case DioErrorType.DEFAULT: + case DioErrorType.other: _makeToast('未知错误'); break; } diff --git a/pubspec.lock b/pubspec.lock index 360945c..9afea14 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -79,7 +79,7 @@ packages: name: auto_size_text url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0" + version: "3.0.0-nullsafety.0" auto_size_text_pk: dependency: transitive description: @@ -205,21 +205,21 @@ packages: name: device_info url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.0" + version: "2.0.0" device_info_platform_interface: dependency: transitive description: name: device_info_platform_interface url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.1" + version: "2.0.0" dio: dependency: "direct main" description: name: dio url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.10" + version: "4.0.0" dotted_border: dependency: "direct main" description: @@ -287,7 +287,7 @@ packages: name: flutter_highlight url: "https://pub.flutter-io.cn" source: hosted - version: "0.6.0" + version: "0.7.0" flutter_localizations: dependency: "direct main" description: flutter @@ -299,7 +299,7 @@ packages: name: flutter_plugin_android_lifecycle url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.11" + version: "2.0.1" flutter_rating_bar: dependency: "direct main" description: @@ -358,7 +358,7 @@ packages: name: highlight url: "https://pub.flutter-io.cn" source: hosted - version: "0.6.0" + version: "0.7.0" hive: dependency: "direct main" description: @@ -379,28 +379,35 @@ packages: name: http url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.2" + version: "0.13.1" http_parser: dependency: transitive description: name: http_parser url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.4" + version: "4.0.0" image_picker: dependency: "direct main" description: name: image_picker url: "https://pub.flutter-io.cn" source: hosted - version: "0.6.7+12" + version: "0.7.4" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.1" + version: "2.0.0" import_sorter: dependency: "direct dev" description: @@ -493,7 +500,7 @@ packages: name: package_info url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.3+4" + version: "2.0.0" path: dependency: transitive description: @@ -542,7 +549,7 @@ packages: name: pedantic url: "https://pub.flutter-io.cn" source: hosted - version: "1.9.2" + version: "1.11.0" permission_handler: dependency: "direct main" description: @@ -584,14 +591,7 @@ packages: name: power_logger url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.3" - pretty_json: - dependency: transitive - description: - name: pretty_json - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.0" + version: "1.0.1-nullsafety.1" provider: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index ddbffce..bff8e44 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,7 +35,7 @@ dependencies: #验证码 pin_input_text_field: ^4.0.0 - image_picker: ^0.6.7+12 + image_picker: ^0.7.4 flutter_rating_bar: ^4.0.0 @@ -49,9 +49,9 @@ dependencies: velocity_x: ^2.6.0 dotted_border: ^2.0.0-nullsafety.0 - dio: + dio: ^4.0.0 - power_logger: ^0.1.3 + power_logger: ^1.0.1-nullsafety.1 logger: ^1.0.0 aku_ui: git: