diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 2f4064c2..2b25d84a 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -62,8 +62,8 @@ "getPasswordTip1":"密码在24小时内至少要使用过一次,否则将无效", "getPasswordTip2":"限时密码可以再有下期内不限次数使用 \n密码在生效后的24小时内至少要使用过一次,否则将失效", "getPasswordTip3":"密码有限期为6个小时,只能使用一次", - "getPasswordTip4":"可在锁旁边通过手机蓝牙添加,也可以通过网关远程添加", - "getPasswordTip5":"密码在生效后的24小时内至少要使用过一次,否则将失效", + "getPasswordTip4":"手动输入6-9位数字作为密码。可在锁旁边通过手机蓝牙添加,也可以通过网关远程添加", + "getPasswordTip5":"限时密码可以再有下期内不限次数使用 \n密码在生效后的24小时内至少要使用过一次,否则将失效", "getPasswordTip6":"密码有效期为24小时,在锁上输入后,将使之前使用过的密码都失效", "getTip":"获取", "addTip":"添加", diff --git a/star_lock/lib/login/login/starLock_login_page.dart b/star_lock/lib/login/login/starLock_login_page.dart index 0d222bde..c71036aa 100644 --- a/star_lock/lib/login/login/starLock_login_page.dart +++ b/star_lock/lib/login/login/starLock_login_page.dart @@ -63,8 +63,8 @@ class _StarLockLoginPageState extends State { hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, keyboardType: TextInputType.number, inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp('[0-9]')), - LengthLimitingTextInputFormatter(20), + // FilteringTextInputFormatter.allow(RegExp('[0-9]')), + LengthLimitingTextInputFormatter(30), ]), SizedBox(height: 10.h), LoginInput( diff --git a/star_lock/lib/login/register/starLock_register_page.dart b/star_lock/lib/login/register/starLock_register_page.dart index f0a87275..b49b895b 100644 --- a/star_lock/lib/login/register/starLock_register_page.dart +++ b/star_lock/lib/login/register/starLock_register_page.dart @@ -215,8 +215,8 @@ class _StarLockRegisterPageState extends State { hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, keyboardType: TextInputType.number, inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp('[0-9]')), - LengthLimitingTextInputFormatter(20), + // FilteringTextInputFormatter.allow(RegExp('[0-9]')), + LengthLimitingTextInputFormatter(30), ]), SizedBox(height: 10.w), LoginInput( diff --git a/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart b/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart index 6e42b12b..6109be79 100644 --- a/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart @@ -41,6 +41,7 @@ class _AddCardManageTabbarState extends State with SingleTi length: _itemTabs.length, initialIndex: widget.initialIndex); _tabController.addListener(() { + if (_tabController.animation!.value==_tabController.index){ FocusScope.of(context).requestFocus(FocusNode()); } @@ -96,8 +97,7 @@ class _AddCardManageTabbarState extends State with SingleTi return Expanded( child: TabBarView( controller: _tabController, - children: _itemTabs - .map((ItemView item) => AddCardPage( + children: _itemTabs.map((ItemView item) => AddCardPage( seletType: item.seletType, lockId: widget.lockId, fromType: widget.fromType, diff --git a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart index b7d4a6f6..46c8b60e 100644 --- a/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart +++ b/star_lock/lib/main/lockDetail/card/addCardType/addCardType_page.dart @@ -317,6 +317,7 @@ class _AddCardPageState extends State { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(18), ], + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: state.nameController, autofocus: false, textAlign: TextAlign.end, diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart index f80251fe..a435e424 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart @@ -37,7 +37,7 @@ class _CheckingInSetPageState extends State { children: [ Obx(() => CommonItem( leftTitel: - "${TranslationLoader.lanKeys!.company!.tr}${TranslationLoader.lanKeys!.name!.tr}", + "公司名称", // rightTitle: state.companyName.value ?? "", isHaveRightWidget: true, rightWidget: getTFWidget(), @@ -136,12 +136,12 @@ class _CheckingInSetPageState extends State { context: context, builder: (BuildContext context) { return ShowTFView( - title: "请输入公司名字", + title: "修改公司名字", tipTitle: "", controller: state.changeNameController, sureClick: () { if(state.changeNameController.text.isEmpty){ - logic.showToast("请输入公司姓名"); + logic.showToast("请输入公司名字"); return; } Get.back(); @@ -173,10 +173,10 @@ class _CheckingInSetPageState extends State { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(30), ], + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: state.nameController, autofocus: false, enabled: false, - style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), textAlign: TextAlign.end, decoration: InputDecoration( //输入里面输入文字内边距设置 diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart index a7b4cdf4..a9788994 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart @@ -257,6 +257,7 @@ class _CheckingInAddStaffPageState extends State { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(30), ], + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: tf, autofocus: false, textAlign: TextAlign.end, diff --git a/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSeletType/addFingerprintType_page.dart b/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSeletType/addFingerprintType_page.dart index bf81520d..d7568974 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSeletType/addFingerprintType_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/addFingerprintSeletType/addFingerprintType_page.dart @@ -297,6 +297,7 @@ class _AddFingerprintTypePageState extends State { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(18), ], + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: state.nameController, autofocus: false, textAlign: TextAlign.end, diff --git a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart index d84e3fa0..124de542 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; +import 'package:get/get.dart'; import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../blue/blue_manage.dart'; @@ -46,6 +47,7 @@ class AutomaticBlockingLogic extends BaseGetXController{ showToast("操作成功", something: (){ eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); + Get.back(); }); } } @@ -213,6 +215,18 @@ class AutomaticBlockingLogic extends BaseGetXController{ }); } + void ifCanNext() { + if(((state.isOpen.value != (state.lockSetInfoData.value.lockSettingInfo!.autoLock! == 1 ? true : false)) && + (state.autoLockTime.value != state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString()) && + (state.isJustForShow.value == false)) || ((state.isOpen.value = true) && (state.lockSetInfoData.value.lockSettingInfo!.autoLock! == 1) && + (state.autoLockTime.value != state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString()) && + (state.isJustForShow.value == false))){ + state.canNext.value = true; + }else{ + state.canNext.value = false; + } + } + @override void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_page.dart b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_page.dart index 1e4a7a82..d3f31edd 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_page.dart @@ -34,20 +34,25 @@ class _AutomaticBlockingPageState extends State with Rout haveBack: true, actionsList: [ Obx(() => TextButton( + onPressed: state.canNext.value == false ? null :() { + // if(state.isJustForShow.value == true){ + // return; + // } + // if(state.isCustomLockTime.value == true && state.timeController.text.isEmpty){ + // logic.showToast("请输入自定义时间"); + // return; + // } + + if(state.isOpen.value == false){ + showDeletAlertTipDialog(context); + }else{ + logic.sendAutoLock(); + } + }, child: Text( - state.isJustForShow.value == true ? "" : TranslationLoader.lanKeys!.save!.tr, + state.canNext.value == false ? "" : TranslationLoader.lanKeys!.save!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), ), - onPressed: () { - if(state.isJustForShow.value == true){ - return; - } - if(state.isCustomLockTime.value == true && state.timeController.text.isEmpty){ - logic.showToast("请输入自定义时间"); - return; - } - logic.sendAutoLock(); - }, )), ], backgroundColor: AppColors.mainColor), @@ -55,97 +60,106 @@ class _AutomaticBlockingPageState extends State with Rout children: [ Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr, - rightTitle: "${state.autoLockTime}s", isHaveLine: false, isHaveRightWidget: true, rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch())),), - Container(height: 10.h,), - Builder(builder: (context) { - return Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.delayTime!.tr, - rightTitle: state.isCustomLockTime.value == true ? "自定义" : "${state.autoLockTime.value}s", - isHaveLine: false, - isHaveDirection: true, - action: () { - if(state.isJustForShow.value == true){ - return; - } - var list = [ - "5", - "10", - "15", - "30", - "60", - TranslationLoader.lanKeys!.custom!.tr - ]; - ShowBottomSheetTool().showSingleRowPicker( - //上下文 - context, - //默认的索引 - normalIndex: 0, - title: TranslationLoader.lanKeys!.time!.tr, - cancelTitle: TranslationLoader.lanKeys!.cancel!.tr, - sureTitle: TranslationLoader.lanKeys!.sure!.tr, - //要显示的列表 - //可自定义数据适配器 - //adapter: PickerAdapter(), - data: list, - //选择事件的回调 - clickCallBack: (int index, var str) { - if(index != 5){ - state.isCustomLockTime.value = false; - state.autoLockTime.value = str.toString(); - }else{ - state.isCustomLockTime.value = true; + Visibility( + visible: state.isOpen.value == true ? true : false, + child: Column( + children: [ + Container(height: 10.h,), + Builder(builder: (context) { + return Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.delayTime!.tr, + rightTitle: state.isCustomLockTime.value == true ? "自定义" : (state.autoLockTime.value.isNotEmpty && state.autoLockTime.value != "0") ? "${state.autoLockTime}s" : "", + isHaveLine: false, + isHaveDirection: true, + action: () { + if(state.isJustForShow.value == true){ + return; } - }); - })); - }), - Container( - height: 10.h, - ), - Obx(() => Visibility( - visible: state.isCustomLockTime.value, - child: Container( - color: Colors.white, - padding: EdgeInsets.only( - left: 30.w, top: 10.w, right: 30.w, bottom: 10.w), - child: Column( - children: [ - Row( - children: [ - Text( - "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)", - style: TextStyle(fontSize: 24.sp), - ), - ], - ), - Obx(() => TextField( - //输入框一行 - maxLines: 1, - controller: state.timeController, - keyboardType: TextInputType.number, - autofocus: false, - readOnly: state.isJustForShow.value == true ? true : false, - decoration: InputDecoration( - //输入里面输入文字内边距设置 - contentPadding: - const EdgeInsets.only(top: 12.0, bottom: 8.0), - hintText: - "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)", - hintStyle: TextStyle(fontSize: 24.sp), - //不需要输入框下划线 - border: InputBorder.none, + var list = [ + "5", + "10", + "15", + "30", + "60", + TranslationLoader.lanKeys!.custom!.tr + ]; + ShowBottomSheetTool().showSingleRowPicker( + //上下文 + context, + //默认的索引 + normalIndex: 0, + title: TranslationLoader.lanKeys!.time!.tr, + cancelTitle: TranslationLoader.lanKeys!.cancel!.tr, + sureTitle: TranslationLoader.lanKeys!.sure!.tr, + //要显示的列表 + //可自定义数据适配器 + //adapter: PickerAdapter(), + data: list, + //选择事件的回调 + clickCallBack: (int index, var str) { + if(index != 5){ + state.isCustomLockTime.value = false; + state.autoLockTime.value = str.toString(); + }else{ + state.isCustomLockTime.value = true; + } + logic.ifCanNext(); + }); + })); + }), + Container(height: 10.h), + Obx(() => Visibility( + visible: state.isCustomLockTime.value, + child: Container( + color: Colors.white, + padding: EdgeInsets.only( + left: 30.w, top: 10.w, right: 30.w, bottom: 10.w), + child: Column( + children: [ + Row( + children: [ + Text( + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)", + style: TextStyle(fontSize: 24.sp), + ), + ], + ), + Obx(() => TextField( + //输入框一行 + maxLines: 1, + controller: state.timeController, + keyboardType: TextInputType.number, + autofocus: false, + readOnly: state.isJustForShow.value == true ? true : false, + onChanged: (value) { + state.autoLockTime.value = value; + logic.ifCanNext(); + }, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: + const EdgeInsets.only(top: 12.0, bottom: 8.0), + hintText: + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)", + hintStyle: TextStyle(fontSize: 24.sp), + //不需要输入框下划线 + border: InputBorder.none, + ), + )), + Container( + height: 0.5.h, + color: Colors.grey, + ), + ], ), - )), - Container( - height: 0.5.h, - color: Colors.grey, - ), - ], - ), - ))), + ))), + ], + ), + ), Container( padding: EdgeInsets.all(30.w), child: Row( @@ -169,17 +183,44 @@ class _AutomaticBlockingPageState extends State with Rout trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, value: state.isOpen.value, - onChanged: (value) { + onChanged: state.isJustForShow.value == true ? null : (value){ setState(() { state.isOpen.value = value; if(state.isOpen.value == false){ - state.autoLockTime.value = "0"; + state.autoLockTime.value = ""; } + logic.ifCanNext(); }); }, ); } + void showDeletAlertTipDialog(BuildContext context) { + showCupertinoDialog( + context: context, + builder: (context) { + return CupertinoAlertDialog( + // title: const Text("提示"), + content: const Text('关闭后,智能锁将设置为全天常开模式,直到手动关闭'), + actions: [ + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.cancel!.tr), + onPressed: () { + Get.back(); + }, + ), + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.sure!.tr), + onPressed: () { + Get.back(); + logic.sendAutoLock(); + }, + ), + ], + ); + }, + ); + } @override void didChangeDependencies() { diff --git a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_state.dart b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_state.dart index aad60abb..768bf6bc 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_state.dart @@ -11,13 +11,15 @@ class AutomaticBlockingState { var isJustForShow = false.obs;// 是否只是作为展示作用,因为普通用户只是展示,不可修改 var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 - var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) + var sureBtnState = 0.obs;// 0可点击 1 不可点击 var isOpen = false.obs;// 是否开启自动落锁 var autoLockTime = "5".obs; var isCustomLockTime = false.obs;// 自定义 final TextEditingController timeController = TextEditingController(); + var canNext = false.obs;// 是否可以点击下一步 + AutomaticBlockingState() { var map = Get.arguments; lockSetInfoData.value = map["lockSetInfoData"]; @@ -29,6 +31,7 @@ class AutomaticBlockingState { if(lockBasicInfo.value.isLockOwner == 1 || lockBasicInfo.value.keyRight == 1){ isJustForShow.value = false; }else{ + // 普通用户只用来展示 isJustForShow.value = true; } diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart index 2196811e..084e257b 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart @@ -121,7 +121,12 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{ print("indexList:$indexList"); var pwd = indexList.sublist(1, 11); var pwdStr = utf8String(pwd); - print("pwd:$pwd pwdStr:$pwdStr"); + print("pwd:$pwd pwdStr:$pwdStr state.adminPwd.value:${state.adminPwd.value}"); + + // if(pwdStr == state.adminPwd.value){ + // showToast(""); + // return; + // } state.adminPwd.value = pwdStr; addLockAdminPassword(false); } diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_page.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_page.dart index 85e8859b..d9563052 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_page.dart @@ -88,7 +88,7 @@ class _AdminOpenLockPasswordPageState extends State { context: context, builder: (BuildContext context) { return ShowTFView( - title: "管理员密码", + title: "修改密码", tipTitle: "请输入", keyboardType: TextInputType.number, inputFormatters: [ diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart index 51de02dc..a9f85bbb 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart @@ -75,7 +75,12 @@ class _BasicInformationPageState extends State { allHeight: 70.h, isHaveLine: false), SizedBox(height: 10.h), - CommonItem( + Visibility( + visible: (state.lockBasicInfo.value.isLockOwner == 1 || + state.lockBasicInfo.value.keyRight == 1) + ? true + : false, + child: CommonItem( leftTitel: TranslationLoader.lanKeys!.lockName!.tr, rightTitle: state.lockBasicInfo.value.lockAlias, isHaveLine: true, @@ -90,7 +95,7 @@ class _BasicInformationPageState extends State { state.lockBasicInfo.value = data["lockBasicInfo"]; }); } - }), + })), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr, rightTitle: state.lockBasicInfo.value.groupName, diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_logic.dart index 53123504..4bcae544 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_logic.dart @@ -16,9 +16,12 @@ class EditLockNameLogic extends BaseGetXController{ lockId: state.lockSetInfoData.value.lockId.toString(), lockName:state.changeLockNameController.text); if (entity.errorCode!.codeIsSuccessful) { - showToast("修改成功"); - state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text; - eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!)); + showToast("修改成功", something: (){ + state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text; + eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!)); + eventBus.fire(RefreshLockListInfoDataEvent()); + }); + Get.back(result: { "lockBasicInfo":state.lockBasicInfo.value }); diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart index 08ab30d7..1daedf9c 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart @@ -23,11 +23,12 @@ class UploadElectricQuantityLogic extends BaseGetXController { Future uploadElectricQuantityRequest(String electricQuantity) async { KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(electricQuantity, state.lockSetInfoData.value.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { - eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); - eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, electricQuantity)); - eventBus.fire(RefreshLockListInfoDataEvent()); - showToast("锁电量更新成功"); + showToast("锁电量更新成功", something: (){ + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); + eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, electricQuantity)); + eventBus.fire(RefreshLockListInfoDataEvent()); + }); } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart index 76881783..7bf772a9 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart @@ -41,4 +41,15 @@ class CheckInCreatCompanyLogic extends BaseGetXController{ showToast("设置成功"); } } + + void ifCanNext() { + if(state.companyNameController.text.isNotEmpty && + state.weekDays.value.isNotEmpty && + state.beginTimeTimestamp.value.isNotEmpty && + state.endTimeTimestamp.value.isNotEmpty) { + state.canNext.value = true; + }else{ + state.canNext.value = false; + } + } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart index 665987eb..91bb7e2d 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart @@ -55,12 +55,11 @@ class _CheckInCreatCompanyPageState extends State { }); if(data != null) { - setState(() { state.beginTime.value = data["beginTime"]; state.endTime.value = data["endTime"]; state.beginTimeTimestamp.value = data["beginTimeTimestamp"]; state.endTimeTimestamp.value = data["endTimeTimestamp"]; - }); + logic.ifCanNext(); } })), Obx(() => CommonItem( @@ -77,26 +76,26 @@ class _CheckInCreatCompanyPageState extends State { "checkingInSetInfo": CheckingInSetInfo(), }); if(data != null) { - setState(() { state.isCustom.value = data["attendanceType"]; state.weekDays.value = data["weekDays"]; state.weekDaysStr.value = state.weekDays.value.join(","); - }); + logic.ifCanNext(); } })), SizedBox( height: 30.h, ), - SubmitBtn( + Obx(() => SubmitBtn( btnName: TranslationLoader.lanKeys!.sure!.tr, borderRadius: 20.w, fontSize: 32.sp, isDelete: false, margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w), padding: EdgeInsets.only(top: 20.w, bottom: 20.w), - onClick: () { + isDisabled: state.canNext.value, + onClick: state.canNext.value ? (){ logic.setCheckInCreateCompany(); - }), + }: null)), ], ), ); @@ -117,8 +116,12 @@ class _CheckInCreatCompanyPageState extends State { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(30), ], + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), autofocus: false, textAlign: TextAlign.end, + onChanged: (value) { + logic.ifCanNext(); + }, decoration: InputDecoration( //输入里面输入文字内边距设置 // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_state.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_state.dart index 9a80bedf..4c6e892e 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_state.dart @@ -19,6 +19,8 @@ class CheckInCreatCompanyState{ var endTime = "".obs;// 结束时间 var beginTimeTimestamp = "".obs;// 开始时间时间戳 var endTimeTimestamp = "".obs;// 结束时间时间戳 + + var canNext = false.obs;// 是否可以点击下一步 CheckInCreatCompanyState() { var map = Get.arguments; lockSetInfoData.value = map["lockSetInfoData"]; diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart index 1e911a59..99685ffd 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart @@ -680,10 +680,11 @@ class LockSetLogic extends BaseGetXController { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus _passCurrentLockInformationEvent = eventBus.on().listen((event) { - state.lockSetInfoData.value = event.lockSetInfoData; - state.isAttendance.value = state.lockSetInfoData.value.lockSettingInfo!.attendance!; + // state.lockSetInfoData.value = event.lockSetInfoData; + // state.isAttendance.value = state.lockSetInfoData.value.lockSettingInfo!.attendance!; // print("22222event.lockSetInfoData.lockSettingInfo!.autoLockSecond:${event.lockSetInfoData.lockSettingInfo!.autoLockSecond}"); - blockSetStateCallback(); + // blockSetStateCallback(); + getLockSettingInfoData(); }); } diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index 55e5a863..ee06c7af 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -216,8 +216,8 @@ class _LockSetPageState extends State with RouteAware { visible: state.lockFeature.value.autoLock == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr, - rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0 - ? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s" + rightTitle: state.lockSettingInfo.value.autoLock! > 0 + ? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s" : TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, isHaveDirection: true, @@ -285,8 +285,8 @@ class _LockSetPageState extends State with RouteAware { SizedBox(height: 10.h), // 常开模式 Obx(() => Visibility( - visible: state.lockFeature.value.passageMode == 1 ? true : false, - // visible:true, + // visible: state.lockFeature.value.passageMode == 1 ? true : false, + visible:true, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr, rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1 diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_logic.dart index 0784dcc2..8ecd8d47 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_logic.dart @@ -31,6 +31,7 @@ class LockSoundSetLogic extends BaseGetXController { state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :0; state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value; eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); + ifCanNext(); showToast("操作成功"); } } @@ -197,6 +198,14 @@ class LockSoundSetLogic extends BaseGetXController { }); } + void ifCanNext() { + if((state.lockSoundLevel.value != state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume!) || (state.isOpenLockSound.value != (state.lockSetInfoData.value.lockSettingInfo!.lockSound == 1 ? true : false))){ + state.canNext.value = true; + }else{ + state.canNext.value = false; + } + } + @override void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_page.dart index 718fc307..68af412a 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_page.dart @@ -73,7 +73,7 @@ class _LockSoundSetPageState extends State with RouteAware { .lanKeys!.pleaseSeletLockVolume!.tr, rightTitle: "", isHaveLine: true), - CommonItem( + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.low!.tr, rightTitle: "", isHaveLine: true, @@ -83,6 +83,7 @@ class _LockSoundSetPageState extends State with RouteAware { setState(() { state.lockSoundLevel.value = 1; }); + logic.ifCanNext(); }, child: Row( children: [ @@ -93,17 +94,18 @@ class _LockSoundSetPageState extends State with RouteAware { ), ], ), - )), - CommonItem( + ))), + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.lower!.tr, rightTitle: "", isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: () { - setState(() { + // setState(() { state.lockSoundLevel.value = 2; - }); + // }); + logic.ifCanNext(); }, child: Row( children: [ @@ -114,17 +116,18 @@ class _LockSoundSetPageState extends State with RouteAware { ), ], ), - )), - CommonItem( + ))), + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.medium!.tr, rightTitle: "", isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: () { - setState(() { + // setState(() { state.lockSoundLevel.value = 3; - }); + // }); + logic.ifCanNext(); }, child: Row( children: [ @@ -135,17 +138,18 @@ class _LockSoundSetPageState extends State with RouteAware { ), ], ), - )), - CommonItem( + ))), + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.higher!.tr, rightTitle: "", isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: () { - setState(() { - state.lockSoundLevel.value = 4; - }); + // setState(() { + state.lockSoundLevel.value = 4; + // }); + logic.ifCanNext(); }, child: Row( children: [ @@ -156,17 +160,18 @@ class _LockSoundSetPageState extends State with RouteAware { ), ], ), - )), - CommonItem( + ))), + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.high!.tr, rightTitle: "", isHaveLine: true, isHaveRightWidget: true, rightWidget: GestureDetector( onTap: () { - setState(() { - state.lockSoundLevel.value = 5; - }); + // setState(() { + state.lockSoundLevel.value = 5; + // }); + logic.ifCanNext(); }, child: Row( children: [ @@ -177,7 +182,7 @@ class _LockSoundSetPageState extends State with RouteAware { ), ], ), - )), + ))), ], ), )), @@ -185,9 +190,10 @@ class _LockSoundSetPageState extends State with RouteAware { margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.w), child: SubmitBtn( btnName: TranslationLoader.lanKeys!.save!.tr, - onClick: () { + isDisabled: state.canNext.value, + onClick: state.canNext.value ? (){ logic.sendLockSound(); - }), + }: null), ), ], ))); @@ -203,6 +209,7 @@ class _LockSoundSetPageState extends State with RouteAware { setState(() { state.isOpenLockSound.value = value; }); + logic.ifCanNext(); }, ); } diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_state.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_state.dart index f1859dfc..a61bf752 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_state.dart @@ -10,6 +10,7 @@ class LockSoundSetState { var lockSoundLevel = 0.obs;// 音量等级 var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) + var canNext = false.obs;// 是否可以点击下一步 LockSoundSetState() { var map = Get.arguments; diff --git a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart index adb18730..43b1aff7 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart @@ -47,12 +47,13 @@ class NormallyOpenModeLogic extends BaseGetXController{ passageModeConfig: passageModeConfig, ); if(entity.errorCode!.codeIsSuccessful){ - eventBus.fire(RefreshLockListInfoDataEvent()); + showToast("操作成功", something: (){ + eventBus.fire(RefreshLockListInfoDataEvent()); - state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:0; - eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); - eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(2, state.lockSetInfoData.value.lockSettingInfo!.passageMode!.toString())); - showToast("操作成功"); + state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:0; + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); + eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(2, state.lockSetInfoData.value.lockSettingInfo!.passageMode!.toString())); + }); } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_page.dart b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_page.dart index 9fd3bed0..86fc25db 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_page.dart @@ -186,6 +186,10 @@ class _NormallyOpenModePageState extends State with RouteA } return GestureDetector( onTap: () { + if(state.isJustForShow.value == true){ + return; + } + if (state.weekDays.value.contains(index)) { state.weekDays.value.remove(index); } else { @@ -235,6 +239,10 @@ class _NormallyOpenModePageState extends State with RouteA rightWidget: GestureDetector( onTap: () { // 选择全天模式 + if(state.isJustForShow.value == true){ + return; + } + if (state.isAllDay.value == 1) { state.isAllDay.value = 0; } else { @@ -274,6 +282,10 @@ class _NormallyOpenModePageState extends State with RouteA isHaveDirection: true, isHaveLine: true, action: () { + if(state.isJustForShow.value == true){ + return; + } + Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) { setState(() { @@ -289,6 +301,10 @@ class _NormallyOpenModePageState extends State with RouteA rightTitle: state.endTime.value, isHaveDirection: true, action: () { + if(state.isJustForShow.value == true){ + return; + } + Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) { setState(() { @@ -312,7 +328,7 @@ class _NormallyOpenModePageState extends State with RouteA trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, value: state.isOpenNormallyOpenMode.value, - onChanged: (value) { + onChanged: state.isJustForShow.value == true ? null : (value) { setState(() { state.isOpenNormallyOpenMode.value = value; }); diff --git a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart index 73b58c0f..b4eeb56a 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart @@ -141,7 +141,7 @@ class _WirelessKeyboardPageState extends State { context: widgetContext, builder: (context) { return CupertinoAlertDialog( - title: const Text('该锁的电子钥匙都将被删除'), + title: const Text('该锁的无线键盘都将被删除'), actions: [ CupertinoDialogAction( child: Text(TranslationLoader.lanKeys!.cancel!.tr), diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index ea67540d..95adbbfb 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -3,7 +3,6 @@ import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; -import 'package:uuid/uuid.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; @@ -358,8 +357,10 @@ class _LockDetailPageState extends State // ic卡 if (state.keyInfos.value.lockFeature!.icCard == 1) { - showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', - TranslationLoader.lanKeys!.card!.tr, () { + showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () { + // logic.showToast("普通用户第一次需要在锁旁边操作哦。", something: () { + // logic.showEasyLoading(); + // }); Get.toNamed(Routers.cardListPage, arguments: { "lockId": widget.lockListInfoItemEntity.lockId, }); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart index 484e52f9..d1b1384e 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart @@ -3,6 +3,7 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/password import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/eventBusEventManage.dart'; class PasswordKeyDetailLogic extends BaseGetXController { final PasswordKeyDetailState state = PasswordKeyDetailState(); @@ -20,21 +21,108 @@ class PasswordKeyDetailLogic extends BaseGetXController { } //更新密码请求 - Future updatePwdRequest() async { + Future updatePwdRequest(int changType) async { PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey( lockId: state.itemData.value.lockId!, keyboardPwdId: state.itemData.value.keyboardPwdId.toString(), keyboardPwdName: state.inputNameController.text, newKeyboardPwd: state.inputPwdController.text, - startDate: state.startDate.value, - endDate: state.endDate.value, + startDate: state.itemData.value.startDate!, + endDate: state.itemData.value.endDate!, changeType: state.changeType.value, - hoursStart: state.hoursStart.value, - hoursEnd: state.hoursEnd.value, - isCoerced: state.isCoerced.value); + hoursStart: state.itemData.value.hoursStart!, + hoursEnd: state.itemData.value.hoursEnd!, + isCoerced: state.itemData.value.isCoerced!.toString()); if (entity.errorCode!.codeIsSuccessful) { showToast("修改成功"); + if(changType == 1){ + // 修改名字 + state.keyboardPwdName.value = state.inputNameController.text; + }else if(changType == 2){ + // 修改密码 + state.keyboardPwd.value = state.inputPwdController.text; + } + print("state.itemData.value.keyboardPwd:${state.itemData.value.keyboardPwd} state.itemData.value.keyboardPwdName:${state.itemData.value.keyboardPwdName}"); Get.back(); + eventBus.fire(GetPasswordListRefreshUI()); } } + + //使用期限 + String getUseDateStr() { + int? getPwdType = state.itemData.value.keyboardPwdType; + String useDateStr = ''; + DateTime startDateStr = + DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!); + DateTime endDateStr = + DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!); + int starHour = startDateStr.hour; + int endHour = endDateStr.hour; + + switch (getPwdType) { + case 1: + //单次 1 只能在开始时间后6小时内使用一次 + useDateStr = + '${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}'; + break; + case 2: + //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 + useDateStr = '永久'; + break; + case 3: + //限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 + useDateStr = + '${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}'; + break; + case 4: + //删除 4 在锁上使用后会删除之前在锁上使用过的密码 + useDateStr = + '${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}'; + break; + case 5: + //周未循环 5 在周未开始和结束时间指定时间段内有效 + useDateStr = '周末 $starHour:00-$endHour:00'; + break; + case 6: + //每日循环 6 每天开始和结束时间指定时间段内有效 + useDateStr = '周日 $starHour:00-$endHour:00'; + break; + case 7: + //工作日循环 7 工作日开始和结束时间指定的时间段内有效 + useDateStr = '工作日 $starHour:00-$endHour:00'; + break; + case 8: + //周一循环 8 每周一开始和结束时间指定时间段内有效 + useDateStr = '周一 $starHour:00-$endHour:00'; + break; + case 9: + //周二循环 9 每周二开始和结束时间指定时间段内有效 + useDateStr = '周二 $starHour:00-$endHour:00'; + break; + case 10: + //周三循环 10 每周三开始和结束时间指定时间段内有效 + useDateStr = '周三 $starHour:00-$endHour:00'; + break; + case 11: + //周四循环 11 每周四开始和结束时间指定时间段内有效 + useDateStr = '周四 $starHour:00-$endHour:00'; + break; + case 12: + //周五循环 12 每周五开始和结束时间指定时间段内有效 + useDateStr = '周五 $starHour:00-$endHour:00'; + break; + case 13: + //周六循环 13 每周六开始和结束时间指定时间段内有效 + useDateStr = '周六 $starHour:00-$endHour:00'; + break; + case 14: + //周天循环 14 每周日开始和结束时间指定时间段内有效 + useDateStr = '周天 $starHour:00-$endHour:00'; + break; + + default: + } + return useDateStr; + } + } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 8e284f6d..d210f648 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -50,53 +50,45 @@ class _PasswordKeyDetailPageState extends State { body: SingleChildScrollView( child: Column( children: [ - CommonItem( + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.password!.tr, - rightTitle: state.inputPwdController.text.isNotEmpty - ? state.inputPwdController.text - : state.itemData.value.keyboardPwd, + rightTitle: state.keyboardPwd.value, isHaveDirection: (state.itemData.value.keyboardPwdType == 1 || - state.itemData.value.keyboardPwdType == 4) + state.itemData.value.keyboardPwdType == 4) ? false : true, isHaveLine: true, action: () { - if (state.itemData.value.keyboardPwdType == 1 || - state.itemData.value.keyboardPwdType == 4) { + if (state.itemData.value.keyboardPwdType == 1 || state.itemData.value.keyboardPwdType == 4) { return; } else { - showCupertinoAlertDialog( - context, state.inputPwdController); + showCupertinoAlertDialog(context, state.inputPwdController); } - }), - CommonItem( + })), + Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.name!.tr, - rightTitle: state.inputNameController.text.isNotEmpty - ? state.inputNameController.text - : state.itemData.value.keyboardPwdName, + rightTitle: state.keyboardPwdName.value, isHaveDirection: true, isHaveLine: true, action: () { showCupertinoAlertDialog( context, state.inputNameController); - }), + })), CommonItem( - leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, - rightTitle: getUseDateStr(), - isHaveDirection: true, + leftTitel: "有效期", + rightTitle: logic.getUseDateStr(), + isHaveDirection: ((state.itemData.value.keyboardPwdType! > 3 && + state.itemData.value.keyboardPwdType! < 15) || state.itemData.value.keyboardPwdType! == 1) ? false : true, allHeight: state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h, action: () { - if (state.itemData.value.keyboardPwdType! > 4 && - state.itemData.value.keyboardPwdType! < 15) { + if ((state.itemData.value.keyboardPwdType! > 3 && + state.itemData.value.keyboardPwdType! < 15 ) || state.itemData.value.keyboardPwdType! == 1) { return; } - Navigator.pushNamed( - context, Routers.passwordKeyDetailChangeDatePage, + Get.toNamed(Routers.passwordKeyDetailChangeDatePage, arguments: { 'itemData': state.itemData.value, - 'lockId': state.itemData.value.lockId, - 'pwdId': state.itemData.value.keyboardPwdId.toString() }); }), Container(height: 10.h), @@ -204,88 +196,10 @@ class _PasswordKeyDetailPageState extends State { )); } - //使用期限 - String getUseDateStr() { - int? getPwdType = state.itemData.value.keyboardPwdType; - String useDateStr = ''; - DateTime startDateStr = - DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!); - DateTime endDateStr = - DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!); - int starHour = startDateStr.hour; - int endHour = endDateStr.hour; - - switch (getPwdType) { - case 1: - //单次 1 只能在开始时间后6小时内使用一次 - useDateStr = - '${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}'; - break; - case 2: - //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 - useDateStr = '永久'; - break; - case 3: - //限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 - useDateStr = - '${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}'; - break; - case 4: - //删除 4 在锁上使用后会删除之前在锁上使用过的密码 - useDateStr = - '${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}'; - break; - case 5: - //周未循环 5 在周未开始和结束时间指定时间段内有效 - useDateStr = '周末 $starHour:00-$endHour:00'; - break; - case 6: - //每日循环 6 每天开始和结束时间指定时间段内有效 - useDateStr = '周日 $starHour:00-$endHour:00'; - break; - case 7: - //工作日循环 7 工作日开始和结束时间指定的时间段内有效 - useDateStr = '工作日 $starHour:00-$endHour:00'; - break; - case 8: - //周一循环 8 每周一开始和结束时间指定时间段内有效 - useDateStr = '周一 $starHour:00-$endHour:00'; - break; - case 9: - //周二循环 9 每周二开始和结束时间指定时间段内有效 - useDateStr = '周二 $starHour:00-$endHour:00'; - break; - case 10: - //周三循环 10 每周三开始和结束时间指定时间段内有效 - useDateStr = '周三 $starHour:00-$endHour:00'; - break; - case 11: - //周四循环 11 每周四开始和结束时间指定时间段内有效 - useDateStr = '周四 $starHour:00-$endHour:00'; - break; - case 12: - //周五循环 12 每周五开始和结束时间指定时间段内有效 - useDateStr = '周五 $starHour:00-$endHour:00'; - break; - case 13: - //周六循环 13 每周六开始和结束时间指定时间段内有效 - useDateStr = '周六 $starHour:00-$endHour:00'; - break; - case 14: - //周天循环 14 每周日开始和结束时间指定时间段内有效 - useDateStr = '周天 $starHour:00-$endHour:00'; - break; - - default: - } - return useDateStr; - } - //发送时间 String getSenderDate(PasswordKeyListItem indexEntity) { String senderDate = ''; - DateTime dateStr = - DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); + DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); senderDate = dateStr.toLocal().toString().substring(0, 16); return senderDate; } @@ -299,13 +213,15 @@ class _PasswordKeyDetailPageState extends State { title: inputController == state.inputNameController ? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}" : "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}", - tipTitle: - inputController.text.isNotEmpty ? inputController.text : "请输入", + tipTitle: inputController.text.isNotEmpty ? inputController.text : "请输入", controller: inputController, + keyboardType: inputController == state.inputNameController + ? TextInputType.text + : TextInputType.number, sureClick: () { //发送编辑钥匙名称请求 if (inputController.text.isNotEmpty) { - logic.updatePwdRequest(); + logic.updatePwdRequest(inputController == state.inputNameController ? 1 : 2); } }, cancelClick: () { @@ -321,7 +237,7 @@ class _PasswordKeyDetailPageState extends State { context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.circular(10)), - constraints: BoxConstraints(maxHeight: 260.h), + constraints: BoxConstraints(maxHeight: 270.h), builder: (BuildContext context) { return Column( children: [ diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart index 5745bef6..e08660f5 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart @@ -6,16 +6,25 @@ class PasswordKeyDetailState { final itemData = PasswordKeyListItem().obs; final TextEditingController inputPwdController = TextEditingController(); final TextEditingController inputNameController = TextEditingController(); - final changeType = '1' - .obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效 - final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警) - final hoursStart = 0.obs; - final hoursEnd = 0.obs; - final startDate = 0.obs; - final endDate = 0.obs; + final changeType = '1'.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效 + final keyboardPwd = ''.obs; + final keyboardPwdName = ''.obs; + // final hoursStart = 0.obs; + // final hoursEnd = 0.obs; + // final startDate = 0.obs; + // final endDate = 0.obs; PasswordKeyDetailState() { Map map = Get.arguments; itemData.value = map["itemData"]; + // isCoerced.value = itemData.value.isCoerced!.toString(); + keyboardPwd.value = itemData.value.keyboardPwd!; + keyboardPwdName.value = itemData.value.keyboardPwdName!; + inputNameController.text = itemData.value.keyboardPwdName!; + inputPwdController.text = itemData.value.keyboardPwd!; + // startDate.value = itemData.value.startDate!; + // endDate.value = itemData.value.endDate!; + // hoursStart.value = itemData.value.hoursStart!; + // hoursEnd.value = itemData.value.hoursEnd!; } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart index e641a0d0..6dd252b5 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart @@ -4,27 +4,30 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/pass import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; -class PasswordKeyDetailChangeDateLogic extends BaseGetXController { - final PasswordKeyDetailChangeDateState state = - PasswordKeyDetailChangeDateState(); +import '../../../../tools/eventBusEventManage.dart'; +class PasswordKeyDetailChangeDateLogic extends BaseGetXController { + final PasswordKeyDetailChangeDateState state = PasswordKeyDetailChangeDateState(); //更新密码请求 Future updatePwdRequest() async { PasswordKeyEntity entity = await ApiRepository.to.updatePasswordKey( lockId: state.itemData.value.lockId!, - keyboardPwdId: state.pwdId.value.toString(), - keyboardPwdName: state.inputNameController.text, - newKeyboardPwd: state.inputPwdController.text, - startDate: state.startDate.value, - endDate: state.endDate.value, - changeType: state.changeType.value, - hoursStart: state.hoursStart.value, - hoursEnd: state.hoursEnd.value, - isCoerced: state.isCoerced.value); + keyboardPwdId: state.itemData.value.keyboardPwdId.toString(), + keyboardPwdName: state.itemData.value.keyboardPwdName!, + newKeyboardPwd: state.itemData.value.keyboardPwd!, + startDate: state.itemData.value.startDate!, + endDate: state.itemData.value.endDate!, + changeType: '1', + hoursStart: state.itemData.value.hoursStart!, + hoursEnd: state.itemData.value.hoursEnd!, + isCoerced: "1"); if (entity.errorCode!.codeIsSuccessful) { showToast("修改成功", something: (){ + eventBus.fire(GetPasswordListRefreshUI()); Get.back(); }); } } + + } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart index f9010216..dd3d335a 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart @@ -39,9 +39,9 @@ class _PasswordKeyDetailChangeDatePage style: TextStyle(color: Colors.white, fontSize: 24.sp), ), onPressed: () { - if (state.lockId.value != 0 && state.pwdId.value.isNotEmpty) { + // if (state.lockId.value != 0 && state.pwdId.value.isNotEmpty) { logic.updatePwdRequest(); - } + // } }, ), ], @@ -75,12 +75,12 @@ class _PasswordKeyDetailChangeDatePage isHaveLine: true, isHaveDirection: true, action: () { - Pickers.showDatePicker(context, mode: DateMode.YMDHM, + Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) { state.selectEffectiveDate.value = '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'; - state.effectiveDateTime = - DateTime.parse(state.selectEffectiveDate.value); + // state.effectiveDateTime = DateTime.parse(state.selectEffectiveDate.value); + state.itemData.value.startDate = DateTime.parse(state.selectEffectiveDate.value).millisecondsSinceEpoch; //更新开始时间 }); })), Obx(() => CommonItem( @@ -90,12 +90,12 @@ class _PasswordKeyDetailChangeDatePage : getEndDate, isHaveDirection: true, action: () { - Pickers.showDatePicker(context, mode: DateMode.YMDHM, + Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) { state.selectFailureDate.value = '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'; - state.failureDateTime = - DateTime.parse(state.selectFailureDate.value); + // state.failureDateTime = DateTime.parse(state.selectFailureDate.value); + state.itemData.value.endDate = DateTime.parse(state.selectFailureDate.value).millisecondsSinceEpoch; //更新结束时间 }); })), ], diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_state.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_state.dart index 7643dae7..63bdad8a 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_state.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_state.dart @@ -4,25 +4,24 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKe class PasswordKeyDetailChangeDateState { final itemData = PasswordKeyListItem().obs; - final TextEditingController inputPwdController = TextEditingController(); - final TextEditingController inputNameController = TextEditingController(); - final changeType = '1' - .obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效 - final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警) - final hoursStart = 0.obs; - final hoursEnd = 0.obs; - final startDate = 0.obs; - final endDate = 0.obs; - final pwdId = ''.obs; - final lockId = 0.obs; - final fromType = ''.obs; + // final TextEditingController inputPwdController = TextEditingController(); + // final TextEditingController inputNameController = TextEditingController(); + // final changeType = '1'.obs; //1-通过APP走蓝牙修改,不传默认1,必需先通过APP SDK蓝牙修改后调用该接口 2-通过网关或WiFi锁修改,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口修改生效 + // final isCoerced = '1'.obs; //胁迫指纹:1;非胁迫指纹:2(胁迫指纹开锁触发报警) + // final hoursStart = 0.obs; + // final hoursEnd = 0.obs; + // final startDate = 0.obs; + // final endDate = 0.obs; + // final pwdId = ''.obs; + // final lockId = 0.obs; + // final fromType = ''.obs; final selectEffectiveDate = ''.obs; //生效时间 final selectFailureDate = ''.obs; //失效时间 - DateTime effectiveDateTime = DateTime.now(); - DateTime failureDateTime = DateTime.now(); - final endDay = ''.obs; - final startDay = ''.obs; - final weekDays = [].obs; + // DateTime effectiveDateTime = DateTime.now(); + // DateTime failureDateTime = DateTime.now(); + // final endDay = ''.obs; + // final startDay = ''.obs; + // final weekDays = [].obs; PasswordKeyDetailChangeDateState() { Map map = Get.arguments; @@ -30,11 +29,11 @@ class PasswordKeyDetailChangeDateState { if ((map["itemData"] != null)) { itemData.value = map["itemData"]; } - if ((map["pwdId"] != null)) { - pwdId.value = map["pwdId"]; - } - if ((map["lockId"] != null)) { - lockId.value = map["lockId"]; - } + // if ((map["pwdId"] != null)) { + // pwdId.value = map["pwdId"]; + // } + // if ((map["lockId"] != null)) { + // lockId.value = map["lockId"]; + // } } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart index a27cb41c..70145f17 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart @@ -79,6 +79,9 @@ class PasswordKeyListItem { int? keyboardPwdId; int? sendDate; String? validTimeStr; + int? isCoerced; + int? hoursStart; + int? hoursEnd; PasswordKeyListItem( {this.apiUserId, @@ -94,7 +97,10 @@ class PasswordKeyListItem { this.senderUsername, this.keyboardPwdId, this.sendDate, - this.validTimeStr}); + this.validTimeStr, + this.isCoerced, + this.hoursStart, + this.hoursEnd}); PasswordKeyListItem.fromJson(Map json) { apiUserId = json['apiUserId']; @@ -111,6 +117,9 @@ class PasswordKeyListItem { keyboardPwdId = json['keyboardPwdId']; sendDate = json['sendDate']; validTimeStr = json['validTimeStr']; + isCoerced = json['isCoerced']; + hoursStart = json['hoursStart']; + hoursEnd = json['hoursEnd']; } Map toJson() { @@ -129,6 +138,9 @@ class PasswordKeyListItem { data['keyboardPwdId'] = keyboardPwdId; data['sendDate'] = sendDate; data['validTimeStr'] = validTimeStr; + data['isCoerced'] = isCoerced; + data['hoursStart'] = hoursStart; + data['hoursEnd'] = hoursEnd; return data; } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index 0c2d7598..c8e66037 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -1,8 +1,11 @@ +import 'dart:async'; + import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../../tools/eventBusEventManage.dart'; import '../passwordKey_perpetual/passwordKeyEntity.dart'; class PasswordKeyListLogic extends BaseGetXController { @@ -43,10 +46,105 @@ class PasswordKeyListLogic extends BaseGetXController { } } + //使用期限 + String getUseDateStr(PasswordKeyListItem indexEntity) { + int? getPwdType = indexEntity.keyboardPwdType; + String useDateStr = ''; + DateTime sendDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); + DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); + DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); + int starHour = startDateStr.hour; + int endHour = endDateStr.hour; + + // print("sendDateStr.toLocal().toString():${sendDateStr.toLocal().toString()}"); + switch (getPwdType) { + case 1: + //单次 1 只能在开始时间后6小时内使用一次 + useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次'; + break; + case 2: + //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 + useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久 ${indexEntity.isCustom! == 1? "自定义" : ""}'; + break; + case 3: + //限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 + useDateStr = + '${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} 限时 ${indexEntity.isCustom! == 1? "自定义" : ""}'; + break; + case 4: + //删除 4 在锁上使用后会删除之前在锁上使用过的密码 + useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 清空码'; + break; + case 5: + //周未循环 5 在周未开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周末$starHour:00-$endHour:00 循环'; + break; + case 6: + //每日循环 6 每天开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周日$starHour:00-$endHour:00 循环'; + break; + case 7: + //工作日循环 7 工作日开始和结束时间指定的时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 工作日$starHour:00-$endHour:00 循环'; + break; + case 8: + //周一循环 8 每周一开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周一$starHour:00-$endHour:00 循环'; + break; + case 9: + //周二循环 9 每周二开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周二$starHour:00-$endHour:00 循环'; + break; + case 10: + //周三循环 10 每周三开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周三$starHour:00-$endHour:00 循环'; + break; + case 11: + //周四循环 11 每周四开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周四$starHour:00-$endHour:00 循环'; + break; + case 12: + //周五循环 12 每周五开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周五$starHour:00-$endHour:00 循环'; + break; + case 13: + //周六循环 13 每周六开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周六$starHour:00-$endHour:00 循环'; + break; + case 14: + //周天循环 14 每周日开始和结束时间指定时间段内有效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} 周天$starHour:00-$endHour:00 循环'; + break; + + default: + } + return useDateStr; + } + + /// 刷新密码列表 + StreamSubscription? _getPasswordListRefreshUIEvent; + void _getPasswordListRefreshUIAction() { + // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus + _getPasswordListRefreshUIEvent = eventBus.on().listen((event) { + mockNetworkDataRequest(); + }); + } + @override void onReady() { // TODO: implement onReady super.onReady(); + _getPasswordListRefreshUIAction(); } @override @@ -58,5 +156,7 @@ class PasswordKeyListLogic extends BaseGetXController { @override void onClose() { // TODO: implement onClose + super.onClose(); + _getPasswordListRefreshUIEvent?.cancel(); } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index e12fe9e2..178a56a1 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -129,44 +129,6 @@ class _PasswordKeyListPageState extends State { // _refreshController.refreshCompleted(); // } - Widget _searchWidget() { - return Container( - height: 60.h, - margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w), - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(5)), - child: TextField( - //输入框一行 - maxLines: 1, - // controller: _controller, - autofocus: false, - controller: state.searchController, - onSubmitted: (value) { - logic.mockNetworkDataRequest(); - }, - decoration: InputDecoration( - //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only( - top: 18.0, left: -19.0, right: -15.0, bottom: 2), - hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, - hintStyle: TextStyle(fontSize: 22.sp, height: 3.0), - //不需要输入框下划线 - border: InputBorder.none, - //左边图标设置 - icon: Padding( - padding: EdgeInsets.only( - top: 20.h, bottom: 20.h, right: 20.w, left: 10.w), - child: Image.asset( - 'images/main/icon_main_search.png', - width: 40.w, - height: 40.w, - ), - ), - ), - ), - ); - } - Widget _buildMainUI(itemData) { List getItemData = itemData; return ListView.separated( @@ -176,7 +138,7 @@ class _PasswordKeyListPageState extends State { String useDateStr = ''; //使用期限 //使用期限 - useDateStr = getUseDateStr(passwordKeyListItem); + useDateStr = logic.getUseDateStr(passwordKeyListItem); if (index < getItemData.length) { return LeftSlideActions( @@ -188,8 +150,7 @@ class _PasswordKeyListPageState extends State { decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(1)), ), - child: _electronicKeyItem(index, 'images/icon_password.png', - passwordKeyListItem.keyboardPwdName!, useDateStr, () { + child: _electronicKeyItem(index, 'images/icon_password.png', passwordKeyListItem.keyboardPwdName!, useDateStr, () { Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: {"itemData": passwordKeyListItem}).then((val) { if (val != null) { @@ -253,93 +214,6 @@ class _PasswordKeyListPageState extends State { }); } - //使用期限 - String getUseDateStr(PasswordKeyListItem indexEntity) { - int? getPwdType = indexEntity.keyboardPwdType; - String useDateStr = ''; - DateTime sendDateStr = - DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); - DateTime startDateStr = - DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); - DateTime endDateStr = - DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); - int starHour = startDateStr.hour; - int endHour = endDateStr.hour; - - switch (getPwdType) { - case 1: - //单次 1 只能在开始时间后6小时内使用一次 - useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次'; - break; - case 2: - //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 - useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久'; - break; - case 3: - //限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 - useDateStr = - '${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} 限时'; - break; - case 4: - //删除 4 在锁上使用后会删除之前在锁上使用过的密码 - useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 清空码'; - break; - case 5: - //周未循环 5 在周未开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周末$starHour:00-$endHour:00 循环'; - break; - case 6: - //每日循环 6 每天开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周日$starHour:00-$endHour:00 循环'; - break; - case 7: - //工作日循环 7 工作日开始和结束时间指定的时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 工作日$starHour:00-$endHour:00 循环'; - break; - case 8: - //周一循环 8 每周一开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周一$starHour:00-$endHour:00 循环'; - break; - case 9: - //周二循环 9 每周二开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周二$starHour:00-$endHour:00 循环'; - break; - case 10: - //周三循环 10 每周三开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周三$starHour:00-$endHour:00 循环'; - break; - case 11: - //周四循环 11 每周四开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周四$starHour:00-$endHour:00 循环'; - break; - case 12: - //周五循环 12 每周五开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周五$starHour:00-$endHour:00 循环'; - break; - case 13: - //周六循环 13 每周六开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周六$starHour:00-$endHour:00 循环'; - break; - case 14: - //周天循环 14 每周日开始和结束时间指定时间段内有效 - useDateStr = - '${sendDateStr.toLocal().toString().substring(0, 16)} 周天$starHour:00-$endHour:00 循环'; - break; - - default: - } - return useDateStr; - } - Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) { PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex]; @@ -352,17 +226,9 @@ class _PasswordKeyListPageState extends State { color: Colors.white, child: Row( children: [ - SizedBox( - width: 30.w, - ), - Image.asset( - lockTypeIcon, - width: 60.w, - height: 60.w, - ), - SizedBox( - width: 20.w, - ), + SizedBox(width: 30.w), + Image.asset(lockTypeIcon, width: 60.w, height: 60.w,), + SizedBox(width: 20.w,), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -370,25 +236,20 @@ class _PasswordKeyListPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - Text( - lockTypeTitle, - style: TextStyle( - fontSize: 24.sp, color: AppColors.blackColor), - ), Expanded( - child: SizedBox( - width: 20.w, - )), - passwordKeyListItem.keyboardPwdStatus == 2 - ? Text( - '已失效', - style: - TextStyle(color: Colors.red, fontSize: 20.sp), - ) - : Container(), - SizedBox( - width: 20.w, - ) + child: Text( + lockTypeTitle, + style: TextStyle( + fontSize: 24.sp, color: AppColors.blackColor), + ), + ), + // Expanded( + // child: SizedBox( + // width: 20.w, + // )), + SizedBox(width: 10.w), + passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已失效', style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(), + SizedBox(width: 15.w) ], ), SizedBox(height: 5.h), @@ -420,7 +281,7 @@ class _PasswordKeyListPageState extends State { context: widgetContext, builder: (context) { return CupertinoAlertDialog( - title: const Text('该锁的电子钥匙都将被删除'), + title: const Text('该锁的密码都将被删除'), actions: [ CupertinoDialogAction( child: Text(TranslationLoader.lanKeys!.cancel!.tr), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart index c51b786c..0c533073 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart @@ -21,9 +21,7 @@ class PasswordKeyManageTabbarPage extends StatefulWidget { _PasswordKeyManageTabbarPageState(); } -class _PasswordKeyManageTabbarPageState - extends State - with SingleTickerProviderStateMixin { +class _PasswordKeyManageTabbarPageState extends State with SingleTickerProviderStateMixin { late TabController _tabController; final List _itemTabs = [ @@ -43,16 +41,23 @@ class _PasswordKeyManageTabbarPageState vsync: this, length: _itemTabs.length, initialIndex: widget.initialIndex); - _tabController.addListener(handleTabIndex); + + _tabController.addListener(() { + // print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}"); + if (_tabController.animation!.value==_tabController.index){ + FocusScope.of(context).requestFocus(FocusNode()); + } + }); + // _tabController.addListener(handleTabIndex); } - int handleTabIndex() { - // 获取当前选定的标签索引 - int currentIndex = _tabController.index; - // 根据索引可以得知用户点击了哪个 item - eventBus.fire(GetPasswordTypeUpdateIndex(currentIndex)); - return currentIndex; - } + // int handleTabIndex() { + // // 获取当前选定的标签索引 + // int currentIndex = _tabController.index; + // // 根据索引可以得知用户点击了哪个 item + // eventBus.fire(GetPasswordTypeUpdateIndex(currentIndex)); + // return currentIndex; + // } @override Widget build(BuildContext context) { @@ -68,6 +73,9 @@ class _PasswordKeyManageTabbarPageState TabBar _tabBar() { return TabBar( controller: _tabController, + onTap: (index){ + FocusScope.of(context).requestFocus(FocusNode()); + }, tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), isScrollable: true, indicatorColor: Colors.red, @@ -108,9 +116,8 @@ class _PasswordKeyManageTabbarPageState return Expanded( child: TabBarView( controller: _tabController, - children: _itemTabs - .map((ItemView item) => PasswordKeyPerpetualPage( - type: _tabController.index.toString(), + children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage( + type: item.type, getKeyInfo: widget.keyInfo, )) .toList(), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index 54f1dc04..28ea8917 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -19,13 +19,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { final PasswordKeyPerpetualState state = PasswordKeyPerpetualState(); /// 收到点击密码类型更新 - StreamSubscription? getPasswordTypeUpdateIndexEvent; - void getPasswordTypeUpdateIndexAction() { - getPasswordTypeUpdateIndexEvent = - eventBus.on().listen((event) { - state.widgetType.value = event.passwordType; - }); - } + // StreamSubscription? getPasswordTypeUpdateIndexEvent; + // void getPasswordTypeUpdateIndexAction() { + // getPasswordTypeUpdateIndexEvent = + // eventBus.on().listen((event) { + // state.widgetType.value = event.passwordType; + // }); + // } /** 单次 1 只能在开始时间后6小时内使用一次 @@ -112,9 +112,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { print('获取密码成功'); state.isSendSuccess.value = true; + state.sendSucceedType.value = state.widgetType.value; + state.nameController.text = ""; + state.pwdController.text = ""; if (entity.data != null) { state.getPwdStr.value = entity.data!.keyboardPwd!; } + eventBus.fire(GetPasswordListRefreshUI()); } else { showToast('${entity.errorMsg}'); } @@ -145,13 +149,17 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { getKeyType, getEffectiveDateTime, getFailureDateTime, - '0'); + '1'); if (entity.errorCode!.codeIsSuccessful) { print('获取密码成功'); state.isSendSuccess.value = true; + state.sendSucceedType.value = state.widgetType.value; + state.nameController.text = ""; + state.pwdController.text = ""; if (entity.data != null) { state.getPwdStr.value = entity.data!.keyboardPwd!; } + eventBus.fire(GetPasswordListRefreshUI()); } else { showToast('${entity.errorMsg}'); } @@ -188,13 +196,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); - print('得到的开始时间时间戳$getStartDate'); - IoSenderManage.senderCustomPasswordsCommand( keyID: "1", userID: await Storage.getUid(), pwdNo: 1, - pwd: "123456", + pwd:state.pwdController.text, useCountLimit: 0xff, startTime: 0x11223344, endTime: 0x11223344, @@ -263,7 +269,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { super.onReady(); _initReplySubscription(); - getPasswordTypeUpdateIndexAction(); + // getPasswordTypeUpdateIndexAction(); } @override diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index 29d85c13..8f05461e 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -42,27 +42,32 @@ class _PasswordKeyPerpetualPageState extends State { super.initState(); initData(); + // state.isSendSuccess.value = false; } void initData() { - if (!state.isInitialized.value) { - state.isInitialized.value = true; - state.keyInfo.value = widget.getKeyInfo; - } + // if (!state.isInitialized.value) { + // state.isInitialized.value = true; + // state.keyInfo.value = widget.getKeyInfo; + // } } @override Widget build(BuildContext context) { + state.keyInfo.value = widget.getKeyInfo; + state.widgetType.value = int.parse(widget.type); + print("state.widgetType.value:${state.widgetType.value}"); + return SingleChildScrollView( child: Obx(() => indexChangeWidget()), ); } Widget indexChangeWidget() { - if (state.isSendSuccess.value == true) { + if (state.isSendSuccess.value == true && state.sendSucceedType.value.toString() == widget.type) { return sendElectronicKeySucceed(); } else { - switch (state.widgetType.value) { + switch (int.parse(widget.type)) { case 0: { // 永久 @@ -132,7 +137,7 @@ class _PasswordKeyPerpetualPageState extends State { TranslationLoader.lanKeys!.name!.tr, TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, state.nameController), - keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip5!.tr) + keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr) ], ); } @@ -185,24 +190,11 @@ class _PasswordKeyPerpetualPageState extends State { onConfirm: (p) { if (state.widgetType.value == 3) { // 自定义 - state.effectiveDateTime.value = DateTime.parse( - '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'); - state.selectEffectiveDate.value = formatDate( - state.effectiveDateTime.value, - [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间 + state.effectiveDateTime.value = DateTime.parse('${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}'); + state.selectEffectiveDate.value = formatDate(state.effectiveDateTime.value, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //默认为当前时间 } else { - state.effectiveDateTime.value = DateTime.parse( - '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}'); - state.selectEffectiveDate.value = - "${formatDate(state.effectiveDateTime.value, [ - yyyy, - '-', - mm, - '-', - dd, - ' ', - HH - ])}:00"; //默认为当前时间 + state.effectiveDateTime.value = DateTime.parse('${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}'); + state.selectEffectiveDate.value = "${formatDate(state.effectiveDateTime.value, [yyyy, '-', mm, '-', dd, ' ', HH])}:00"; //默认为当前时间 } }); }), @@ -263,7 +255,7 @@ class _PasswordKeyPerpetualPageState extends State { return Column( children: [ CommonItem( - leftTitel: TranslationLoader.lanKeys!.recursiveDevice!.tr, + leftTitel: "有效日", rightTitle: state.loopModeStr.value, isHaveLine: true, isHaveDirection: true, @@ -393,7 +385,7 @@ class _PasswordKeyPerpetualPageState extends State { height: 20.h, ), SubmitBtn( - btnName: TranslationLoader.lanKeys!.getPassword!.tr, + btnName: widget.type == "3" ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr, onClick: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { @@ -512,7 +504,9 @@ class _PasswordKeyPerpetualPageState extends State { btnName: '完成', onClick: () { state.isSendSuccess.value = false; - Navigator.pop(context, true); + state.nameController.text = ""; + state.pwdController.text = ""; + // Navigator.pop(context, true); }), SizedBox( height: 10.h, @@ -547,8 +541,10 @@ class _PasswordKeyPerpetualPageState extends State { maxLines: 1, inputFormatters: [ FilteringTextInputFormatter.deny('\n'), - LengthLimitingTextInputFormatter(18), + LengthLimitingTextInputFormatter(editController == state.nameController ? 18 : 9), ], + keyboardType: editController == state.nameController ? TextInputType.text: TextInputType.number, + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: editController, autofocus: false, textAlign: TextAlign.end, diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart index a5f20071..96db4879 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart @@ -7,7 +7,7 @@ class PasswordKeyPerpetualState { final TextEditingController nameController = TextEditingController(); final TextEditingController pwdController = TextEditingController(); - final isInitialized = false.obs; + // final isInitialized = false.obs; final isSendSuccess = false.obs; //是否发送成功 final isPermanent = true.obs; //是否永久 var getPwdStr = ''.obs; @@ -44,5 +44,6 @@ class PasswordKeyPerpetualState { var loopModeStr = '周末'.obs; //循环模式 final widgetType = 0.obs; + final sendSucceedType = 0.obs; final keyInfo = LockListInfoItemEntity().obs; } diff --git a/star_lock/lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart b/star_lock/lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart index 73967272..632aa0b1 100644 --- a/star_lock/lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart +++ b/star_lock/lib/main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart @@ -283,6 +283,7 @@ class _AddRemoteControlPageState extends State { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(18), ], + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: state.nameController, autofocus: false, textAlign: TextAlign.end, diff --git a/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart b/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart index 944571eb..8fb5b4cc 100644 --- a/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart +++ b/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart @@ -299,18 +299,24 @@ class LockFeature { class LockSetting { int? attendance; int? appUnlockOnline; - - LockSetting({this.attendance, this.appUnlockOnline}); + int? remoteUnlock; + LockSetting({ + this.attendance, + this.appUnlockOnline, + this.remoteUnlock, + }); LockSetting.fromJson(Map json) { attendance = json['attendance']; appUnlockOnline = json['appUnlockOnline']; + remoteUnlock = json['remoteUnlock']; } Map toJson() { final Map data = {}; data['attendance'] = attendance; data['appUnlockOnline'] = appUnlockOnline; + data['remoteUnlock'] = remoteUnlock; return data; } } diff --git a/star_lock/lib/main/lockMian/lockList/lockList_page.dart b/star_lock/lib/main/lockMian/lockList/lockList_page.dart index 76fc80e4..5f32c1ab 100644 --- a/star_lock/lib/main/lockMian/lockList/lockList_page.dart +++ b/star_lock/lib/main/lockMian/lockList/lockList_page.dart @@ -163,11 +163,26 @@ class _LockListPageState extends State { SizedBox(width: 30.w), ], ), - SizedBox( - height: 5.h, - ), + SizedBox(height: 5.h), Visibility( - visible: keyInfo.remoteEnable == 1 ? true : false, + visible: keyInfo.passageMode == 1 ? true : false, + child:Row( + children: [ + SizedBox(width: 30.w), + Container( + padding: EdgeInsets.only(right: 5.w, left: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: AppColors.openPassageModeColor, + ), + child: Text("常开模式开启", style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)), + ), + + ], + )), + SizedBox(height: 5.h), + Visibility( + visible: keyInfo.lockSetting!.remoteUnlock == 1 ? true : false, child:Row( children: [ SizedBox(width: 30.w), diff --git a/star_lock/lib/mine/about/about_page.dart b/star_lock/lib/mine/about/about_page.dart index 14e8e25b..518ac9c2 100644 --- a/star_lock/lib/mine/about/about_page.dart +++ b/star_lock/lib/mine/about/about_page.dart @@ -37,7 +37,7 @@ class _AbountPageState extends State { ), SizedBox(height: 20.h), Text( - "星锁 1.0.0.07(preRelease-20240118-1)", + "星锁 1.0.0.08(preRelease-20240123)", style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), ), SizedBox( diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index ef58acb2..a8282cdd 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -71,7 +71,7 @@ abstract class Api { final String getLockVersionInfoUrl = '/room/update'; // 获取锁当前版本信息 final String openCheckingInURL = '/attendanceCompany/isExistenceCompany'; // 开启考勤获取是否有公司 final String setCheckInCreateCompanyURL = '/attendanceCompany/add'; // 设置考勤时创建公司 - final String deleteCompanyURL = '/vacation/delete'; // 删除公司 + final String deleteCompanyURL = '/attendanceCompany/delete'; // 删除公司 final String getAttendanceRecordListByDateURL = '/attendanceRecord/listByDate'; // 获取考勤列表-早到榜日榜 diff --git a/star_lock/lib/tools/baseGetXController.dart b/star_lock/lib/tools/baseGetXController.dart index 260a1b40..e3d38d8f 100644 --- a/star_lock/lib/tools/baseGetXController.dart +++ b/star_lock/lib/tools/baseGetXController.dart @@ -4,6 +4,7 @@ import 'dart:async'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/blue/blue_manage.dart'; import '../common/XSConstantMacro/XSConstantMacro.dart'; import 'manager/client_manager.dart'; @@ -83,13 +84,14 @@ class BaseGetXController extends GetxController{ } void showBlueConnetctToast() { - showToast("连接设备失败,请确保在设备附近,设备未被连接,设备已打开"); + bool isContains = BlueManage().connectDeviceName!.contains("T9A"); + showToast("连接设备失败,请确保在设备附近,设备未被连接,设备已打开${isContains == true ? "。如果是全自动锁,请使屏幕变亮" : ""}"); } void showToast(String status,{Function? something}) { - EasyLoading.showToast(status,duration: 1000.milliseconds); + EasyLoading.showToast(status,duration: 2000.milliseconds); if(something != null) { - delay(duration: 1100.milliseconds,something: something); + delay(duration: 2100.milliseconds,something: something); } } diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart index 05c36ea0..1b790fbe 100644 --- a/star_lock/lib/tools/eventBusEventManage.dart +++ b/star_lock/lib/tools/eventBusEventManage.dart @@ -79,3 +79,8 @@ class GetPasswordTypeUpdateIndex { int passwordType; GetPasswordTypeUpdateIndex(this.passwordType); } + +/// 刷新密码列表 +class GetPasswordListRefreshUI { + GetPasswordListRefreshUI(); +} diff --git a/star_lock/lib/tools/keySearchWidget.dart b/star_lock/lib/tools/keySearchWidget.dart index b5f38af9..8c7a3ebf 100644 --- a/star_lock/lib/tools/keySearchWidget.dart +++ b/star_lock/lib/tools/keySearchWidget.dart @@ -5,6 +5,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import '../app_settings/app_colors.dart'; import '../translations/trans_lib.dart'; class KeySearchWidget extends StatelessWidget { @@ -50,6 +51,7 @@ class KeySearchWidget extends StatelessWidget { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(18), ], + style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: editingController, autofocus: false, textAlign: TextAlign.start, diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 61d2cd71..1a745978 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+8 +version: 1.0.0+9 environment: sdk: '>=2.12.0 <3.0.0'