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 1/6] =?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 2/6] =?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 3/6] =?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 4/6] =?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 5/6] =?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 6/6] =?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({