1,操作记录完善部分缺失UI布局
2,新增操作记录读取记录功能 3,新增PopupMenuButton组件及公用弹窗 4,修复我的设置、锁设置—锁需联网标识 关联锁详情页面问题
This commit is contained in:
parent
7b59e9056a
commit
738c9e19b4
@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
|
||||||
|
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
||||||
@ -58,24 +57,24 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
var indexList = getList[i];
|
var indexList = getList[i];
|
||||||
// AppLog.log("indexList:$indexList");
|
// AppLog.log("indexList:$indexList");
|
||||||
var indexMap = {};
|
var indexMap = {};
|
||||||
indexMap["type"] = indexList[0].toString();
|
indexMap['type'] = indexList[0].toString();
|
||||||
int operateDate = 0;
|
int operateDate = 0;
|
||||||
if (indexList[0] == 2) {
|
if (indexList[0] == 2) {
|
||||||
var passwordData = indexList.sublist(7, 17);
|
var passwordData = indexList.sublist(7, 17);
|
||||||
var password = utf8String(passwordData);
|
var password = utf8String(passwordData);
|
||||||
indexMap["user"] = password.toString();
|
indexMap['user'] = password.toString();
|
||||||
}else {
|
} else {
|
||||||
int userNo = (indexList[1] * 256) + indexList[2];
|
int userNo = (indexList[1] * 256) + indexList[2];
|
||||||
indexMap["user"] = userNo.toString();
|
indexMap['user'] = userNo.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
indexMap["success"] = "1";
|
indexMap['success'] = '1';
|
||||||
|
|
||||||
int time = ((0xff & indexList[(3)]) << 24 |
|
int time = ((0xff & indexList[(3)]) << 24 |
|
||||||
(0xff & indexList[4]) << 16 |
|
(0xff & indexList[4]) << 16 |
|
||||||
(0xff & indexList[5]) << 8 |
|
(0xff & indexList[5]) << 8 |
|
||||||
(0xFF & indexList[6]));
|
(0xFF & indexList[6]));
|
||||||
indexMap["date"] = "${time * 1000}";
|
indexMap['date'] = '${time * 1000}';
|
||||||
uploadList.add(indexMap);
|
uploadList.add(indexMap);
|
||||||
|
|
||||||
if (i == getList.length - 1) {
|
if (i == getList.length - 1) {
|
||||||
@ -141,13 +140,13 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//请求操作记录列表(门锁日志)
|
//请求操作记录列表(门锁日志)
|
||||||
void mockNetworkDataRequest({required bool isRefresh}) async {
|
Future<void> mockNetworkDataRequest({required bool isRefresh}) async {
|
||||||
// 如果是下拉刷新,清空已有数据
|
// 如果是下拉刷新,清空已有数据
|
||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
state.lockLogItemList.clear();
|
state.lockLogItemList.clear();
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
}
|
}
|
||||||
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
final DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
||||||
lockId: state.keyInfos.value.lockId!,
|
lockId: state.keyInfos.value.lockId!,
|
||||||
lockEventType: state.dropdownValue.value,
|
lockEventType: state.dropdownValue.value,
|
||||||
pageNo: pageNo,
|
pageNo: pageNo,
|
||||||
@ -165,8 +164,9 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
/// 刷新门锁日志列表
|
/// 刷新门锁日志列表
|
||||||
StreamSubscription? _getDoorLockLogListRefreshUIEvent;
|
StreamSubscription? _getDoorLockLogListRefreshUIEvent;
|
||||||
void _getDoorLockLogListRefreshUIAction() {
|
void _getDoorLockLogListRefreshUIAction() {
|
||||||
_getDoorLockLogListRefreshUIEvent =
|
_getDoorLockLogListRefreshUIEvent = eventBus
|
||||||
eventBus.on<DoorLockLogListRefreshUI>().listen((event) {
|
.on<DoorLockLogListRefreshUI>()
|
||||||
|
.listen((DoorLockLogListRefreshUI event) {
|
||||||
state.currentSelectDate.value = event.getDoorLockLogTime;
|
state.currentSelectDate.value = event.getDoorLockLogTime;
|
||||||
// 设置startDate为当天的0点
|
// 设置startDate为当天的0点
|
||||||
state.startDate.value = DateTime(
|
state.startDate.value = DateTime(
|
||||||
@ -175,11 +175,11 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
state.currentSelectDate.value.day)
|
state.currentSelectDate.value.day)
|
||||||
.millisecondsSinceEpoch;
|
.millisecondsSinceEpoch;
|
||||||
// 设置endDate为下一天的0点,然后减去1毫秒
|
// 设置endDate为下一天的0点,然后减去1毫秒
|
||||||
state.endDate.value = (DateTime(
|
state.endDate.value = DateTime(
|
||||||
state.currentSelectDate.value.year,
|
state.currentSelectDate.value.year,
|
||||||
state.currentSelectDate.value.month,
|
state.currentSelectDate.value.month,
|
||||||
state.currentSelectDate.value.day + 1)
|
state.currentSelectDate.value.day + 1)
|
||||||
.subtract(const Duration(milliseconds: 1)))
|
.subtract(const Duration(milliseconds: 1))
|
||||||
.millisecondsSinceEpoch;
|
.millisecondsSinceEpoch;
|
||||||
|
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
@ -188,9 +188,9 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询锁记录最后时间
|
// 查询锁记录最后时间
|
||||||
void getLockRecordLastUploadDataTime() async {
|
Future<void> getLockRecordLastUploadDataTime() async {
|
||||||
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
|
final LockOperatingRecordGetLastRecordTimeEntity entity =
|
||||||
.getLockRecordLastUploadDataTime(
|
await ApiRepository.to.getLockRecordLastUploadDataTime(
|
||||||
lockId: state.keyInfos.value.lockId.toString());
|
lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||||
@ -199,8 +199,8 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 操作记录上传
|
// 操作记录上传
|
||||||
void lockRecordUploadData(List list) async {
|
Future<void> lockRecordUploadData(List list) async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.lockRecordUploadData(
|
.lockRecordUploadData(
|
||||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
@ -213,12 +213,12 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//清空操作记录
|
//清空操作记录
|
||||||
void clearOperationRecordRequest() async {
|
Future<void> clearOperationRecordRequest() async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.clearOperationRecord(
|
.clearOperationRecord(
|
||||||
CommonDataManage().currentKeyInfo.lockId.toString());
|
CommonDataManage().currentKeyInfo.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("清除数据成功", something: () {
|
showToast('清除数据成功', something: () {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest(isRefresh: true);
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,12 +5,14 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
||||||
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||||
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
import 'package:timelines/timelines.dart';
|
import 'package:timelines/timelines.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
@ -26,8 +28,8 @@ class DoorLockLogPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||||
final logic = Get.put(DoorLockLogLogic());
|
final DoorLockLogLogic logic = Get.put(DoorLockLogLogic());
|
||||||
final state = Get.find<DoorLockLogLogic>().state;
|
final DoorLockLogState state = Get.find<DoorLockLogLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -37,22 +39,45 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
|
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1,
|
||||||
? true
|
child: GestureDetector(
|
||||||
: false,
|
child: Image.asset(
|
||||||
child: TextButton(
|
'images/icon_tips_Q.png',
|
||||||
onPressed: () {
|
width: 34.w,
|
||||||
ShowCupertinoAlertView().showClearOperationRecordAlert(
|
height: 32.w,
|
||||||
clearClick: () {
|
color: Colors.white,
|
||||||
logic.clearOperationRecordRequest();
|
),
|
||||||
});
|
onTap: () {
|
||||||
},
|
ShowTipView().showSureAlertDialog(
|
||||||
child: Text(
|
'1.锁没有联网,密码、IC卡、指纹等开门记录无法实时上传,可以点击右上角按钮,然后读取记录。\n2.只能保留一定时间内的记录,如果您需要保留历史记录,可以点击右上角按钮,然后导出记录',
|
||||||
'清空记录'.tr,
|
tipTitle: '看不到操作记录,可能原因有',
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
sureStr: '我知道了');
|
||||||
))),
|
},
|
||||||
|
)),
|
||||||
|
Visibility(
|
||||||
|
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1,
|
||||||
|
child: PopupMenuButton<String>(
|
||||||
|
onSelected: _onMenuItemSelected,
|
||||||
|
color: Colors.black,
|
||||||
|
itemBuilder: (BuildContext context) {
|
||||||
|
return <PopupMenuEntry<String>>[
|
||||||
|
_buildCustomPopupMenuItem('读取记录'),
|
||||||
|
const PopupMenuDivider(),
|
||||||
|
_buildCustomPopupMenuItem('清空记录'),
|
||||||
|
const PopupMenuDivider(),
|
||||||
|
_buildCustomPopupMenuItem('导出记录'),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
icon: Image.asset(
|
||||||
|
'images/icon_bar_more.png',
|
||||||
|
height: 30.h,
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
offset: Offset(0, 70.h), // 设置弹出框位置偏移量
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
@ -73,9 +98,47 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
PopupMenuItem<String> _buildCustomPopupMenuItem(String value) {
|
||||||
|
return PopupMenuItem<String>(
|
||||||
|
value: value,
|
||||||
|
height: 46.h,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 46.h,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(value, style: TextStyle(color: Colors.white, fontSize: 22.sp)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onMenuItemSelected(String value) {
|
||||||
|
switch (value) {
|
||||||
|
case '读取记录':
|
||||||
|
{
|
||||||
|
logic.mockNetworkDataRequest(isRefresh: true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '清空记录':
|
||||||
|
{
|
||||||
|
ShowCupertinoAlertView().showClearOperationRecordAlert(
|
||||||
|
clearClick: () {
|
||||||
|
logic.clearOperationRecordRequest();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '导出记录':
|
||||||
|
{}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//顶部日历小部件
|
//顶部日历小部件
|
||||||
Widget topAdvancedCalendarWidget() {
|
Widget topAdvancedCalendarWidget() {
|
||||||
final theme = Theme.of(context);
|
final ThemeData theme = Theme.of(context);
|
||||||
return Theme(
|
return Theme(
|
||||||
data: theme.copyWith(
|
data: theme.copyWith(
|
||||||
textTheme: theme.textTheme.copyWith(
|
textTheme: theme.textTheme.copyWith(
|
||||||
@ -134,7 +197,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
margin: EdgeInsets.only(top: 20.h, left: 30.w, bottom: 10.h, right: 20.w),
|
margin: EdgeInsets.only(top: 20.h, left: 30.w, bottom: 10.h, right: 20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => XSDropDownWidget(
|
Obx(() => XSDropDownWidget(
|
||||||
items: state.getDropDownItemList,
|
items: state.getDropDownItemList,
|
||||||
value: state.dropdownTitle.value,
|
value: state.dropdownTitle.value,
|
||||||
@ -187,11 +250,11 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
return TimelineTileBuilder.fromStyle(
|
return TimelineTileBuilder.fromStyle(
|
||||||
contentsAlign: ContentsAlign.basic,
|
contentsAlign: ContentsAlign.basic,
|
||||||
itemCount: state.lockLogItemList.length,
|
itemCount: state.lockLogItemList.length,
|
||||||
contentsBuilder: (context, index) {
|
contentsBuilder: (BuildContext context, int index) {
|
||||||
DoorLockLogDataItem timelineData = state.lockLogItemList[index];
|
final DoorLockLogDataItem timelineData = state.lockLogItemList[index];
|
||||||
DateTime dateTime =
|
final DateTime dateTime =
|
||||||
DateTime.fromMillisecondsSinceEpoch(timelineData.operateDate!);
|
DateTime.fromMillisecondsSinceEpoch(timelineData.operateDate!);
|
||||||
String formattedTime =
|
final String formattedTime =
|
||||||
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
@ -199,7 +262,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
'$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}用" : ""}${timelineData.recordTypeName}',
|
'$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}用" : ""}${timelineData.recordTypeName}',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
@ -217,14 +280,15 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
Get.toNamed(Routers.videoLogDetailPage);
|
Get.toNamed(Routers.videoLogDetailPage);
|
||||||
},
|
},
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
timelineData.imagesUrl!.isNotEmpty
|
if (timelineData.imagesUrl!.isNotEmpty)
|
||||||
? Image.network(
|
Image.network(
|
||||||
timelineData.imagesUrl!,
|
timelineData.imagesUrl!,
|
||||||
width: 260.w,
|
width: 260.w,
|
||||||
height: 260.h,
|
height: 260.h,
|
||||||
)
|
)
|
||||||
: Container(),
|
else
|
||||||
|
Container(),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 150.h,
|
top: 150.h,
|
||||||
left: 10.w,
|
left: 10.w,
|
||||||
@ -293,7 +357,9 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
void didPushNext() {
|
void didPushNext() {
|
||||||
super.didPushNext();
|
super.didPushNext();
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) {
|
||||||
|
EasyLoading.dismiss(animation: true);
|
||||||
|
}
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -350,18 +350,20 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
Future<void> getServerDatetime() async {
|
Future<void> getServerDatetime() async {
|
||||||
final GetServerDatetimeEntity entity =
|
final GetServerDatetimeEntity entity =
|
||||||
await ApiRepository.to.getServerDatetimeData(isUnShowLoading:true);
|
await ApiRepository.to.getServerDatetimeData(isUnShowLoading: true);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
state.differentialTime = entity.data!.date! ~/ 1000 -
|
||||||
}else{
|
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
|
} else {
|
||||||
state.isHaveNetwork = false;
|
state.isHaveNetwork = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getUTCNetTime() {
|
int getUTCNetTime() {
|
||||||
if(state.isHaveNetwork){
|
if (state.isHaveNetwork) {
|
||||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
|
||||||
}else{
|
state.differentialTime;
|
||||||
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -474,10 +476,10 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// state.keyInfos.value.electricQuantity = int.parse(event.setResult);
|
// state.keyInfos.value.electricQuantity = int.parse(event.setResult);
|
||||||
final int electricQuantity =
|
final int electricQuantity =
|
||||||
int.tryParse(event.setResult['electricQuantity']) ?? 0;
|
int.tryParse(event.setResult['electricQuantity']) ?? 0;
|
||||||
state.electricQuantity.value =electricQuantity;
|
state.electricQuantity.value = electricQuantity;
|
||||||
state.keyInfos.value.electricQuantity = electricQuantity;
|
state.keyInfos.value.electricQuantity = electricQuantity;
|
||||||
state.keyInfos.value.electricQuantityDate =
|
state.keyInfos.value.electricQuantityDate =
|
||||||
event.setResult['uploadElectricQuantityDate'];
|
event.setResult['uploadElectricQuantityDate'];
|
||||||
} else if (event.type == 5) {
|
} else if (event.type == 5) {
|
||||||
// 5 远程开锁
|
// 5 远程开锁
|
||||||
state.keyInfos.value.lockSetting!.remoteUnlock =
|
state.keyInfos.value.lockSetting!.remoteUnlock =
|
||||||
@ -536,6 +538,13 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription = eventBus
|
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription = eventBus
|
||||||
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||||
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
|
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
|
||||||
|
//更新 开锁时是否需联网 状态
|
||||||
|
if (event.type == 1) {
|
||||||
|
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
||||||
|
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
||||||
|
int.parse(event.setResult);
|
||||||
|
state.isOpenLockNeedOnline.refresh();
|
||||||
|
}
|
||||||
if (event.type == 4) {
|
if (event.type == 4) {
|
||||||
final int electricQuantity =
|
final int electricQuantity =
|
||||||
int.tryParse(event.setResult['electricQuantity']) ?? 0;
|
int.tryParse(event.setResult['electricQuantity']) ?? 0;
|
||||||
|
|||||||
@ -776,18 +776,18 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
child: Image.asset('images/main/icon_lockDetail_needNetwork.png',
|
child: Image.asset('images/main/icon_lockDetail_needNetwork.png',
|
||||||
width: 24.w,
|
width: 24.w,
|
||||||
height: 20.w,
|
height: 20.w,
|
||||||
color: state.keyInfos.value.appUnlockOnline == 1
|
color: state.isOpenLockNeedOnline.value == 1
|
||||||
? AppColors.mainColor
|
? AppColors.mainColor
|
||||||
: AppColors.btnDisableColor),
|
: AppColors.btnDisableColor),
|
||||||
),
|
),
|
||||||
SizedBox(width: 6.w),
|
SizedBox(width: 6.w),
|
||||||
Text(
|
Obx(
|
||||||
'手机需联网',
|
() => Text('手机需联网',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20.sp,
|
fontSize: 20.sp,
|
||||||
color: state.keyInfos.value.appUnlockOnline == 1
|
color: state.isOpenLockNeedOnline.value == 1
|
||||||
? AppColors.mainColor
|
? AppColors.mainColor
|
||||||
: AppColors.btnDisableColor),
|
: AppColors.btnDisableColor)),
|
||||||
),
|
),
|
||||||
if (add) ...<Widget>[
|
if (add) ...<Widget>[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
|
||||||
import 'package:star_lock/tools/showTipView.dart';
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
@ -596,7 +597,8 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
|
|
||||||
final bool isXHJ = F.isXHJ;
|
final bool isXHJ = F.isXHJ;
|
||||||
final bool isOnlyOneData = state.isOnlyOneData.value == true;
|
final bool isOnlyOneData = state.isOnlyOneData.value == true;
|
||||||
await Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
|
await Future<dynamic>.delayed(const Duration(milliseconds: 200))
|
||||||
|
.then((e) {
|
||||||
if (isXHJ) {
|
if (isXHJ) {
|
||||||
Get.close(3);
|
Get.close(3);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,15 +1,20 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_logic.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
|
||||||
|
|
||||||
import '../../../network/api_repository.dart';
|
import '../../../network/api_repository.dart';
|
||||||
import '../../../tools/baseGetXController.dart';
|
import '../../../tools/baseGetXController.dart';
|
||||||
import 'appUnlockNeedMobileNetworkingLock_state.dart';
|
import 'appUnlockNeedMobileNetworkingLock_state.dart';
|
||||||
import 'selectLockListEntity.dart';
|
import 'selectLockListEntity.dart';
|
||||||
|
|
||||||
class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController{
|
class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController {
|
||||||
final AppUnlockNeedMobileNetworkingLockState state = AppUnlockNeedMobileNetworkingLockState();
|
final AppUnlockNeedMobileNetworkingLockState state =
|
||||||
|
AppUnlockNeedMobileNetworkingLockState();
|
||||||
|
|
||||||
//请求锁列表
|
//请求锁列表
|
||||||
Future<SelectLockListEntity> mockNetworkDataRequest() async {
|
Future<SelectLockListEntity> mockNetworkDataRequest() async {
|
||||||
final SelectLockListEntity entity = await ApiRepository.to.selectLockList(searchStr: state.searchController.text);
|
final SelectLockListEntity entity = await ApiRepository.to
|
||||||
|
.selectLockList(searchStr: state.searchController.text);
|
||||||
List<LockItemData> dataList = <LockItemData>[];
|
List<LockItemData> dataList = <LockItemData>[];
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
dataList = entity.data!.list!;
|
dataList = entity.data!.list!;
|
||||||
@ -27,9 +32,14 @@ class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController{
|
|||||||
//APP开锁时需手机联网的锁
|
//APP开锁时需手机联网的锁
|
||||||
Future<void> setAppUnlockMustOnlineRequest() async {
|
Future<void> setAppUnlockMustOnlineRequest() async {
|
||||||
final SelectLockListEntity entity =
|
final SelectLockListEntity entity =
|
||||||
await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList);
|
await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('操作成功');
|
showToast('操作成功');
|
||||||
|
|
||||||
|
//刷新锁列表,更新锁详情--手机需联网标识
|
||||||
|
if (Get.isRegistered<LockMainLogic>()) {
|
||||||
|
Get.find<LockMainLogic>().getStarLockInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,5 +54,4 @@ class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController{
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -102,7 +102,8 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
EasyLoading.showToast('数据不存在', duration: 2000.milliseconds);
|
EasyLoading.showToast('数据不存在', duration: 2000.milliseconds);
|
||||||
break;
|
break;
|
||||||
case 434: //与后台约定弹出确认框提示
|
case 434: //与后台约定弹出确认框提示
|
||||||
ShowTipView().showSureBtnTipsAlert(T['errorMsg']);
|
ShowTipView()
|
||||||
|
.showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: '确定');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,8 @@ class ShowTipView {
|
|||||||
content: Text(contentStr),
|
content: Text(contentStr),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(sureStr ?? TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(sureStr ?? TranslationLoader.lanKeys!.sure!.tr,
|
||||||
|
style: TextStyle(color: AppColors.mainColor)),
|
||||||
onPressed: Get.back,
|
onPressed: Get.back,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -93,7 +94,9 @@ class ShowTipView {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showTFViewAlertDialog(TextEditingController controller, String title, String tipTitle, Function sureClick, {List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) {
|
void showTFViewAlertDialog(TextEditingController controller, String title,
|
||||||
|
String tipTitle, Function sureClick,
|
||||||
|
{List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) {
|
||||||
// 点击删除 开始扫描
|
// 点击删除 开始扫描
|
||||||
showDialog(
|
showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
@ -122,7 +125,8 @@ class ShowTipView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 只有一个确定按钮
|
// 只有一个确定按钮
|
||||||
void showSureBtnTipsAlert(String tipsText) {
|
void showSureBtnTipsAlert(
|
||||||
|
{required String tipsText, required String sureText}) {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user