From c31c771ee9d3b59c22c62f0b02c5d434ba57c8d6 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 09:29:55 +0800 Subject: [PATCH 01/12] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pubspec.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index ec8ee1c1..3d588e18 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,8 +62,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.53+2024052803:xhj 线上环境,提审 sky 线上环境提审 # 1.0.53+2024052804:xhj 线上环境,提审 修改鑫锁名字为星星锁 # 1.0.54+2024053001:xhj 线上环境,对外发布,提交测试 +# 1.0.56+202406401:xhj 线上环境,对外发布,提交测试 -version: 1.0.54+2024053001 +version: 1.0.56+202406401 environment: sdk: '>=2.12.0 <3.0.0' From bd2f9fa4ac4690e7c584496ee7752da6a0a24bb9 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 14:29:51 +0800 Subject: [PATCH 02/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=8F=91=E9=80=81?= =?UTF-8?q?=E9=92=A5=E5=8C=99=E9=A1=B5=E9=9D=A2=EF=BC=8C=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5=EF=BC=8C=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=EF=BC=8C=E5=BE=AE=E4=BF=A1=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Runner.xcodeproj/project.pbxproj | 22 +++++++++++++- ios/Runner/Info.plist | 6 ++-- ios/Runner/zh-Hans.lproj/LaunchScreen.strings | 1 + ios/Runner/zh-Hans.lproj/Main.strings | 1 + .../view/sendElectronicKeyView_logic.dart | 30 +++++++++++++++++++ .../view/sendElectronicKeyView_page.dart | 22 ++++++++++++-- 6 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 ios/Runner/zh-Hans.lproj/LaunchScreen.strings create mode 100644 ios/Runner/zh-Hans.lproj/Main.strings diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 238f4a2e..a7b5e0e6 100755 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -153,6 +153,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0420903B2C0EEAA50073E654 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = ""; }; + 0420903C2C0EEAA60073E654 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = ""; }; 04BFC4482BCFE05100688FCA /* RunnerRelease-xhj.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "RunnerRelease-xhj.entitlements"; sourceTree = ""; }; 0BEB3ADCCEC961E2916B9004 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 0D02C18E16914A687A4A1AC2 /* devDebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = devDebug.xcconfig; path = Flutter/devDebug.xcconfig; sourceTree = ""; }; @@ -619,11 +621,12 @@ }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; + developmentRegion = "zh-Hans"; hasScannedForEncodings = 0; knownRegions = ( en, Base, + "zh-Hans", ); mainGroup = 97C146E51CF9000F007C117D; productRefGroup = 97C146EF1CF9000F007C117D /* Products */; @@ -830,6 +833,7 @@ isa = PBXVariantGroup; children = ( 97C146FB1CF9000F007C117D /* Base */, + 0420903B2C0EEAA50073E654 /* zh-Hans */, ); name = Main.storyboard; sourceTree = ""; @@ -838,6 +842,7 @@ isa = PBXVariantGroup; children = ( 97C147001CF9000F007C117D /* Base */, + 0420903C2C0EEAA60073E654 /* zh-Hans */, ); name = LaunchScreen.storyboard; sourceTree = ""; @@ -1034,6 +1039,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1101,6 +1107,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1298,6 +1305,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1367,6 +1375,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1436,6 +1445,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1510,6 +1520,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1579,6 +1590,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1648,6 +1660,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1720,6 +1733,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -1776,6 +1790,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -2118,6 +2133,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -2187,6 +2203,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -2261,6 +2278,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -2330,6 +2348,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -2399,6 +2418,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 8c233454..101a2449 100755 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -28,14 +28,14 @@ CFBundleTypeRole None CFBundleURLIconFile - + CFBundleURLName com.sky.skysmartlock CFBundleURLSchemes skysmartlock - - + + diff --git a/ios/Runner/zh-Hans.lproj/LaunchScreen.strings b/ios/Runner/zh-Hans.lproj/LaunchScreen.strings new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/ios/Runner/zh-Hans.lproj/LaunchScreen.strings @@ -0,0 +1 @@ + diff --git a/ios/Runner/zh-Hans.lproj/Main.strings b/ios/Runner/zh-Hans.lproj/Main.strings new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/ios/Runner/zh-Hans.lproj/Main.strings @@ -0,0 +1 @@ + diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart index 5d49209f..f50161ed 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart @@ -3,9 +3,11 @@ import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart'; +import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart'; import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/network/api_repository.dart'; +import 'package:star_lock/tools/NativeInteractionTool.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/commonDataManage.dart'; import 'package:star_lock/tools/dateTool.dart'; @@ -20,6 +22,8 @@ class SendElectronicKeyViewLogic extends BaseGetXController { SendElectronicKeyViewLogic(this.type); String type; final SendElectronicKeyViewState state = SendElectronicKeyViewState(); + int? keyId; + List get weekDayStr { return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList(); @@ -176,6 +180,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { state.createUser.value = 0; state.isSendSuccess = true; + keyId = entity.data!.keyId; resetData(); update(); eventBus.fire(ElectronicKeyListRefreshUI()); @@ -237,6 +242,31 @@ class SendElectronicKeyViewLogic extends BaseGetXController { return currentController; } + //发送消息 + Future sendMsg({required bool isPhone}) async { + if (keyId == null) { + return; + } + final NoticeTemplateEntity entity = await ApiRepository.to + .getNoticeTemplate( + lockId: CommonDataManage().currentKeyInfo.lockId!, + keyId: keyId!, + channelType: isPhone ? 1 : 2); + if (entity.errorCode!.codeIsSuccessful) { + final List list = + entity.data!.list!.where((Item item) => item.isUse == 0).toList(); + if (list.isNotEmpty) { + final Item item = list.first!; + final String template = item.template ?? ''; + NativeInteractionTool().loadNativeShare(shareText: template); + } else { + showToast('获取模板失败 0x02'); + } + } else { + showToast('获取模板失败 0x01'); + } + } + void resetData() { state.emailOrPhoneController.text = ''; state.keyNameController.text = ''; diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart index a9cedb69..e9af69b4 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart @@ -416,15 +416,33 @@ class _SendElectronicKeyViewState extends State SizedBox( height: 10.h, ), + // OutLineBtn( + // btnName: '分享'.tr, + // onClick: () { + // _openModalBottomSheet(); + // }, + // ), OutLineBtn( - btnName: '分享'.tr, + btnName: + logic.state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知', onClick: () { - _openModalBottomSheet(); + if (logic.state.emailOrPhoneController.text.contains('@')) { + Get.toNamed(Routers.sendEmailNotificationPage); + } else { + logic.sendMsg(isPhone: true); + } }, ), SizedBox( height: 10.h, ), + OutLineBtn( + btnName: '微信通知', + onClick: () { + logic.sendMsg( + isPhone: logic.state.emailOrPhoneController.text.contains('@')); + }, + ), ], ); } From caf62a74135e5cb5a23d5dbd4d81b2e30dedb429 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Tue, 4 Jun 2024 14:44:04 +0800 Subject: [PATCH 03/12] =?UTF-8?q?1=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E7=9F=AD=E4=BF=A1=E6=A8=A1=E7=89=88=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=202=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96=E9=BB=98=E8=AE=A4=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1=E6=A8=A1=E7=89=88=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=8A=E7=9B=B8=E5=BA=94=E9=80=BB=E8=BE=91=E5=A4=84=E7=90=86?= =?UTF-8?q?=203=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=94=B5=E5=AD=90=E9=92=A5?= =?UTF-8?q?=E5=8C=99=E3=80=81=E5=AF=86=E7=A0=81=E6=A8=A1=E7=89=88=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=80=BB=E8=BE=91=E5=8F=8A=E5=B8=83=E5=B1=80=E5=A4=84?= =?UTF-8?q?=E7=90=86=204=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E6=A8=A1=E7=89=88=EF=BC=88=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E9=92=A5=E5=8C=99=E3=80=81=E5=AF=86=E7=A0=81=EF=BC=89=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AF=B9=E6=8E=A5=205=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=9F=AD=E4=BF=A1=E6=A8=A1=E7=89=88=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=8A=A5=E9=94=99=E4=B8=8D=E8=83=BD=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images/lan/lan_en.json | 6 +- images/lan/lan_keys.json | 6 +- images/lan/lan_zh.json | 8 +- lib/appRouters.dart | 190 ++++--- ...eAddedServicesNoteAndEmailDetail_page.dart | 2 +- .../newSMSTemplate_entity.dart | 53 ++ .../newSMSTemplate_logic.dart | 192 +++++++ .../newSMSTemplate_page.dart | 265 ++++++++++ .../newSMSTemplate_state.dart | 57 ++ ...valueAddedServicesAddSMSTemplate_page.dart | 489 ------------------ .../customSMSTemplateList_entity.dart | 130 +++++ .../customSMSTemplateList_logic.dart | 155 ++++++ ...e.dart => customSMSTemplateList_page.dart} | 91 ++-- .../customSMSTemplateList_state.dart | 55 ++ lib/network/api.dart | 6 + lib/network/api_provider.dart | 36 ++ lib/network/api_repository.dart | 29 ++ lib/tools/dateTool.dart | 3 +- lib/tools/regularExpression.dart | 5 + 19 files changed, 1184 insertions(+), 594 deletions(-) create mode 100644 lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart create mode 100644 lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart create mode 100755 lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart create mode 100644 lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart delete mode 100755 lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/valueAddedServicesAddSMSTemplate_page.dart create mode 100644 lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart create mode 100644 lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart rename lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/{valueAddedServicesListSMSTemplate_page.dart => customSMSTemplateList_page.dart} (64%) create mode 100644 lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart diff --git a/images/lan/lan_en.json b/images/lan/lan_en.json index 5c9cf9f3..41ffcb40 100755 --- a/images/lan/lan_en.json +++ b/images/lan/lan_en.json @@ -861,5 +861,9 @@ "四": "Thu", "五": "Fri", "六": "Sat", - "日": "Sun" + "日": "Sun", + "新建短信模版":"New SMS template", + "自定义短信模版":"Custom SMS template", + "自定义邮件模版":"Custom email template", + "名称":"Name" } diff --git a/images/lan/lan_keys.json b/images/lan/lan_keys.json index 2f33cfae..49e3f09b 100755 --- a/images/lan/lan_keys.json +++ b/images/lan/lan_keys.json @@ -893,5 +893,9 @@ "四":"四", "五":"五", "六":"六", - "日":"日" + "日":"日", + "新建短信模版":"新建短信模版", + "自定义短信模版":"自定义短信模版", + "自定义邮件模版":"自定义邮件模版", + "名称":"名称" } diff --git a/images/lan/lan_zh.json b/images/lan/lan_zh.json index d0a4460d..39f3e924 100755 --- a/images/lan/lan_zh.json +++ b/images/lan/lan_zh.json @@ -334,8 +334,6 @@ "emailBuyTip": "您可通过邮件将密码、电子钥匙信息发给接收人。", "currentRemainingQuantity": "当前剩余数量", "buy": "购买", - "customSMSTemplate": "自定义短信模版", - "customMailTemplate": "自定义邮件模版", "record": "记录", "buyRealNameTip": "给用户发送电子钥匙时,可以要求其开锁前先进行人脸识别,以保证是他本人在操作。人脸实名认证调用国家公安系统接口,为付费功能,请购买次数后再使用。", "buyRealNameSelectYouWantBuyTip": "请选择你希望的实名认证频次", @@ -863,5 +861,9 @@ "四": "四", "五": "五", "六": "六", - "日": "日" + "日": "日", + "新建短信模版":"新建短信模版", + "自定义短信模版":"自定义短信模版", + "自定义邮件模版":"自定义邮件模版", + "名称":"名称" } diff --git a/lib/appRouters.dart b/lib/appRouters.dart index e7edb548..99470270 100755 --- a/lib/appRouters.dart +++ b/lib/appRouters.dart @@ -190,8 +190,8 @@ import 'mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedService import 'mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart'; import 'mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart'; import 'mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_page.dart'; -import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/valueAddedServicesAddSMSTemplate_page.dart'; -import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/valueAddedServicesListSMSTemplate_page.dart'; +import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart'; +import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart'; import 'mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdministratorList_page.dart'; import 'starLockApplication/starLockApplication.dart'; import 'tools/seletKeyCyclicDate/seletKeyCyclicDate_page.dart'; @@ -208,19 +208,25 @@ abstract class Routers { static const String lockAddressGaoDePage = '/LockAddressGaoDePage'; // 锁地址-高德 static const String saveLockPage = '/SaveLockPage'; // 保存锁 static const String lockDetailMainPage = '/LockDetailMainPage'; // 锁详情 - static const String electronicKeyListPage = '/ElectronicKeyListPage'; // 电子钥匙列表 - static const String electronicKeyDetailPage = '/ElectronicKeyDetailPage'; // 电子钥匙详情 + static const String electronicKeyListPage = + '/ElectronicKeyListPage'; // 电子钥匙列表 + static const String electronicKeyDetailPage = + '/ElectronicKeyDetailPage'; // 电子钥匙详情 static const String electronicKeyDetailChangeDate = '/ElectronicKeyDetailChangeDate'; // 修改有效期 - static const String sendElectronicKeyPage = '/SendElectronicKeyPage'; // 发送电子钥匙 + static const String sendElectronicKeyPage = + '/SendElectronicKeyPage'; // 发送电子钥匙 static const String massSendElectronicKeyManagePage = '/MassSendElectronicKeyManagePage'; // 群发钥匙 static const String electronicKeyPeriodValidityPage = '/ElectronicKeyPeriodValidityPage'; // 电子钥匙有效期 - static const String sendEmailNotificationPage = '/SendEmailNotificationPage'; // 邮件通知 + static const String sendEmailNotificationPage = + '/SendEmailNotificationPage'; // 邮件通知 static const String passwordKeyListPage = '/PasswordKeyListPage'; // 密码钥匙列表 - static const String passwordKeyPerpetualPage = '/PasswordKeyPerpetualPage'; // 密码钥匙 - static const String passwordKeyDetailPage = '/PasswordKeyDetailPage'; // 密码钥匙详情 + static const String passwordKeyPerpetualPage = + '/PasswordKeyPerpetualPage'; // 密码钥匙 + static const String passwordKeyDetailPage = + '/PasswordKeyDetailPage'; // 密码钥匙详情 // static const otherTypeKeyListPage = '/OtherTypeKeyListPage'; // 卡、指纹、遥控钥匙列表 // static const otherTypeKeyDetailPage = '/OtherTypeKeyDetailPage'; // 卡、指纹、遥控钥匙详情 // static const otherTypeKeyManagePage = '/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加 @@ -229,35 +235,41 @@ abstract class Routers { static const String otherTypeKeyChangeValidityDatePage = '/OtherTypeKeyChangeValidityDatePage'; // 卡、指纹、遥控钥匙详情修改有效期 - static const String addFingerprintTipPage = '/AddFingerprintTipPage'; // 添加指纹提示 + static const String addFingerprintTipPage = + '/AddFingerprintTipPage'; // 添加指纹提示 static const String addFingerprintPage = '/AddFingerprintPage'; // 添加指纹 static const String addICCardPage = '/AddICCardPage'; // 添加卡 - static const String authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表 + static const String authorizedAdminListPage = + '/AuthorizedAdminListPage'; // 授权管理员列表 static const String authorizedAdminDetailPage = '/AuthorizedAdminDetailPage'; // 授权管理员详情 static const String authorizedAdminPage = '/AuthorizedAdminPage'; // 授权管理员 static const String volumeAuthorizationLockManagePage = '/VolumeAuthorizationLockManagePage'; // 批量授权锁 - static const String lockOperatingRecordPage = '/LockOperatingRecordPage'; // 操作记录 + static const String lockOperatingRecordPage = + '/LockOperatingRecordPage'; // 操作记录 static const String lockSetPage = '/LockSetPage'; // 锁设置 static const String basicInformationPage = '/BasicInformationPage'; // 基本信息 static const String uploadElectricQuantityPage = '/UploadElectricQuantityPage'; // 更新锁电量 static const String editLockNamePage = '/EditLockNamePage'; // 修改锁名字 - static const String lockSelectGroupingPage = '/LockSelectGroupingPage'; // 锁选择分组 + static const String lockSelectGroupingPage = + '/LockSelectGroupingPage'; // 锁选择分组 static const String groupEditLockPage = '/GroupEditLockPage'; // 编辑锁分组里面的锁 static const String adminOpenLockPasswordPage = '/AdminOpenLockPasswordPage'; // 管理员开锁密码 static const String wirelessKeyboardPage = '/WirelessKeyboardPage'; // 蓝牙键盘 - static const String addWirelessKeyboardPage = '/AddWirelessKeyboardPage'; // 添加蓝牙键盘 + static const String addWirelessKeyboardPage = + '/AddWirelessKeyboardPage'; // 添加蓝牙键盘 static const String addWirelessKeyboardScreenNotLightOnPage = '/AddWirelessKeyboardScreenNotLightOnPage'; // 添加蓝牙键盘屏幕不亮时提示 static const String selectWirelessKeyboardPage = '/SelectWirelessKeyboardPage'; // 选择蓝牙键盘 static const String doorMagneticPage = '/DoorMagneticPage'; // 门磁列表 static const String addDoorMagneticPage = '/AddDoorMagneticPage'; // 添加门磁 - static const String nearbyDoorMagneticPage = '/NearbyDoorMagneticPage'; // 附近的门磁 + static const String nearbyDoorMagneticPage = + '/NearbyDoorMagneticPage'; // 附近的门磁 static const String remoteUnlockingPage = '/RemoteUnlockingPage'; // 远程开锁 static const String automaticBlockingPage = '/AutomaticBlockingPage'; // 自动闭锁 static const String normallyOpenModePage = '/NormallyOpenModePage'; // 常开模式 @@ -270,21 +282,28 @@ abstract class Routers { static const String lockTimePage = '/LockTimePage'; // 锁时间 static const String diagnosePage = '/DiagnosePage'; // 诊断 static const String uploadDataPage = '/UploadDataPage'; // 上传数据 - static const String importOtherLockDataPage = '/ImportOtherLockDataPage'; // 导入其他锁数据 + static const String importOtherLockDataPage = + '/ImportOtherLockDataPage'; // 导入其他锁数据 static const String lockEscalationPage = '/LockEscalationPage'; // 锁升级 static const String markedHouseStatePage = '/MarkedHouseStatePage'; // 标记房态 - static const String checkInCreatCompanyPage = '/CheckInCreatCompanyPage'; // 创建公司 + static const String checkInCreatCompanyPage = + '/CheckInCreatCompanyPage'; // 创建公司 static const String checkingInListPage = '/CheckingInListPage'; // 考勤 static const String checkingInSetPage = '/CheckingInSetPage'; // 考勤设置 - static const String checkingInStaffManagePage = '/CheckingInStaffManagePage'; // 员工管理 - static const String checkingInAddStaffPage = '/CheckingInAddStaffPage'; // 添加员工 - static const String checkingInStaffDetailPage = '/CheckingInStaffDetailPage'; // 编辑员工 + static const String checkingInStaffManagePage = + '/CheckingInStaffManagePage'; // 员工管理 + static const String checkingInAddStaffPage = + '/CheckingInAddStaffPage'; // 添加员工 + static const String checkingInStaffDetailPage = + '/CheckingInStaffDetailPage'; // 编辑员工 static const String checkingInSetWorkTimePage = '/CheckingInSetWorkTimePage'; // 工作时间设置 - static const String checkingInSetWorkdaySet = '/CheckingInSetWorkdaySet'; // 工作日设置 + static const String checkingInSetWorkdaySet = + '/CheckingInSetWorkdaySet'; // 工作日设置 static const String checkingInSetHolidaysPage = '/CheckingInSetHolidaysPage'; // 节假日设置 - static const String checkingInAddHolidaysPage = '/CheckingInAddHolidaysPage'; // 添加假日 + static const String checkingInAddHolidaysPage = + '/CheckingInAddHolidaysPage'; // 添加假日 static const String checkingInDetailPage = '/CheckingInDetailPage'; // 考勤详情 static const String checkingInDeletHolidaysPage = '/CheckingInDeletHolidaysPage'; // 删除考勤 @@ -306,13 +325,15 @@ abstract class Routers { '/MinePersonInfoSetSafetyProblemPage'; // 我的信息设置安全问题 static const String minePersonInfoViewSafetyProblemPage = '/MinePersonInfoViewSafetyProblemPage'; // 查看我的安全问题 - static const String mineBindPhoneOrEmailPage = '/MineBindPhoneOrEmailPage'; //我的信息-邮箱 + static const String mineBindPhoneOrEmailPage = + '/MineBindPhoneOrEmailPage'; //我的信息-邮箱 static const String gatewayListPage = '/GatewayListPage'; // 我的-网关 static const String gatewayDetailPage = '/GatewayDetailPage'; // 我的-网关详情 static const String gatewayConnectionLockPage = '/GatewayConnectionLockPage'; // 我的-网关网关链接的锁 - static const String selectGatewayTypePage = '/SelectGatewayTypePage'; // 我的-选择网关类型 + static const String selectGatewayTypePage = + '/SelectGatewayTypePage'; // 我的-选择网关类型 static const String selectGatewayTypeNextTipPage = '/SelectGatewayTypeNextTipPage'; // 我的-选择网关类型下一步 static const String selectGatewayPage = '/SelectGatewayPage'; // 我的-选择网关 @@ -322,7 +343,8 @@ abstract class Routers { static const String messageListPage = '/MessageListPage'; // 我的-消息 static const String messageDetailPage = '/MessageDetailPage'; // 我的-消息详情 static const String supportStaffPage = '/SupportStaffPage'; // 我的-客服 - static const String valueAddedServicesPage = '/ValueAddedServicesPage'; // 我的-增值服务 + static const String valueAddedServicesPage = + '/ValueAddedServicesPage'; // 我的-增值服务 static const String aboutPage = '/AboutPage'; // 我的-关于 static const String valueAddedServicesNoteAndEmailDetailPage = @@ -352,13 +374,15 @@ abstract class Routers { static const String hideInvalidUnlockPermissionsPage = '/HideInvalidUnlockPermissionsPage'; // 我的设置-隐藏无效开锁权限 - static const String lockUserManageLisPage = '/LockUserManageLisPage'; //我的设置-锁用户管理 + static const String lockUserManageLisPage = + '/LockUserManageLisPage'; //我的设置-锁用户管理 static const String authorizedAdministratorListPage = '/AuthorizedAdministratorListPage'; //我的设置-授权管理员 static const String lockGroupListPage = '/LockGroupListPage'; //我的设置-锁分组 static const String lockItemListPage = '/LockItemListPage'; //锁分组-锁列表 static const String transferSmartLockPage = '/transferSmartLockPage'; //转移智能锁 - static const String recipientInformationPage = '/recipientInformationPage'; //接受人信息 + static const String recipientInformationPage = + '/recipientInformationPage'; //接受人信息 static const String selectBranchPage = '/SelectBranchPage'; //选择分店 static const String selectGetewayListPage = '/selectGetewayListPage'; //选择网关 static const String addAuthorizedAdministratorPage = @@ -369,24 +393,30 @@ abstract class Routers { static const String starLockRegisterPage = '/StarLockRegisterPage'; // 注册 static const String starLockForgetPasswordPage = '/StarLockForgetPasswordPage'; // 忘记密码 - static const String selectCountryRegionPage = '/SelectCountryRegionPage'; // 选择国家和地区 - static const String safetyVerificationPage = '/SafetyVerificationPage'; // 安全验证 + static const String selectCountryRegionPage = + '/SelectCountryRegionPage'; // 选择国家和地区 + static const String safetyVerificationPage = + '/SafetyVerificationPage'; // 安全验证 static const String getDeviceListPage = '/getDeviceListPage'; //设备列表 static const String getNameListPage = '/getNameListPage'; //姓名列表 - static const String authorityManagementPage = '/authorityManagementPage'; //批量授权 + static const String authorityManagementPage = + '/authorityManagementPage'; //批量授权 static const String massSendLockGroupListPage = '/massSendLockGroupListPage'; //群发锁分组列表 static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人 static const lockUserListPage = '/lockUserListPage'; //锁用户列表 static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情 static const expireLockManagePage = '/expireLockManagePage'; //即将到期 - static const expireKeyChangeDatePage = '/ExpireKeyChangeDatePage'; //即将到期卡、指纹、遥控钥匙详情修改日期 - static const adminDetailChangeDatePage = '/adminDetailChangeDatePage'; //管理员详情修改生效时间 + static const expireKeyChangeDatePage = + '/ExpireKeyChangeDatePage'; //即将到期卡、指纹、遥控钥匙详情修改日期 + static const adminDetailChangeDatePage = + '/adminDetailChangeDatePage'; //管理员详情修改生效时间 static const String adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表 static const String safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证 static const String webviewShowPage = '/webviewShowPage'; //网页 - static const String demoModeLockDetailPage = '/DemoModeLockDetailPage'; // 演示模式锁详情页 + static const String demoModeLockDetailPage = + '/DemoModeLockDetailPage'; // 演示模式锁详情页 static const String demoModeLockSetPage = '/DemoModeLockSetPage'; // 演示模式锁设置页 static const String addLockSelectCountryPage = '/AddLockSelectCountryPage'; // 演示模式锁设置页 @@ -404,8 +434,10 @@ abstract class Routers { static const String catEyeSetPage = '/catEyeSetPage'; //猫眼设置 static const String coerceOpenDoorPage = '/coerceOpenDoorPage'; //胁迫开门 static const String coerceFingerprintPage = '/coerceFingerprintPage'; //胁迫指纹 - static const String lowBatteryReminderPage = '/lowBatteryReminderPage'; //低电量提醒 - static const String coerceFingerprintListPage = '/coerceFingerprintListPage'; //指纹列表 + static const String lowBatteryReminderPage = + '/lowBatteryReminderPage'; //低电量提醒 + static const String coerceFingerprintListPage = + '/coerceFingerprintListPage'; //指纹列表 static const String lockMonitoringPage = '/LockMonitoringPage'; //监控 static const String monitoringRealTimeScreenPage = '/MonitoringRealTimeScreenPage'; //实时画面 @@ -422,7 +454,8 @@ abstract class Routers { static const String addCardPage = '/AddCardPage'; // 添加卡 static const String cardDetailPage = '/CardDetailPage'; // 卡详情 static const String fingerprintListPage = '/FingerprintListPage'; // 指纹列表 - static const String addFingerprintTypePage = '/AddFingerprintTypePage'; // 添加指纹 + static const String addFingerprintTypePage = + '/AddFingerprintTypePage'; // 添加指纹 static const String fingerprintDetailPage = '/FingerprintDetailPage'; // 指纹详情 static const String faceListPage = '/FaceListPage'; // 人脸列表 static const String addFaceTypePage = '/AddFaceTypePage'; // 添加人脸 @@ -447,7 +480,8 @@ abstract class Routers { static const String accessoriesListPage = '/accessoriesListPage'; //配件列表 static const String seletKeyCyclicDatePage = '/SeletKeyCyclicDatePage'; // 电子钥匙、授权管理员、卡、指纹、遥控等添加添加循环日期公共界面 - static const String advancedFeaturesWebPage = '/advancedFeaturesWebPage'; // 高级功能 + static const String advancedFeaturesWebPage = + '/advancedFeaturesWebPage'; // 高级功能 static const String advancedFunctionRecordPage = '/advancedFunctionRecordPage'; //高级功能购买记录 static const String administratorAssociationLockPage = @@ -834,11 +868,11 @@ abstract class AppRouters { ), GetPage( name: Routers.valueAddedServicesListSMSTemplatePage, - page: () => const ValueAddedServicesListSMSTemplatePage(), + page: () => const CustomSMSTemplateListPage(), ), GetPage( name: Routers.valueAddedServicesAddSMSTemplatePage, - page: () => const ValueAddedServicesAddSMSTemplatePage(), + page: () => const NewSMSTemplatePage(), ), GetPage( name: Routers.valueAddedServicesListEmailTemplatePage, @@ -902,7 +936,8 @@ abstract class AppRouters { name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()), GetPage( name: Routers.getDeviceListPage, page: () => const GetDeviceListPage()), - GetPage(name: Routers.getNameListPage, page: () => const GetNameListPage()), + GetPage( + name: Routers.getNameListPage, page: () => const GetNameListPage()), GetPage( name: Routers.authorityManagementPage, page: () => const AuthorityManagementPage()), @@ -941,18 +976,21 @@ abstract class AppRouters { GetPage( name: Routers.otherTypeKeyChangeValidityDatePage, page: () => const OtherTypeKeyChangeValidityDatePage()), - GetPage(name: Routers.addICCardPage, page: () => const AddICCardPage()), + GetPage( + name: Routers.addICCardPage, page: () => const AddICCardPage()), GetPage( name: Routers.adminDetailChangeDatePage, page: () => const AdminDetailChangeDatePage()), GetPage( name: Routers.lockAddressGaoDePage, page: () => const LockAddressGaoDePage()), - GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()), + GetPage( + name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()), GetPage( name: Routers.minePersonInfoViewSafetyProblemPage, page: () => const MinePersonInfoViewSafetyProblemPage()), - GetPage(name: Routers.webviewShowPage, page: () => const WebviewShowPage()), + GetPage( + name: Routers.webviewShowPage, page: () => const WebviewShowPage()), GetPage( name: Routers.demoModeLockSetPage, page: () => const DemoModeLockSetPage()), @@ -962,8 +1000,10 @@ abstract class AppRouters { GetPage( name: Routers.addLockSelectCountryPage, page: () => const AddLockSelectCountryPage()), - GetPage(name: Routers.faceUnlockPage, page: () => const FaceUnlockPage()), - GetPage(name: Routers.motorPowerPage, page: () => const MotorPowerPage()), + GetPage( + name: Routers.faceUnlockPage, page: () => const FaceUnlockPage()), + GetPage( + name: Routers.motorPowerPage, page: () => const MotorPowerPage()), GetPage( name: Routers.openDoorDirectionPage, page: () => const OpenDoorDirectionPage()), @@ -973,7 +1013,8 @@ abstract class AppRouters { GetPage( name: Routers.msgNotificationPage, page: () => const MsgNotificationPage()), - GetPage(name: Routers.addFacePage, page: () => const AddFacePage()), + GetPage( + name: Routers.addFacePage, page: () => const AddFacePage()), GetPage( name: Routers.nDaysUnopenedPage, page: () => const NDaysUnopenedPage()), GetPage( @@ -982,9 +1023,12 @@ abstract class AppRouters { GetPage( name: Routers.openDoorNotifyPage, page: () => const OpenDoorNotifyPage()), - GetPage(name: Routers.addFamilyPage, page: () => const AddFamilyPage()), - GetPage(name: Routers.lockUserPage, page: () => const LockUserPage()), - GetPage(name: Routers.catEyeSetPage, page: () => const CatEyeSetPage()), + GetPage( + name: Routers.addFamilyPage, page: () => const AddFamilyPage()), + GetPage( + name: Routers.lockUserPage, page: () => const LockUserPage()), + GetPage( + name: Routers.catEyeSetPage, page: () => const CatEyeSetPage()), GetPage( name: Routers.coerceOpenDoorPage, page: () => const CoerceOpenDoorPage()), @@ -1003,7 +1047,8 @@ abstract class AppRouters { GetPage( name: Routers.monitoringRealTimeScreenPage, page: () => const MonitoringRealTimeScreenPage()), - GetPage(name: Routers.videoLogPage, page: () => const VideoLogPage()), + GetPage( + name: Routers.videoLogPage, page: () => const VideoLogPage()), GetPage( name: Routers.editVideoLogPage, page: () => const EditVideoLogPage()), GetPage( @@ -1018,12 +1063,15 @@ abstract class AppRouters { GetPage( name: Routers.addRemoteControlPage, page: () => const AddRemoteControlPage()), - GetPage(name: Routers.cardListPage, page: () => const CardListPage()), + GetPage( + name: Routers.cardListPage, page: () => const CardListPage()), // GetPage( // name: Routers.addCardTypeManagePage, // page: () => const AddCardTypeManagePage()), - GetPage(name: Routers.addCardPage, page: () => const AddCardPage()), - GetPage(name: Routers.cardDetailPage, page: () => const CardDetailPage()), + GetPage( + name: Routers.addCardPage, page: () => const AddCardPage()), + GetPage( + name: Routers.cardDetailPage, page: () => const CardDetailPage()), GetPage( name: Routers.fingerprintListPage, page: () => const FingerprintListPage()), @@ -1033,41 +1081,51 @@ abstract class AppRouters { GetPage( name: Routers.fingerprintDetailPage, page: () => const FingerprintDetailPage()), - GetPage(name: Routers.faceListPage, page: () => const FaceListPage()), - GetPage(name: Routers.addFaceTypePage, page: () => const AddFaceTypePage()), + GetPage( + name: Routers.faceListPage, page: () => const FaceListPage()), + GetPage( + name: Routers.addFaceTypePage, page: () => const AddFaceTypePage()), GetPage( name: Routers.passwordKeyDetailChangeDatePage, page: () => const PasswordKeyDetailChangeDatePage()), GetPage( name: Routers.realTimePicturePage, page: () => const RealTimePicturePage()), - GetPage(name: Routers.doorLockLogPage, page: () => const DoorLockLogPage()), + GetPage( + name: Routers.doorLockLogPage, page: () => const DoorLockLogPage()), GetPage( name: Routers.catEyeCustomModePage, page: () => const CatEyeCustomModePage()), - GetPage(name: Routers.videoSlotPage, page: () => const VideoSlotPage()), - GetPage(name: Routers.liveVideoPage, page: () => const LiveVideoPage()), - GetPage(name: Routers.faceDetailPage, page: () => const FaceDetailPage()), GetPage( - name: Routers.messageDetailPage, - page: () => const MessageDetailPage()), + name: Routers.videoSlotPage, page: () => const VideoSlotPage()), + GetPage( + name: Routers.liveVideoPage, page: () => const LiveVideoPage()), + GetPage( + name: Routers.faceDetailPage, page: () => const FaceDetailPage()), + GetPage( + name: Routers.messageDetailPage, page: () => const MessageDetailPage()), GetPage( name: Routers.accessoriesListPage, page: () => const AccessoriesListPage()), - GetPage(name: Routers.wifiListPage, page: () => const WifiListPage()), + GetPage( + name: Routers.wifiListPage, page: () => const WifiListPage()), GetPage( name: Routers.seletKeyCyclicDatePage, page: () => const SeletKeyCyclicDatePage()), - GetPage(name: Routers.irisListPage, page: () => const IrisListPage()), + GetPage( + name: Routers.irisListPage, page: () => const IrisListPage()), GetPage( name: Routers.addIrisTypeManagePage, - page: () => const AddIrisTypeManagePage()), - GetPage(name: Routers.addIrisPage, page: () => const AddIrisPage()), - GetPage(name: Routers.palmListPage, page: () => const PalmListPage()), + page: () => const AddIrisTypeManagePage()), + GetPage( + name: Routers.addIrisPage, page: () => const AddIrisPage()), + GetPage( + name: Routers.palmListPage, page: () => const PalmListPage()), GetPage( name: Routers.addPalmTypeManagePage, page: () => const AddPalmTypeManagePage()), - GetPage(name: Routers.addPalmPage, page: () => const AddPalmPage()), + GetPage( + name: Routers.addPalmPage, page: () => const AddPalmPage()), GetPage( name: Routers.advancedFeaturesWebPage, page: () => const AdvancedFeaturesWebPage()), diff --git a/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart b/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart index 005492cf..a19bd936 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart @@ -131,7 +131,7 @@ class _ValueAddedServicesNoteAndEmailDetailPageState ), Text( (type == 1) - ? TranslationLoader.lanKeys!.customSMSTemplate!.tr + ? '自定义短信模版'.tr : TranslationLoader.lanKeys!.customMailTemplate!.tr, style: TextStyle(fontSize: 24.sp), ), diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart new file mode 100644 index 00000000..16363d46 --- /dev/null +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart @@ -0,0 +1,53 @@ +class NewSMSTemplateEntity { + NewSMSTemplateEntity( + {this.errorCode, this.description, this.errorMsg, this.dataList}); + NewSMSTemplateEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + if (json['data'] != null) { + dataList = []; + json['data'].forEach((v) { + dataList!.add(SMSTemplateData.fromJson(v)); + }); + } + } + int? errorCode; + String? description; + String? errorMsg; + List? dataList; + + Map toJson() { + final Map data = {}; + data['errorCode'] = errorCode; + data['description'] = description; + data['errorMsg'] = errorMsg; + if (dataList != null) { + data['data'] = dataList!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class SMSTemplateData { + SMSTemplateData({this.contentType, this.name, this.template, this.fixedKey}); + SMSTemplateData.fromJson(Map json) { + contentType = json['content_type']; + name = json['name']; + template = json['template']; + fixedKey = json['fixed_key']; + } + int? contentType; + String? name; + String? template; + String? fixedKey; + + Map toJson() { + final Map data = {}; + data['content_type'] = contentType; + data['name'] = name; + data['template'] = template; + data['fixed_key'] = fixedKey; + return data; + } +} diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart new file mode 100644 index 00000000..62d9e411 --- /dev/null +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart @@ -0,0 +1,192 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/login/login/entity/LoginEntity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart'; +import 'package:star_lock/tools/regularExpression.dart'; + +import '../../../../network/api_repository.dart'; +import '../../../../tools/baseGetXController.dart'; + +class NewSMSTemplateLogic extends BaseGetXController { + NewSMSTemplateState state = NewSMSTemplateState(); + + //获取默认模板-- 1:电子钥匙 2:密码 + Future getDefaultTemplate() async { + final NewSMSTemplateEntity entity = + await ApiRepository.to.getDefaultTemplate(type: 1); + if (entity.errorCode!.codeIsSuccessful) { + state.templateList.value = entity.dataList ?? []; + if (state.templateList.isNotEmpty) { + state.templateTypeText.value = state.templateList[0].name ?? ''; + state.currentTemplate.value = state.templateList.firstWhere( + (SMSTemplateData element) => + element.name == state.templateTypeText.value, + ); + state.templateTypeText.refresh(); + state.currentTemplate.refresh(); + } + } + } + + //获取默认模板-- 1:电子钥匙 2:密码 + Future addSMSTemplate() async { + if (state.templateNameTf.text.isEmpty) { + showToast('请输入模板名称'); + return; + } + final LoginEntity entity = await ApiRepository.to.addSMSTemplate( + type: 1, + name: state.templateNameTf.text, + fixedKey: state.currentTemplate.value.fixedKey ?? '', + contentType: state.currentTemplate.value.contentType ?? 0, + regards: state.templateOneTf.text, + tips: state.templateTwoTf.text); + if (entity.errorCode!.codeIsSuccessful) { + showToast('添加成功'); + Get.back(); + } + } + + List buildElectronicKeySpan({required bool isPreview}) { + final List textSpans = []; + + // 如果是预览模式,添加预览模板的文本 + if (isPreview) { + textSpans.add( + TextSpan( + text: '${state.templateOneTf.text}\n', + style: state.defaultStyle, + ), + ); + } + // 将模板分割为文本片段 + final List textFragments = state.currentTemplate.value.template + ?.split(RegularExpression.urlRegExp) ?? + []; + + // 添加链接文本和普通文本到文本片段列表 + for (int i = 0; i < textFragments.length; i++) { + final String textFragment = textFragments[i]; + // 添加普通文本 + textSpans.add( + TextSpan( + text: textFragment, + style: state.defaultStyle, + ), + ); + // 如果不是最后一个文本片段,则添加换行符 + if (i < textFragments.length - 1) { + textSpans.add( + TextSpan( + text: '\n', + style: state.defaultStyle, + ), + ); + // 添加链接文本 + textSpans.add( + TextSpan( + text: RegularExpression.urlRegExp + .stringMatch(state.currentTemplate.value.template!) ?? + '', + style: state.highStyle, + ), + ); + } + } + + // 如果是预览模式,添加预览模板的文本 + if (isPreview) { + textSpans.add( + TextSpan( + text: '\n${state.templateTwoTf.text}', + style: state.defaultStyle, + ), + ); + } + + return textSpans; + } + + List buildPasswordSpan({required bool isPreview}) { + final List textSpans = []; + + // 如果是预览模式,添加预览模板的文本 + if (isPreview) { + textSpans.add( + TextSpan( + text: '${state.templateOneTf.text}\n', + style: state.defaultStyle, + ), + ); + } + + // 定义匹配 ${} 包围的变量的正则表达式 + final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}'); + + final String template = state.currentTemplate.value.template ?? ''; + + // 对模板进行处理 + int startIndex = 0; + for (final Match match in variableRegExp.allMatches(template)) { + // 处理变量之前的文本 + final String nonVariableText = + template.substring(startIndex, match.start); + // 替换非变量文本中的字符 + final String replacedNonVariableText = + nonVariableText.replaceAllMapped(RegExp(r',|。'), (Match match) { + return '${match.group(0)}\n'; + }); + textSpans.add( + TextSpan( + text: replacedNonVariableText, + style: state.defaultStyle, + ), + ); + + // 处理变量 + final String variableText = match.group(0) ?? ''; + textSpans.add( + TextSpan( + text: variableText, + style: state.highStyle, + ), + ); + + // 更新起始索引 + startIndex = match.end; + } + + // 添加最后一个变量之后的文本 + final String remainingText = template.substring(startIndex); + // 替换非变量文本中的字符 + final String replacedRemainingText = + remainingText.replaceAllMapped(RegExp(r',|。'), (Match match) { + return '${match.group(0)}\n'; + }); + textSpans.add( + TextSpan( + text: replacedRemainingText, + style: state.defaultStyle, + ), + ); + + // 在预览模式下,添加预览模板的文本 + if (isPreview) { + textSpans.add( + TextSpan( + text: '\n${state.templateTwoTf.text}', + style: state.defaultStyle, + ), + ); + } + + return textSpans; + } + + @override + Future onReady() async { + super.onReady(); + } +} diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart new file mode 100755 index 00000000..5172e04d --- /dev/null +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart @@ -0,0 +1,265 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart'; + +import '../../../../tools/commonItem.dart'; +import '../../../../tools/showBottomSheetTool.dart'; +import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; +import '../../../../translations/trans_lib.dart'; + +class NewSMSTemplatePage extends StatefulWidget { + const NewSMSTemplatePage({Key? key}) : super(key: key); + + @override + State createState() => _NewSMSTemplatePageState(); +} + +class _NewSMSTemplatePageState extends State { + final NewSMSTemplateLogic logic = Get.put(NewSMSTemplateLogic()); + final NewSMSTemplateState state = Get.find().state; + + @override + void initState() { + super.initState(); + logic.getDefaultTemplate(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '新建短信模版'.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: SingleChildScrollView( + child: Column( + children: [ + _buildEditTopInfo(), + SizedBox(height: 10.h), + _buildEditTemplate(), + SizedBox(height: 10.h), + _buildPreView(), + SizedBox(height: 42.h), + Container( + margin: EdgeInsets.symmetric(horizontal: 20.w), + child: SubmitBtn( + btnName: TranslationLoader.lanKeys!.save!.tr, + onClick: () { + logic.addSMSTemplate(); + }, + ), + ), + SizedBox(height: 40.h), + ], + ), + ), + ); + } + + Widget _buildEditTopInfo() { + return Column( + children: [ + CommonItem( + leftTitel: '名称'.tr, + rightTitle: '', + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: getTFWidget( + state.templateNameTf, + TranslationLoader.lanKeys!.pleaseEnter!.tr, + ), + ), + Obx( + () => CommonItem( + leftTitel: TranslationLoader.lanKeys!.type!.tr, + rightTitle: state.templateTypeText.value, + isHaveLine: false, + isHaveDirection: true, + action: _showSelectTemplateType, + ), + ), + ], + ); + } + + Widget _buildEditTemplate() { + return Container( + color: Colors.white, + child: Column( + children: [ + Row( + children: [ + Padding( + padding: EdgeInsets.all(25.w), + child: Text( + TranslationLoader.lanKeys!.templateContent!.tr, + style: + TextStyle(fontSize: 20.sp, fontWeight: FontWeight.w600), + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h), + height: 100, + child: _buildTextField(state.templateOneTf), + ), + Obx(() => _buildTemplateWithType(isPreview: false)), + SizedBox(height: 10.h), + Container( + margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h), + height: 100, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + _buildTextField(state.templateTwoTf), + ], + ), + ), + ], + ), + ); + } + + Widget _buildPreView() { + return Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 20.h), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(top: 25.h, bottom: 25.h, left: 25.w), + child: Align( + alignment: Alignment.centerLeft, + child: Text( + TranslationLoader.lanKeys!.preview!.tr, + style: TextStyle(fontSize: 20.sp, fontWeight: FontWeight.w600), + textAlign: TextAlign.left, + ), + ), + ), + Obx(() => Container( + margin: EdgeInsets.only(left: 25.w, right: 25.w), + decoration: BoxDecoration( + color: const Color(0xFFF5F5F5), + borderRadius: BorderRadius.circular(10.h), + ), + child: _buildTemplateWithType(isPreview: true), + )), + Padding( + padding: EdgeInsets.only( + left: 25.w, + top: 25.h, + bottom: 25.h, + ), + child: Text( + '预计产生短信条数:2', + style: TextStyle( + color: Colors.grey, + fontSize: 20.sp, + ), + ), + ), + ], + ), + ); + } + + Widget _buildTemplateWithType({required bool isPreview}) { + // 检查当前模板是否为空 + if (state.currentTemplate.value.template == null || + state.currentTemplate.value.template!.isEmpty) { + return const SizedBox.shrink(); // 如果为空,返回一个空的 SizedBox + } else { + return Row( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 25.w, vertical: 10.h), + child: Obx(() => RichText( + text: TextSpan( + children: state.templateTypeText.value == '电子钥匙' + ? logic.buildElectronicKeySpan(isPreview: isPreview) + : logic.buildPasswordSpan(isPreview: isPreview), + ), + )), + ), + ], + ); + } + } + + Widget _buildTextField(TextEditingController controller) { + return TextField( + maxLines: 8, + textAlign: TextAlign.start, + controller: controller, + style: state.defaultStyle, + decoration: InputDecoration( + contentPadding: EdgeInsets.all(20.w), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(20.h), + borderSide: const BorderSide(color: Color(0xffB2B2B2), width: 0.5), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(20.h), + borderSide: const BorderSide(color: Color(0xffB2B2B2), width: 1), + ), + ), + onChanged: (String value) { + controller.text = value; + }, + ); + } + + Widget getTFWidget(TextEditingController tfController, String tfStr) { + return SizedBox( + height: 50.h, + width: 300.w, + child: Row( + children: [ + Expanded( + child: TextField( + maxLines: 1, + controller: tfController, + autofocus: false, + textAlign: TextAlign.end, + decoration: InputDecoration( + contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), + hintText: tfStr, + hintStyle: TextStyle(fontSize: 22.sp), + border: InputBorder.none, + ), + ), + ), + ], + ), + ); + } + + void _showSelectTemplateType() { + final List titleList = state.templateList + .map((SMSTemplateData template) => template.name ?? '') + .toList(); + ShowBottomSheetTool().showSingleRowPicker( + context, + normalIndex: 0, + title: TranslationLoader.lanKeys!.type!.tr, + cancelTitle: TranslationLoader.lanKeys!.cancel!.tr, + sureTitle: TranslationLoader.lanKeys!.sure!.tr, + data: titleList, + clickCallBack: (int index, Object str) { + state.templateTypeText.value = str.toString(); + state.templateTypeText.refresh(); + state.currentTemplate.value = state.templateList[index]; + state.currentTemplate.refresh(); + }, + ); + } +} diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart new file mode 100644 index 00000000..8bd74667 --- /dev/null +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart'; + +class NewSMSTemplateState { + //高亮样式 + final TextStyle highStyle = + TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp); + +//默认样式 + final TextStyle defaultStyle = + TextStyle(color: Colors.black, fontSize: 20.sp); + +//预览样式封装-密码 + // late InlineSpan passwardSpan = TextSpan(children: [ + // TextSpan( + // text: + // '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.yourRoomIs!.tr}:', + // style: defaultStyle), + // TextSpan(text: '201', style: highStyle), + // TextSpan( + // text: ' ${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}: ', + // style: defaultStyle), + // TextSpan(text: '332211\n', style: highStyle), + // TextSpan( + // text: '${TranslationLoader.lanKeys!.periodValidity!.tr}: ', + // style: defaultStyle), + // TextSpan(text: '2021.12.11 12:00 - 2021.12.12 13:00。\n', style: highStyle), + // TextSpan( + // text: TranslationLoader.lanKeys!.templateTip1!.tr, style: defaultStyle), + // ]); + +//预览样式封装-电子钥匙 + // late InlineSpan electronicKeySpan = TextSpan(children: [ + // TextSpan( + // text: + // '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.templateTip2!.tr}', + // style: defaultStyle), + // TextSpan(text: 'https://abc.com/bcd\n', style: highStyle), + // TextSpan( + // text: '${TranslationLoader.lanKeys!.templateTip3!.tr}\n', + // style: defaultStyle), + // TextSpan(text: 'https://abc.com/bcd', style: highStyle), + // ]); + + final TextEditingController templateOneTf = TextEditingController(); + final TextEditingController templateTwoTf = TextEditingController(); + final TextEditingController templateNameTf = TextEditingController(); + + RxBool isVip = false.obs; + RxList templateList = [].obs; + RxString templateTypeText = '电子钥匙'.tr.obs; + RxString templateContentText = ''.obs; //模版内容 + Rx currentTemplate = SMSTemplateData().obs; + RxBool isShowDate = false.obs; +} diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/valueAddedServicesAddSMSTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/valueAddedServicesAddSMSTemplate_page.dart deleted file mode 100755 index 09b5c7b7..00000000 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/valueAddedServicesAddSMSTemplate_page.dart +++ /dev/null @@ -1,489 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:star_lock/app_settings/app_colors.dart'; - -import '../../../../tools/commonItem.dart'; -import '../../../../tools/showBottomSheetTool.dart'; -import '../../../../tools/submitBtn.dart'; -import '../../../../tools/titleAppBar.dart'; -import '../../../../translations/trans_lib.dart'; - -//高亮样式 -final TextStyle highStyle = - TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp); - -//默认样式 -final TextStyle defaultStyle = TextStyle(color: Colors.black, fontSize: 20.sp); - -//预览样式封装-密码 -late InlineSpan passwardSpan = TextSpan(children: [ - TextSpan( - text: - '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.yourRoomIs!.tr}:', - style: defaultStyle), - TextSpan(text: '201', style: highStyle), - TextSpan( - text: ' ${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}: ', - style: defaultStyle), - TextSpan(text: '332211\n', style: highStyle), - TextSpan( - text: '${TranslationLoader.lanKeys!.periodValidity!.tr}: ', - style: defaultStyle), - TextSpan(text: '2021.12.11 12:00 - 2021.12.12 13:00。\n', style: highStyle), - TextSpan( - text: TranslationLoader.lanKeys!.templateTip1!.tr, style: defaultStyle), -]); - -//预览样式封装-密码 -late InlineSpan electronicKeySpan = TextSpan(children: [ - TextSpan( - text: - '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.templateTip2!.tr}', - style: defaultStyle), - TextSpan(text: 'https://abc.com/bcd\n', style: highStyle), - TextSpan( - text: '${TranslationLoader.lanKeys!.templateTip3!.tr}\n', - style: defaultStyle), - TextSpan(text: 'https://abc.com/bcd', style: highStyle), -]); - -class ValueAddedServicesAddSMSTemplatePage extends StatefulWidget { - const ValueAddedServicesAddSMSTemplatePage({Key? key}) : super(key: key); - - @override - State createState() => - _ValueAddedServicesAddSMSTemplatePageState(); -} - -class _ValueAddedServicesAddSMSTemplatePageState - extends State { - final _templateOneTf = TextEditingController(); - final _templateTwoTf = TextEditingController(); - final _templateNameTf = TextEditingController(); - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - _templateOneTf.text = TranslationLoader.lanKeys!.hello!.tr; - _templateTwoTf.text = TranslationLoader.lanKeys!.templateTip1!.tr; - - return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.customSMSTemplate!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor), - body: ListView( - children: [ - _buildEditTopInfo(), - SizedBox( - height: 10.h, - ), - _buildEditTemplate(), - SizedBox( - height: 10.h, - ), - _buildpreview(), - SizedBox(height: 42.h), - Container( - margin: EdgeInsets.only(left: 20.w, right: 20.w), - child: SubmitBtn( - btnName: TranslationLoader.lanKeys!.save!.tr, - borderRadius: 10.w, - margin: EdgeInsets.only( - left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), - padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () { - // Navigator.pushNamed(context, Routers.sendElectronicKeyManagePage); - }), - ), - SizedBox( - height: 40.h, - ) - ], - )); - } - - Widget _buildEditTopInfo() { - return Column( - children: [ - CommonItem( - leftTitel: TranslationLoader.lanKeys!.name!.tr, - rightTitle: "", - isHaveLine: true, - isHaveRightWidget: true, - rightWidget: getTFWidget( - _templateNameTf, TranslationLoader.lanKeys!.pleaseEnter!.tr)), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.type!.tr, - rightTitle: TranslationLoader.lanKeys!.password!.tr, - isHaveLine: false, - action: () { - _showSelectTemplateType(); - }), - ], - ); - } - - Widget _buildEditTemplate() { - return Container( - color: Colors.white, - child: Column( - children: [ - Row( - children: [ - Padding( - padding: EdgeInsets.only( - left: 25.w, top: 25.h, bottom: 25.h, right: 25.w), - child: Text( - TranslationLoader.lanKeys!.templateContent!.tr, - style: - TextStyle(fontSize: 20.sp, fontWeight: FontWeight.w600), - ), - ), - ], - ), - Container( - margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h), - height: 100, - child: TextField( - maxLines: 8, - // maxLength:1000, - textAlign: TextAlign.start, - controller: _templateOneTf, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp, - ), - decoration: InputDecoration( - contentPadding: EdgeInsets.only( - top: 20.h, left: 20.w, right: 20.w, bottom: 20.h), - border: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), - - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), - - ///设置边框的粗细 - width: 0.5, - ), - ), - - ///用来配置输入框获取焦点时的颜色 - focusedBorder: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), - - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), - - ///设置边框的粗细 - width: 1, - ), - ), - ), - ), - ), - Visibility( - visible: true, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - children: [ - Padding( - padding: - EdgeInsets.only(left: 25.w, top: 10.h, right: 25.w), - child: RichText( - text: TextSpan(children: [ - TextSpan( - text: - '${TranslationLoader.lanKeys!.yourRoomIs!.tr}: ', - style: defaultStyle), - TextSpan( - text: - '{${TranslationLoader.lanKeys!.roomName!.tr}}', - style: highStyle), - TextSpan( - text: - ' ${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}: ', - style: defaultStyle), - TextSpan( - text: - '{${TranslationLoader.lanKeys!.password!.tr}}', - style: highStyle), - ]))), - ], - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Padding( - padding: EdgeInsets.only(left: 25.w, top: 10.h), - child: RichText( - text: TextSpan(children: [ - TextSpan( - text: - '${TranslationLoader.lanKeys!.periodValidity!.tr}: ', - style: defaultStyle), - TextSpan( - text: - '{${TranslationLoader.lanKeys!.periodValidity!.tr}}', - style: highStyle), - ]))), - SizedBox( - width: 10.w, - ), - GestureDetector( - onTap: () {}, - child: Row( - children: [ - Image.asset( - 'images/icon_round_unSelect.png', - width: 26.w, - height: 26.w, - ), - ], - ), - ) - ], - ), - ], - ), - ), - Visibility( - visible: false, - child: Row( - children: [ - Padding( - padding: - EdgeInsets.only(left: 25.w, top: 10.h, right: 25.w), - child: RichText( - text: TextSpan(children: [ - TextSpan( - text: - '${TranslationLoader.lanKeys!.templateTip2!.tr}\n', - style: defaultStyle), - TextSpan( - text: 'https://abc.com/bcd\n', - style: TextStyle( - color: const Color(0xFFEEDFA8), fontSize: 20.sp)), - TextSpan( - text: - '${TranslationLoader.lanKeys!.templateTip3!.tr}\n', - style: defaultStyle), - TextSpan( - text: 'https://abc.com/bcd\n', - style: TextStyle( - color: const Color(0xFFEEDFA8), fontSize: 20.sp)), - ]))), - ], - ), - ), - SizedBox(height: 10.h), - Container( - margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h), - height: 100, - child: Stack( - alignment: Alignment.bottomRight, - children: [ - TextField( - maxLines: 8, - // maxLength:1000, - textAlign: TextAlign.start, - controller: _templateTwoTf, - style: TextStyle( - color: Colors.black, - fontSize: 20.sp, - ), - decoration: InputDecoration( - contentPadding: EdgeInsets.only( - top: 20.h, left: 20.w, right: 20.w, bottom: 20.h), - border: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), - - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), - - ///设置边框的粗细 - width: 0.5, - ), - ), - - ///用来配置输入框获取焦点时的颜色 - focusedBorder: OutlineInputBorder( - ///设置边框四个角的弧度 - borderRadius: BorderRadius.all(Radius.circular(20.h)), - - ///用来配置边框的样式 - borderSide: const BorderSide( - ///设置边框的颜色 - color: Color(0xffB2B2B2), - - ///设置边框的粗细 - width: 1, - ), - ), - ), - ) - ], - ), - ), - ], - ), - ); - } - - Widget _buildpreview() { - return Column( - // mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - color: Colors.white, - margin: EdgeInsets.only(bottom: 20.h), - child: Column( - children: [ - Column( - children: [ - Row( - children: [ - Padding( - padding: EdgeInsets.only( - left: 25.w, - top: 25.h, - bottom: 25.h, - right: 25.w), - child: Text( - TranslationLoader.lanKeys!.preview!.tr, - style: TextStyle( - fontSize: 20.sp, fontWeight: FontWeight.w600), - ), - ), - ], - ), - Container( - margin: EdgeInsets.only(left: 25.w, right: 25.w), - decoration: BoxDecoration( - color: const Color(0xFFF5F5F5), - borderRadius: BorderRadius.circular(10.h), - ), - child: Padding( - padding: EdgeInsets.only( - left: 20.w, - top: 20.h, - right: 20.w, - bottom: 20.h), - child: RichText(text: passwardSpan)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - left: 25.w, - top: 25.h, - bottom: 25.h, - ), - child: Text( - '${TranslationLoader.lanKeys!.expectedNotoCount!.tr}:2', - style: TextStyle( - color: Colors.grey, - fontSize: 20.sp, - ), - ), - ) - ], - ) - /* - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - // left: 25.w, - top: 25.h, - bottom: 25.h, - ), - child: Text( - '${TranslationLoader.lanKeys!.expectedNotoCount!.tr}:2', - style: TextStyle( - color: Colors.grey, - fontSize: 20.sp, - ), - ), - ), - ], - ), - */ - ], - ), - ], - )) - ]); - } - - Widget getTFWidget(TextEditingController tfController, String tfStr) { - return Container( - height: 50.h, - width: 300.w, - child: Row( - children: [ - Expanded( - child: TextField( - //输入框一行 - maxLines: 1, - controller: tfController, - autofocus: false, - textAlign: TextAlign.end, - decoration: InputDecoration( - //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), - hintText: tfStr, - hintStyle: TextStyle(fontSize: 22.sp), - //不需要输入框下划线 - border: InputBorder.none, - ), - ), - ), - ], - ), - ); - } - - void _showSelectTemplateType() { - var list = [ - TranslationLoader.lanKeys!.electronicKey!.tr, - TranslationLoader.lanKeys!.password!.tr - ]; - ShowBottomSheetTool().showSingleRowPicker( - //上下文 - context, - //默认的索引 - normalIndex: 0, - title: TranslationLoader.lanKeys!.type!.tr, - cancelTitle: TranslationLoader.lanKeys!.cancel!.tr, - sureTitle: TranslationLoader.lanKeys!.sure!.tr, - //要显示的列表 - //可自定义数据适配器 - //adapter: PickerAdapter(), - data: list, - //选择事件的回调 - clickCallBack: (int index, var str) {}); - } -} diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart new file mode 100644 index 00000000..89e01d9d --- /dev/null +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart @@ -0,0 +1,130 @@ +class CustomSMSTemplateListEntity { + CustomSMSTemplateListEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + CustomSMSTemplateListEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null + ? CustomSMSTemplateListData.fromJson(json['data']) + : null; + } + int? errorCode; + String? description; + String? errorMsg; + CustomSMSTemplateListData? data; + + Map toJson() { + final Map data = {}; + data['errorCode'] = errorCode; + data['description'] = description; + data['errorMsg'] = errorMsg; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} + +class CustomSMSTemplateListData { + CustomSMSTemplateListData( + {this.type, + this.list, + this.pageNo, + this.pageSize, + this.pages, + this.total}); + + CustomSMSTemplateListData.fromJson(Map json) { + type = json['type']; + if (json['list'] != null) { + list = []; + json['list'].forEach((v) { + list!.add(CustomSMSTemplateItem.fromJson(v)); + }); + } + pageNo = json['pageNo']; + pageSize = json['pageSize']; + pages = json['pages']; + total = json['total']; + } + int? type; + List? list; + int? pageNo; + int? pageSize; + int? pages; + int? total; + + Map toJson() { + final Map data = {}; + data['type'] = type; + if (list != null) { + data['list'] = list!.map((v) => v.toJson()).toList(); + } + data['pageNo'] = pageNo; + data['pageSize'] = pageSize; + data['pages'] = pages; + data['total'] = total; + return data; + } +} + +class CustomSMSTemplateItem { + CustomSMSTemplateItem( + {this.id, + this.userId, + this.type, + this.contentType, + this.name, + this.regards, + this.tips, + this.fixedKey, + this.createdAt, + this.updatedAt, + this.template, + this.fixedTemplate}); + CustomSMSTemplateItem.fromJson(Map json) { + id = json['id']; + userId = json['user_id']; + type = json['type']; + contentType = json['content_type']; + name = json['name']; + regards = json['regards']; + tips = json['tips']; + fixedKey = json['fixed_key']; + createdAt = json['created_at']; + updatedAt = json['updated_at']; + template = json['template']; + fixedTemplate = json['fixed_template']; + } + int? id; + int? userId; + int? type; + int? contentType; + String? name; + String? regards; + String? tips; + String? fixedKey; + String? createdAt; + String? updatedAt; + String? template; + String? fixedTemplate; + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['user_id'] = userId; + data['type'] = type; + data['content_type'] = contentType; + data['name'] = name; + data['regards'] = regards; + data['tips'] = tips; + data['fixed_key'] = fixedKey; + data['created_at'] = createdAt; + data['updated_at'] = updatedAt; + data['template'] = template; + data['fixed_template'] = fixedTemplate; + return data; + } +} diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart new file mode 100644 index 00000000..4a6d8475 --- /dev/null +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart @@ -0,0 +1,155 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart'; +import 'package:star_lock/tools/regularExpression.dart'; +import 'package:star_lock/tools/storage.dart'; + +import '../../../../network/api_repository.dart'; +import '../../../../tools/baseGetXController.dart'; + +class CustomSMSTemplateListLogic extends BaseGetXController { + CustomSMSTemplateListState state = CustomSMSTemplateListState(); + + //获取短信模板列表 + Future getSMSTemplateListRequest() async { + final CustomSMSTemplateListEntity entity = await ApiRepository.to + .getSMSTemplateList(type: 1, pageNo: 1, pageSize: 20); + if (entity.errorCode!.codeIsSuccessful) { + state.smsTemplateList.value = + entity.data?.list ?? []; + state.smsTemplateList.refresh(); + } + } + + List buildElectronicKeySpan( + {required CustomSMSTemplateItem templateData}) { + final List textSpans = []; + + textSpans.add( + TextSpan( + text: '${templateData.regards}\n', + style: state.defaultStyle, + ), + ); + // 将模板分割为文本片段 + final List textFragments = + templateData.template?.split(RegularExpression.urlRegExp) ?? []; + + // 添加链接文本和普通文本到文本片段列表 + for (int i = 0; i < textFragments.length; i++) { + final String textFragment = textFragments[i]; + // 添加普通文本 + textSpans.add( + TextSpan( + text: textFragment, + style: state.defaultStyle, + ), + ); + // 如果不是最后一个文本片段,则添加换行符 + if (i < textFragments.length - 1) { + textSpans.add( + TextSpan( + text: '\n', + style: state.defaultStyle, + ), + ); + // 添加链接文本 + textSpans.add( + TextSpan( + text: RegularExpression.urlRegExp + .stringMatch(templateData.template!) ?? + '', + style: state.highStyle, + ), + ); + } + } + + textSpans.add( + TextSpan( + text: '\n${templateData.tips}', + style: state.defaultStyle, + ), + ); + + return textSpans; + } + + List buildPasswordSpan( + {required CustomSMSTemplateItem templateData}) { + final List textSpans = []; + + textSpans.add( + TextSpan( + text: '${templateData.regards}\n', + style: state.defaultStyle, + ), + ); + + // 定义匹配 ${} 包围的变量的正则表达式 + final RegExp variableRegExp = RegExp(r'\$\{([^}]+)\}'); + + final String template = templateData.template ?? ''; + + // 对模板进行处理 + int startIndex = 0; + for (final Match match in variableRegExp.allMatches(template)) { + // 处理变量之前的文本 + final String nonVariableText = + template.substring(startIndex, match.start); + // 替换非变量文本中的字符 + final String replacedNonVariableText = + nonVariableText.replaceAllMapped(RegExp(r',|。'), (Match match) { + return '${match.group(0)}\n'; + }); + textSpans.add( + TextSpan( + text: replacedNonVariableText, + style: state.defaultStyle, + ), + ); + + // 处理变量 + final String variableText = match.group(0) ?? ''; + textSpans.add( + TextSpan( + text: variableText, + style: state.highStyle, + ), + ); + + // 更新起始索引 + startIndex = match.end; + } + + // 添加最后一个变量之后的文本 + final String remainingText = template.substring(startIndex); + // 替换非变量文本中的字符 + final String replacedRemainingText = + remainingText.replaceAllMapped(RegExp(r',|。'), (Match match) { + return '${match.group(0)}\n'; + }); + textSpans.add( + TextSpan( + text: replacedRemainingText, + style: state.defaultStyle, + ), + ); + + textSpans.add( + TextSpan( + text: '\n${templateData.tips}', + style: state.defaultStyle, + ), + ); + + return textSpans; + } + + @override + onReady() async { + var isVip = await Storage.getBool(saveIsVip); + state.isVip.value = isVip ?? false; + } +} diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/valueAddedServicesListSMSTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart similarity index 64% rename from lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/valueAddedServicesListSMSTemplate_page.dart rename to lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart index 6359cd44..64b4db8f 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/valueAddedServicesListSMSTemplate_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart @@ -1,36 +1,52 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart'; +import 'package:star_lock/tools/noData.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; -import '../valueAddedServicesAddSMSTemplate/valueAddedServicesAddSMSTemplate_page.dart'; -class ValueAddedServicesListSMSTemplatePage extends StatefulWidget { - const ValueAddedServicesListSMSTemplatePage({Key? key}) : super(key: key); +class CustomSMSTemplateListPage extends StatefulWidget { + const CustomSMSTemplateListPage({Key? key}) : super(key: key); @override - State createState() => - _ValueAddedServicesListSMSTemplatePageState(); + State createState() => + _CustomSMSTemplateListPageState(); } -class _ValueAddedServicesListSMSTemplatePageState - extends State { +class _CustomSMSTemplateListPageState extends State { + final CustomSMSTemplateListLogic logic = + Get.put(CustomSMSTemplateListLogic()); + final CustomSMSTemplateListState state = + Get.find().state; + + @override + void initState() { + super.initState(); + logic.getSMSTemplateListRequest(); + } + @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.customSMSTemplate!.tr, + barTitle: '自定义短信模版'.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: Column( - children: [ - _topTipWidget(), - Expanded(child: _buildMainUI()), + children: [ + Obx(() => Visibility( + child: _topTipWidget(), + visible: !state.isVip.value, + )), + Expanded(child: Obx(buildMainUI)), SubmitBtn( btnName: TranslationLoader.lanKeys!.creatingANewTemplate!.tr, borderRadius: 20.w, @@ -57,7 +73,7 @@ class _ValueAddedServicesListSMSTemplatePageState decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(5)), child: Column( - children: [ + children: [ Text( TranslationLoader.lanKeys!.customTemplatesTip!.tr, style: TextStyle( @@ -76,15 +92,15 @@ class _ValueAddedServicesListSMSTemplatePageState borderRadius: BorderRadius.circular(10.h)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( + children: [ + SizedBox( width: 1.sw - 15.w * 2 - 40.w * 2 - 140.w, // margin: EdgeInsets.only(top:15.h, left: 15.w, right: 15.w, bottom: 15.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( - "${TranslationLoader.lanKeys!.currentState!.tr}:${TranslationLoader.lanKeys!.onTrial!.tr}", + '${TranslationLoader.lanKeys!.currentState!.tr}:${TranslationLoader.lanKeys!.onTrial!.tr}', style: TextStyle( fontSize: 20.sp, fontWeight: FontWeight.w600), ), @@ -119,21 +135,25 @@ class _ValueAddedServicesListSMSTemplatePageState )); } - Widget _buildMainUI() { - return ListView.builder( - itemCount: 10, - itemBuilder: (c, index) { - return _valueAddedServicesListSMSTemplateItem( - 'images/icon_lock.png', "张三", () { - // Navigator.pushNamed(context, Routers.valueAddedServicesAddSMSTemplatePage); - }); - }); + Widget buildMainUI() { + return state.smsTemplateList.isNotEmpty + ? ListView.builder( + itemCount: state.smsTemplateList.length, + itemBuilder: (BuildContext c, int index) { + final CustomSMSTemplateItem itemData = + state.smsTemplateList[index]; + return _valueAddedServicesListSMSTemplateItem(itemData); + }) + : NoData(); } Widget _valueAddedServicesListSMSTemplateItem( - String title, String content, Function() action) { + CustomSMSTemplateItem itemData) { return GestureDetector( - onTap: action, + onTap: () { + Navigator.pushNamed( + context, Routers.valueAddedServicesAddSMSTemplatePage); + }, child: Container( // height: 100.h, margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), @@ -143,24 +163,31 @@ class _ValueAddedServicesListSMSTemplatePageState ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Padding( padding: EdgeInsets.only(left: 30.h, top: 30.h, bottom: 20.h), child: Text( - "101", + itemData.name ?? '', style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600), ), ), Container( + width: 1.sw - 20.w * 2 - 30.w * 2, margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h), decoration: BoxDecoration( color: const Color(0xFFF5F5F5), borderRadius: BorderRadius.circular(10.h), ), child: Padding( - padding: EdgeInsets.only( - left: 20.w, top: 20.h, right: 20.w, bottom: 20.h), - child: RichText(text: electronicKeySpan)), + padding: EdgeInsets.only(left: 20.w, top: 20.h, bottom: 20.h), + child: RichText( + text: TextSpan( + children: itemData.contentType == 1 + ? logic.buildElectronicKeySpan(templateData: itemData) + : logic.buildPasswordSpan(templateData: itemData), + ), + ), + ), ), ], ), diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart new file mode 100644 index 00000000..50a8ccea --- /dev/null +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart @@ -0,0 +1,55 @@ +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/translations/trans_lib.dart'; + +class CustomSMSTemplateListState { + //高亮样式 + final TextStyle highStyle = + TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp); + +//默认样式 + final TextStyle defaultStyle = + TextStyle(color: Colors.black, fontSize: 20.sp); + +// //预览样式封装-密码 +// late InlineSpan passwardSpan = TextSpan(children: [ +// TextSpan( +// text: +// '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.yourRoomIs!.tr}:', +// style: defaultStyle), +// TextSpan(text: '201', style: highStyle), +// TextSpan( +// text: ' ${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}: ', +// style: defaultStyle), +// TextSpan(text: '332211\n', style: highStyle), +// TextSpan( +// text: '${TranslationLoader.lanKeys!.periodValidity!.tr}: ', +// style: defaultStyle), +// TextSpan(text: '2021.12.11 12:00 - 2021.12.12 13:00。\n', style: highStyle), +// TextSpan( +// text: TranslationLoader.lanKeys!.templateTip1!.tr, style: defaultStyle), +// ]); + +// //预览样式封装-密码 +// late InlineSpan electronicKeySpan = TextSpan(children: [ +// TextSpan( +// text: +// '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.templateTip2!.tr}', +// style: defaultStyle), +// TextSpan(text: 'https://abc.com/bcd\n', style: highStyle), +// TextSpan( +// text: '${TranslationLoader.lanKeys!.templateTip3!.tr}\n', +// style: defaultStyle), +// TextSpan(text: 'https://abc.com/bcd', style: highStyle), +// ]); + + // final TextEditingController templateOneTf = TextEditingController(); + // final TextEditingController templateTwoTf = TextEditingController(); + // final TextEditingController templateNameTf = TextEditingController(); + + RxBool isVip = false.obs; + RxList smsTemplateList = [].obs; +} diff --git a/lib/network/api.dart b/lib/network/api.dart index af2786e3..af3c5fa2 100755 --- a/lib/network/api.dart +++ b/lib/network/api.dart @@ -241,4 +241,10 @@ abstract class Api { final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //获取短信或者邮箱模板 final String appGetAppInfoURL = '/app/getAppInfo'; //获取APP基本信息 final String appGetFwVersionURL = '/app/getFwVersion'; //获取固件信息 + final String smsTemplateListURL = '/v2/service/listSmsTemplate'; //获取短信模板列表 + final String emailTemplateListURL = + '/v2/service/listEmailTemplate'; //获取邮件模板列表 + final String getDefaultTemplateURL = + '/v2/service/getDefaultTemplate'; //获取默认模板 + final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; //添加短信模板 } diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index 8e0c1718..2a5be43d 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -2141,6 +2141,42 @@ class ApiProvider extends BaseProvider { }), isUnShowLoading: true, ); + + // 获取默认模板 + Future> getDefaultTemplate(int type) => post( + getDefaultTemplateURL.toUrl, + jsonEncode({'type': type}), + isUnShowLoading: true, + ); + +// 获取短信模板列表 + Future> getSMSTemplateList( + int type, int pageNo, int pageSize) => + post( + smsTemplateListURL.toUrl, + jsonEncode({ + 'type': type, + 'pageNo': pageNo, + 'pageSize': pageSize + }), + isUnShowLoading: true, + ); + + // 添加短信模板 + Future> addSMSTemplate(int type, String name, + int contentType, String regards, String tips, String fixedKey) => + post( + addSMSTemplateURL.toUrl, + jsonEncode({ + 'type': type, + 'name': name, + 'content_type': contentType, + 'regards': regards, + 'tips': tips, + 'fixed_key': fixedKey + }), + isUnShowLoading: true, + ); } extension ExtensionString on String { diff --git a/lib/network/api_repository.dart b/lib/network/api_repository.dart index 6da98b73..07bd33b4 100755 --- a/lib/network/api_repository.dart +++ b/lib/network/api_repository.dart @@ -36,6 +36,8 @@ import 'package:star_lock/mine/valueAddedServices/valueAddedServicesHighFunction import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/face_authentication_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/buy_record_list_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart'; import 'package:star_lock/tools/aliyunRealNameAuth/realNameVertify_entity.dart'; import 'package:star_lock/tools/aliyunRealNameAuth/serviceAuthResult_entity.dart'; import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart'; @@ -2168,4 +2170,31 @@ class ApiRepository { await apiProvider.getFwVersion(model, currentVersion); return FwVersionEntity.fromJson(res.body); } + + // 获取默认模板 + Future getDefaultTemplate({required int type}) async { + final Response res = await apiProvider.getDefaultTemplate(type); + return NewSMSTemplateEntity.fromJson(res.body); + } + + // 获取短信模板列表 + Future getSMSTemplateList( + {required int type, required int pageNo, required int pageSize}) async { + final Response res = + await apiProvider.getSMSTemplateList(type, pageNo, pageSize); + return CustomSMSTemplateListEntity.fromJson(res.body); + } + + // 添加短信模板 + Future addSMSTemplate( + {required int type, + required String name, + required int contentType, + required String regards, + required String tips, + required String fixedKey}) async { + final Response res = await apiProvider.addSMSTemplate( + type, name, contentType, regards, tips, fixedKey); + return LoginEntity.fromJson(res.body); + } } diff --git a/lib/tools/dateTool.dart b/lib/tools/dateTool.dart index 3e986e92..ba27cc9a 100755 --- a/lib/tools/dateTool.dart +++ b/lib/tools/dateTool.dart @@ -176,7 +176,8 @@ class DateTool { String dateToYMDString(String timestamp) { final int time = int.parse(timestamp); final DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time); - final String appointmentDate = formatDate(nowDate, [yyyy, '-', mm, '-', dd]); + final String appointmentDate = + formatDate(nowDate, [yyyy, '-', mm, '-', dd]); return appointmentDate; } diff --git a/lib/tools/regularExpression.dart b/lib/tools/regularExpression.dart index da965a43..2d7c1aaf 100644 --- a/lib/tools/regularExpression.dart +++ b/lib/tools/regularExpression.dart @@ -11,4 +11,9 @@ class RegularExpression { RegExp(r'^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$'); return emailRegExp.hasMatch(input); } + + static RegExp urlRegExp = RegExp( + r'https?:\/\/\S+', + caseSensitive: false, + ); } From 5d689749d197aa2e4b386bf730b78db1c3dc3cba Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 14:57:18 +0800 Subject: [PATCH 04/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=EF=BC=8C=E5=B9=B6=E4=B8=94=E4=BF=AE=E5=A4=8D=E5=8F=91?= =?UTF-8?q?=E9=80=81=E9=92=A5=E5=8C=99=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 8196 -> 8196 bytes .../view/sendElectronicKeyView_logic.dart | 17 ++++++--- .../view/sendElectronicKeyView_page.dart | 36 +++++++++--------- pubspec.yaml | 4 +- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/.DS_Store b/.DS_Store index fdfcd7d0d25a05b4ccfcfeffa86d37533538e7af..ed4e320f2ee064343447de46bd628e2ced192c0d 100755 GIT binary patch delta 25 gcmZp1XmQvuOPIsL&{#*o#LQ%JhLHW{hr-G{0B2GMmH+?% delta 25 gcmZp1XmQvuOPIsZ(o9Fe$jEqdhLHW{hr-G{0B1S}lK=n! diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart index f50161ed..249fce41 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart @@ -20,13 +20,16 @@ import 'package:star_lock/tools/storage.dart'; class SendElectronicKeyViewLogic extends BaseGetXController { SendElectronicKeyViewLogic(this.type); + String type; final SendElectronicKeyViewState state = SendElectronicKeyViewState(); int? keyId; - + String? emailOrPhone; List get weekDayStr { - return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList(); + return state.weekdaysList + .map((e) => TimeUtils.translateWeekday(e)) + .toList(); } @override @@ -178,6 +181,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController { ? state.idCardController.text : ''); if (entity.errorCode!.codeIsSuccessful) { + emailOrPhone = state.emailOrPhoneController.text; state.createUser.value = 0; state.isSendSuccess = true; keyId = entity.data!.keyId; @@ -185,6 +189,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController { update(); eventBus.fire(ElectronicKeyListRefreshUI()); } else { + emailOrPhone = null; if (entity.errorCode == 425) { //用户未注册 update(); @@ -249,12 +254,12 @@ class SendElectronicKeyViewLogic extends BaseGetXController { } final NoticeTemplateEntity entity = await ApiRepository.to .getNoticeTemplate( - lockId: CommonDataManage().currentKeyInfo.lockId!, - keyId: keyId!, - channelType: isPhone ? 1 : 2); + lockId: CommonDataManage().currentKeyInfo.lockId!, + keyId: keyId!, + channelType: isPhone ? 1 : 2); if (entity.errorCode!.codeIsSuccessful) { final List list = - entity.data!.list!.where((Item item) => item.isUse == 0).toList(); + entity.data!.list!.where((Item item) => item.isUse == 0).toList(); if (list.isNotEmpty) { final Item item = list.first!; final String template = item.template ?? ''; diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart index e9af69b4..33f1b2ac 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart @@ -422,27 +422,27 @@ class _SendElectronicKeyViewState extends State // _openModalBottomSheet(); // }, // ), - OutLineBtn( - btnName: - logic.state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知', - onClick: () { - if (logic.state.emailOrPhoneController.text.contains('@')) { - Get.toNamed(Routers.sendEmailNotificationPage); - } else { - logic.sendMsg(isPhone: true); - } - }, - ), + if (logic.emailOrPhone != null) + OutLineBtn( + btnName: logic.emailOrPhone!.contains('@') ? '邮件通知' : '短信通知', + onClick: () { + if (logic.emailOrPhone!.contains('@')) { + Get.toNamed(Routers.sendEmailNotificationPage); + } else { + logic.sendMsg(isPhone: true); + } + }, + ), SizedBox( height: 10.h, ), - OutLineBtn( - btnName: '微信通知', - onClick: () { - logic.sendMsg( - isPhone: logic.state.emailOrPhoneController.text.contains('@')); - }, - ), + if (logic.emailOrPhone != null) + OutLineBtn( + btnName: '微信通知', + onClick: () { + logic.sendMsg(isPhone: logic.emailOrPhone!.contains('@')); + }, + ), ], ); } diff --git a/pubspec.yaml b/pubspec.yaml index 38c73add..5f669045 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,9 +62,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.53+2024052803:xhj 线上环境,提审 sky 线上环境提审 # 1.0.53+2024052804:xhj 线上环境,提审 修改鑫锁名字为星星锁 # 1.0.54+2024053001:xhj 线上环境,对外发布,提交测试 -# 1.0.56+202406401:xhj 线上环境,对外发布,提交测试 +# 1.0.56+2024060401:xhj 线上环境,对外发布,提交测试 -version: 1.0.56+202406401 +version: 1.0.56+2024060401 environment: sdk: '>=2.12.0 <3.0.0' From f44c86a5127f67601bf0e01655e8992772523cb5 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 15:09:22 +0800 Subject: [PATCH 05/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=EF=BC=8C=E8=AE=BE=E5=A4=87=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lockSet/lockSet/lockSet_logic.dart | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index 2729d160..870e4a56 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -509,6 +509,7 @@ class LockSetLogic extends BaseGetXController { // 下级界面修改成功后传递数据 StreamSubscription? _passCurrentLockInformationEvent; + void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus _passCurrentLockInformationEvent = eventBus @@ -567,18 +568,19 @@ class LockSetLogic extends BaseGetXController { ); if (entity.errorCode!.codeIsSuccessful) { BlueManage().connectDeviceMacAddress = ''; + final bool isXHJ = F.isXHJ; + final bool isOnlyOneData = state.isOnlyOneData.value == true; + await Future.delayed(const Duration(milliseconds: 200)) + .then((e) { + if (isXHJ) { + Get.close(3); + } else { + Get.close(isOnlyOneData ? 1 : 2); + } + }); SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent()); }); - if (state.isOnlyOneData.value == true) { - Future.delayed(const Duration(milliseconds: 200)).then((e) { - Get.close(1); - }); - } else { - Future.delayed(const Duration(milliseconds: 200)).then((e) { - Get.close(2); - }); - } } } @@ -591,12 +593,10 @@ class LockSetLogic extends BaseGetXController { state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0); if (entity.errorCode!.codeIsSuccessful) { BlueManage().connectDeviceMacAddress = ''; - SchedulerBinding.instance.addPostFrameCallback((_) { - eventBus.fire(RefreshLockListInfoDataEvent()); - }); + final bool isXHJ = F.isXHJ; final bool isOnlyOneData = state.isOnlyOneData.value == true; - Future.delayed(const Duration(milliseconds: 200)).then((e) { + await Future.delayed(const Duration(milliseconds: 200)).then((e) { if (isXHJ) { Get.close(3); } else { @@ -604,6 +604,9 @@ class LockSetLogic extends BaseGetXController { Get.close(onlyOneDataInt); } }); + SchedulerBinding.instance.addPostFrameCallback((_) { + eventBus.fire(RefreshLockListInfoDataEvent()); + }); } } From 46caa4633815447f698477e6c7f4b57f0f336ec2 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 15:48:39 +0800 Subject: [PATCH 06/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E7=9A=84=20url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Runner/XSFlutterManager.m | 10 +++++++--- lib/tools/NativeInteractionTool.dart | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ios/Runner/XSFlutterManager.m b/ios/Runner/XSFlutterManager.m index 2b8b540f..e371a2c3 100755 --- a/ios/Runner/XSFlutterManager.m +++ b/ios/Runner/XSFlutterManager.m @@ -14,6 +14,7 @@ @property(nonatomic,strong) FlutterMethodChannel* methodChannel; @property (nonatomic, copy) NSString *textToShare; +@property (nonatomic, copy) NSString *urlToShare; @end @@ -24,7 +25,8 @@ - (void)viewDidLoad { [super viewDidLoad]; self.textToShare = [[NSString alloc] init]; - + self.textToShare = [[NSString alloc] init]; + [self methodChannelFunction]; } - (void)methodChannelFunction { @@ -44,10 +46,12 @@ NSDictionary *paramDic = (NSDictionary *)params; //分享的标题 self.textToShare = paramDic[@"shareText"]; + self.urlToShare = paramDic[@"urlToShare"]; } //分享的url - NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"]; - + NSURL *urlToShare = [NSURL URLWithString:self.urlToShare]; +// NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"]; + //在这里呢 如果想分享图片 就把图片添加进去 文字什么的通上 NSArray *activityItems = @[self.textToShare,urlToShare]; diff --git a/lib/tools/NativeInteractionTool.dart b/lib/tools/NativeInteractionTool.dart index f971cfac..2b667a9d 100755 --- a/lib/tools/NativeInteractionTool.dart +++ b/lib/tools/NativeInteractionTool.dart @@ -1,4 +1,5 @@ import 'package:flutter/services.dart'; +import 'package:star_lock/flavors.dart'; import '../app_settings/app_settings.dart'; @@ -19,8 +20,9 @@ class NativeInteractionTool { ///加载原生分享 void loadNativeShare({required String shareText}) { + final String urlToShare = '${F.apiPrefix}/apps'; sendChannel.invokeMethod( - 'loadNativeShare', {'shareText': shareText}); + 'loadNativeShare', {'shareText': shareText,'urlToShare':urlToShare}); } ///获取设备蓝牙状态 From 0593da75984b077959753931c1a4f9b7fb578b32 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 16:38:23 +0800 Subject: [PATCH 07/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/skychip/lock/MainActivity.kt | 7 +- .../lockMian/lockList/lockList_xhj_page.dart | 190 +++++++++++------- lib/tools/baseGetXController.dart | 50 +++-- 3 files changed, 151 insertions(+), 96 deletions(-) diff --git a/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt b/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt index 0237e5c7..a4f10348 100755 --- a/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt +++ b/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt @@ -10,14 +10,14 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.plugins.GeneratedPluginRegistrant import android.bluetooth.BluetoothAdapter; -class MainActivity: FlutterActivity() { +class MainActivity : FlutterActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) GeneratedPluginRegistrant.registerWith(flutterEngine!!) MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result -> if (call.method == "loadNativeShare") { var map = call.arguments as Map - shareText(map["shareText"], "分享") + shareText(map["shareText"] , "分享") } else if (call.method == "sendGetBlueStatus") { // 蓝牙是否开启 // println("收到原生的信息了 methodmethodmethod: ${call.method}") @@ -58,8 +58,7 @@ class MainActivity: FlutterActivity() { override fun configureFlutterEngine(flutterEngine: FlutterEngine) { GeneratedPluginRegistrant.registerWith(flutterEngine); - MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { - call, result -> + MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result -> println("methodmethodmethod: ${call.method}") // 在这里处理从 Flutter 发送过来的方法调用 if (call.method == "loadNativeShare") { diff --git a/lib/main/lockMian/lockList/lockList_xhj_page.dart b/lib/main/lockMian/lockList/lockList_xhj_page.dart index f76baa68..8a3b3fd1 100755 --- a/lib/main/lockMian/lockList/lockList_xhj_page.dart +++ b/lib/main/lockMian/lockList/lockList_xhj_page.dart @@ -230,25 +230,20 @@ class _LockListXHJPageState extends State with RouteAware { Widget _xhjLockInfoListItem( LockListInfoItemEntity keyInfo, bool isLast, Function() action) { - String lockAlias = keyInfo.lockAlias!; + final String lockAlias = keyInfo.lockAlias!; final TextStyle lockAliasTextStyle = TextStyle( - fontSize: 24.sp, + fontSize: 25.sp, fontWeight: FontWeight.w500, color: keyInfo.passageMode == 1 ? AppColors.openPassageModeColor : AppColors.darkGrayTextColor, overflow: TextOverflow.ellipsis, ); - final TextPainter textPainter = TextPainter( - text: TextSpan(text: lockAlias, style: lockAliasTextStyle), - maxLines: 1, - textDirection: TextDirection.ltr) - ..layout(minWidth: 0, maxWidth: double.infinity); + final List useKeyTypeListStr = logic.getUseKeyTypeListStr( + keyInfo.startDate, keyInfo.endDate, keyInfo.keyType); + final bool isThree = useKeyTypeListStr.length == 3; + final bool isOne = useKeyTypeListStr.length == 1; - final double textSizeWidth = textPainter.size.width; // 获取文本的尺寸 - if (textSizeWidth > Get.width * .6) { - lockAlias = '${lockAlias.substring(0, 14)}...'; - } return GestureDetector( onTap: action, child: Container( @@ -270,6 +265,7 @@ class _LockListXHJPageState extends State with RouteAware { mainAxisAlignment: MainAxisAlignment.center, children: [ Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( 'images/icon_lock_circle.png', @@ -277,50 +273,85 @@ class _LockListXHJPageState extends State with RouteAware { height: 48.r, color: AppColors.mainColor, ), + const Spacer(), + Column( + children: [ + Row( + children: [ + Image.asset( + logic.showElectricIcon(keyInfo.electricQuantity!), + width: 30.w, + height: 24.w, + ), + SizedBox(width: 2.w), + Text( + '${keyInfo.electricQuantity!}%', + style: TextStyle( + fontSize: 16.sp, + color: AppColors.darkGrayTextColor), + ), + ], + ), + Text( + keyInfo.isLockOwner == 1 + ? '超级管理员'.tr + : (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr), + style: TextStyle( + fontSize: 16.sp, + color: AppColors.darkGrayTextColor), + ) + ], + ), ], ), SizedBox( - height: 10.h, + height: 8.h, ), - FittedBox( - fit: BoxFit.scaleDown, - child: Text(lockAlias, style: lockAliasTextStyle, maxLines: 1), + Text( + lockAlias, + style: lockAliasTextStyle, + maxLines: 2, ), - Visibility( - visible: keyInfo.passageMode == 1, - child: Padding( - padding: EdgeInsets.only(top: 5.h), - child: Row( - children: [ - Container( - padding: EdgeInsets.only(right: 5.w, left: 5.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.w), - color: AppColors.openPassageModeColor, - ), - child: Text('常开模式开启'.tr, + Row( + children: [ + Visibility( + visible: keyInfo.passageMode == 1, + child: Container( + padding: + EdgeInsets.only(top: 5.h, right: 5.w, left: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: AppColors.openPassageModeColor, + ), + child: Text('常开模式开启'.tr, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.appBarIconColor)), + )), + SizedBox( + width: 5.w, + ), + Visibility( + visible: keyInfo.lockSetting!.remoteUnlock == 1, + child: Row( + children: [ + Container( + padding: EdgeInsets.only( + top: 5.h, right: 5.w, left: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: AppColors.mainColor, + ), + child: Text( + '远程开锁'.tr, style: TextStyle( - fontSize: 18.sp, - color: AppColors.appBarIconColor)), - ), - ], - ), - )), - Visibility( - visible: keyInfo.lockSetting!.remoteUnlock == 1, - child: Padding( - padding: EdgeInsets.only(top: 5.h), - child: Row( - children: [ - Text( - '远程开锁'.tr, - style: TextStyle( - fontSize: 18.sp, - color: AppColors.darkGrayTextColor), - ), - ], - ), - )), + fontSize: 18.sp, color: Colors.white), + ), + ), + ], + )), + ], + ), Visibility( visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && @@ -331,7 +362,7 @@ class _LockListXHJPageState extends State with RouteAware { keyInfo.keyStatus == XSConstantMacro.keyStatusExpired), child: Padding( - padding: EdgeInsets.only(top: 20.h), + padding: EdgeInsets.only(top: 5.h), child: Row( children: [ Container( @@ -353,37 +384,40 @@ class _LockListXHJPageState extends State with RouteAware { ), )), SizedBox(height: 5.h), - Row( - children: [ - Expanded( - child: Text( - keyInfo.isLockOwner == 1 - ? '超级管理员'.tr - : (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr), + if (isThree) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + Characters(useKeyTypeListStr[0]).join('\u{200B}'), style: TextStyle( fontSize: 16.sp, color: AppColors.darkGrayTextColor), ), - ), - Image.asset( - logic.showElectricIcon(keyInfo.electricQuantity!), - width: 30.w, - height: 24.w, - ), - SizedBox(width: 2.w), - Text( - '${keyInfo.electricQuantity!}%', - style: TextStyle( - fontSize: 16.sp, color: AppColors.darkGrayTextColor), - ), - ], - ), - Text( - Characters(logic.getUseKeyTypeStr( - keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)) - .join('\u{200B}'), - style: TextStyle( - fontSize: 16.sp, color: AppColors.darkGrayTextColor), - ) + Row( + children: [ + Text( + Characters(useKeyTypeListStr[1]).join('\u{200B}'), + style: TextStyle( + fontSize: 16.sp, + color: AppColors.darkGrayTextColor), + ), + SizedBox(width: 5.w), + Text( + useKeyTypeListStr[2], + style: TextStyle( + fontSize: 16.sp, + color: AppColors.darkGrayTextColor), + ), + ], + ), + ], + ) + else if (isOne) + Text( + useKeyTypeListStr[0], + style: TextStyle( + fontSize: 16.sp, color: AppColors.darkGrayTextColor), + ), ], ), ), diff --git a/lib/tools/baseGetXController.dart b/lib/tools/baseGetXController.dart index b20208b3..a69b56e0 100755 --- a/lib/tools/baseGetXController.dart +++ b/lib/tools/baseGetXController.dart @@ -21,7 +21,7 @@ class BaseGetXController extends GetxController { bool currentPage = true; var pageNo = 1; - var pageSize = "20"; + var pageSize = '20'; @override void onReady() { @@ -93,7 +93,7 @@ class BaseGetXController extends GetxController { } void showBlueConnetctToast() { - bool isContains = BlueManage().connectDeviceName.contains("T9A"); + bool isContains = BlueManage().connectDeviceName.contains('T9A'); showToast( "${'操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。'.tr}${isContains == true ? "如果是全自动锁,请使屏幕变亮" : ""}"); } @@ -123,10 +123,10 @@ class BaseGetXController extends GetxController { } void showOperationSuccessful({String? status, Function? something}) => - showSuccess(status ?? "成功", something: something); + showSuccess(status ?? '成功', something: something); void showOperationFailed({String? status, Function? something}) => - showError(status ?? "失败", something: something); + showError(status ?? '失败', something: something); void logOff() async { await ClientManager().logOff(); @@ -136,11 +136,11 @@ class BaseGetXController extends GetxController { void checkBlueIsOpen(void Function() action) { NativeInteractionTool().sendGetBlueStatus(); NativeInteractionTool().receiveChannelBlueIsOnEvent((String status) { - if (status == "1") { + if (status == '1') { // 蓝牙已打开 AppLog.log('蓝牙已打开'); action(); - } else if (status == "0") { + } else if (status == '0') { // 蓝牙未打开 AppLog.log('蓝牙未打开'); showIosTipViewDialog(); @@ -148,7 +148,7 @@ class BaseGetXController extends GetxController { } else { // 蓝牙未打开 AppLog.log('设备不支持蓝牙'); - showToast("设备不支持蓝牙"); + showToast('设备不支持蓝牙'); return; } }); @@ -159,8 +159,8 @@ class BaseGetXController extends GetxController { context: Get.context!, builder: (BuildContext context) { return ShowIosTipView( - title: "提示", - tipTitle: "蓝牙未打开,请到设置里面打开蓝牙", + title: '提示', + tipTitle: '蓝牙未打开,请到设置里面打开蓝牙', sureClick: () { Get.back(); if (Platform.isIOS) { @@ -184,23 +184,45 @@ class BaseGetXController extends GetxController { "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} ${"限时".tr}"; } else if (keyType == XSConstantMacro.keyTypeLong) { //永久 - // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久'; useDateStr = '永久'.tr; } else if (keyType == XSConstantMacro.keyTypeOnce) { //单次 - // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次'; useDateStr = '单次'.tr; } else if (keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} ${"循环".tr}"; } - return useDateStr; } + List getUseKeyTypeListStr( + int? startDate, int? endDate, int? keyType) { + final List useDateListStr = []; + if (keyType == XSConstantMacro.keyTypeTime) { + //限期 + useDateListStr.addAll([ + DateTool().dateToYMDHNString(startDate.toString()), + DateTool().dateToYMDHNString(endDate.toString()), + '限时'.tr, + ]); + } else if (keyType == XSConstantMacro.keyTypeLong) { + //永久 + useDateListStr.add('永久'.tr); + } else if (keyType == XSConstantMacro.keyTypeOnce) { + //单次 + useDateListStr.add('单次'.tr); + } else if (keyType == XSConstantMacro.keyTypeLoop) { + //循环 + useDateListStr.addAll([ + DateTool().dateToYMDString(startDate.toString()), + DateTool().dateToYMDString(endDate.toString()), + '循环'.tr, + ]); + } + return useDateListStr; + } + static List splitList(List list, int len) { if (len <= 1) { return [list]; From 91749354521bcb8b5b79d753013f615191c22b5e Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 16:50:08 +0800 Subject: [PATCH 08/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98,=E8=A1=A5=E5=85=85=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main/lockMian/lockList/lockList_xhj_page.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/main/lockMian/lockList/lockList_xhj_page.dart b/lib/main/lockMian/lockList/lockList_xhj_page.dart index 8a3b3fd1..0eab9fd7 100755 --- a/lib/main/lockMian/lockList/lockList_xhj_page.dart +++ b/lib/main/lockMian/lockList/lockList_xhj_page.dart @@ -313,12 +313,12 @@ class _LockListXHJPageState extends State with RouteAware { maxLines: 2, ), Row( - children: [ + children: [ Visibility( visible: keyInfo.passageMode == 1, child: Container( padding: - EdgeInsets.only(top: 5.h, right: 5.w, left: 5.w), + EdgeInsets.only(top: 2.h, right: 3.w, left: 3.w,bottom: 1.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.w), color: AppColors.openPassageModeColor, @@ -328,16 +328,17 @@ class _LockListXHJPageState extends State with RouteAware { fontSize: 18.sp, color: AppColors.appBarIconColor)), )), - SizedBox( - width: 5.w, - ), + if (keyInfo.passageMode == 1) + SizedBox( + width: 5.w, + ), Visibility( visible: keyInfo.lockSetting!.remoteUnlock == 1, child: Row( children: [ Container( padding: EdgeInsets.only( - top: 5.h, right: 5.w, left: 5.w), + top: 2.h, right: 3.w, left: 3.w,bottom: 1.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.w), color: AppColors.mainColor, @@ -394,7 +395,7 @@ class _LockListXHJPageState extends State with RouteAware { fontSize: 16.sp, color: AppColors.darkGrayTextColor), ), Row( - children: [ + children: [ Text( Characters(useKeyTypeListStr[1]).join('\u{200B}'), style: TextStyle( From a5154333450288bab11e69a0a14e5182e925f207 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 18:05:33 +0800 Subject: [PATCH 09/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=AF=86=E7=A0=81/=E5=8D=A1/=E6=8C=87=E7=BA=B9/=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98/=E4=B8=8D=E4=BC=9A=E6=B6=88=E5=A4=B1?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authorizedAdminList_page.dart | 8 ++- .../electronicKeyList_page.dart | 8 ++- .../fingerprintDetail_logic.dart | 2 +- .../fingerprintList/fingerprintList_page.dart | 15 +++-- .../passwordKeyList_logic.dart | 46 ++++++++------- .../passwordKeyList/passwordKeyList_page.dart | 56 +++++++++++++------ lib/network/api_provider.dart | 42 ++++++-------- 7 files changed, 107 insertions(+), 70 deletions(-) diff --git a/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index cd1220d8..aac3c42e 100755 --- a/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -151,7 +151,13 @@ class _AuthorizedAdminListPageState extends State { arguments: { 'itemData': indexEntity, }).then((Object? val) { - if (val != null) { + if (val == 'deletScuess') { + state.itemDataList.removeWhere( + ( ElectronicKeyListItem item) => + item.keyId == + indexEntity.keyId!); + setState(() {}); + } else if (val != null) { logic .refreshIndividualKeys( lockId: indexEntity.lockId!, diff --git a/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 7359179c..153c3193 100755 --- a/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -182,7 +182,13 @@ class _ElectronicKeyListPageState extends State { arguments: { 'itemData': indexEntity, }).then((Object? val) { - if (val != null) { + if (val == 'deletScuess') { + state.itemDataList.removeWhere( + ( ElectronicKeyListItem item) => + item.keyId == + indexEntity.keyId!); + setState(() {}); + } else if (val != null) { logic .refreshIndividualKeys( lockId: indexEntity.lockId!, diff --git a/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart b/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart index 7d70c18c..5211aba8 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart @@ -154,7 +154,7 @@ class FingerprintDetailLogic extends BaseGetXController{ ); if(entity.errorCode!.codeIsSuccessful){ showToast('删除成功'.tr, something: (){ - Get.back(result: 'addScuess'); + Get.back(result: 'deletScuess'); }); } } diff --git a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart index 107343c8..91865d3d 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -69,7 +68,8 @@ class _FingerprintListPageState extends State onPressed: () async { final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - ShowTipView().showIosTipWithContentDialog('重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async { + ShowTipView().showIosTipWithContentDialog( + '重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async { state.isDeletAll = true; state.deletKeyID = '1'; state.deletFingerNo = 0; @@ -161,11 +161,18 @@ class _FingerprintListPageState extends State fingerprintItemData.fingerprintName!, logic.getKeyType(fingerprintItemData), logic.getKeyDateType(fingerprintItemData), () async { - final data = await Get.toNamed(Routers.fingerprintDetailPage, + final data = await Get.toNamed( + Routers.fingerprintDetailPage, arguments: { 'fingerprintItemData': fingerprintItemData, }); - if (data != null) { + if (data == 'deletScuess') { + state.fingerprintItemListData.removeWhere( + (FingerprintItemData item) => + item.fingerprintId == + fingerprintItemData.fingerprintId!); + setState(() {}); + } else if (data != null) { logic .refreshIndividualKeys( fingerprintId: fingerprintItemData.fingerprintId!) diff --git a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index 21572725..6e093bb8 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -25,6 +25,7 @@ class PasswordKeyListLogic extends BaseGetXController { // 获取解析后的数据 late StreamSubscription _replySubscription; + void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { @@ -70,7 +71,8 @@ class PasswordKeyListLogic extends BaseGetXController { keyID: '0', userID: (await Storage.getUid())!, pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0, - pwd: state.pwd, //state.deletPWD, + pwd: state.pwd, + //state.deletPWD, operate: state.itemData.isCustom == 1 ? 2 : 3, isAdmin: 0, useCountLimit: 0xffff, @@ -157,7 +159,8 @@ class PasswordKeyListLogic extends BaseGetXController { keyID: '0', userID: (await Storage.getUid())!, pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0, - pwd: state.pwd, //state.deletPWD, + pwd: state.pwd, + //state.deletPWD, operate: state.itemData.isCustom == 1 ? 2 : 3, isAdmin: 0, useCountLimit: 0xffff, @@ -228,28 +231,28 @@ class PasswordKeyListLogic extends BaseGetXController { } /** - * //请求操作记录列表(门锁日志) - void mockNetworkDataRequest({required bool isRefresh}) async { - // 如果是下拉刷新,清空已有数据 - if (isRefresh) { + * //请求操作记录列表(门锁日志) + void mockNetworkDataRequest({required bool isRefresh}) async { + // 如果是下拉刷新,清空已有数据 + if (isRefresh) { state.lockLogItemList.clear(); pageNo = 1; - } - DoorLockLogEntity entity = await ApiRepository.to.lockEventList( - lockId: state.keyInfos.value.lockId!, - lockEventType: state.dropdownValue.value, - pageNo: pageNo, - pageSize: int.parse(pageSize), - startDate: state.startDate.value, - endDate: state.endDate.value); - if (entity.errorCode!.codeIsSuccessful) { + } + DoorLockLogEntity entity = await ApiRepository.to.lockEventList( + lockId: state.keyInfos.value.lockId!, + lockEventType: state.dropdownValue.value, + pageNo: pageNo, + pageSize: int.parse(pageSize), + startDate: state.startDate.value, + endDate: state.endDate.value); + if (entity.errorCode!.codeIsSuccessful) { // 更新数据列表 state.lockLogItemList.addAll(entity.data!.itemList!); // 更新页码 pageNo++; - } - } - */ + } + } + */ //请求密码钥匙列表 Future mockNetworkDataRequest( @@ -396,10 +399,10 @@ class PasswordKeyListLogic extends BaseGetXController { Future refreshIndividualKeys( {required int lockId, required int keyboardPwdId}) async { final PasswordKeyEntity entity = - await ApiRepository.to.passwordKey(lockId, keyboardPwdId); + await ApiRepository.to.passwordKey(lockId, keyboardPwdId); if (entity.errorCode!.codeIsSuccessful) { - final int index = state.itemDataList - .indexWhere((PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId); + final int index = state.itemDataList.indexWhere( + (PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId); state.itemDataList.removeAt(index); state.itemDataList.insert(index, entity.data!); } @@ -407,6 +410,7 @@ class PasswordKeyListLogic extends BaseGetXController { /// 刷新密码列表 StreamSubscription? _getPasswordListRefreshUIEvent; + void _getPasswordListRefreshUIAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus _getPasswordListRefreshUIEvent = eventBus diff --git a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index b6c79629..4ed1ff0a 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; @@ -64,13 +63,15 @@ class _PasswordKeyListPageState extends State style: TextStyle(color: Colors.white, fontSize: 24.sp), ), onPressed: () async { - final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); + final bool? isDemoMode = + await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { if (state.itemDataList.isEmpty) { logic.showToast('暂无密码,无需重置'.tr); return; } - ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, logic.getUserInfoRequest); + ShowTipView().showIosTipWithContentDialog( + '该锁的密码都将被删除'.tr, logic.getUserInfoRequest); } else { logic.showToast('演示模式'.tr); } @@ -105,9 +106,10 @@ class _PasswordKeyListPageState extends State btnName: TranslationLoader.lanKeys!.getPassword!.tr, onClick: () { Navigator.pushNamed( - context, Routers.passwordKeyPerpetualPage, - arguments: {'keyInfo': state.keyInfo.value}) - .then((Object? val) { + context, Routers.passwordKeyPerpetualPage, + arguments: { + 'keyInfo': state.keyInfo.value + }).then((Object? val) { if (val != null) { getHttpData(isRefresh: true); } @@ -146,7 +148,8 @@ class _PasswordKeyListPageState extends State children: [ SlidableAction( onPressed: (BuildContext context) { - ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async { + ShowTipView().showIosTipWithContentDialog( + '确定要删除吗?'.tr, () async { state.itemData = passwordKeyListItem; state.pwdNo = passwordKeyListItem.pwdUserNo!; state.pwd = passwordKeyListItem.keyboardPwd!; @@ -162,10 +165,23 @@ class _PasswordKeyListPageState extends State ), child: _electronicKeyItem(index, 'images/icon_password.png', passwordKeyListItem.keyboardPwdName!, useDateStr, () { - Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: {'itemData': passwordKeyListItem}) - .then((Object? val) { - if (val != null) { - // getHttpData(isRefresh: true); + Navigator.pushNamed(context, Routers.passwordKeyDetailPage, + arguments: { + 'itemData': passwordKeyListItem + }).then((Object? val) { + if (val == 'deletScuess') { + state.itemDataList.removeWhere( + (PasswordKeyListItem item) => + item.keyboardPwdId == + passwordKeyListItem.keyboardPwdId!); + setState(() {}); + } else if (val != null) { + logic + .refreshIndividualKeys( + lockId: passwordKeyListItem.lockId!, + keyboardPwdId: + passwordKeyListItem.keyboardPwdId!) + .then((dynamic value) => setState(() {})); } }); }), @@ -181,8 +197,10 @@ class _PasswordKeyListPageState extends State )); } - Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) { - final PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex]; + Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, + String lockTypeTitle, String useDateStr, Function()? action) { + final PasswordKeyListItem passwordKeyListItem = + state.itemDataList[itemIndex]; return GestureDetector( onTap: action, @@ -223,11 +241,13 @@ class _PasswordKeyListPageState extends State ]), ), SizedBox(width: 10.w), - if (passwordKeyListItem.keyboardPwdStatus == 2) Text( - '已过期'.tr, - style: - TextStyle(color: Colors.red, fontSize: 20.sp), - ) else Container(), + if (passwordKeyListItem.keyboardPwdStatus == 2) + Text( + '已过期'.tr, + style: TextStyle(color: Colors.red, fontSize: 20.sp), + ) + else + Container(), // SizedBox(width: 15.w) ], ), diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index 81804437..3c2b6aa4 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -126,15 +126,12 @@ class ApiProvider extends BaseProvider { 'searchStr': searchStr })); - Future electronicKey( - int lockId, int keyId - ) => - post( - keydetail.toUrl, - jsonEncode({ - 'lockId': lockId.toString(), - 'keyId': keyId.toString(), - })); + Future electronicKey(int lockId, int keyId) => post( + keydetail.toUrl, + jsonEncode({ + 'lockId': lockId.toString(), + 'keyId': keyId.toString(), + })); Future sendElectronicKey( int createUser, @@ -449,13 +446,12 @@ class ApiProvider extends BaseProvider { 'searchStr': searchStr })); - Future passwordKey(int lockId, int keyboardPwdId,) => - post( - passwordKeyDetailURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'keyboardPwdId': keyboardPwdId - })); + Future passwordKey( + int lockId, + int keyboardPwdId, + ) => + post(passwordKeyDetailURL.toUrl, + jsonEncode({'lockId': lockId, 'keyboardPwdId': keyboardPwdId})); Future resetPasswordKey(String lockId, String operatorUid) => post( resetPasswordURL.toUrl, @@ -1116,17 +1112,15 @@ class ApiProvider extends BaseProvider { })); // 获取指纹详情 - Future getFingerprintsData( - int fingerprintId) => - post( - getFingerprintDetailURL.toUrl, - jsonEncode({ - 'fingerprintId': fingerprintId, - })); + Future getFingerprintsData(int fingerprintId) => post( + getFingerprintDetailURL.toUrl, + jsonEncode({ + 'fingerprintId': fingerprintId, + })); // 获取指纹列表 Future getFingerprintsListData( - String lockId, String pageNo, String pageSize, String searchStr) => + String lockId, String pageNo, String pageSize, String searchStr) => post( getFingerprintListURL.toUrl, jsonEncode({ From 2df1d2daccf7ab70f0c96c6b7aa44fbc8359104a Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Tue, 4 Jun 2024 18:09:38 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=E4=B8=94=E5=85=BC=E5=AE=B9=E6=96=B0=E5=BB=BA=E6=A8=A1?= =?UTF-8?q?=E7=89=88=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/appRouters.dart | 12 ++-- ...ueAddedServicesListEmailTemplate_page.dart | 2 +- ...eAddedServicesNoteAndEmailDetail_page.dart | 8 +-- .../newSMSTemplate_entity.dart | 13 +++-- .../newSMSTemplate_logic.dart | 23 ++++++-- .../newSMSTemplate_page.dart | 26 ++++----- .../newSMSTemplate_state.dart | 49 +++++------------ .../customSMSTemplateList_page.dart | 30 +++++++--- .../customSMSTemplateList_state.dart | 42 +------------- lib/network/api.dart | 1 + lib/network/api_provider.dart | 55 +++++++++++-------- lib/network/api_repository.dart | 24 +++++--- 12 files changed, 138 insertions(+), 147 deletions(-) diff --git a/lib/appRouters.dart b/lib/appRouters.dart index 99470270..eb4e6d5c 100755 --- a/lib/appRouters.dart +++ b/lib/appRouters.dart @@ -357,10 +357,10 @@ abstract class Routers { '/ValueAddedServicesHighFunctionPage'; // 增值服务-高级功能 static const String valueAddedServicesBuyPage = '/ValueAddedServicesBuyPage'; // 增值服务-购买服务 - static const String valueAddedServicesListSMSTemplatePage = - '/ValueAddedServicesListSMSTemplatePage'; // 增值服务-短信模版列表 - static const String valueAddedServicesAddSMSTemplatePage = - '/valueAddedServicesAddSMSTemplatePage'; // 增值服务-自定义短信模版 + static const String customSMSTemplateListPage = + '/CustomSMSTemplateListPage'; // 增值服务-短信模版列表 + static const String newSMSTemplatePage = + '/NewSMSTemplatePage'; // 增值服务-自定义短信模版 static const String valueAddedServicesListEmailTemplatePage = '/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表 static const String valueAddedServicesAddEmailTemplatePage = @@ -867,11 +867,11 @@ abstract class AppRouters { page: () => const ValueAddedServicesHighFunctionPage(), ), GetPage( - name: Routers.valueAddedServicesListSMSTemplatePage, + name: Routers.customSMSTemplateListPage, page: () => const CustomSMSTemplateListPage(), ), GetPage( - name: Routers.valueAddedServicesAddSMSTemplatePage, + name: Routers.newSMSTemplatePage, page: () => const NewSMSTemplatePage(), ), GetPage( diff --git a/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart index 1bb5f2d9..52db8831 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesEmailTemplate/valueAddedServicesListEmailTemplate/valueAddedServicesListEmailTemplate_page.dart @@ -24,7 +24,7 @@ class _ValueAddedServicesListEmailTemplatePageState return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.customMailTemplate!.tr, + barTitle: '自定义邮件模版'.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: Column( diff --git a/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart b/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart index a19bd936..0b1c7a8a 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_page.dart @@ -112,8 +112,8 @@ class _ValueAddedServicesNoteAndEmailDetailPageState GestureDetector( onTap: () { if (type == 1) { - Navigator.pushNamed(context, - Routers.valueAddedServicesListSMSTemplatePage); + Navigator.pushNamed( + context, Routers.customSMSTemplateListPage); } else { Navigator.pushNamed(context, Routers.valueAddedServicesListEmailTemplatePage); @@ -130,9 +130,7 @@ class _ValueAddedServicesNoteAndEmailDetailPageState height: 36.w, ), Text( - (type == 1) - ? '自定义短信模版'.tr - : TranslationLoader.lanKeys!.customMailTemplate!.tr, + (type == 1) ? '自定义短信模版'.tr : '自定义邮件模版'.tr, style: TextStyle(fontSize: 24.sp), ), ], diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart index 16363d46..9e65f85a 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart @@ -30,22 +30,27 @@ class NewSMSTemplateEntity { } class SMSTemplateData { - SMSTemplateData({this.contentType, this.name, this.template, this.fixedKey}); + SMSTemplateData( + {this.contentType, this.typeName, this.template, this.fixedKey}); SMSTemplateData.fromJson(Map json) { contentType = json['content_type']; - name = json['name']; + typeName = json['typeName']; template = json['template']; fixedKey = json['fixed_key']; } int? contentType; - String? name; + String? typeName; String? template; String? fixedKey; + String? regards = ''; + String? tips = ''; + int? id; + String? name; Map toJson() { final Map data = {}; data['content_type'] = contentType; - data['name'] = name; + data['typeName'] = typeName; data['template'] = template; data['fixed_key'] = fixedKey; return data; diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart index 62d9e411..52cc0378 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_logic.dart @@ -19,12 +19,11 @@ class NewSMSTemplateLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { state.templateList.value = entity.dataList ?? []; if (state.templateList.isNotEmpty) { - state.templateTypeText.value = state.templateList[0].name ?? ''; + // state.templateTypeText.value = state.templateList[0].name ?? ''; state.currentTemplate.value = state.templateList.firstWhere( (SMSTemplateData element) => - element.name == state.templateTypeText.value, + element.name == state.templateList[0].name, ); - state.templateTypeText.refresh(); state.currentTemplate.refresh(); } } @@ -45,7 +44,19 @@ class NewSMSTemplateLogic extends BaseGetXController { tips: state.templateTwoTf.text); if (entity.errorCode!.codeIsSuccessful) { showToast('添加成功'); - Get.back(); + Get.back(result: true); + } + } + + Future updateTemplateInfo() async { + final LoginEntity entity = await ApiRepository.to.updateTemplateInfo( + id: state.currentTemplate.value.id ?? 0, + name: state.templateNameTf.text, + regards: state.templateOneTf.text, + tips: state.templateTwoTf.text); + if (entity.errorCode!.codeIsSuccessful) { + showToast('修改成功'); + Get.back(result: true); } } @@ -188,5 +199,9 @@ class NewSMSTemplateLogic extends BaseGetXController { @override Future onReady() async { super.onReady(); + + if (state.isUpdate.value == false) { + getDefaultTemplate(); + } } } diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart index 5172e04d..160f1f0c 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart @@ -23,12 +23,6 @@ class _NewSMSTemplatePageState extends State { final NewSMSTemplateLogic logic = Get.put(NewSMSTemplateLogic()); final NewSMSTemplateState state = Get.find().state; - @override - void initState() { - super.initState(); - logic.getDefaultTemplate(); - } - @override Widget build(BuildContext context) { return Scaffold( @@ -52,7 +46,11 @@ class _NewSMSTemplatePageState extends State { child: SubmitBtn( btnName: TranslationLoader.lanKeys!.save!.tr, onClick: () { - logic.addSMSTemplate(); + if (state.isUpdate.value == true) { + logic.updateTemplateInfo(); + } else { + logic.addSMSTemplate(); + } }, ), ), @@ -79,7 +77,7 @@ class _NewSMSTemplatePageState extends State { Obx( () => CommonItem( leftTitel: TranslationLoader.lanKeys!.type!.tr, - rightTitle: state.templateTypeText.value, + rightTitle: state.currentTemplate.value.typeName ?? '', isHaveLine: false, isHaveDirection: true, action: _showSelectTemplateType, @@ -184,7 +182,7 @@ class _NewSMSTemplatePageState extends State { padding: EdgeInsets.symmetric(horizontal: 25.w, vertical: 10.h), child: Obx(() => RichText( text: TextSpan( - children: state.templateTypeText.value == '电子钥匙' + children: state.currentTemplate.value.typeName == '电子钥匙' ? logic.buildElectronicKeySpan(isPreview: isPreview) : logic.buildPasswordSpan(isPreview: isPreview), ), @@ -213,7 +211,9 @@ class _NewSMSTemplatePageState extends State { ), ), onChanged: (String value) { - controller.text = value; + setState(() { + controller.text = value; + }); }, ); } @@ -230,6 +230,7 @@ class _NewSMSTemplatePageState extends State { controller: tfController, autofocus: false, textAlign: TextAlign.end, + style: TextStyle(fontSize: 22.sp), decoration: InputDecoration( contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), hintText: tfStr, @@ -245,7 +246,7 @@ class _NewSMSTemplatePageState extends State { void _showSelectTemplateType() { final List titleList = state.templateList - .map((SMSTemplateData template) => template.name ?? '') + .map((SMSTemplateData template) => template.typeName ?? '') .toList(); ShowBottomSheetTool().showSingleRowPicker( context, @@ -255,9 +256,8 @@ class _NewSMSTemplatePageState extends State { sureTitle: TranslationLoader.lanKeys!.sure!.tr, data: titleList, clickCallBack: (int index, Object str) { - state.templateTypeText.value = str.toString(); - state.templateTypeText.refresh(); state.currentTemplate.value = state.templateList[index]; + state.currentTemplate.value.typeName = str.toString(); state.currentTemplate.refresh(); }, ); diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart index 8bd74667..74f97315 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_state.dart @@ -4,6 +4,18 @@ import 'package:get/get.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart'; class NewSMSTemplateState { + NewSMSTemplateState() { + if (Get.arguments != null) { + final Map map = Get.arguments; + currentTemplate.value = map['currentTemplate']; + currentTemplate.refresh(); + isUpdate.value = true; + templateNameTf.text = currentTemplate.value.name ?? ''; + templateOneTf.text = currentTemplate.value.regards ?? ''; + templateTwoTf.text = currentTemplate.value.tips ?? ''; + } + } + //高亮样式 final TextStyle highStyle = TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp); @@ -12,46 +24,15 @@ class NewSMSTemplateState { final TextStyle defaultStyle = TextStyle(color: Colors.black, fontSize: 20.sp); -//预览样式封装-密码 - // late InlineSpan passwardSpan = TextSpan(children: [ - // TextSpan( - // text: - // '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.yourRoomIs!.tr}:', - // style: defaultStyle), - // TextSpan(text: '201', style: highStyle), - // TextSpan( - // text: ' ${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}: ', - // style: defaultStyle), - // TextSpan(text: '332211\n', style: highStyle), - // TextSpan( - // text: '${TranslationLoader.lanKeys!.periodValidity!.tr}: ', - // style: defaultStyle), - // TextSpan(text: '2021.12.11 12:00 - 2021.12.12 13:00。\n', style: highStyle), - // TextSpan( - // text: TranslationLoader.lanKeys!.templateTip1!.tr, style: defaultStyle), - // ]); - -//预览样式封装-电子钥匙 - // late InlineSpan electronicKeySpan = TextSpan(children: [ - // TextSpan( - // text: - // '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.templateTip2!.tr}', - // style: defaultStyle), - // TextSpan(text: 'https://abc.com/bcd\n', style: highStyle), - // TextSpan( - // text: '${TranslationLoader.lanKeys!.templateTip3!.tr}\n', - // style: defaultStyle), - // TextSpan(text: 'https://abc.com/bcd', style: highStyle), - // ]); - final TextEditingController templateOneTf = TextEditingController(); final TextEditingController templateTwoTf = TextEditingController(); final TextEditingController templateNameTf = TextEditingController(); RxBool isVip = false.obs; RxList templateList = [].obs; - RxString templateTypeText = '电子钥匙'.tr.obs; - RxString templateContentText = ''.obs; //模版内容 + // RxString templateTypeText = '电子钥匙'.tr.obs; + // RxString templateContentText = ''.obs; //模版内容 Rx currentTemplate = SMSTemplateData().obs; RxBool isShowDate = false.obs; + RxBool isUpdate = false.obs; } diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart index 64b4db8f..5db7684d 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart'; @@ -53,9 +54,11 @@ class _CustomSMSTemplateListPageState extends State { margin: EdgeInsets.only( left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () { - Navigator.pushNamed( - context, Routers.valueAddedServicesAddSMSTemplatePage); + onClick: () async { + final result = await Get.toNamed(Routers.newSMSTemplatePage); + if (result != null) { + logic.getSMSTemplateListRequest(); + } }), SizedBox( height: 40.h, @@ -95,7 +98,6 @@ class _CustomSMSTemplateListPageState extends State { children: [ SizedBox( width: 1.sw - 15.w * 2 - 40.w * 2 - 140.w, - // margin: EdgeInsets.only(top:15.h, left: 15.w, right: 15.w, bottom: 15.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -150,12 +152,24 @@ class _CustomSMSTemplateListPageState extends State { Widget _valueAddedServicesListSMSTemplateItem( CustomSMSTemplateItem itemData) { return GestureDetector( - onTap: () { - Navigator.pushNamed( - context, Routers.valueAddedServicesAddSMSTemplatePage); + onTap: () async { + final SMSTemplateData templateData = SMSTemplateData(); + templateData.name = itemData.name; + templateData.regards = itemData.regards; + templateData.tips = itemData.tips; + templateData.id = itemData.id; + templateData.template = itemData.template; + templateData.contentType = itemData.contentType; + templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码'; + final result = await Get.toNamed(Routers.newSMSTemplatePage, + arguments: { + 'currentTemplate': templateData + }); + if (result != null) { + logic.getSMSTemplateListRequest(); + } }, child: Container( - // height: 100.h, margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), decoration: BoxDecoration( color: Colors.white, diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart index 50a8ccea..2b5198d2 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart @@ -1,9 +1,7 @@ -import 'dart:ui'; - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:star_lock/translations/trans_lib.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart'; class CustomSMSTemplateListState { //高亮样式 @@ -14,42 +12,6 @@ class CustomSMSTemplateListState { final TextStyle defaultStyle = TextStyle(color: Colors.black, fontSize: 20.sp); -// //预览样式封装-密码 -// late InlineSpan passwardSpan = TextSpan(children: [ -// TextSpan( -// text: -// '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.yourRoomIs!.tr}:', -// style: defaultStyle), -// TextSpan(text: '201', style: highStyle), -// TextSpan( -// text: ' ${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}: ', -// style: defaultStyle), -// TextSpan(text: '332211\n', style: highStyle), -// TextSpan( -// text: '${TranslationLoader.lanKeys!.periodValidity!.tr}: ', -// style: defaultStyle), -// TextSpan(text: '2021.12.11 12:00 - 2021.12.12 13:00。\n', style: highStyle), -// TextSpan( -// text: TranslationLoader.lanKeys!.templateTip1!.tr, style: defaultStyle), -// ]); - -// //预览样式封装-密码 -// late InlineSpan electronicKeySpan = TextSpan(children: [ -// TextSpan( -// text: -// '${TranslationLoader.lanKeys!.hello!.tr},\n${TranslationLoader.lanKeys!.templateTip2!.tr}', -// style: defaultStyle), -// TextSpan(text: 'https://abc.com/bcd\n', style: highStyle), -// TextSpan( -// text: '${TranslationLoader.lanKeys!.templateTip3!.tr}\n', -// style: defaultStyle), -// TextSpan(text: 'https://abc.com/bcd', style: highStyle), -// ]); - - // final TextEditingController templateOneTf = TextEditingController(); - // final TextEditingController templateTwoTf = TextEditingController(); - // final TextEditingController templateNameTf = TextEditingController(); - RxBool isVip = false.obs; - RxList smsTemplateList = [].obs; + RxList smsTemplateList = [].obs; } diff --git a/lib/network/api.dart b/lib/network/api.dart index 6f6ec420..9bdb14a0 100755 --- a/lib/network/api.dart +++ b/lib/network/api.dart @@ -250,4 +250,5 @@ abstract class Api { '/v2/service/getDefaultTemplate'; //获取默认模板 final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; //添加短信模板 final String keydetail = ' /key/detail'; //获取钥匙详情 + final String updateTemplateInfoURL = '/v2/service/update'; //更新模板信息 } diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index 81804437..403dd5cd 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -126,15 +126,12 @@ class ApiProvider extends BaseProvider { 'searchStr': searchStr })); - Future electronicKey( - int lockId, int keyId - ) => - post( - keydetail.toUrl, - jsonEncode({ - 'lockId': lockId.toString(), - 'keyId': keyId.toString(), - })); + Future electronicKey(int lockId, int keyId) => post( + keydetail.toUrl, + jsonEncode({ + 'lockId': lockId.toString(), + 'keyId': keyId.toString(), + })); Future sendElectronicKey( int createUser, @@ -449,13 +446,12 @@ class ApiProvider extends BaseProvider { 'searchStr': searchStr })); - Future passwordKey(int lockId, int keyboardPwdId,) => - post( - passwordKeyDetailURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'keyboardPwdId': keyboardPwdId - })); + Future passwordKey( + int lockId, + int keyboardPwdId, + ) => + post(passwordKeyDetailURL.toUrl, + jsonEncode({'lockId': lockId, 'keyboardPwdId': keyboardPwdId})); Future resetPasswordKey(String lockId, String operatorUid) => post( resetPasswordURL.toUrl, @@ -1116,17 +1112,15 @@ class ApiProvider extends BaseProvider { })); // 获取指纹详情 - Future getFingerprintsData( - int fingerprintId) => - post( - getFingerprintDetailURL.toUrl, - jsonEncode({ - 'fingerprintId': fingerprintId, - })); + Future getFingerprintsData(int fingerprintId) => post( + getFingerprintDetailURL.toUrl, + jsonEncode({ + 'fingerprintId': fingerprintId, + })); // 获取指纹列表 Future getFingerprintsListData( - String lockId, String pageNo, String pageSize, String searchStr) => + String lockId, String pageNo, String pageSize, String searchStr) => post( getFingerprintListURL.toUrl, jsonEncode({ @@ -2204,6 +2198,19 @@ class ApiProvider extends BaseProvider { }), isUnShowLoading: true, ); + + Future> updateTemplateInfo( + int id, String name, String regards, String tips) => + post( + updateTemplateInfoURL.toUrl, + jsonEncode({ + 'id': id, + 'name': name, + 'regards': regards, + 'tips': tips, + }), + isUnShowLoading: true, + ); } extension ExtensionString on String { diff --git a/lib/network/api_repository.dart b/lib/network/api_repository.dart index 556891a1..f8ef8da6 100755 --- a/lib/network/api_repository.dart +++ b/lib/network/api_repository.dart @@ -174,10 +174,9 @@ class ApiRepository { } //获取电子钥匙 - Future electronicKey({ - required int lockId,required int keyId - }) async { - final res = await apiProvider.electronicKey(lockId,keyId); + Future electronicKey( + {required int lockId, required int keyId}) async { + final res = await apiProvider.electronicKey(lockId, keyId); return ElectronicKeyEntity.fromJson(res.body); } @@ -425,13 +424,11 @@ class ApiRepository { } //密码获取 - Future passwordKey( int lockId,int keyboardPwdId) async { - final res = await apiProvider.passwordKey( - lockId, keyboardPwdId); + Future passwordKey(int lockId, int keyboardPwdId) async { + final res = await apiProvider.passwordKey(lockId, keyboardPwdId); return PasswordKeyEntity.fromJson(res.body); } - //重置密码钥匙 Future resetPasswordKey( String lockId, String operatorUid) async { @@ -2221,4 +2218,15 @@ class ApiRepository { type, name, contentType, regards, tips, fixedKey); return LoginEntity.fromJson(res.body); } + + // 更新模板信息 + Future updateTemplateInfo( + {required int id, + required String name, + required String regards, + required String tips}) async { + final Response res = + await apiProvider.updateTemplateInfo(id, name, regards, tips); + return LoginEntity.fromJson(res.body); + } } From 110bdc0aac1d966898874ecfb419d6c900f9f586 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 18:14:18 +0800 Subject: [PATCH 11/12] =?UTF-8?q?feat:=E6=B3=A8=E5=86=8C=E5=90=8E=E5=B0=86?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../register/starLock_register_logic.dart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/login/register/starLock_register_logic.dart b/lib/login/register/starLock_register_logic.dart index 54c11fed..53424f86 100755 --- a/lib/login/register/starLock_register_logic.dart +++ b/lib/login/register/starLock_register_logic.dart @@ -2,11 +2,16 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_settings.dart'; +import 'package:star_lock/blue/blue_manage.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart'; +import 'package:star_lock/tools/eventBusEventManage.dart'; +import 'package:star_lock/tools/storage.dart'; +import 'package:star_lock/tools/xs_jPhush.dart'; import '../../network/api_repository.dart'; import '../../tools/baseGetXController.dart'; @@ -49,12 +54,13 @@ class StarLockRegisterLogic extends BaseGetXController { verificationCode: state.verificationCode.value, deviceInfo: state.deviceInfoMap.value); if (entity.errorCode!.codeIsSuccessful) { - showToast('注册成功'.tr); - - Get.back(result: { - 'phoneOrEmailStr': state.phoneOrEmailStr.value, - 'pwd': state.pwd.value - }); + Storage.saveLoginData(entity.data); + Storage.setBool(saveIsVip, entity.data!.isVip == 1); + eventBus.fire(MineInfoChangeRefreshUI()); + XSJPushProvider().bindDeviceID(); + XSJPushProvider().initLocalNotification(isCancelLocalPush: false); + Get.offNamedUntil(Routers.starLockMain, (Route route) => false); + BlueManage().scanDevices.clear(); //清除设备缓存 } } From 3035a53ff79267fee76fb72c8acfe297f769f4ee Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 4 Jun 2024 18:32:36 +0800 Subject: [PATCH 12/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B2=A1=E6=9C=89=E9=BB=98=E8=AE=A4=E6=98=AF=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=A4=9A=E9=95=BF=E6=97=B6=E9=97=B4=EF=BC=8C=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E5=89=8D=E9=94=81=E4=B8=8A=E8=AE=BE=E7=9A=84?= =?UTF-8?q?=E4=BB=80=E4=B9=88=E6=97=B6=E9=97=B4=E5=9C=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8E=E5=B0=B1=E6=98=BE=E7=A4=BA=E8=BF=99=E4=B8=AA=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E3=80=82=E5=A6=82=E6=98=AF=E5=85=B3=E9=97=AD=E7=9A=84?= =?UTF-8?q?=E5=86=8D=E6=B7=BB=E5=8A=A0=E6=98=BE=E7=A4=BA=E4=B8=BA0?= =?UTF-8?q?=E7=A7=92=EF=BC=8C=E6=89=93=E5=BC=80=E8=BF=9B=E5=85=A5=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lockSet/automaticBlocking/automaticBlocking_logic.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart index 4dc59725..9f52c4d2 100755 --- a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart +++ b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart @@ -187,6 +187,10 @@ class AutomaticBlockingLogic extends BaseGetXController { } else { state.canNext.value = false; } + + if (!openLock && (state.autoLockTime.value.isEmpty || state.autoLockTime.value == '0')) { + state.autoLockTime.value = '5'; + } } @override