新增获取锁消息设置接口

This commit is contained in:
Daisy 2024-04-09 09:49:30 +08:00
parent f96a613ad5
commit fbb102eca3
11 changed files with 95 additions and 31 deletions

View File

@ -71,7 +71,8 @@ class _LockDetailPageState extends State<LockDetailPage>
StreamSubscription? _lockRefreshLockDetailInfoDataEvent; StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
void _initRefreshLockDetailInfoDataEventAction() { void _initRefreshLockDetailInfoDataEventAction() {
// eventBus // eventBus
_lockRefreshLockDetailInfoDataEvent = eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) { _lockRefreshLockDetailInfoDataEvent =
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
setState(() {}); setState(() {});
}); });
} }
@ -110,12 +111,14 @@ class _LockDetailPageState extends State<LockDetailPage>
BlueManage().connectDeviceName = BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!; state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
List<int> publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast<int>(); List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
var saveStrList = changeIntListToStringList(publicKeyData); var saveStrList = changeIntListToStringList(publicKeyData);
Storage.setStringList(saveBluePublicKey, saveStrList); Storage.setStringList(saveBluePublicKey, saveStrList);
// //
List<int> privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast<int>(); List<int> privateKeyData =
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
var savePrivateKeyList = changeIntListToStringList(privateKeyData); var savePrivateKeyList = changeIntListToStringList(privateKeyData);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
@ -138,9 +141,19 @@ class _LockDetailPageState extends State<LockDetailPage>
children: [ children: [
Visibility( Visibility(
visible: visible:
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // ((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 030 state.keyInfos.value.keyType ==
(state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive) // 使 XSConstantMacro.keyTypeLoop) && //
(DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) <=
15 &&
DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) >=
0) && // 030
(state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusNormalUse ||
state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitReceive) // 使
) )
? true ? true
: false, : false,
@ -234,9 +247,8 @@ class _LockDetailPageState extends State<LockDetailPage>
GestureDetector( GestureDetector(
onTap: () { onTap: () {
// logic.getStarLockStatus(); // logic.getStarLockStatus();
ShowTipView().showSureAlertDialog("${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state ShowTipView().showSureAlertDialog(
.keyInfos.value.electricQuantityDate! "${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
.toString())}");
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -263,11 +275,16 @@ class _LockDetailPageState extends State<LockDetailPage>
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Image.asset(showElectricIcon(state.electricQuantity.value), width: 30.w, height: 24.w), Image.asset(showElectricIcon(state.electricQuantity.value),
width: 30.w, height: 24.w),
SizedBox(width: 2.w), SizedBox(width: 2.w),
Text("--%", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)), Text("--%",
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w), SizedBox(width: 2.w),
Icon(Icons.info, // 使 warning Icon(
Icons.info, // 使 warning
color: AppColors.mainColor, // color: AppColors.mainColor, //
size: 25.w, // 30 size: 25.w, // 30
), ),
@ -561,11 +578,8 @@ class _LockDetailPageState extends State<LockDetailPage>
})); }));
// //
showWidgetArr.add(bottomItem( showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, true, true, () {
TranslationLoader.lanKeys!.set!.tr,
true,
true, () {
Get.toNamed(Routers.lockSetPage, arguments: { Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId, "lockId": state.keyInfos.value.lockId,
"isOnlyOneData": state.isOnlyOneData "isOnlyOneData": state.isOnlyOneData
@ -729,17 +743,16 @@ class _LockDetailPageState extends State<LockDetailPage>
TranslationLoader.lanKeys!.messageReminding!.tr, TranslationLoader.lanKeys!.messageReminding!.tr,
state.openDoorBtnisUneable.value, state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () { state.bottomBtnisEable.value, () {
Get.toNamed(Routers.msgNotificationPage); Get.toNamed(Routers.msgNotificationPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
}), }),
); );
endWiddget.add( endWiddget.add(
// //
bottomItem( bottomItem('images/main/icon_main_set.png',
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, true, true, () {
TranslationLoader.lanKeys!.set!.tr,
true,
true, () {
// logic.clickItemBtnAction(10); // logic.clickItemBtnAction(10);
Get.toNamed(Routers.lockSetPage, arguments: { Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId, "lockId": state.keyInfos.value.lockId,
@ -752,7 +765,8 @@ class _LockDetailPageState extends State<LockDetailPage>
} }
// //
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable, bool bottomBtnisEable, Function() onClick) { Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable,
bool bottomBtnisEable, Function() onClick) {
var width = 42.w; var width = 42.w;
var height = 42.h; var height = 42.h;
return GestureDetector( return GestureDetector(

View File

@ -371,7 +371,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.msgNotificationPage); Get.toNamed(Routers.msgNotificationPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
})), })),
// //
Visibility( Visibility(

View File

@ -67,11 +67,13 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
// ), // ),
CommonItem( CommonItem(
leftTitel: '开门通知', leftTitel: '开门通知',
rightTitle: "已启用", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.openDoorNotifyPage); Get.toNamed(Routers.openDoorNotifyPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value,
});
}, },
), ),
CommonItem( CommonItem(

View File

@ -1,9 +1,18 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class MsgNotificationState { class MsgNotificationState {
var lockSetInfoData = LockSetInfoData().obs;
var isCheck = false.obs; var isCheck = false.obs;
var isLeaveHomeOpenDoor = false.obs; // var isLeaveHomeOpenDoor = false.obs; //
var isDoorNotShut = false.obs; // var isDoorNotShut = false.obs; //
var isSomeoneRing = false.obs; // var isSomeoneRing = false.obs; //
var isSomeoneAppeared = false.obs; // var isSomeoneAppeared = false.obs; //
MsgNotificationState() {
Map map = Get.arguments;
if (map['lockSetInfoData'] != null) {
lockSetInfoData.value = map['lockSetInfoData'];
}
}
} }

View File

@ -1,7 +1,16 @@
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
import 'openDoorNotify_state.dart'; import 'openDoorNotify_state.dart';
class OpenDoorNotifyLogic extends BaseGetXController { class OpenDoorNotifyLogic extends BaseGetXController {
final OpenDoorNotifyState state = OpenDoorNotifyState(); final OpenDoorNotifyState state = OpenDoorNotifyState();
//
void getLockNoticeSetting() async {
VersionUndateEntity entity = await ApiRepository.to.getLockNoticeSetting(
lockId: state.lockSetInfoData.value.lockId!,
);
if (entity.errorCode!.codeIsSuccessful) {}
}
} }

View File

@ -22,6 +22,8 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
logic.getLockNoticeSetting();
} }
@override @override

View File

@ -1,7 +1,16 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class OpenDoorNotifyState { class OpenDoorNotifyState {
var lockSetInfoData = LockSetInfoData().obs;
var pageNum = 1.obs; // var pageNum = 1.obs; //
final pageSize = 20.obs; // final pageSize = 20.obs; //
final itemDataList = [].obs; final itemDataList = [].obs;
OpenDoorNotifyState() {
Map map = Get.arguments;
if (map['lockSetInfoData'] != null) {
lockSetInfoData.value = map['lockSetInfoData'];
}
}
} }

View File

@ -190,4 +190,7 @@ abstract class Api {
'/lockSetting/updateCatEyeConfig'; // '/lockSetting/updateCatEyeConfig'; //
final String updateFaceConfigURL = '/lockSetting/updateFaceConfig'; // final String updateFaceConfigURL = '/lockSetting/updateFaceConfig'; //
final String getLockNoticeSettingURL =
'/lockSetting/getLockNoticeSetting'; //
} }

View File

@ -1747,6 +1747,13 @@ class ApiProvider extends BaseProvider {
'lockId': lockId, 'lockId': lockId,
'faceAutoLightScreen': faceAutoLightScreen, 'faceAutoLightScreen': faceAutoLightScreen,
})); }));
//
Future<Response> getLockNoticeSetting(int lockId) => post(
getLockNoticeSettingURL.toUrl,
jsonEncode({
'lockId': lockId,
}));
} }
extension ExtensionString on String { extension ExtensionString on String {

View File

@ -1779,4 +1779,11 @@ class ApiRepository {
lockId, faceAutoLightScreen); lockId, faceAutoLightScreen);
return VersionUndateEntity.fromJson(res.body); return VersionUndateEntity.fromJson(res.body);
} }
//
Future<VersionUndateEntity> getLockNoticeSetting(
{required int lockId}) async {
final res = await apiProvider.getLockNoticeSetting(lockId);
return VersionUndateEntity.fromJson(res.body);
}
} }

View File

@ -60,7 +60,7 @@ class CallTalk {
} }
// //
else { else {
print('********视频数据来了'); // print('********视频数据来了');
// //
var bagLen = bb[POS_blen + 2] + bb[POS_blen + 3] * 256; var bagLen = bb[POS_blen + 2] + bb[POS_blen + 3] * 256;
// print('音视频数据开始下标 bagLen$bagLen'); // print('音视频数据开始下标 bagLen$bagLen');
@ -101,8 +101,8 @@ class CallTalk {
var getList = bb.sublist(POS_data, bb.length); var getList = bb.sublist(POS_data, bb.length);
iframe!.bb!.addAll(getList); iframe!.bb!.addAll(getList);
} }
print( // print(
'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}'); // 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
// //
if (iframe!.bagNum == iframe!.bagReceive) { if (iframe!.bagNum == iframe!.bagReceive) {