fix:调整人脸列表加载逻辑

This commit is contained in:
liyi 2025-04-08 14:35:15 +08:00
parent 3552d15429
commit 99813877b6
2 changed files with 38 additions and 43 deletions

View File

@ -22,6 +22,7 @@ class FaceListLogic extends BaseGetXController {
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
@ -77,11 +78,15 @@ class FaceListLogic extends BaseGetXController {
userID: (await Storage.getUid())!,
faceNo: state.deletFaceNo,
useCountLimit: 0xffff,
operate: state.isDeletAll == true ? 3 : 2, // 0: 1 2: 3
operate: state.isDeletAll == true ? 3 : 2,
// 0: 1 2: 3
isAdmin: 0,
isForce: 0, //
isRound: 0, //
weekRound: 0, //
isForce: 0,
//
isRound: 0,
//
weekRound: 0,
//
startDate: 0x11223344,
endDate: 0x11223344,
startTime: '0',
@ -277,11 +282,15 @@ class FaceListLogic extends BaseGetXController {
userID: (await Storage.getUid())!,
faceNo: state.deletFaceNo,
useCountLimit: 0xffff,
operate: state.isDeletAll == true ? 3 : 2, // 0: 1 2: 3
operate: state.isDeletAll == true ? 3 : 2,
// 0: 1 2: 3
isAdmin: 0,
isForce: 0, //
isRound: 0, //
weekRound: 0, //
isForce: 0,
//
isRound: 0,
//
weekRound: 0,
//
startDate: 0x11223344,
endDate: 0x11223344,
startTime: '0',
@ -348,8 +357,8 @@ class FaceListLogic extends BaseGetXController {
lockId: state.lockId.value,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('删除成功'.tr, something: () {
getFaceListData(isRefresh: true);
showToast('删除成功'.tr, something: () async {
await getFaceListData(isRefresh: true);
});
}
}
@ -366,8 +375,8 @@ class FaceListLogic extends BaseGetXController {
lockId: state.lockId.value,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('重置成功'.tr, something: () {
getFaceListData(isRefresh: true);
showToast('重置成功'.tr, something: () async{
await getFaceListData(isRefresh: true);
});
}
}
@ -403,11 +412,12 @@ class FaceListLogic extends BaseGetXController {
//
late StreamSubscription _teamEvent;
void _initRefreshAction() {
_teamEvent = eventBus
.on<OtherTypeRefreshListEvent>()
.listen((OtherTypeRefreshListEvent event) {
getFaceListData(isRefresh: true);
.listen((OtherTypeRefreshListEvent event) async {
await getFaceListData(isRefresh: true);
});
}
@ -434,6 +444,7 @@ class FaceListLogic extends BaseGetXController {
// senderCheckingUserInfoCount();
}
getFaceListData(isRefresh: true);
}
@override

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -31,24 +30,6 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
final FaceListLogic logic = Get.put(FaceListLogic());
final FaceListState state = Get.find<FaceListLogic>().state;
Future<void> getHttpData({required bool isRefresh}) async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
logic.getFaceListData(isRefresh: isRefresh).then((FingerprintListDataEntity value) {
if (mounted) {
setState(() {});
}
});
}
}
@override
void initState() {
super.initState();
getHttpData(isRefresh: true);
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -92,17 +73,17 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
),
body: EasyRefreshTool(
onRefresh: () {
getHttpData(isRefresh: true);
logic.getFaceListData(isRefresh: true);
},
onLoad: () {
getHttpData(isRefresh: false);
logic.getFaceListData(isRefresh: false);
},
child: Column(
children: <Widget>[
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
getHttpData(isRefresh: true);
logic.getFaceListData(isRefresh: true);
},
),
SizedBox(
@ -110,14 +91,15 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
),
Expanded(child: _buildMainUI()),
AddBottomWhiteBtn(
btnName:
'添加人脸'.tr,
btnName: '添加人脸'.tr,
onClick: () async {
await Get.toNamed(Routers.addFaceTypePage, arguments: <String, int>{
await Get.toNamed(Routers.addFaceTypePage,
arguments: <String, int>{
'lockId': state.lockId.value,
'fromType': 1 // 1 2
})!.then((value) {
getHttpData(isRefresh: true);
})!
.then((value) {
logic.getFaceListData(isRefresh: true);
});
},
),
@ -154,9 +136,11 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
logic.getKeyType(getFaceItemData),
logic.getKeyDateType(getFaceItemData), () async {
await Get.toNamed(Routers.faceDetailPage,
arguments: <String, FingerprintItemData>{
arguments: <String, FingerprintItemData>{
'faceItemData': getFaceItemData,
})!.then((value) => getHttpData(isRefresh: true));
})!
.then((value) =>
logic.getFaceListData(isRefresh: true));
}),
);
}