From 885dbf1b8e1aa65d20b8394085c54b6c28349b14 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Thu, 17 Mar 2022 11:50:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=91=E5=AE=B6=E5=8A=A8=E6=80=81/=E6=8A=95?= =?UTF-8?q?=E8=AF=89=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/retrofit_api.dart | 10 +++-- lib/retrofit/retrofit_api.g.dart | 64 +++++++++++++++++++---------- lib/setting/help_feedback_page.dart | 17 +++++--- 3 files changed, 62 insertions(+), 29 deletions(-) diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index a6e88c81..130c0cc8 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -380,9 +380,9 @@ abstract class ApiService { @Path("shipperCode") String shipperCode, @Path("logisticCode") String logisticCode); - ///反馈 - @POST("/other/report") - Future> report(@Body() Map map); + // ///反馈 + // @POST("/other/report") + // Future> report(@Body() Map map); ///取消订单 @GET("/order/cancel/{id}") @@ -512,4 +512,8 @@ abstract class ApiService { @GET("/member/deleteMine") Future deleteMine(); + ///投诉资讯/动态 + @POST("/information/complaint") + Future complaint(@Body() Map param); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 78730b7d..71baf8d6 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -1166,27 +1166,27 @@ class _ApiService implements ApiService { return value; } - @override - Future> report(map) async { - ArgumentError.checkNotNull(map, 'map'); - const _extra = {}; - final queryParameters = {}; - final _data = {}; - _data.addAll(map ?? {}); - final _result = await _dio.request>('/other/report', - queryParameters: queryParameters, - options: RequestOptions( - method: 'POST', - headers: {}, - extra: _extra, - baseUrl: baseUrl), - data: _data); - final value = BaseData.fromJson( - _result.data, - (json) => json as bool, - ); - return value; - } + // @override + // Future> report(map) async { + // ArgumentError.checkNotNull(map, 'map'); + // const _extra = {}; + // final queryParameters = {}; + // final _data = {}; + // _data.addAll(map ?? {}); + // final _result = await _dio.request>('/other/report', + // queryParameters: queryParameters, + // options: RequestOptions( + // method: 'POST', + // headers: {}, + // extra: _extra, + // baseUrl: baseUrl), + // data: _data); + // final value = BaseData.fromJson( + // _result.data, + // (json) => json as bool, + // ); + // return value; + // } @override Future> orderCancel(id) async { @@ -1915,4 +1915,26 @@ class _ApiService implements ApiService { return value; } + @override + Future> complaint(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/information/complaint', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + } diff --git a/lib/setting/help_feedback_page.dart b/lib/setting/help_feedback_page.dart index 57d2d478..62128a1e 100644 --- a/lib/setting/help_feedback_page.dart +++ b/lib/setting/help_feedback_page.dart @@ -166,16 +166,23 @@ class _HelpFeedbackPage extends State { } report() async { - BaseData baseData = await apiService.report({ - "mobile": phoneController.text, - "reportContent": editingController.text, + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = await apiService.complaint({ + "content": phoneController.text, + "informationId":0, }).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { SmartDialog.showToast("反馈成功"); Navigator.of(context).pop(); } else { - SmartDialog.showToast("反馈成功"); - Navigator.of(context).pop(); + SmartDialog.showToast(baseData.msg,alignment: Alignment.center); } }