bug:1001991 没有获取锁信息成功时,不允许对锁进行设置操作

This commit is contained in:
Liuyf 2025-03-03 19:24:57 +08:00
parent e22a510307
commit 49d2797619
2 changed files with 28 additions and 4 deletions

View File

@ -75,6 +75,10 @@ class LockSetInfoData {
} }
return data; return data;
} }
bool isValid() {
return lockId != null;
}
} }
class LockStatus { class LockStatus {
@ -717,11 +721,19 @@ class CatEyeModeConfig {
// JSON // JSON
factory CatEyeModeConfig.fromJson(Map<String, dynamic> json) { factory CatEyeModeConfig.fromJson(Map<String, dynamic> json) {
return CatEyeModeConfig( return CatEyeModeConfig(
recordMode: json['recordMode'] != null ? int.tryParse(json['recordMode'].toString()) : null, recordMode: json['recordMode'] != null
? int.tryParse(json['recordMode'].toString())
: null,
recordTime: json['recordTime'], recordTime: json['recordTime'],
realTimeMode: json['realTimeMode'] != null ? int.tryParse(json['realTimeMode'].toString()) : null, realTimeMode: json['realTimeMode'] != null
recordEndTime: json['recordEndTime'] != null ? int.tryParse(json['recordEndTime'].toString()) : null, ? int.tryParse(json['realTimeMode'].toString())
recordStartTime: json['recordStartTime'] != null ? int.tryParse(json['recordStartTime'].toString()) : null, : null,
recordEndTime: json['recordEndTime'] != null
? int.tryParse(json['recordEndTime'].toString())
: null,
recordStartTime: json['recordStartTime'] != null
? int.tryParse(json['recordStartTime'].toString())
: null,
detectionDistance: json['detectionDistance'], detectionDistance: json['detectionDistance'],
); );
} }

View File

@ -102,6 +102,10 @@ class _LockSetPageState extends State<LockSetPage>
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
if (!state.lockSetInfoData.value.isValid()) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr);
return;
}
Get.toNamed(Routers.basicInformationPage, Get.toNamed(Routers.basicInformationPage,
arguments: <String, LockSetInfoData>{ arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
@ -154,6 +158,10 @@ class _LockSetPageState extends State<LockSetPage>
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
if (!state.lockSetInfoData.value.isValid()) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr);
return;
}
Get.toNamed(Routers.lockTimePage, Get.toNamed(Routers.lockTimePage,
arguments: <String, LockSetInfoData>{ arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
@ -166,6 +174,10 @@ class _LockSetPageState extends State<LockSetPage>
btnName: '删除'.tr, btnName: '删除'.tr,
isDelete: true, isDelete: true,
onClick: () async { onClick: () async {
if (!state.lockSetInfoData.value.isValid()) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr);
return;
}
// logic.deletUserAction(); // logic.deletUserAction();
// logic.deletLockInfoData(); // logic.deletLockInfoData();
// showDeletAlertDialog(context); // showDeletAlertDialog(context);