From 34c334449e55b6140a17f59abec9646b7611b8cd Mon Sep 17 00:00:00 2001 From: fff Date: Wed, 22 Jan 2025 18:55:50 +0800 Subject: [PATCH] =?UTF-8?q?IP=E8=8E=B7=E5=8F=96=E5=9F=8E=E5=B8=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9,=E5=85=B6=E4=BB=96UI=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/generated/intl/messages_en.dart | 2 +- lib/generated/intl/messages_en_US.dart | 2 +- lib/generated/intl/messages_zh_CN.dart | 2 +- lib/generated/intl/messages_zh_Hans_CN.dart | 2 +- lib/generated/intl/messages_zh_Hant_CN.dart | 2 +- lib/generated/intl/messages_zh_TW.dart | 2 +- lib/generated/l10n.dart | 4 +- lib/l10n/intl_en.arb | 2 +- lib/l10n/intl_en_US.arb | 2 +- lib/l10n/intl_zh_CN.arb | 2 +- lib/l10n/intl_zh_Hans_CN.arb | 2 +- lib/l10n/intl_zh_Hant_CN.arb | 2 +- lib/l10n/intl_zh_TW.arb | 2 +- lib/retrofit/retrofit_api.dart | 54 ++++++++++----------- lib/union/union_list.dart | 11 ++++- lib/union/union_page.dart | 10 ++++ 16 files changed, 59 insertions(+), 44 deletions(-) diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index e07c301b..e53b872d 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -76,7 +76,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m27(ren) => "¥${ren}/人"; - static String m28(second) => "${second}s后重新发送"; + static String m28(second) => "重新发送(${second}s)"; static String m29(jifen) => "商品积分 ${jifen}积分"; diff --git a/lib/generated/intl/messages_en_US.dart b/lib/generated/intl/messages_en_US.dart index a16bbefc..2b392bbf 100644 --- a/lib/generated/intl/messages_en_US.dart +++ b/lib/generated/intl/messages_en_US.dart @@ -76,7 +76,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m27(ren) => "¥${ren}/person"; - static String m28(second) => "${second}s and then resend"; + static String m28(second) => "resend (${second}s)"; static String m29(jifen) => "Product credit ${jifen}credit"; diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index afde9968..1a908029 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -76,7 +76,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m27(ren) => "¥${ren}/人"; - static String m28(second) => "${second}s后重新发送"; + static String m28(second) => "重新发送(${second}s)"; static String m29(jifen) => "商品积分 ${jifen}积分"; diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart index bffcb6b4..e0eff865 100644 --- a/lib/generated/intl/messages_zh_Hans_CN.dart +++ b/lib/generated/intl/messages_zh_Hans_CN.dart @@ -76,7 +76,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m27(ren) => "¥${ren}/人"; - static String m28(second) => "${second}s后重新发送"; + static String m28(second) => "重新发送(${second}s)"; static String m29(jifen) => "商品积分 ${jifen}积分"; diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart index 37405578..a635c9ae 100644 --- a/lib/generated/intl/messages_zh_Hant_CN.dart +++ b/lib/generated/intl/messages_zh_Hant_CN.dart @@ -74,7 +74,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m27(ren) => "¥${ren}/人"; - static String m28(second) => "${second}s后重新發送"; + static String m28(second) => "重新發送(${second}s)"; static String m29(jifen) => "商品積分 ${jifen}積分"; diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index 6fcb7d68..b79e2666 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -74,7 +74,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m27(ren) => "¥${ren}/人"; - static String m28(second) => "${second}s后重新發送"; + static String m28(second) => "重新發送(${second}s)"; static String m29(jifen) => "商品積分 ${jifen}積分"; diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 60173b2a..6eb2e0c6 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -120,10 +120,10 @@ class S { ); } - /// `{second}s后重新发送` + /// `重新发送({second}s)` String resend_in_seconds(Object second) { return Intl.message( - '${second}s后重新发送', + '重新发送(${second}s)', name: 'resend_in_seconds', desc: '', args: [second], diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 80dea08c..c08f3efb 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -6,7 +6,7 @@ "input_code_hide": "请输入验证码", "login": "登录", "send_code": "发送验证码", - "resend_in_seconds": "{second}s后重新发送", + "resend_in_seconds": "重新发送({second}s)", "phone_error": "手机格式错误", "code_error": "验证码输入错误", "privacy_policy1": "登录既同意", diff --git a/lib/l10n/intl_en_US.arb b/lib/l10n/intl_en_US.arb index 775438c2..fb29ec49 100644 --- a/lib/l10n/intl_en_US.arb +++ b/lib/l10n/intl_en_US.arb @@ -6,7 +6,7 @@ "input_code_hide": "Please enter the verification code", "login": "login", "send_code": "Validate code", - "resend_in_seconds": "{second}s and then resend", + "resend_in_seconds": "resend ({second}s)", "phone_error": "Wrong phone format", "code_error": "Wrong input of verification code", "privacy_policy1": "Login Agreed", diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 6e395540..160e29d0 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -6,7 +6,7 @@ "input_code_hide": "请输入验证码", "login": "登录", "send_code": "发送验证码", - "resend_in_seconds": "{second}s后重新发送", + "resend_in_seconds": "重新发送({second}s)", "phone_error": "手机格式错误", "code_error": "验证码输入错误", "privacy_policy1": "登录既同意", diff --git a/lib/l10n/intl_zh_Hans_CN.arb b/lib/l10n/intl_zh_Hans_CN.arb index 6e395540..160e29d0 100644 --- a/lib/l10n/intl_zh_Hans_CN.arb +++ b/lib/l10n/intl_zh_Hans_CN.arb @@ -6,7 +6,7 @@ "input_code_hide": "请输入验证码", "login": "登录", "send_code": "发送验证码", - "resend_in_seconds": "{second}s后重新发送", + "resend_in_seconds": "重新发送({second}s)", "phone_error": "手机格式错误", "code_error": "验证码输入错误", "privacy_policy1": "登录既同意", diff --git a/lib/l10n/intl_zh_Hant_CN.arb b/lib/l10n/intl_zh_Hant_CN.arb index 7261e68d..03436f27 100644 --- a/lib/l10n/intl_zh_Hant_CN.arb +++ b/lib/l10n/intl_zh_Hant_CN.arb @@ -6,7 +6,7 @@ "input_code_hide": "請輸入驗證碼", "login": "登錄", "send_code": "發送驗證碼", - "resend_in_seconds": "{second}s后重新發送", + "resend_in_seconds": "重新發送({second}s)", "phone_error": "手機格式錯誤", "code_error": "驗證碼輸入錯誤", "privacy_policy1": "登錄既同意", diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb index c46d38c6..deecce18 100644 --- a/lib/l10n/intl_zh_TW.arb +++ b/lib/l10n/intl_zh_TW.arb @@ -6,7 +6,7 @@ "input_code_hide": "請輸入驗證碼", "login": "登錄", "send_code": "發送驗證碼", - "resend_in_seconds": "{second}s后重新發送", + "resend_in_seconds": "重新發送({second}s)", "phone_error": "手機格式錯誤", "code_error": "驗證碼輸入錯誤", "privacy_policy1": "登錄既同意", diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 1a0a09db..4bf4ab6b 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -119,38 +119,34 @@ abstract class ApiService { } catch (e1) {} handler.next(options); }, onResponse: (Response response, ResponseInterceptorHandler handler) { - try { - debugPrint("\n======================= 响应数据开始 ======================="); - if (SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) { - AppUtils.removeLoadingPath(response.requestOptions.path); - } else { - AppUtils.cleanLoadingPath(); - } - debugPrint("code = ${response.statusCode}"); - p(jsonEncode(response.data)); - if (response.data is Map) { - Map map = response.data; - if (map["code"] == 40005 || map["code"] == 40001) { - if (context != null) { - LoginTipsDialog.instance.show(context); - } - } - debugPrint("======================= 响应数据结束 =======================\n"); - if (map["code"] == 0 || map["code"] == 200 || map["infocode"] == "10000") { - handler.next(response); - } else { - throw DioException( - requestOptions: response.requestOptions, - type: DioExceptionType.unknown, - response: response, - message: "${map["msg"] ?? map["message"] ?? map["repMsg"]}", - ); + debugPrint("\n======================= 响应数据开始 ======================="); + if (SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) { + AppUtils.removeLoadingPath(response.requestOptions.path); + } else { + AppUtils.cleanLoadingPath(); + } + debugPrint("code = ${response.statusCode}"); + p(jsonEncode(response.data)); + if (response.data is Map) { + Map map = response.data; + if (map["code"] == 40005 || map["code"] == 40001) { + if (context != null) { + LoginTipsDialog.instance.show(context); } - } else { + } + debugPrint("======================= 响应数据结束 =======================\n"); + if (map["code"] == 0 || map["code"] == 200 || map["repCode"] == "0000" || map["infocode"] == "10000") { handler.next(response); + } else { + throw DioException( + requestOptions: response.requestOptions, + type: DioExceptionType.unknown, + response: response, + message: "${map["msg"] ?? map["message"] ?? map["repMsg"]}", + ); } - } catch (e2) { - print("respon: ${e2}"); + } else { + handler.next(response); } }, onError: (DioException e, ErrorInterceptorHandler handler) { if (SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) { diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index f51cd532..91d94743 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -55,10 +55,13 @@ class UnionListState extends State @override bool get wantKeepAlive => true; + late String cityName; + @override void initState() { super.initState(); powerFlag = false; + cityName = widget.city ?? "所有门店"; getLocation(); } @@ -128,6 +131,11 @@ class UnionListState extends State } } + void refreshData(String areaName) { + this.cityName = areaName; + getLocation(); + } + queryStore() async { apiService ??= ApiService( Dio(), @@ -135,7 +143,7 @@ class UnionListState extends State token: SharedInstance.instance.token, ); BaseListData? baseData = await apiService?.queryStore({ - "city": widget.city ?? "所有门店", + "city": cityName, "latitude": (widget.latLng?.latitude ?? "").toString(), "longitude": (widget.latLng?.longitude ?? "").toString(), if (widget.searchKey != "") "searchKey": widget.searchKey, @@ -818,4 +826,5 @@ class UnionListState extends State ), ); } + } diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 00ce30b2..7a08085e 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -104,10 +104,19 @@ class UnionPageState extends State with AutomaticKeepAliveClientMixin String string = ipResult.replaceAll("\n", ""); MIpData ipData = MIpData.fromJson(jsonDecode(string)); areaName = ipData.data?.location?[2]; + refreshChild(); setState(() {}); } } + refreshChild() { + if (areaName?.isNotEmpty ?? false) { + _allKey.forEach((key1) { + key1.currentState?.refreshData(areaName!); + }); + } + } + @override void didChangeAppLifecycleState(AppLifecycleState state) { if (state == AppLifecycleState.resumed) { @@ -171,6 +180,7 @@ class UnionPageState extends State with AutomaticKeepAliveClientMixin }).then((value) { if (value != null) { areaName = "$value"; + refreshChild(); setState(() {}); } });