This commit is contained in:
魏少阳 2023-08-30 14:55:47 +08:00
commit a487a22580
6 changed files with 94 additions and 51 deletions

View File

@ -125,7 +125,9 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
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<ElectronicKeyDetailPage> {
}
}
//
Future<void> 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,
) {

View File

@ -428,12 +428,26 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
),
OutLineBtn(
btnName: '标记为已入住',
onClick: () {},
onClick: () {
updateRoomCheckIn();
},
),
],
);
}
// isOn:: 1 2
Future<void> 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(

View File

@ -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<PasswordKeyDetailPage> {
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<PasswordKeyDetailPage> {
);
}
//
Future<void> 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,

View File

@ -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'; //
}

View File

@ -250,24 +250,19 @@ class ApiProvider extends BaseProvider {
}));
//
Future<Response> getLockInfo(
String lastUpdateDate,
String pageNo) =>
post(
getLockInfoURL.toUrl,
jsonEncode({
'lastUpdateDate': lastUpdateDate,
"pageNo": pageNo,
}));
Future<Response> getLockInfo(String lastUpdateDate, String pageNo) => post(
getLockInfoURL.toUrl,
jsonEncode({
'lastUpdateDate': lastUpdateDate,
"pageNo": pageNo,
}));
//
Future<Response> deletLockInfo(
String lockId) =>
post(
deletLockURL.toUrl,
jsonEncode({
'lockId': lockId,
}));
Future<Response> deletLockInfo(String lockId) => post(
deletLockURL.toUrl,
jsonEncode({
'lockId': lockId,
}));
Future<Response> passwordKeyList(
String keyStatus,
@ -337,6 +332,10 @@ class ApiProvider extends BaseProvider {
'keyboardPwdId': keyboardPwdId,
'deleteType': deleteType
}));
Future<Response> updateSetting(String lockId, String isOn, String type) =>
post(updateSettingURL.toUrl,
jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type}));
}
extension ExtensionString on String {

View File

@ -177,24 +177,17 @@ class ApiRepository {
}
//
Future<SaveLockEntity> 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<SaveLockEntity> 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<LockMainEntity> getLockInfo({
required String lastUpdateDate,
required String pageNo}) async {
final res = await apiProvider.getLockInfo(
lastUpdateDate,
pageNo);
Future<LockMainEntity> getLockInfo(
{required String lastUpdateDate, required String pageNo}) async {
final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo);
return LockMainEntity.fromJson(res.body);
}
//
Future<LockMainEntity> deletLockData({
required String lockId}) async {
Future<LockMainEntity> deletLockData({required String lockId}) async {
final res = await apiProvider.deletLockInfo(lockId);
return LockMainEntity.fromJson(res.body);
}
@ -311,16 +300,23 @@ class ApiRepository {
}
//
Future<LockGroupListEntity> deleteElectronicKey(String type) async {
final res = await apiProvider.deleteElectronicKey(type);
return LockGroupListEntity.fromJson(res.body);
Future<ElectronicKeyListEntity> deleteElectronicKey(String keyId) async {
final res = await apiProvider.deleteElectronicKey(keyId);
return ElectronicKeyListEntity.fromJson(res.body);
}
//
Future<LockGroupListEntity> deleteKeyboardPwd(
Future<PasswordKeyEntity> 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<PasswordKeyEntity> updateSetting(
String lockId, String isOn, String type) async {
final res = await apiProvider.deleteKeyboardPwd(lockId, isOn, type);
return PasswordKeyEntity.fromJson(res.body);
}
}