diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index bd9f3179..051825a5 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -1,9 +1,13 @@ import 'dart:async'; +import 'package:flutter/material.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_settings.dart'; +import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/tools/dateTool.dart'; +import 'package:star_lock/tools/showCupertinoAlertView.dart'; import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_reply.dart'; @@ -136,6 +140,45 @@ class AuthorizedAdminLogic extends BaseGetXController { } } + //如果打开了实名认证,需要弹出输入身份证信息框 + if (state.isAuthentication.value == true) { + if (state.realNameController.text.isEmpty) { + showToast("请输入真实姓名".tr); + return; + } + + if (state.idCardController.text.isEmpty) { + showToast("请输入身份证号".tr); + return; + } + //弹出身份证信息确认框 + ShowCupertinoAlertView().realNameIDCardInfoComfirmAlert( + getNameStr: state.realNameController.text, + getIDCardStr: state.idCardController.text, + onConfirm: () { + goSendElectronicKey( + endDate: endDate, + getKeyType: getKeyType, + startDate: startDate, + startTime: startTime, + endTime: endTime); + }); + } else { + goSendElectronicKey( + endDate: endDate, + getKeyType: getKeyType, + startDate: startDate, + startTime: startTime, + endTime: endTime); + } + } + + Future goSendElectronicKey( + {required String endDate, + required String getKeyType, + required String startDate, + required String startTime, + required String endTime}) async { var entity = await ApiRepository.to.sendElectronicKey( createUser: state.isCreateUser.value ? "1" : "0", countryCode: state.countryCode.value, @@ -156,8 +199,12 @@ class AuthorizedAdminLogic extends BaseGetXController { startTime: int.parse(startTime), endTime: int.parse(endTime), isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0, - realName: '', - idCardNumber: ''); + realName: state.isRequireAuth.value == true + ? state.realNameController.text + : "", + idCardNumber: state.isRequireAuth.value == true + ? state.idCardController.text + : ""); if (entity.errorCode!.codeIsSuccessful) { state.isCreateUser.value = false; state.isSendSuccess.value = true; @@ -169,7 +216,6 @@ class AuthorizedAdminLogic extends BaseGetXController { if (entity.errorCode == 425) { //用户未注册 state.isCreateUser.value = true; - // _showDialog('${entity.errorMsg}'); ShowTipView().showIosTipWithContentDialog( '${"是否发送授权管理员给未注册账号".tr}\n${state.emailOrPhoneController.text}', () { @@ -179,6 +225,24 @@ class AuthorizedAdminLogic extends BaseGetXController { } } + //检测实名认证是否支持开启 + Future keyCheckFace() async { + AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( + countryCode: int.parse(state.countryCode.value), + account: state.emailOrPhoneController.text); + if (entity.errorCode!.codeIsSuccessful) { + //打开实名认证,需要弹出输入身份证信息框 + state.isRequireAuth.value = true; + } else { + ShowTipView().showBuyTipWithContentAlert( + titleStr: '实名认证为付费功能,请购买后再使用'.tr, + sureClick: () { + Get.toNamed(Routers.advancedFeaturesWebPage, + arguments: {'isShop': false}); + }); + } + } + //标记房间为已入住 isOn:已入住: 1 空闲:2 Future updateRoomCheckIn() async { var entity = await ApiRepository.to.setRoomStatusData( @@ -190,40 +254,25 @@ class AuthorizedAdminLogic extends BaseGetXController { } } - //用户未注册确认弹窗 - // void _showDialog(String errMsg) { - // showCupertinoDialog( - // context: Get.context!, - // builder: (context) { - // return CupertinoAlertDialog( - // title: const Text('接收者号码未注册,请重新发送'), - // actions: [ - // CupertinoDialogAction( - // child: Text(TranslationLoader.lanKeys!.cancel!.tr), - // onPressed: () { - // Get.back(); - // }, - // ), - // CupertinoDialogAction( - // child: Text(TranslationLoader.lanKeys!.sure!.tr), - // onPressed: () async { - // //选择国家代码 - // Get.back(); - // - // // var result = await Get.toNamed(Routers.selectCountryRegionPage); - // // if (result != null) { - // // result as Map; - // // state.countryCode.value = result['code']; - // // state.countryName.value = result['countryName']; - // // } - // sendElectronicKeyRequest(); - // }, - // ), - // ], - // ); - // }, - // ); - // } + TextEditingController getCurrentController(int lineIndex) { + TextEditingController currentController = TextEditingController(); + switch (lineIndex) { + case 1: + currentController = state.emailOrPhoneController; + break; + case 2: + currentController = state.keyNameController; + break; + case 3: + currentController = state.realNameController; + break; + case 4: + currentController = state.idCardController; + break; + default: + } + return currentController; + } @override void onReady() { 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 8d71f90b..492e6220 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -36,7 +36,6 @@ class _AuthorizedAdminPageState extends State @override void initState() { - // TODO: implement initState super.initState(); state.tabController = @@ -82,7 +81,7 @@ class _AuthorizedAdminPageState extends State children: [ keyInfoWidget(), keyTimeWidget(), - keyRealNameWidget(), + keyOnlyManageWidget(), keyBottomWidget( TranslationLoader.lanKeys!.authorizedAdminTip!.tr) ], @@ -95,7 +94,7 @@ class _AuthorizedAdminPageState extends State child: Column( children: [ keyInfoWidget(), - keyRealNameWidget(), + keyOnlyManageWidget(), keyBottomWidget( TranslationLoader.lanKeys!.authorizedAdminTip!.tr) ], @@ -189,7 +188,7 @@ class _AuthorizedAdminPageState extends State } // 实名认证 - Widget keyRealNameWidget() { + Widget keyOnlyManageWidget() { return Column( children: [ CommonItem( @@ -205,17 +204,7 @@ class _AuthorizedAdminPageState extends State height: 50.h, child: _onlyManageYouCreatesUserSwitch())), Container(height: 10.h), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr, - rightTitle: "", - isTipsImg: true, - tipsImgAction: () { - ShowTipView().showSureAlertDialog( - "人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。"); - }, - isHaveRightWidget: true, - rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()), - action: () {}), + keyRealNameWidget(), Container(height: 10.h), ], ); @@ -227,7 +216,6 @@ class _AuthorizedAdminPageState extends State Container( padding: EdgeInsets.all(20.w), child: Row( - // crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Text( @@ -255,7 +243,6 @@ class _AuthorizedAdminPageState extends State }), Container( padding: EdgeInsets.only(right: 30.w), - // color: Colors.red, child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -264,7 +251,6 @@ class _AuthorizedAdminPageState extends State var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { Get.toNamed(Routers.volumeAuthorizationLockManagePage); - // Navigator.pushNamed(context, Routers.volumeAuthorizationLockManagePage); } else { logic.showToast("演示模式"); } @@ -281,6 +267,43 @@ class _AuthorizedAdminPageState extends State ); } + // 实名认证 + Widget keyRealNameWidget() { + return Column( + children: [ + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr, + rightTitle: "", + isTipsImg: true, + isHaveLine: + logic.state.isRequireAuth.value == true ? true : false, + tipsImgAction: () { + ShowTipView().showSureAlertDialog( + "人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。".tr); + }, + isHaveRightWidget: true, + rightWidget: SizedBox( + width: 60.w, height: 50.h, child: _realNameAuthSwitch()), + )), + Obx(() => Visibility( + visible: logic.state.isRequireAuth.value, + child: CommonItem( + leftTitel: '真实姓名'.tr, + rightTitle: "", + isHaveRightWidget: true, + isHaveLine: true, + rightWidget: getTFWidget(false, '请输入真实姓名'.tr, 3)))), + Obx(() => Visibility( + visible: logic.state.isRequireAuth.value, + child: CommonItem( + leftTitel: '身份证号'.tr, + rightTitle: "", + isHaveRightWidget: true, + rightWidget: getTFWidget(false, '请输入身份证号'.tr, 4)))), + ], + ); + } + // 发送电子钥匙成功 Widget sendElectronicKeySucceed() { return Column( @@ -336,11 +359,9 @@ class _AuthorizedAdminPageState extends State if (state.emailOrPhoneController.text.contains("@")) { Get.toNamed(Routers.sendEmailNotificationPage); } else { - // _openModalBottomSheet(); NativeInteractionTool() .loadNativeShare(shareText: state.pwdShareStr); } - // Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage); }, ), SizedBox( @@ -349,7 +370,6 @@ class _AuthorizedAdminPageState extends State OutLineBtn( btnName: '微信通知', onClick: () { - // _openModalBottomSheet(); NativeInteractionTool() .loadNativeShare(shareText: state.pwdShareStr); }, @@ -357,12 +377,6 @@ class _AuthorizedAdminPageState extends State SizedBox( height: 10.h, ), - // OutLineBtn( - // btnName: '标记为:已入住', - // onClick: () { - // logic.updateRoomCheckIn(); - // }, - // ), ], ); } @@ -384,9 +398,7 @@ class _AuthorizedAdminPageState extends State ], style: TextStyle( fontSize: 22.sp, color: AppColors.darkGrayTextColor), - controller: lineIndex == 1 - ? state.emailOrPhoneController - : state.keyNameController, + controller: logic.getCurrentController(lineIndex), autofocus: false, textAlign: TextAlign.end, decoration: InputDecoration( @@ -408,15 +420,6 @@ class _AuthorizedAdminPageState extends State 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( @@ -460,7 +463,7 @@ class _AuthorizedAdminPageState extends State } //实名认证 - CupertinoSwitch _switch() { + CupertinoSwitch _realNameAuthSwitch() { return CupertinoSwitch( activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, @@ -469,6 +472,11 @@ class _AuthorizedAdminPageState extends State onChanged: (value) { setState(() { state.isAuthentication.value = !state.isAuthentication.value; + if (state.isAuthentication.value == true) { + logic.keyCheckFace(); + } else { + state.isRequireAuth.value = false; + } }); }, ); @@ -631,11 +639,9 @@ class _AuthorizedAdminPageState extends State Tab _tab(ItemView item) { return Tab( - // text: item.title, child: Container( width: 1.sw / 4, margin: EdgeInsets.all(10.w), - // color: Colors.red, child: Text( item.title, textAlign: TextAlign.center, diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart index 1421ac32..0a350e43 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart @@ -3,23 +3,27 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart import 'package:get/get.dart'; import 'package:star_lock/tools/dateTool.dart'; -import '../../../lockMian/entity/lockListInfo_entity.dart'; - class AuthorizedAdminState { - final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框 - final TextEditingController keyNameController = TextEditingController(); //钥匙名输入框 + final TextEditingController emailOrPhoneController = + TextEditingController(); //邮箱/手机号输入框 + final TextEditingController keyNameController = + TextEditingController(); //钥匙名输入框 late TabController tabController; + TextEditingController realNameController = TextEditingController(); //真实姓名输入框 + TextEditingController idCardController = TextEditingController(); //身份证号输入框 final FlutterContactPicker contactPicker = FlutterContactPicker(); late Contact contact; - // final keyInfo = LockListInfoItemEntity().obs; - // final lockMainEntity = LockMainEntity().obs; - final isAuthentication = false.obs; //是否可以实名认证 + var isAuthentication = false.obs; //是否可以实名认证 final onlyManageYouCreatesUser = false.obs; // 只能管理自己创建的用户 - var beginDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs; //默认为当前时间 开始时间 - var endDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//默认为当前时间 结束时间 + var beginDate = DateTool() + .dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()) + .obs; //默认为当前时间 开始时间 + var endDate = DateTool() + .dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()) + .obs; //默认为当前时间 结束时间 var isSendSuccess = false.obs; var countryName = '中国'.obs; @@ -31,9 +35,5 @@ class AuthorizedAdminState { String pwdShareStr = '您好,您的授权管理员生成成功'; var addUserId = ''.obs; - // AuthorizedAdminState() { - // Map map = Get.arguments; - // // lockMainEntity.value = map["lockMainEntity"]; - // keyInfo.value = map["keyInfo"]; - // } + var isRequireAuth = false.obs; //是否需要实名认证的必填项 } 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 dd967e4b..c89ecb27 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart @@ -22,14 +22,14 @@ class AuthorizedAdminListLogic extends BaseGetXController { pageNo: pageNo.toString(), pageSize: pageSize.toString(), startDate: '0', - searchStr:state.searchStr.value); + searchStr: state.searchStr.value); if (entity.errorCode!.codeIsSuccessful) { if (pageNo == 1) { - state.itemDataList.value = entity.data!.itemList!; + state.itemDataList.value = entity.data!.itemList; pageNo++; } else { - if (entity.data!.itemList!.isNotEmpty) { - state.itemDataList.value.addAll(entity.data!.itemList!); + if (entity.data!.itemList.isNotEmpty) { + state.itemDataList.addAll(entity.data!.itemList); pageNo++; } } @@ -39,11 +39,8 @@ class AuthorizedAdminListLogic extends BaseGetXController { //删除电子钥匙名称请求 Future deleteKeyRequest(String keyId, int includeUnderlings) async { - ElectronicKeyListEntity entity = - await ApiRepository.to.deleteElectronicKey( - keyId:keyId, - includeUnderlings: includeUnderlings - ); + ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey( + keyId: keyId, includeUnderlings: includeUnderlings); if (entity.errorCode!.codeIsSuccessful) { showToast("删除成功"); pageNo = 1; @@ -55,7 +52,8 @@ class AuthorizedAdminListLogic extends BaseGetXController { StreamSubscription? _getAuthorizedAdminPageRefreshUIEvent; void _getAuthorizedAdminPageRefreshUIAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - _getAuthorizedAdminPageRefreshUIEvent = eventBus.on().listen((event) { + _getAuthorizedAdminPageRefreshUIEvent = + eventBus.on().listen((event) { pageNo = 1; mockNetworkDataRequest(); }); diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index 1400711f..752a1115 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -11,7 +11,6 @@ import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/EasyRefreshTool.dart'; -import '../../../../tools/showIosTipView.dart'; import '../../../../tools/showTipView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; @@ -40,7 +39,7 @@ class _AuthorizedAdminListPageState extends State { // 获取是否是演示模式 演示模式不获取接口 var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value){ + logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value) { setState(() {}); }); } @@ -56,24 +55,24 @@ class _AuthorizedAdminListPageState extends State { backgroundColor: AppColors.mainColor, ), body: EasyRefreshTool( - onRefresh: (){ + onRefresh: () { logic.pageNo = 1; mockRequest(); }, - onLoad: (){ + onLoad: () { mockRequest(); }, child: Column( children: [ - Expanded( - child:_buildMainUI()), + Expanded(child: _buildMainUI()), SizedBox( height: 20.h, ), AddBottomWhiteBtn( btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr, onClick: () { - Navigator.pushNamed(context, Routers.authorizedAdminPage).then((val) { + Navigator.pushNamed(context, Routers.authorizedAdminPage) + .then((val) { if (val != null) { logic.pageNo = 1; mockRequest(); @@ -93,116 +92,80 @@ class _AuthorizedAdminListPageState extends State { return Obx(() => state.itemDataList.value.isEmpty ? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - 90) : SlidableAutoCloseBehavior( - child: ListView.separated( - itemCount: state.itemDataList.value.length, - itemBuilder: (c, index) { - ElectronicKeyListItem indexEntity = state.itemDataList.value[index]; - String useDateStr = ''; //使用期限 - String keyStatus = ''; //钥匙状态 + child: ListView.separated( + itemCount: state.itemDataList.value.length, + itemBuilder: (c, index) { + ElectronicKeyListItem indexEntity = + state.itemDataList.value[index]; + String useDateStr = ''; //使用期限 + String keyStatus = ''; //钥匙状态 - //使用期限 - useDateStr = getUseDateStr(indexEntity); + //使用期限 + useDateStr = getUseDateStr(indexEntity); - //钥匙状态 - keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!); + //钥匙状态 + keyStatus = + XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!); - //是否为管理钥匙 - 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){ - ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) { - logic.deleteKeyRequest(indexEntity.keyId.toString(), isAllData ? 1 : 0); - }); - }, - backgroundColor: Colors.red, - foregroundColor: Colors.white, - label: '删除', - padding: EdgeInsets.only(left: 5.w, right: 5.w), - ), - ], - ), - 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(() {}); + //是否为管理钥匙 + bool isAdminKey = false; + if (indexEntity.keyRight == 1) { + isAdminKey = true; + } else { + isAdminKey = false; } - }); - }), - ); - // if (index < state.itemDataList.value.length) { - // return LeftSlideActions( - // // key: Key(indexEntity.lockId!.toString()), - // actionsWidth: 60, - // actions: [ - // _buildDeleteBtn(indexEntity), - // ], - // decoration: const BoxDecoration( - // borderRadius: BorderRadius.all(Radius.circular(1)), - // ), - // 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 const SizedBox.shrink(); - }, - separatorBuilder: (BuildContext context, int index) { - return Divider( - height: 1.h, - color: AppColors.greyLineColor, - ); - }, - ), - )); + return Slidable( + key: ValueKey(indexEntity.keyId), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context) { + ShowTipView() + .showDeleteAdministratorIsHaveAllDataDialog( + '同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) { + logic.deleteKeyRequest(indexEntity.keyId.toString(), + isAllData ? 1 : 0); + }); + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + label: '删除', + padding: EdgeInsets.only(left: 5.w, right: 5.w), + ), + ], + ), + 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 Divider( + height: 1.h, + color: AppColors.greyLineColor, + ); + }, + ), + )); } - // void showIosTipViewDialog( - // BuildContext context, String keyId) { - // showDialog( - // context: context, - // builder: (BuildContext context) { - // return ShowIosTipView( - // title: "提示", - // tipTitle: "确定要删除吗?", - // sureClick: () { - // Get.back(); - // logic.deleteKeyRequest(keyId); - // }, - // cancelClick: () { - // Get.back(); - // }, - // ); - // }); - // } - //使用期限 String getUseDateStr(ElectronicKeyListItem indexEntity) { String useDateStr = ''; @@ -216,48 +179,11 @@ class _AuthorizedAdminListPageState extends State { useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { - //永久 - // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; useDateStr = "永久"; } - // else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { - // //单次 - // // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - // // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; - // useDateStr = "单次"; - // } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { - // //循环 - // useDateStr = '循环'; - // } - return useDateStr; } -//钥匙状态 -// String getKeyStatus(int? keyStatusFlag) { -// String keyStatus = ''; -// -// if (keyStatusFlag == 110401) { -// //正常使用 -// keyStatus = ''; -// } else if (keyStatusFlag == 110402) { -// //待接收 -// keyStatus = '待接收'; -// } else if (keyStatusFlag == 110405) { -// //已冻结 -// keyStatus = '已冻结'; -// } else if (keyStatusFlag == 110408) { -// //已删除 -// keyStatus = '已删除'; -// } else if (keyStatusFlag == 110410) { -// //已重置 -// keyStatus = '已重置'; -// } -// -// return keyStatus; -// } - Widget _electronicKeyItem(String avatarURL, String receiveUser, String useDate, String keyStatus, bool isAdminKey, Function() action) { return GestureDetector( @@ -268,7 +194,11 @@ class _AuthorizedAdminListPageState extends State { child: Row( children: [ SizedBox(width: 30.w), - Image.asset(avatarURL, width: 60.w, height: 60.w,), + Image.asset( + avatarURL, + width: 60.w, + height: 60.w, + ), SizedBox(width: 20.w), Expanded( child: Column( @@ -281,14 +211,13 @@ class _AuthorizedAdminListPageState extends State { child: Row( children: [ Flexible( - child: Text( - receiveUser, + child: Text(receiveUser, maxLines: 1, overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) - ), + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor)), ), - ], ), ), @@ -321,80 +250,4 @@ class _AuthorizedAdminListPageState extends State { ), ); } - - // Widget _electronicKeyItem(String avatarURL, String receiveUser, - // String useDate, String keyStatus, bool isAdminKey, Function() action) { - // return GestureDetector( - // onTap: action, - // child: Container( - // height: 100.h, - // // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), - // // decoration: BoxDecoration( - // // color: Colors.white, - // // borderRadius: BorderRadius.circular(10.w), - // // ), - // child: Row( - // children: [ - // SizedBox( - // width: 30.w, - // ), - // Image.asset( - // avatarURL, - // width: 60.w, - // height: 60.w, - // ), - // SizedBox( - // width: 20.w, - // ), - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Text( - // receiveUser, - // style: TextStyle( - // fontSize: 24.sp, color: AppColors.blackColor), - // ), - // SizedBox( - // width: 8.w, - // ), - // Container( - // padding: EdgeInsets.only( - // left: 4.w, right: 4.w, top: 1.w, bottom: 1.w), - // decoration: BoxDecoration( - // color: AppColors.toBeReceiveBgColor, - // borderRadius: BorderRadius.circular(5.0), - // ), - // child: Text( - // keyStatus, - // style: TextStyle(color: Colors.red, fontSize: 16.sp), - // ), - // ) - // ], - // ), - // SizedBox(height: 5.h), - // Row( - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Text( - // useDate, - // style: TextStyle( - // fontSize: 18.sp, - // color: AppColors.placeholderTextColor), - // ), - // ], - // ), - // SizedBox(width: 20.h), - // ], - // ), - // ), - // SizedBox(width: 20.h), - // ], - // ), - // ), - // ); - // } } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart index f3077f96..1766a13d 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart @@ -270,8 +270,6 @@ class _VolumeAuthorizationLockPageState autofocus: false, textAlign: TextAlign.end, decoration: InputDecoration( - //输入里面输入文字内边距设置 - // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), hintText: tfStr, hintStyle: TextStyle(fontSize: 22.sp), focusedBorder: const OutlineInputBorder( @@ -288,14 +286,6 @@ class _VolumeAuthorizationLockPageState 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(fontSize: 22.sp), - // //不需要输入框下划线 - // border: InputBorder.none, - // ), ), ), SizedBox( diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart index 5aefa554..59fb9403 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart @@ -142,7 +142,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController { ? '1' : '2', endDate: int.parse(endDate), - faceAuthentication: state.isAuthentication == true ? '1' : '2', + faceAuthentication: state.isAuthentication.value == true ? '1' : '2', isCameraEnable: '2', isRemoteUnlock: state.isRemoteUnlock == true ? '1' : '2', keyNameForAdmin: state.keyNameController.text, diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart index 1e5b0d33..6e00872c 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart @@ -43,18 +43,6 @@ class _LockOperatingRecordPageState extends State { onPressed: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - // JhPopMenus.showLinePop(context, clickCallback: (index, selText) { - // if (index == 0) { - // logic.mockNetworkDataRequest(); - // } else if (index == 1) { - // logic.clearOperationRecordRequest(); - // } - // }, listData: [ - // {'text': '读取记录'}, - // {'text': '清空记录'}, - // {'text': '导出记录'}, - // ]); - _openModalBottomSheet(); } else { // Get.toNamed(Routers.selectLockTypePage); @@ -67,20 +55,22 @@ class _LockOperatingRecordPageState extends State { ), body: Column( children: [ - (state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1) ? - Column( - children: [ - Container( - padding: EdgeInsets.all(20.h), - child: Text( - TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr, - textAlign: TextAlign.start, - style: TextStyle(fontSize: 20.sp), - ), - ), - _searchWidget(), - ], - ) : Container(), + (state.keyInfos.value.isLockOwner == 1 || + state.keyInfos.value.keyRight == 1) + ? Column( + children: [ + Container( + padding: EdgeInsets.all(20.h), + child: Text( + TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr, + textAlign: TextAlign.start, + style: TextStyle(fontSize: 20.sp), + ), + ), + _searchWidget(), + ], + ) + : Container(), SizedBox(height: 10.h), Expanded(child: _buildMainUI()), ], @@ -148,22 +138,6 @@ class _LockOperatingRecordPageState extends State { : NoData()); } - Widget _dateItem(String lockDate) { - return Container( - height: 60.h, - // color: Colors.red, - padding: EdgeInsets.only(left: 20.h, right: 20.h), - child: Row( - children: [ - Text( - lockDate, - style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), - ), - ], - ), - ); - } - String getTypeIcon(int type) { String title = 'images/controls_user.png'; switch (type) { diff --git a/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart b/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart index 00b8ee8c..10be744e 100644 --- a/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart @@ -14,7 +14,7 @@ class CatEyeWorkModeLogic extends BaseGetXController { catEyeConfig: [ { 'catEyeMode': - state.boolList.value.indexWhere((element) => element == true) + 1, + state.boolList.indexWhere((element) => element == true) + 1, 'catEyeModeConfig': { 'recordMode': state.lockSetInfoData.value.lockSettingInfo! .catEyeConfig!.isNotEmpty @@ -63,24 +63,17 @@ class CatEyeWorkModeLogic extends BaseGetXController { state.catEyeConfigData.value = entity.data!.lockSettingInfo!.catEyeConfig![0]; - // state.selectCatEyeWorkMode.value = - // state.catEyeConfigData.value.catEyeMode!; - if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModePowerSaving) { - // state.boolList.value[0] = true; state.boolList.value = [true, false, false, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeStayCapture) { - // state.boolList.value[1] = true; state.boolList.value = [false, true, false, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeRealTimeMonitoring) { - // state.boolList.value[2] = true; state.boolList.value = [false, false, true, false]; } else if (state.catEyeConfigData.value.catEyeMode == XSConstantMacro.catEyeWorkModeCustom) { - // state.boolList.value[3] = true; state.boolList.value = [false, false, false, true]; } } diff --git a/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart b/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart index 14a56478..c205c0fc 100644 --- a/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart @@ -137,24 +137,6 @@ class _CatEyeWorkModePageState extends State { for (int i = 0; i < state.boolList.value.length; i++) { if (clickIndex == i) { state.boolList.value[clickIndex] = true; - // switch (clickIndex) { - // case 0: - // state.selectCatEyeWorkMode.value = - // XSConstantMacro.catEyeWorkModePowerSaving; - // break; - // case 1: - // state.selectCatEyeWorkMode.value = - // XSConstantMacro.catEyeWorkModeStayCapture; - // break; - // case 2: - // state.selectCatEyeWorkMode.value = - // XSConstantMacro.catEyeWorkModeRealTimeMonitoring; - // break; - // case 3: - // state.selectCatEyeWorkMode.value = - // XSConstantMacro.catEyeWorkModeCustom; - // break; - // } logic.updateCatEyeModeConfig(); } else { state.boolList.value[i] = false;