fix: 在选择网关界面当显示出网关时网关拔掉电源,左上键返回再点下一步应没有该网关显示
This commit is contained in:
parent
6769e9af5d
commit
42d9bfd2ec
@ -1,4 +1,4 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -19,7 +19,8 @@ class RemoteUnlockingPage extends StatefulWidget {
|
||||
State<RemoteUnlockingPage> createState() => _RemoteUnlockingPageState();
|
||||
}
|
||||
|
||||
class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAware {
|
||||
class _RemoteUnlockingPageState extends State<RemoteUnlockingPage>
|
||||
with RouteAware {
|
||||
final RemoteUnlockingLogic logic = Get.put(RemoteUnlockingLogic());
|
||||
final RemoteUnlockingState state = Get.find<RemoteUnlockingLogic>().state;
|
||||
|
||||
@ -62,16 +63,20 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAwa
|
||||
],
|
||||
);
|
||||
}),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20.h),
|
||||
child: Text('功能开启后,你将可以通过网关远程开锁。此功能的开启和关闭只能在锁附近通过手机蓝牙进行。'.tr,
|
||||
style: TextStyle(fontSize: 20.sp)),
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
Obx(() => SubmitBtn(
|
||||
btnName: state.remoteEnable.value == 1
|
||||
? '关闭'.tr
|
||||
: '开启'.tr,
|
||||
btnName: state.remoteEnable.value == 1 ? '关闭'.tr : '开启'.tr,
|
||||
onClick: () {
|
||||
//全自动锁只判断是否开启远程开锁
|
||||
bool isContains = BlueManage().connectDeviceName.contains('T9A');
|
||||
bool isContains =
|
||||
BlueManage().connectDeviceName.contains('T9A');
|
||||
if (isContains) {
|
||||
logic.remoteUnlockingOpenOrClose();
|
||||
} else {
|
||||
|
||||
@ -5,6 +5,7 @@ import '../../../login/login/entity/LoginEntity.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
import '../../../tools/eventBusEventManage.dart';
|
||||
import '../../../tools/showTipView.dart';
|
||||
import '../../mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||
import 'gatewayDetail_state.dart';
|
||||
|
||||
class GatewayDetailLogic extends BaseGetXController {
|
||||
@ -40,4 +41,13 @@ class GatewayDetailLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getGatewayDetail() async {
|
||||
final GetewayInfoEntity entity = await ApiRepository.to
|
||||
.getGatewayDetailData(
|
||||
gatewayId: state.getewayItemData.value.gatewayId ?? 0, timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.getewayItemData.value = entity.data!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,6 +84,8 @@ class _GatewayDetailPageState extends State<GatewayDetailPage> {
|
||||
action: () {
|
||||
Get.toNamed(Routers.gatewayConnectionLockPage, arguments: {
|
||||
'gatewayId': state.getewayItemData.value.gatewayId ?? 0
|
||||
})?.then((value) {
|
||||
logic.getGatewayDetail();
|
||||
});
|
||||
}),
|
||||
// CommonItem(
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
class GetewayDataEntity {
|
||||
|
||||
GetewayDataEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
@ -9,6 +8,7 @@ class GetewayDataEntity {
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? GetewayListData.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
@ -27,8 +27,8 @@ class GetewayDataEntity {
|
||||
}
|
||||
|
||||
class GetewayListData {
|
||||
|
||||
GetewayListData({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
||||
GetewayListData(
|
||||
{this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
||||
|
||||
GetewayListData.fromJson(Map<String, dynamic> json) {
|
||||
if (json['list'] != null) {
|
||||
@ -42,6 +42,7 @@ class GetewayListData {
|
||||
pages = json['pages'];
|
||||
total = json['total'];
|
||||
}
|
||||
|
||||
List<GetewayItemData>? list;
|
||||
int? pageNo;
|
||||
int? pageSize;
|
||||
@ -62,20 +63,19 @@ class GetewayListData {
|
||||
}
|
||||
|
||||
class GetewayItemData {
|
||||
|
||||
GetewayItemData(
|
||||
{this.serialNumber,
|
||||
this.gatewayMac,
|
||||
this.gatewayName,
|
||||
this.gatewayType,
|
||||
this.networkName,
|
||||
this.networkMac,
|
||||
this.lockNum,
|
||||
this.isOnline,
|
||||
this.firmwareInfo,
|
||||
this.needUpgrade,
|
||||
this.version,
|
||||
this.gatewayId});
|
||||
this.gatewayMac,
|
||||
this.gatewayName,
|
||||
this.gatewayType,
|
||||
this.networkName,
|
||||
this.networkMac,
|
||||
this.lockNum,
|
||||
this.isOnline,
|
||||
this.firmwareInfo,
|
||||
this.needUpgrade,
|
||||
this.version,
|
||||
this.gatewayId});
|
||||
|
||||
GetewayItemData.fromJson(Map<String, dynamic> json) {
|
||||
serialNumber = json['serialNumber'];
|
||||
@ -96,6 +96,7 @@ class GetewayItemData {
|
||||
version = json['version'];
|
||||
gatewayId = json['gatewayId'];
|
||||
}
|
||||
|
||||
String? serialNumber;
|
||||
String? gatewayMac;
|
||||
String? gatewayName;
|
||||
@ -130,3 +131,30 @@ class GetewayItemData {
|
||||
}
|
||||
}
|
||||
|
||||
class GetewayInfoEntity {
|
||||
GetewayInfoEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
GetewayInfoEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? GetewayItemData.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
GetewayItemData? data;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['errorCode'] = errorCode;
|
||||
data['description'] = description;
|
||||
data['errorMsg'] = errorMsg;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,6 +158,7 @@ abstract class Api {
|
||||
final String gatewaykListURL = '/gateway/list'; // 网关列表
|
||||
final String addGatewayURL = '/gateway/add'; // 添加网关
|
||||
final String deletGatewayURL = '/gateway/delete'; // 删除网关
|
||||
final String gatewayDetailURL = '/gateway/detail'; // 网关列表
|
||||
final String transferGatewayConfirmURL =
|
||||
'/plug/transferPlugConfirm'; // 转移网关确认
|
||||
final String transferGatewayURL = '/plug/transfer'; // 转移网关
|
||||
|
||||
@ -1742,6 +1742,11 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}),
|
||||
timeout: timeout);
|
||||
|
||||
// 获取网关详情
|
||||
Future<Response> getGatewayDetailData(int gatewayId, int timeout) =>
|
||||
post(gatewayDetailURL.toUrl, jsonEncode({'gatewayId': gatewayId}),
|
||||
timeout: timeout);
|
||||
|
||||
// 添加网关
|
||||
Future<Response> addGatewayNetwork(
|
||||
String gatewayName,
|
||||
@ -1823,7 +1828,8 @@ class ApiProvider extends BaseProvider {
|
||||
post(getGatewayConfigURL.toUrl, jsonEncode({}), timeout: timeout);
|
||||
|
||||
Future<Response> getGatewayConfigurationNotLoading(int timeout) =>
|
||||
post(getGatewayConfigURL.toUrl, jsonEncode({}), timeout: timeout,isUnShowLoading: true);
|
||||
post(getGatewayConfigURL.toUrl, jsonEncode({}),
|
||||
timeout: timeout, isUnShowLoading: true);
|
||||
|
||||
Future<Response> gatewayConnectionLockListLoadData(
|
||||
int gatewayId, int timeout) =>
|
||||
|
||||
@ -496,10 +496,12 @@ class ApiRepository {
|
||||
final res = await apiProvider.getLockSettingInfoData(lockId);
|
||||
return LockSetInfoEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 获取所有锁设置信息(不显示加载框)
|
||||
Future<LockSetInfoEntity> getLockSettingInfoDataIsNotLoadingIcon(
|
||||
{required String lockId}) async {
|
||||
final res = await apiProvider.getLockSettingInfoDataIsNotLoadingIcon(lockId);
|
||||
final res =
|
||||
await apiProvider.getLockSettingInfoDataIsNotLoadingIcon(lockId);
|
||||
return LockSetInfoEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1928,6 +1930,13 @@ class ApiRepository {
|
||||
return GetewayDataEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 获取网关详情
|
||||
Future<GetewayInfoEntity> getGatewayDetailData(
|
||||
{required int gatewayId, required int timeout}) async {
|
||||
final res = await apiProvider.getGatewayDetailData(gatewayId, timeout);
|
||||
return GetewayInfoEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 添加网关
|
||||
Future<LoginEntity> gatewayDistributionNetwork(
|
||||
{required String gatewayName,
|
||||
@ -2027,7 +2036,6 @@ class ApiRepository {
|
||||
return GetGatewayConfigurationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
// 移除坏锁
|
||||
Future<RecipientInformationEntity> removeBrokenLockData(
|
||||
{required List lockIdList}) async {
|
||||
|
||||
@ -1045,6 +1045,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.13"
|
||||
jverify:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: jverify
|
||||
sha256: "26d1667d8c71403b77a2620a8c618625f8b4bfc950dac285b8f35ebc5e60fa5a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user