diff --git a/star_lock/images/main/icon_face.png b/star_lock/images/main/icon_face.png index 0aa2397c..80c7231f 100644 Binary files a/star_lock/images/main/icon_face.png and b/star_lock/images/main/icon_face.png differ diff --git a/star_lock/images/main/icon_lockDetail_messageReminding.png b/star_lock/images/main/icon_lockDetail_messageReminding.png index 8f170aa5..47ba9fb8 100644 Binary files a/star_lock/images/main/icon_lockDetail_messageReminding.png and b/star_lock/images/main/icon_lockDetail_messageReminding.png differ diff --git a/star_lock/images/main/icon_lockDetail_videoLog.png b/star_lock/images/main/icon_lockDetail_videoLog.png index 982c7554..e39dc6e0 100644 Binary files a/star_lock/images/main/icon_lockDetail_videoLog.png and b/star_lock/images/main/icon_lockDetail_videoLog.png differ diff --git a/star_lock/images/main/icon_main_authorizedAdmin.png b/star_lock/images/main/icon_main_authorizedAdmin.png index cdf18471..13c3463e 100644 Binary files a/star_lock/images/main/icon_main_authorizedAdmin.png and b/star_lock/images/main/icon_main_authorizedAdmin.png differ diff --git a/star_lock/images/main/icon_main_clockingIn.png b/star_lock/images/main/icon_main_clockingIn.png index d21ba58e..b14e38af 100644 Binary files a/star_lock/images/main/icon_main_clockingIn.png and b/star_lock/images/main/icon_main_clockingIn.png differ diff --git a/star_lock/images/main/icon_main_electronicKey.png b/star_lock/images/main/icon_main_electronicKey.png index 577e2336..3f8f90fe 100644 Binary files a/star_lock/images/main/icon_main_electronicKey.png and b/star_lock/images/main/icon_main_electronicKey.png differ diff --git a/star_lock/images/main/icon_main_fingerprint.png b/star_lock/images/main/icon_main_fingerprint.png index 6e211f0a..39da4f3e 100644 Binary files a/star_lock/images/main/icon_main_fingerprint.png and b/star_lock/images/main/icon_main_fingerprint.png differ diff --git a/star_lock/images/main/icon_main_icCard.png b/star_lock/images/main/icon_main_icCard.png index 68930543..e5131378 100644 Binary files a/star_lock/images/main/icon_main_icCard.png and b/star_lock/images/main/icon_main_icCard.png differ diff --git a/star_lock/images/main/icon_main_operatingRecord.png b/star_lock/images/main/icon_main_operatingRecord.png index 698e0eb2..c6e1ccf5 100644 Binary files a/star_lock/images/main/icon_main_operatingRecord.png and b/star_lock/images/main/icon_main_operatingRecord.png differ diff --git a/star_lock/images/main/icon_main_password.png b/star_lock/images/main/icon_main_password.png index a6cb4df3..7d18f743 100644 Binary files a/star_lock/images/main/icon_main_password.png and b/star_lock/images/main/icon_main_password.png differ diff --git a/star_lock/images/main/icon_main_remoteControl.png b/star_lock/images/main/icon_main_remoteControl.png index a71016d9..132d9c1f 100644 Binary files a/star_lock/images/main/icon_main_remoteControl.png and b/star_lock/images/main/icon_main_remoteControl.png differ diff --git a/star_lock/images/main/icon_main_set.png b/star_lock/images/main/icon_main_set.png index 4f23cb4e..e5f802a2 100644 Binary files a/star_lock/images/main/icon_main_set.png and b/star_lock/images/main/icon_main_set.png differ diff --git a/star_lock/lib/app_settings/app_colors.dart b/star_lock/lib/app_settings/app_colors.dart index 2ac4e057..caec2e39 100644 --- a/star_lock/lib/app_settings/app_colors.dart +++ b/star_lock/lib/app_settings/app_colors.dart @@ -130,4 +130,6 @@ class AppColors { static Color openPassageModeColor = const Color(0xFFEB2A3B);// 首页开启常开模式颜色(红色) static Color listTimeYellowColor = const Color(0xFFF3BA37);// 首页时间过期颜色(黄色) + + static Color get lockDetailBottomBtnUneable => const Color(0xFF808080);// 首页时间灰色颜色(灰色) } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart index f64ad11f..4da0974d 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -1,8 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; -// import 'package:flutter_pickers/pickers.dart'; -// import 'package:flutter_pickers/time_picker/model/date_mode.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -340,7 +339,7 @@ class _AuthorizedAdminPageState extends State { // 接受者信息输入框 Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) { return SizedBox( - height: 50.h, + height: 65.h, width: 300.w, child: Row( children: [ @@ -348,6 +347,10 @@ class _AuthorizedAdminPageState extends State { child: TextField( //输入框一行 maxLines: 1, + inputFormatters: [ + FilteringTextInputFormatter.deny('\n'), + LengthLimitingTextInputFormatter(30), + ], controller: lineIndex == 1 ? state.emailOrPhoneController : state.keyNameController, @@ -355,13 +358,24 @@ class _AuthorizedAdminPageState extends State { textAlign: TextAlign.end, decoration: InputDecoration( //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), + // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), hintText: tfStr, - hintStyle: TextStyle( - color: AppColors.placeholderTextColor, fontSize: 22.sp), - //不需要输入框下划线 - border: InputBorder.none, + hintStyle: TextStyle(fontSize: 22.sp), + focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), + disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), + enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), + border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), + contentPadding: const EdgeInsets.symmetric(vertical: 0), ), + // decoration: InputDecoration( + // //输入里面输入文字内边距设置 + // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), + // hintText: tfStr, + // hintStyle: TextStyle( + // color: AppColors.placeholderTextColor, fontSize: 22.sp), + // //不需要输入框下划线 + // border: InputBorder.none, + // ), ), ), SizedBox( diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart index 45f8bc3e..1bdbf550 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart @@ -9,16 +9,16 @@ class AuthorizedAdminListLogic extends BaseGetXController { //请求电子钥匙列表 Future> mockNetworkDataRequest() async { ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( - '0', - state.keyInfo.value.keyId.toString(), - '', - state.keyInfo.value.lockId.toString(), - '', - state.pageNum.toString(), - state.pageSize.toString(), - '0', - '0', - state.searchStr.value); + endDate: '0', + keyId: state.keyInfo.value.keyId.toString(), + keyStatus: '', + lockId: state.keyInfo.value.lockId.toString(), + operatorUid: '', + pageNo: pageNo.toString(), + pageSize: pageSize.toString(), + startDate: '0', + keyRight: '0', + searchStr:state.searchStr.value); List dataList = []; if (entity.errorCode!.codeIsSuccessful) { print("电子钥匙列表成功:${entity.data?.itemList}"); diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart index 43c7c29d..13abfa3a 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart @@ -36,6 +36,7 @@ class _CheckingInListPageState extends State { haveBack: true, backgroundColor: AppColors.mainColor, actionsList: [ + (state.getKeyInfosData.value.isLockOwner == 1 && state.getKeyInfosData.value.keyRight == 1) ? GestureDetector( onTap: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); @@ -48,7 +49,7 @@ class _CheckingInListPageState extends State { logic.showToast("演示模式"); } }, - child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)), + child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)) : Container(), SizedBox(width: 30.w), ], ), 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 a435e424..223aea96 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart @@ -115,17 +115,20 @@ class _CheckingInSetPageState extends State { SizedBox( height: 30.h, ), - SubmitBtn( - btnName: - "${TranslationLoader.lanKeys!.delete!.tr}${TranslationLoader.lanKeys!.company!.tr}", - borderRadius: 20.w, - fontSize: 32.sp, - isDelete: true, - margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w), - padding: EdgeInsets.only(top: 20.w, bottom: 20.w), - onClick: () { - showDeletCompanyAlertDialog(context); - }), + Visibility( + visible: state.getKeyInfosData.value.isLockOwner == 1, + child: SubmitBtn( + btnName: + "${TranslationLoader.lanKeys!.delete!.tr}${TranslationLoader.lanKeys!.company!.tr}", + borderRadius: 20.w, + fontSize: 32.sp, + isDelete: true, + margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w), + padding: EdgeInsets.only(top: 20.w, bottom: 20.w), + onClick: () { + showDeletCompanyAlertDialog(context); + }), + ), ], ), ); diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index 4472602b..052e792a 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -5,6 +5,8 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../../../tools/eventBusEventManage.dart'; + class ElectronicKeyDetailLogic extends BaseGetXController { final ElectronicKeyDetailState state = ElectronicKeyDetailState(); @@ -15,8 +17,10 @@ class ElectronicKeyDetailLogic extends BaseGetXController { state.changeNameController.text, ''); if (entity.errorCode!.codeIsSuccessful) { print("修改要是名称成功啦啦啦啦啦"); - showToast("修改成功"); - Get.back(); + showToast("修改成功", something: (){ + eventBus.fire(ElectronicKeyListRefreshUI()); + Get.back(); + }); } } @@ -26,8 +30,10 @@ class ElectronicKeyDetailLogic extends BaseGetXController { .deleteElectronicKey(state.itemData.value.keyId.toString()); if (entity.errorCode!.codeIsSuccessful) { print("删除电子钥匙成功"); - showToast("删除成功"); - Get.back(); + showToast("删除成功", something: (){ + eventBus.fire(ElectronicKeyListRefreshUI()); + Get.back(); + }); } } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart index 360de109..4a901cd5 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart @@ -5,6 +5,8 @@ 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'; +import '../../../../../tools/eventBusEventManage.dart'; + class ElectronicKeyDetailChangeDateLogic extends BaseGetXController { final ElectronicKeyDetailChangeDateState state = ElectronicKeyDetailChangeDateState(); @@ -23,8 +25,10 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController { hoursEnd: state.hoursEnd.value, isCoerced: state.isCoerced.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("修改成功"); - Get.back(); + showToast("修改成功", something: (){ + eventBus.fire(ElectronicKeyListRefreshUI()); + Get.back(); + }); } } @@ -40,8 +44,10 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController { state.startDay.value, state.weekDays.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("修改成功"); - Get.back(); + showToast("修改成功", something: (){ + eventBus.fire(ElectronicKeyListRefreshUI()); + Get.back(); + }); } } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart index cffedf02..025005bb 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart @@ -1,24 +1,28 @@ +import 'dart:async'; + import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../../tools/eventBusEventManage.dart'; + class ElectronicKeyListLogic extends BaseGetXController { final ElectronicKeyListState state = ElectronicKeyListState(); //请求电子钥匙列表 Future mockNetworkDataRequest() async { ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( - '0', - state.keyInfo.value.keyId.toString(), - '', - state.keyInfo.value.lockId.toString(), - '', - pageNo.toString(), - pageSize.toString(), - '0', - '0', - state.searchController.text); + endDate: '0', + keyId: state.keyInfo.value.keyId.toString(), + keyStatus: '', + lockId: state.keyInfo.value.lockId.toString(), + operatorUid: '', + pageNo: pageNo.toString(), + pageSize: pageSize.toString(), + startDate: '0', + keyRight: '0', + searchStr: state.searchController.text); if (entity.errorCode!.codeIsSuccessful) { if (pageNo == 1) { state.itemDataList.value = entity.data!.itemList!; @@ -40,6 +44,7 @@ class ElectronicKeyListLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { print("重置电子钥匙成功啦啦啦啦啦"); showToast("重置成功"); + pageNo = 1; mockNetworkDataRequest(); } } @@ -51,14 +56,27 @@ class ElectronicKeyListLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { print("删除电子钥匙成功"); showToast("删除成功"); + pageNo = 1; mockNetworkDataRequest(); } } + /// 刷新电子钥匙列表 + StreamSubscription? _getElectronicKeyListRefreshUIEvent; + void _getElectronicKeyListRefreshUIAction() { + // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus + _getElectronicKeyListRefreshUIEvent = eventBus.on().listen((event) { + pageNo = 1; + mockNetworkDataRequest(); + }); + } + @override void onReady() { // TODO: implement onReady super.onReady(); + + _getElectronicKeyListRefreshUIAction(); } @override @@ -70,5 +88,8 @@ class ElectronicKeyListLogic extends BaseGetXController { @override void onClose() { // TODO: implement onClose + super.onClose(); + + _getElectronicKeyListRefreshUIEvent?.cancel(); } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 59bf9242..57469de0 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -121,63 +121,64 @@ class _ElectronicKeyListPageState extends State { Widget _buildMainUI() { return Obx(() => state.itemDataList.value.isEmpty ? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h) - : ListView.separated( + : SlidableAutoCloseBehavior( + child: ListView.separated( shrinkWrap: true, itemCount: state.itemDataList.value.length, itemBuilder: (c, index) { - ElectronicKeyListItem indexEntity = state.itemDataList.value[index]; - String useDateStr = ''; //使用期限 - String keyStatus = ''; //钥匙状态 + ElectronicKeyListItem indexEntity = state.itemDataList.value[index]; + String useDateStr = ''; //使用期限 + String keyStatus = ''; //钥匙状态 - //使用期限 - useDateStr = getUseDateStr(indexEntity); + //使用期限 + useDateStr = getUseDateStr(indexEntity); - //钥匙状态 - keyStatus = getKeyStatus(indexEntity.keyStatus); + //钥匙状态 + keyStatus = getKeyStatus(indexEntity.keyStatus); - //是否为管理钥匙 - bool isAdminKey = false; - if (indexEntity.keyRight == 1) { - isAdminKey = true; - } else { - isAdminKey = false; - } + //是否为管理钥匙 + bool isAdminKey = false; + if (indexEntity.keyRight == 1) { + isAdminKey = true; + } else { + isAdminKey = false; + } - return Slidable( - key:ValueKey(indexEntity.keyId), - endActionPane: ActionPane( - extentRatio: 0.2, - motion: const ScrollMotion(), - children: [ - SlidableAction( - onPressed: (BuildContext context){ - showIosTipViewDialog(context, indexEntity.keyId!.toString()); - }, - backgroundColor: Colors.red, - foregroundColor: Colors.white, - label: '删除', - ), - ], - ), - child: _electronicKeyItem('images/controls_user.png', - indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { - Navigator.pushNamed(context, Routers.electronicKeyDetailPage, - arguments: {"itemData": indexEntity}).then((val) { - if (val != null) { - logic.mockNetworkDataRequest(); - setState(() {}); - } - }); - }), - ); + return Slidable( + key:ValueKey(indexEntity.keyId), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context){ + showIosTipViewDialog(context, indexEntity.keyId!.toString()); + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + label: '删除', + ), + ], + ), + child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { + Navigator.pushNamed(context, Routers.electronicKeyDetailPage, + arguments: {"itemData": indexEntity}).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + setState(() {}); + } + }); + }), + ); }, separatorBuilder: (BuildContext context, int index) { - return const Divider( - height: 1, - color: AppColors.greyLineColor, - ); + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); }, - )); + ), + )); } Widget _buildDeleteBtn(String keyId) { @@ -269,6 +270,9 @@ class _ElectronicKeyListPageState extends State { } else if (keyStatusFlag == 110410) { //已重置 keyStatus = '已重置'; + } else if (keyStatusFlag == 110412) { + //已过期 + keyStatus = '已过期'; } return keyStatus; diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart index 7d7577da..0aefe1b4 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart @@ -6,6 +6,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/eventBusEventManage.dart'; import 'package:star_lock/translations/trans_lib.dart'; class SendElectronicKeyLogic extends BaseGetXController { @@ -62,6 +63,9 @@ class SendElectronicKeyLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { print('发送电子钥匙成功'); state.isSendSuccess.value = true; + state.sendSucceedType.value = int.parse(state.type.value); + resetData(); + eventBus.fire(ElectronicKeyListRefreshUI()); } else { if (entity.errorCode == 425) { //用户未注册 @@ -162,4 +166,11 @@ class SendElectronicKeyLogic extends BaseGetXController { }, ); } + + void resetData(){ + state.emailOrPhoneController.text = ""; + state.keyNameController.text = ""; + state.selectEffectiveDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间 + state.selectFailureDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间 + } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart index 3261aa5b..405ddfe4 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart @@ -53,7 +53,7 @@ class _SendElectronicKeyPageState extends State { } Widget indexChangeWidget() { - if (state.isSendSuccess.value == true) { + if (state.isSendSuccess.value == true && state.sendSucceedType.value.toString() == widget.type) { return sendElectronicKeySucceed(); } else { switch (int.parse(widget.type)) { @@ -281,8 +281,7 @@ class _SendElectronicKeyPageState extends State { state.failureDateTime.value.hour, state.failureDateTime.value.minute); //发送钥匙请求 - if (state.emailOrPhoneController.text.isNotEmpty && - state.keyNameController.text.isNotEmpty) { + if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.text.isNotEmpty) { if (int.parse(widget.type) == 0) { if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) { @@ -372,7 +371,7 @@ class _SendElectronicKeyPageState extends State { btnName: '完成', onClick: () { state.isSendSuccess.value = false; - Navigator.pop(context, true); + logic.resetData(); }), SizedBox( height: 10.h, @@ -443,7 +442,7 @@ class _SendElectronicKeyPageState extends State { maxLines: 1, inputFormatters: [ FilteringTextInputFormatter.deny('\n'), - LengthLimitingTextInputFormatter(18), + LengthLimitingTextInputFormatter(30), ], // controller: _controller, autofocus: false, @@ -508,17 +507,20 @@ class _SendElectronicKeyPageState extends State { // 远程开锁 Widget remoteUnlockingWidget() { - return Column( - children: [ - CommonItem( - leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr, - rightTitle: "", - isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, height: 50.h, child: _remoteSwitch(true)), - action: () {}), - Container(height: 10.h), - ], + return Visibility( + visible: state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false, + child: Column( + children: [ + CommonItem( + leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr, + rightTitle: "", + isHaveRightWidget: true, + rightWidget: + SizedBox(width: 60.w, height: 50.h, child: _remoteSwitch(true)), + action: () {}), + Container(height: 10.h), + ], + ), ); } diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart index ffd62849..ca3f0db0 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart @@ -35,6 +35,8 @@ class SendElectronicKeyState { var weekdaysList = [].obs; var isCreateUser = false.obs; //用户未注册时传1 已注册传0 + final sendSucceedType = 0.obs; + SendElectronicKeyState() { Map map = Get.arguments; keyInfo.value = map["keyInfo"]; diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_tabbar.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_tabbar.dart index 1329f520..fc4bdabd 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_tabbar.dart @@ -38,6 +38,13 @@ class _SendElectronicKeyManageTabbarState vsync: this, length: _itemTabs.length, initialIndex: widget.initialIndex); + + _tabController.addListener(() { + // print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}"); + if (_tabController.animation!.value==_tabController.index){ + FocusScope.of(context).requestFocus(FocusNode()); + } + }); } @override @@ -54,6 +61,9 @@ class _SendElectronicKeyManageTabbarState 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, diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 81f9f77e..97aafcde 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -137,7 +137,10 @@ class LockDetailLogic extends BaseGetXController { case 0x16: // 正在开锁中... print("${reply.commandType}正在开锁中..."); - showToast("正在开锁中..."); + state.openLockBtnState.value = 0; + showToast("正在开锁中...", something: (){ + cancelBlueConnetctToastTimer(); + }); break; default: //失败 @@ -317,7 +320,7 @@ class LockDetailLogic extends BaseGetXController { } else { getLockNetToken(); } - + // clickPushBtnAction(); break; case 0x06: //无权限 @@ -598,38 +601,45 @@ class LockDetailLogic extends BaseGetXController { } } - // 0开锁 1长按闭锁 2密码 3卡 4指纹 5遥控 6人脸 7监控 8操作记录 9消息提醒 10设置 - clickItemBtnAction(int type){ - state.clickNextType = type; - if (state.lockUserNo == 0) { - // 电子钥匙lockUserNo为0 要先添加用户 - addUserConnectBlue(); - } else { - clickPushBtnAction(); - } - } - - clickPushBtnAction(){ - // 0开锁 1长按闭锁 2密码 3卡 4指纹 5遥控 6人脸 7监控 8操作记录 9消息提醒 10设置 - switch(state.clickNextType){ - case 0: - // 开锁 - startOpenLock(); - break; - case 1: - // 长按闭锁 - startUnLock(); - break; - case 2: - // 密码 - Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); - break; - case 3: - // 卡 - Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); - break; - } - } + // // 0开锁 1长按闭锁 2密码 3卡 4指纹 5遥控 6人脸 7监控 8操作记录 9消息提醒 10设置 + // clickItemBtnAction(int type){ + // state.clickNextType = type; + // if (state.lockUserNo == 0) { + // // 电子钥匙lockUserNo为0 要先添加用户 + // addUserConnectBlue(); + // } else { + // clickPushBtnAction(); + // } + // } + // + // clickPushBtnAction(){ + // // 0开锁 1长按闭锁 2密码 3卡 4指纹 5遥控 6人脸 7监控 8操作记录 9消息提醒 10设置 + // switch(state.clickNextType){ + // case 0: + // // 开锁 + // startOpenLock(); + // break; + // case 1: + // // 长按闭锁 + // startUnLock(); + // break; + // case 2: + // // 密码 + // Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); + // break; + // case 3: + // // 卡 + // Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); + // break; + // case 10: + // // 设置 + // Get.toNamed(Routers.lockSetPage, arguments: { + // "lockId": state.keyInfos.value.lockId, + // "isOnlyOneData": state.isOnlyOneData, + // }); + // break; + // } + // } // 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口 void getLockNetToken() async { @@ -648,6 +658,8 @@ class LockDetailLogic extends BaseGetXController { lockUserNo: state.lockUserNo.toString()); if (entity.errorCode!.codeIsSuccessful) { if (state.isOpenLockNeedOnline.value == 0) { + state.bottomBtnisUneable.value = false; + eventBus.fire(RefreshLockListInfoDataEvent()); openDoorAction(1); } else { getLockNetToken(); diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index ae1a5472..4e538b2b 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -36,12 +36,15 @@ class _LockDetailPageState extends State void initState() { // TODO: implement initState super.initState(); - Get.log("LockDetailPage initState1111"); + // Get.log("LockDetailPage initState1111"); - print("LockDetailPage isOnlyOneData==${widget.isOnlyOneData}"); state.keyInfos.value = widget.lockListInfoItemEntity; state.lockUserNo = state.keyInfos.value.lockUserNo!; - print("state.lockUserNo==${state.lockUserNo}"); + if(state.lockUserNo == 0){ + state.bottomBtnisUneable.value = true; + } + state.isOnlyOneData = widget.isOnlyOneData; + // print("state.lockUserNo==${state.lockUserNo}"); state.senderUserId = state.keyInfos.value.senderUserId!; state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!; state.isOpenLockNeedOnline.value = @@ -111,7 +114,6 @@ class _LockDetailPageState extends State } Widget topWidget() { - // KeyInfos keyInfo = widget.lockMainEntity.data!.keyInfos![0]; return Column( children: [ SizedBox(height: 50.h), @@ -300,8 +302,7 @@ class _LockDetailPageState extends State // 根据权限显示不同的底部按钮 List getBottomWidget() { - if (state.keyInfos.value.isLockOwner == 1 || - state.keyInfos.value.keyRight == 1) { + if (state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1) { // 超级管理员、授权管理员 return getAllWidget(); } else { @@ -311,20 +312,24 @@ class _LockDetailPageState extends State // 普通用户 List getNormalWidget() { - var showWidgetArr = [ + var showWidgetArr = []; + // 考勤 + if (state.isAttendance.value == 1) { + showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', TranslationLoader.lanKeys!.checkingIn!.tr, state.bottomBtnisUneable.value, () { + Get.toNamed(Routers.checkingInListPage, + arguments: state.keyInfos.value); + })); + } // 操作记录 - bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () { - Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": state.keyInfos.value}); - }), + showWidgetArr.add(bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, state.bottomBtnisUneable.value,() { + Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": state.keyInfos.value}); + })); // 设置 - bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () { - Get.toNamed(Routers.lockSetPage, arguments: { - "lockId": state.keyInfos.value.lockId, - "isOnlyOneData": widget.isOnlyOneData, - }); - }), - ]; + showWidgetArr.add(bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, state.bottomBtnisUneable.value, () { + Get.toNamed(Routers.lockSetPage, arguments: {"lockId": state.keyInfos.value.lockId, "isOnlyOneData": state.isOnlyOneData}); + })); + return showWidgetArr; } @@ -333,30 +338,27 @@ class _LockDetailPageState extends State var showWidgetArr = []; // 考勤 if (state.isAttendance.value == 1) { - showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', - TranslationLoader.lanKeys!.checkingIn!.tr, () { + showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', TranslationLoader.lanKeys!.checkingIn!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.checkingInListPage, arguments: state.keyInfos.value); })); } // 电子钥匙 - showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png', - TranslationLoader.lanKeys!.electronicKey!.tr, () { + showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.electronicKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); })); // 密码 - showWidgetArr.add(bottomItem('images/main/icon_main_password.png', - TranslationLoader.lanKeys!.password!.tr, () { + showWidgetArr.add(bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); })); // 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, state.bottomBtnisUneable.value, () { // logic.showToast("普通用户第一次需要在锁旁边操作哦。", something: () { // logic.showEasyLoading(); // }); @@ -368,8 +370,7 @@ class _LockDetailPageState extends State // 指纹 if (state.keyInfos.value.lockFeature!.fingerprint == 1) { - showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', - TranslationLoader.lanKeys!.fingerprint!.tr, () { + showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.fingerprintListPage, arguments: { "lockId": state.keyInfos.value.lockId, }); @@ -378,8 +379,7 @@ class _LockDetailPageState extends State // 遥控 if (state.keyInfos.value.lockFeature!.bluetoothRemoteControl == 1) { - showWidgetArr.add(bottomItem('images/main/icon_main_remoteControl.png', - TranslationLoader.lanKeys!.remoteControl!.tr, () { + showWidgetArr.add(bottomItem('images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.remoteControlListPage); })); } @@ -387,8 +387,7 @@ class _LockDetailPageState extends State //可视对讲门锁新增->人脸 if (state.keyInfos.value.lockFeature!.d3Face == 1) { showWidgetArr.add( - bottomItem('images/main/icon_face.png', - TranslationLoader.lanKeys!.humanFace!.tr, () { + bottomItem('images/main/icon_face.png', TranslationLoader.lanKeys!.humanFace!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.faceList, arguments: { "lockId": state.keyInfos.value.lockId, }); // Toast.show(msg: "功能暂未开放"); @@ -399,8 +398,7 @@ class _LockDetailPageState extends State //可视对讲门锁新增->监控 if (state.keyInfos.value.lockFeature!.videoIntercom == 1) { showWidgetArr.add( - bottomItem('images/main/icon_catEyes.png', - TranslationLoader.lanKeys!.monitoring!.tr, () { + bottomItem('images/main/icon_catEyes.png', TranslationLoader.lanKeys!.monitoring!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.realTimePicturePage, arguments: { "lockName": state.keyInfos.value.lockName, "isMonitoring": true @@ -409,40 +407,41 @@ class _LockDetailPageState extends State ); } - var endWiddget = [ - // 授权管理员 - bottomItem('images/main/icon_main_authorizedAdmin.png', - TranslationLoader.lanKeys!.authorizedAdmin!.tr, () { + // 授权管理员 + if(state.keyInfos.value.isLockOwner == 1){ + showWidgetArr.add(bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.authorizedAdminListPage, arguments: {"keyInfo": state.keyInfos.value}); - }), + })); + } + // bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, state.bottomBtnisUneable.value, () { + // Get.toNamed(Routers.authorizedAdminListPage, + // arguments: {"keyInfo": state.keyInfos.value}); + // }) + + var endWiddget = [ // 操作记录 - bottomItem('images/main/icon_main_operatingRecord.png', - TranslationLoader.lanKeys!.operatingRecord!.tr, () { + bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, state.bottomBtnisUneable.value, () { // Get.toNamed(Routers.lockOperatingRecordPage, // arguments: {"keyInfo": state.keyInfos.value}); Get.toNamed(Routers.doorLockLogPage, arguments: {"keyInfo": state.keyInfos.value}); }), // 视频日志 - bottomItem('images/main/icon_lockDetail_videoLog.png', - TranslationLoader.lanKeys!.videoLog!.tr, () { + bottomItem('images/main/icon_lockDetail_videoLog.png', TranslationLoader.lanKeys!.videoLog!.tr, state.bottomBtnisUneable.value, () { //视频日志 Get.toNamed(Routers.videoLogPage); }), // 消息提醒 - bottomItem('images/main/icon_lockDetail_messageReminding.png', - TranslationLoader.lanKeys!.messageReminding!.tr, () { + bottomItem('images/main/icon_lockDetail_messageReminding.png', TranslationLoader.lanKeys!.messageReminding!.tr, state.bottomBtnisUneable.value, () { Get.toNamed(Routers.msgNotificationPage); }), // 设置 - bottomItem( - 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, - () { - // BlueManage().stopScan(); + bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, state.bottomBtnisUneable.value, () { + // logic.clickItemBtnAction(10); Get.toNamed(Routers.lockSetPage, arguments: { "lockId": state.keyInfos.value.lockId, - "isOnlyOneData": widget.isOnlyOneData, + "isOnlyOneData": state.isOnlyOneData, }); }), ]; @@ -450,11 +449,14 @@ class _LockDetailPageState extends State return showWidgetArr; } - Widget bottomItem(String iconUrl, String name, Function() onClick) { + // + Widget bottomItem(String iconUrl, String name, bool isForbidden, Function() onClick) { var width = 42.w; var height = 42.h; return GestureDetector( - onTap: onClick, + onTap: isForbidden ? (){ + logic.showToast("请在锁旁边完成第一次开锁"); + } : onClick , child: Container( // height: 300.h, color: Colors.white, @@ -463,16 +465,13 @@ class _LockDetailPageState extends State children: [ SizedBox( width: width, - height: height, - child: Image.asset(iconUrl, - width: width, height: height, fit: BoxFit.fitWidth), + height: height,// isForbidden ? "${iconUrl}_uneable.png" :"${iconUrl}.png" + child: Image.asset(iconUrl, width: width, height: height, color: isForbidden ? AppColors.lockDetailBottomBtnUneable : AppColors.mainColor,fit: BoxFit.fitWidth), ), SizedBox(height: 10.w), Expanded( - child: Text(name, - style: TextStyle( - fontSize: 20.sp, color: AppColors.blackColor), - textAlign: TextAlign.center)) + child: Text(name, style: TextStyle(fontSize: 20.sp, color: isForbidden ? AppColors.lockDetailBottomBtnUneable : AppColors.blackColor), textAlign: TextAlign.center) + ) ], )), ); @@ -552,7 +551,7 @@ class _LockDetailPageState extends State child: Column( children: [ Text( - widget.lockListInfoItemEntity.lockAlias!, + state.keyInfos.value.lockAlias!, style: TextStyle( color: AppColors.placeholderTextColor, fontSize: 24.sp), ), diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart index 7438c7b2..b088909b 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart @@ -21,6 +21,7 @@ class LockDetailState { String lockNetToken = ""; var lockUserNo = 0; var senderUserId = 0; + var isOnlyOneData = false; var isAttendance = 0.obs;// 是否开启考勤 var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网 @@ -35,8 +36,7 @@ class LockDetailState { var iSOpenLock = true.obs; // 是开锁还是关锁 Timer? closedUnlockSuccessfulTimer; - // 0开锁 1长按闭锁 2密码 3卡 4指纹 5遥控 6人脸 7监控 8操作记录 9消息提醒 10设置 - var clickNextType = 0; + var bottomBtnisUneable = false.obs; // 是否不可用 //过渡动画控制器 late AnimationController animationController; diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart index 2cabfc33..ded8cae4 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart @@ -34,7 +34,8 @@ class _LockOperatingRecordPageState extends State { haveBack: true, backgroundColor: AppColors.mainColor, actionsList: [ - IconButton( + (state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1) + ? IconButton( icon: Image.asset( 'images/icon_bar_more.png', height: 30.h, @@ -63,7 +64,8 @@ class _LockOperatingRecordPageState extends State { logic.showToast("演示模式"); } }, - ), + ) + : Container(), ], ), body: Column( diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart index 0d87eac7..411a0f81 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_page.dart @@ -91,6 +91,7 @@ class _BasicInformationPageState extends State { if (data != null) { setState(() { state.lockBasicInfo.value = data["lockBasicInfo"]; + print("state.lockBasicInfo.value.lockAlias:${state.lockBasicInfo.value.lockAlias}"); }); } })), @@ -111,8 +112,7 @@ class _BasicInformationPageState extends State { }); })), Visibility( - visible: (state.lockBasicInfo.value.isLockOwner == 1 || - state.lockBasicInfo.value.keyRight == 1) + visible: state.lockBasicInfo.value.isLockOwner == 1 ? true : false, child: CommonItem( diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_logic.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_logic.dart index 4bcae544..1e5b66a9 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_logic.dart @@ -16,8 +16,8 @@ class EditLockNameLogic extends BaseGetXController{ lockId: state.lockSetInfoData.value.lockId.toString(), lockName:state.changeLockNameController.text); if (entity.errorCode!.codeIsSuccessful) { + state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text; showToast("修改成功", something: (){ - state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text; eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!)); eventBus.fire(RefreshLockListInfoDataEvent()); }); diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index 8c4bb3bb..e6922ced 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -330,7 +330,7 @@ class _LockSetPageState extends State with RouteAware { }))), // 重置键 Obx(() => Visibility( - visible: state.lockFeature.value.resetSwitch == 1 ? true : false, + visible: (state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.resetSwitch == 1) ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.resetButton!.tr, rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1 @@ -470,7 +470,7 @@ class _LockSetPageState extends State with RouteAware { // 考勤 Obx( () => Visibility( - visible: state.lockFeature.value.attendance == 1 ? true : false, + visible: (state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.attendance == 1) ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr, rightTitle: "", @@ -481,7 +481,7 @@ class _LockSetPageState extends State with RouteAware { // 开锁提醒 Obx( () => Visibility( - visible: state.lockFeature.value.unlockReminder == 1 ? true : false, + visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.unlockReminder == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr, rightTitle: "", @@ -492,7 +492,7 @@ class _LockSetPageState extends State with RouteAware { // APP开锁时是否需联网 Obx( () => Visibility( - visible: state.lockFeature.value.appUnlockOnline == 1 ? true : false, + visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.appUnlockOnline == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader .lanKeys!.whetherInternetRequiredWhenUnlocking!.tr, diff --git a/star_lock/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart b/star_lock/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart index 766b5243..3defb3ae 100644 --- a/star_lock/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart @@ -23,13 +23,13 @@ class RemoteUnlockingLogic extends BaseGetXController{ remoteUnlock:state.remoteEnable.value == 1 ? 0 : 1 ); if(entity.errorCode!.codeIsSuccessful){ - eventBus.fire(RefreshLockListInfoDataEvent()); - - state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1; - state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value; - print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}"); - eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); - showToast("操作成功"); + showToast("操作成功", something: (){ + eventBus.fire(RefreshLockListInfoDataEvent()); + state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1; + state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value; + print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}"); + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); + }); } } 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 e62dc307..1b73dff5 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -41,6 +41,7 @@ class PasswordKeyListLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { print("重置电子钥匙成功啦啦啦啦啦"); showToast("重置成功"); + pageNo = 1; mockNetworkDataRequest(); } } @@ -52,6 +53,7 @@ class PasswordKeyListLogic extends BaseGetXController { .deleteKeyboardPwd(lockId, keyboardPwdId, deleteType); if (entity.errorCode!.codeIsSuccessful) { showToast("删除成功"); + pageNo = 1; mockNetworkDataRequest(); } } @@ -146,6 +148,7 @@ class PasswordKeyListLogic extends BaseGetXController { void _getPasswordListRefreshUIAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus _getPasswordListRefreshUIEvent = eventBus.on().listen((event) { + pageNo = 1; mockNetworkDataRequest(); }); } diff --git a/star_lock/lib/mine/message/messageList/messageList_page.dart b/star_lock/lib/mine/message/messageList/messageList_page.dart index 30aa376e..4567aaac 100644 --- a/star_lock/lib/mine/message/messageList/messageList_page.dart +++ b/star_lock/lib/mine/message/messageList/messageList_page.dart @@ -1,4 +1,3 @@ -import 'package:easy_refresh/easy_refresh.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -6,7 +5,6 @@ import 'package:star_lock/tools/noData.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; -import '../../../network/api_repository.dart'; import '../../../tools/EasyRefreshTool.dart'; import '../../../tools/dateTool.dart'; import '../../../tools/titleAppBar.dart'; @@ -79,7 +77,7 @@ class _MessageListPageState extends State with TickerProviderSt ), ], ), - child: _selectGatewayListListItem(messageItemEntity, () { + child: _messageListItem(messageItemEntity, () { Get.toNamed(Routers.messageDetailPage, arguments: {"messageItemEntity": messageItemEntity}); }), ); @@ -90,51 +88,51 @@ class _MessageListPageState extends State with TickerProviderSt ); } - Widget _selectGatewayListListItem(MessageItemEntity messageItemEntity, Function() action) { + Widget _messageListItem(MessageItemEntity messageItemEntity, Function() action) { return GestureDetector( onTap: action, child: Container( height: 90.h, + width: 1.sw, margin: EdgeInsets.only(bottom: 2.h), - // padding: - // EdgeInsets.only(left: 10.w, right: 20.w, top: 20.h, bottom: 20.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10.w), ), - child: Row( - children: [ - SizedBox( - width: 20.w, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, + child: Container( + width: 1.sw, + margin: EdgeInsets.only(left: 20.w, right: 20.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( + SizedBox( + width: 1.sw - 20.w*2, + child: Flexible( + child: Text( messageItemEntity.data!, + maxLines: 1, + overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 22.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor), ), - ], + ), ), - SizedBox(height: 10.h), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - // Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 40.w, height: 40.w,), - // SizedBox(width: 10.w,), - Text(DateTool().dateToYMDHNString(messageItemEntity.createdAt!.toString()), style: TextStyle(fontSize: 18.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor)), - ], - ), - SizedBox(width: 20.h), ], ), - ) - ], + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + // Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 40.w, height: 40.w,), + // SizedBox(width: 10.w,), + Text(DateTool().dateToYMDHNString(messageItemEntity.createdAt!.toString()), style: TextStyle(fontSize: 18.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor)), + ], + ), + SizedBox(width: 20.h), + ], + ), ), ), ); diff --git a/star_lock/lib/network/api_provider_base.dart b/star_lock/lib/network/api_provider_base.dart index fcbb8ab5..ee82aa85 100644 --- a/star_lock/lib/network/api_provider_base.dart +++ b/star_lock/lib/network/api_provider_base.dart @@ -32,7 +32,7 @@ class BaseProvider extends GetConnect with Api { // print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}"); if (isUnShowLoading == false) EasyLoading.show(); // print('请求url======>$url'); - // print('请求body体======>$body'); + print('请求body体======>$body'); var res = await super.post(url, body, contentType: contentType, headers: headers, diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index 7ae6a6c8..969571e4 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -125,16 +125,18 @@ class ApiRepository { //电子钥匙列表 Future electronicKeyList( - String endDate, - String keyId, - String keyStatus, - String lockId, - String operatorUid, - String pageNo, - String pageSize, - String startDate, - String keyRight, - String searchStr) async { + { + required String endDate, + required String keyId, + required String keyStatus, + required String lockId, + required String operatorUid, + required String pageNo, + required String pageSize, + required String startDate, + required String keyRight, + required String searchStr + }) async { final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus, lockId, operatorUid, pageNo, pageSize, startDate, keyRight, searchStr); return ElectronicKeyListEntity.fromJson(res.body); diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart index 72c71f27..eac42f8b 100644 --- a/star_lock/lib/tools/eventBusEventManage.dart +++ b/star_lock/lib/tools/eventBusEventManage.dart @@ -89,3 +89,8 @@ class GetPasswordListRefreshUI { class ReadMessageRefreshUI { ReadMessageRefreshUI(); } + +/// 刷新电子钥匙列表 +class ElectronicKeyListRefreshUI { + ElectronicKeyListRefreshUI(); +}