From 5960876d53578dc33dc1dcd0a8a02e9e5094c082 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 30 Aug 2023 10:58:00 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=94=B5=E5=AD=90=E9=92=A5=E5=8C=99=E6=8E=A5=E5=8F=A3=202?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=203=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=A0=87?= =?UTF-8?q?=E8=AE=B0=E6=88=BF=E6=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../electronicKeyDetail_page.dart | 17 +++++- .../sendElectronicKey_page.dart | 16 ++++- .../passwordKeyDetail_page.dart | 22 ++++++- star_lock/lib/network/api.dart | 1 + star_lock/lib/network/api_provider.dart | 31 +++++----- star_lock/lib/network/api_repository.dart | 58 +++++++++---------- 6 files changed, 94 insertions(+), 51 deletions(-) diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index c2d82182..4276af29 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -125,7 +125,9 @@ class _ElectronicKeyDetailPageState extends State { margin: EdgeInsets.only( left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () {}), + onClick: () { + deleteKeyRequest(); + }), ], ), ); @@ -249,6 +251,19 @@ class _ElectronicKeyDetailPageState extends State { } } + //删除电子钥匙名称请求 + Future deleteKeyRequest() async { + ElectronicKeyListEntity entity = + await ApiRepository.to.deleteElectronicKey('0'); + if (entity.errorCode!.codeIsSuccessful) { + print("删除电子钥匙成功"); + Toast.show(msg: "删除成功"); + setState(() { + Navigator.pop(context); + }); + } + } + void showCupertinoAlertDialog( BuildContext context, ) { 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 8083416e..38eedfff 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 @@ -428,12 +428,26 @@ class _SendElectronicKeyPageState extends State { ), OutLineBtn( btnName: '标记为已入住', - onClick: () {}, + onClick: () { + updateRoomCheckIn(); + }, ), ], ); } + //标记房间为已入住 isOn:已入住: 1 空闲:2 + Future updateRoomCheckIn() async { + var entity = await ApiRepository.to.updateSetting('0', '1', '13'); + if (entity.errorCode!.codeIsSuccessful) { + print("标记为已入住成功啦啦啦啦啦"); + Toast.show(msg: "标记成功"); + setState(() {}); + } else { + Toast.show(msg: '操作失败'); + } + } + // 接受者信息输入框 Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) { return SizedBox( 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 60857039..f20bccde 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -3,7 +3,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; -import 'package:star_lock/tools/shareModule/sharePopup.dart'; +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/toast.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; @@ -163,7 +166,9 @@ class _PasswordKeyDetailPageState extends State { margin: EdgeInsets.only( left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () {}), + onClick: () { + deletePwdRequest(); + }), ], ), ); @@ -232,6 +237,19 @@ class _PasswordKeyDetailPageState extends State { ); } + //删除密码请求 + Future deletePwdRequest() async { + PasswordKeyEntity entity = + await ApiRepository.to.deleteKeyboardPwd('0', '1', '1'); + if (entity.errorCode!.codeIsSuccessful) { + print("删除密码成功"); + Toast.show(msg: "删除成功"); + setState(() { + Navigator.pop(context); + }); + } + } + void showCupertinoAlertDialog(BuildContext context) { showDialog( context: context, diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 22278042..f3e9c1fa 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -34,4 +34,5 @@ abstract class Api { final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录 final String addlockGroupURL = '/keyGroup/add'; //创建锁分组 final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表 + final String updateSettingURL = '/room/updateSetting'; //标记房态 } diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 15357dd4..507401f2 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -250,24 +250,19 @@ class ApiProvider extends BaseProvider { })); // 获取锁信息 - Future getLockInfo( - String lastUpdateDate, - String pageNo) => - post( - getLockInfoURL.toUrl, - jsonEncode({ - 'lastUpdateDate': lastUpdateDate, - "pageNo": pageNo, - })); + Future getLockInfo(String lastUpdateDate, String pageNo) => post( + getLockInfoURL.toUrl, + jsonEncode({ + 'lastUpdateDate': lastUpdateDate, + "pageNo": pageNo, + })); // 删除锁 - Future deletLockInfo( - String lockId) => - post( - deletLockURL.toUrl, - jsonEncode({ - 'lockId': lockId, - })); + Future deletLockInfo(String lockId) => post( + deletLockURL.toUrl, + jsonEncode({ + 'lockId': lockId, + })); Future passwordKeyList( String keyStatus, @@ -337,6 +332,10 @@ class ApiProvider extends BaseProvider { 'keyboardPwdId': keyboardPwdId, 'deleteType': deleteType })); + + Future updateSetting(String lockId, String isOn, String type) => + post(updateSettingURL.toUrl, + jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type})); } extension ExtensionString on String { diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index fc3fae28..0942761c 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -177,24 +177,17 @@ class ApiRepository { } // 绑定蓝牙管理员 - Future bindingBlueAdmin({ - required String bindingDate, - required String hotelMode, - required String lockAlias, - required Map lockData, - required String nbInitSuccess, - required Map position, - required Map bluetooth, - required String deviceNo}) async { - final res = await apiProvider.bindingBlueAdmin( - bindingDate, - hotelMode, - lockAlias, - lockData, - nbInitSuccess, - position, - bluetooth, - deviceNo); + Future bindingBlueAdmin( + {required String bindingDate, + required String hotelMode, + required String lockAlias, + required Map lockData, + required String nbInitSuccess, + required Map position, + required Map bluetooth, + required String deviceNo}) async { + final res = await apiProvider.bindingBlueAdmin(bindingDate, hotelMode, + lockAlias, lockData, nbInitSuccess, position, bluetooth, deviceNo); return SaveLockEntity.fromJson(res.body); } @@ -250,18 +243,14 @@ class ApiRepository { } // 获取锁信息 - Future getLockInfo({ - required String lastUpdateDate, - required String pageNo}) async { - final res = await apiProvider.getLockInfo( - lastUpdateDate, - pageNo); + Future getLockInfo( + {required String lastUpdateDate, required String pageNo}) async { + final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo); return LockMainEntity.fromJson(res.body); } // 删除锁 - Future deletLockData({ - required String lockId}) async { + Future deletLockData({required String lockId}) async { final res = await apiProvider.deletLockInfo(lockId); return LockMainEntity.fromJson(res.body); } @@ -311,16 +300,23 @@ class ApiRepository { } //删除电子钥匙 - Future deleteElectronicKey(String type) async { - final res = await apiProvider.deleteElectronicKey(type); - return LockGroupListEntity.fromJson(res.body); + Future deleteElectronicKey(String keyId) async { + final res = await apiProvider.deleteElectronicKey(keyId); + return ElectronicKeyListEntity.fromJson(res.body); } //删除密码 - Future deleteKeyboardPwd( + Future deleteKeyboardPwd( String keyId, String keyboardPwdId, String deleteType) async { final res = await apiProvider.deleteKeyboardPwd(keyId, keyboardPwdId, deleteType); - return LockGroupListEntity.fromJson(res.body); + return PasswordKeyEntity.fromJson(res.body); + } + + //标记房态 + Future updateSetting( + String lockId, String isOn, String type) async { + final res = await apiProvider.deleteKeyboardPwd(lockId, isOn, type); + return PasswordKeyEntity.fromJson(res.body); } }