添加lockData逻辑,修改bug

This commit is contained in:
魏少阳 2023-11-01 17:28:59 +08:00
parent 58074e7786
commit 3be4a6b45f
84 changed files with 2445 additions and 1084 deletions

View File

@ -393,7 +393,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = DWNXC92BQ6; DEVELOPMENT_TEAM = 7D53BZAN75;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -401,7 +401,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021"; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -528,7 +528,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = DWNXC92BQ6; DEVELOPMENT_TEAM = 7D53BZAN75;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -536,7 +536,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021"; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -557,7 +557,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = DWNXC92BQ6; DEVELOPMENT_TEAM = 7D53BZAN75;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -565,7 +565,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021"; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@ -23,7 +23,7 @@
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Debug" buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
@ -40,7 +40,7 @@
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
@ -61,7 +61,7 @@
</BuildableProductRunnable> </BuildableProductRunnable>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Profile" buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
@ -78,7 +78,7 @@
</BuildableProductRunnable> </BuildableProductRunnable>
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug"> buildConfiguration = "Release">
</AnalyzeAction> </AnalyzeAction>
<ArchiveAction <ArchiveAction
buildConfiguration = "Release" buildConfiguration = "Release"

View File

@ -216,9 +216,9 @@ class BlueManage{
// //
Future<void> judgeReconnect(String deviceMAC, String deviceName, ConnectStateCallBack? connectStateCallBack, {bool isShowLoading = true}) async { Future<void> judgeReconnect(String deviceMAC, String deviceName, ConnectStateCallBack? connectStateCallBack, {bool isShowLoading = true}) async {
print("11111111$deviceConnectionState"); // print("11111111$deviceConnectionState");
if(deviceConnectionState == DeviceConnectionState.connected){ if(deviceConnectionState == DeviceConnectionState.connected){
print("2222222:$deviceConnectionState"); // print("2222222:$deviceConnectionState");
if(isShowLoading){ if(isShowLoading){
EasyLoading.show(); EasyLoading.show();
Future.delayed(const Duration(seconds: 10), () { //asynchronous delay Future.delayed(const Duration(seconds: 10), () { //asynchronous delay

View File

@ -279,7 +279,15 @@ String asciiString(List<int> codeUnits) {
} }
String utf8String(List<int> codeUnits) { String utf8String(List<int> codeUnits) {
return utf8.decode(codeUnits); codeUnits.reversed;
List<int> uniqueList = [];
for (int i = 0; i < codeUnits.length; i++) {
if (codeUnits[i] != 0) {
uniqueList.add(codeUnits[i]);
}
}
uniqueList.reversed;
return utf8.decode(uniqueList).toString();
} }
bool compareTwoList({List<int>? list1, List<int>? list2}) { bool compareTwoList({List<int>? list1, List<int>? list2}) {

View File

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
class AuthorizedAdminState { class AuthorizedAdminState {
final TextEditingController emailOrPhoneController = TextEditingController(); /// final TextEditingController emailOrPhoneController = TextEditingController(); ///
@ -13,8 +13,8 @@ class AuthorizedAdminState {
late Contact contact; late Contact contact;
var type = ''.obs; var type = ''.obs;
final keyInfo = KeyInfos().obs; final keyInfo = LockListInfoItemEntity().obs;
final lockMainEntity = LockMainEntity().obs; // final lockMainEntity = LockMainEntity().obs;
final isAuthentication = false.obs; // final isAuthentication = false.obs; //
DateTime dateTime = DateTime.now(); DateTime dateTime = DateTime.now();
final effectiveDateTime = DateTime.now().obs; final effectiveDateTime = DateTime.now().obs;
@ -32,7 +32,7 @@ class AuthorizedAdminState {
var addUserId = ''.obs; var addUserId = ''.obs;
AuthorizedAdminState() { AuthorizedAdminState() {
Map map = Get.arguments; Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"]; // lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"]; keyInfo.value = map["keyInfo"];
} }
} }

View File

@ -65,7 +65,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
onClick: () { onClick: () {
Navigator.pushNamed(context, Routers.authorizedAdminManagePage, Navigator.pushNamed(context, Routers.authorizedAdminManagePage,
arguments: { arguments: {
"lockMainEntity": state.lockMainEntity.value, // "lockMainEntity": state.lockMainEntity.value,
"keyInfo": state.keyInfo.value "keyInfo": state.keyInfo.value
}).then((val) { }).then((val) {
if (val != null) { if (val != null) {
@ -188,12 +188,14 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
// //
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
useDateStr = "永久";
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
// //
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
useDateStr = "单次";
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
// //
useDateStr = '循环'; useDateStr = '循环';

View File

@ -1,10 +1,11 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class AuthorizedAdminListState { class AuthorizedAdminListState {
final keyInfo = KeyInfos().obs; final keyInfo = LockListInfoItemEntity().obs;
final lockMainEntity = LockMainEntity().obs; // final lockMainEntity = LockMainEntity().obs;
var pageNum = 1.obs; // var pageNum = 1.obs; //
final pageSize = 20.obs; // final pageSize = 20.obs; //
final itemDataList = <ElectronicKeyListItem>[].obs; final itemDataList = <ElectronicKeyListItem>[].obs;
@ -12,7 +13,7 @@ class AuthorizedAdminListState {
AuthorizedAdminListState() { AuthorizedAdminListState() {
Map map = Get.arguments; Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"]; // lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"]; keyInfo.value = map["keyInfo"];
} }
} }

View File

@ -1,12 +1,11 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import 'checkingInDetail_entity.dart'; import 'checkingInDetail_entity.dart';
class CheckingInDetailState{ class CheckingInDetailState{
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs; final companyId = "".obs;
final staffId = 0.obs; final staffId = 0.obs;

View File

@ -1,15 +1,14 @@
import 'package:date_format/date_format.dart'; import 'package:date_format/date_format.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import 'checkingInListDay_entity.dart'; import 'checkingInListDay_entity.dart';
import 'checkingInListMonth_entity.dart'; import 'checkingInListMonth_entity.dart';
class CheckingInListState{ class CheckingInListState{
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs; final companyId = "".obs;
final listType = "1".obs;// 1 2 3 final listType = "1".obs;// 1 2 3
@ -26,6 +25,6 @@ class CheckingInListState{
var noPunchTimes = "".obs;// var noPunchTimes = "".obs;//
CheckingInListState() { CheckingInListState() {
getKeyInfosData.value = Get.arguments as KeyInfos; getKeyInfosData.value = Get.arguments as LockListInfoItemEntity;
} }
} }

View File

@ -2,11 +2,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import 'checkingInSet_entity.dart'; import 'checkingInSet_entity.dart';
class CheckingInSetState{ class CheckingInSetState{
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs; final companyId = "".obs;
var isCustom = true.obs; var isCustom = true.obs;

View File

@ -1,12 +1,11 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../tools/dateTool.dart'; import '../../../../tools/dateTool.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSet/checkingInSet_entity.dart'; import '../checkingInSet/checkingInSet_entity.dart';
class CheckingInSetWorkTimeState{ class CheckingInSetWorkTimeState{
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final checkingInSetInfo = CheckingInSetInfo().obs; final checkingInSetInfo = CheckingInSetInfo().obs;
final companyId = "".obs; final companyId = "".obs;

View File

@ -1,8 +1,6 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../checkingInSet/checkingInSet_entity.dart'; import '../checkingInSet/checkingInSet_entity.dart';
class CheckingInSetWorkdaySetState{ class CheckingInSetWorkdaySetState{
@ -10,7 +8,7 @@ class CheckingInSetWorkdaySetState{
var isSingledayWeekend = 2.obs; // 0 1 var isSingledayWeekend = 2.obs; // 0 1
var weekDays = <int>[].obs;// var weekDays = <int>[].obs;//
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final checkingInSetInfo = CheckingInSetInfo().obs; final checkingInSetInfo = CheckingInSetInfo().obs;
final companyId = "".obs; final companyId = "".obs;

View File

@ -2,12 +2,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../lockMian/entity/lockInfoEntity.dart'; import '../../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSetStaffList/checkingInStaffList_entity.dart'; import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
import 'checkingInAddStaffSeletKey_entity.dart'; import 'checkingInAddStaffSeletKey_entity.dart';
class CheckingInAddStaffState{ class CheckingInAddStaffState{
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs; final companyId = "".obs;
final staffListItemData = CheckingInAddStaffListItemEntity().obs; final staffListItemData = CheckingInAddStaffListItemEntity().obs;

View File

@ -1,11 +1,11 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../lockMian/entity/lockInfoEntity.dart'; import '../../../../lockMian/entity/lockListInfo_entity.dart';
import 'checkingInStaffList_entity.dart'; import 'checkingInStaffList_entity.dart';
class CheckingInStaffManageState{ class CheckingInStaffManageState{
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs; final companyId = "".obs;
final staffListData = <CheckingInAddStaffListItemEntity>[].obs; final staffListData = <CheckingInAddStaffListItemEntity>[].obs;

View File

@ -1,11 +1,11 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../lockMian/entity/lockInfoEntity.dart'; import '../../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSetStaffList/checkingInStaffList_entity.dart'; import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
class CheckingInStaffDetailState{ class CheckingInStaffDetailState{
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs; final companyId = "".obs;
final staffListItemData = CheckingInAddStaffListItemEntity().obs; final staffListItemData = CheckingInAddStaffListItemEntity().obs;

View File

@ -86,7 +86,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
onClick: () { onClick: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.sendElectronicKeyManagePage, arguments: { context, Routers.sendElectronicKeyManagePage, arguments: {
"lockMainEntity": state.lockMainEntity.value, // "lockMainEntity": state.lockMainEntity.value,
"keyInfo": state.keyInfo.value "keyInfo": state.keyInfo.value
}).then((val) { }).then((val) {
if (val != null) { if (val != null) {
@ -277,12 +277,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
// //
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
useDateStr = "永久";
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
// //
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
useDateStr = "单次";
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
// //
useDateStr = '循环'; useDateStr = '循环';

View File

@ -1,19 +1,20 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class ElectronicKeyListState { class ElectronicKeyListState {
TextEditingController searchController = TextEditingController(); /// TextEditingController searchController = TextEditingController(); ///
final keyInfo = KeyInfos().obs; final keyInfo = LockListInfoItemEntity().obs;
final lockMainEntity = LockMainEntity().obs; // final lockMainEntity = LockMainEntity().obs;
var pageNum = 1.obs; // var pageNum = 1.obs; //
final pageSize = 20.obs; // final pageSize = 20.obs; //
final itemDataList = <ElectronicKeyListItem>[].obs; final itemDataList = <ElectronicKeyListItem>[].obs;
ElectronicKeyListState() { ElectronicKeyListState() {
Map map = Get.arguments; Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"]; // lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"]; keyInfo.value = map["keyInfo"];
} }
} }

View File

@ -1,7 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
class SendElectronicKeyState { class SendElectronicKeyState {
TextEditingController emailOrPhoneController = TextEditingController emailOrPhoneController =
@ -10,8 +11,8 @@ class SendElectronicKeyState {
final FlutterContactPicker contactPicker = FlutterContactPicker(); final FlutterContactPicker contactPicker = FlutterContactPicker();
late Contact contact; late Contact contact;
final keyInfo = KeyInfos().obs; final keyInfo = LockListInfoItemEntity().obs;
final lockMainEntity = LockMainEntity().obs; // final lockMainEntity = LockMainEntity().obs;
final isRemoteUnlock = false.obs; // final isRemoteUnlock = false.obs; //
final isAuthentication = false.obs; // final isAuthentication = false.obs; //
@ -37,7 +38,7 @@ class SendElectronicKeyState {
SendElectronicKeyState() { SendElectronicKeyState() {
Map map = Get.arguments; Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"]; // lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"]; keyInfo.value = map["keyInfo"];
} }
} }

View File

@ -33,15 +33,15 @@ class AutomaticBlockingLogic extends BaseGetXController{
} }
var entity = await ApiRepository.to.setAutoUnlock( var entity = await ApiRepository.to.setAutoUnlock(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId!,
autoLockTime:autoTime, autoLockTime:int.parse(autoTime),
type: "1", type: 1,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
state.autoLockTime.value = state.isOpen.value == false ? "0" : autoTime; state.autoLockTime.value = state.isOpen.value == false ? "0" : autoTime;
state.getKeyInfosData.value.autoLockTime = int.parse(autoTime); state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond = int.parse(autoTime);
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功"); Toast.show(msg: "操作成功");
} }
} }
@ -140,7 +140,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsWithParametersCommand( IoSenderManage.readSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 29, featureBit: 29,
token: getTokenList, token: getTokenList,
@ -177,7 +177,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
} }
print("autoTimeautoTimeautoTime:${autoTime}"); print("autoTimeautoTimeautoTime:${autoTime}");
IoSenderManage.setSupportFunctionsWithParametersCommand( IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 29, featureBit: 29,
featureParaLength: 2, featureParaLength: 2,

View File

@ -2,10 +2,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class AutomaticBlockingState { class AutomaticBlockingState {
var getKeyInfosData = KeyInfos().obs; var lockSetInfoData = LockSetInfoData().obs;
var isOpen = false.obs;// var isOpen = false.obs;//
var autoLockTime = "5".obs; var autoLockTime = "5".obs;
@ -13,16 +14,18 @@ class AutomaticBlockingState {
final TextEditingController timeController = TextEditingController(); final TextEditingController timeController = TextEditingController();
AutomaticBlockingState() { AutomaticBlockingState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
isOpen.value = getKeyInfosData.value.autoLockTime! > -1 ? true : false; lockSetInfoData.value = map["lockSetInfoData"];
autoLockTime.value = getKeyInfosData.value.autoLockTime!.toString();
if((getKeyInfosData.value.autoLockTime! > 0) isOpen.value = lockSetInfoData.value.lockSettingInfo!.autoLock! == 1 ? true : false;
&& (getKeyInfosData.value.autoLockTime! != 5) autoLockTime.value = lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString();
&& (getKeyInfosData.value.autoLockTime! != 10)
&& (getKeyInfosData.value.autoLockTime! != 15) if((lockSetInfoData.value.lockSettingInfo!.autoLock! > 0)
&& (getKeyInfosData.value.autoLockTime! != 30) && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 5)
&& (getKeyInfosData.value.autoLockTime! != 60)){ && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 10)
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 15)
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 30)
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 60)){
isCustomLockTime.value = true; isCustomLockTime.value = true;
timeController.text = autoLockTime.value; timeController.text = autoLockTime.value;
} }

View File

@ -0,0 +1,8 @@
import '../../../../../tools/baseGetXController.dart';
import 'basicInformation_state.dart';
class BasicInformationLogic extends BaseGetXController{
final BasicInformationState state = BasicInformationState();
}

View File

@ -2,16 +2,14 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart'; import '../../../../../tools/commonItem.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart'; import '../../../../../translations/trans_lib.dart';
import '../../lockSet/lockSetInfo_entity.dart';
import 'basicInformation_logic.dart';
class BasicInformationPage extends StatefulWidget { class BasicInformationPage extends StatefulWidget {
const BasicInformationPage({Key? key}) : super(key: key); const BasicInformationPage({Key? key}) : super(key: key);
@ -21,145 +19,119 @@ class BasicInformationPage extends StatefulWidget {
} }
class _BasicInformationPageState extends State<BasicInformationPage> { class _BasicInformationPageState extends State<BasicInformationPage> {
late String _groupName = ""; final logic = Get.put(BasicInformationLogic());
late KeyInfos keyInfo; final state = Get.find<BasicInformationLogic>().state;
late LockMainEntity lockMainEntity;
late LockData _lockData;
@override // late String _groupName = "";
void initState() { // late LockData _lockData;
super.initState(); //
_groupName = '未分组'; // @override
} // void initState() {
// super.initState();
// _groupName = '未分组';
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["keyInfo"] != null)) {
keyInfo = obj["keyInfo"];
}
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.basicInformation!.tr, barTitle: TranslationLoader.lanKeys!.basicInformation!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: FutureBuilder<LockData>( body: ListView(
future: mockNetworkDataRequest(), children: [
builder: (BuildContext context, AsyncSnapshot<LockData> snapshot) { CommonItem(
// leftTitel:
if (snapshot.connectionState == ConnectionState.done) { TranslationLoader.lanKeys!.lockNumber!.tr,
if (snapshot.hasError) { rightTitle: state.lockBasicInfo.value.lockAlias,
// allHeight: 70.h,
return const Text('请求失败'); isHaveLine: true),
} else { CommonItem(
// leftTitel: "MAC/ID",
final LockData itemData = snapshot.data!; rightTitle: state.lockBasicInfo.value.lockAlias,
allHeight: 70.h,
return Column( isHaveLine: false),
children: [ SizedBox(
Expanded( height: 10.h,
child: ListView( ),
children: [ CommonItem(
CommonItem( leftTitel: TranslationLoader
leftTitel: .lanKeys!.electricQuantity!.tr,
TranslationLoader.lanKeys!.lockNumber!.tr, rightTitle: "${state.lockBasicInfo.value.electricQuantity}%",
rightTitle: itemData.lockAlias, isHaveLine: true,
allHeight: 70.h, isHaveDirection: true,
isHaveLine: true), action: () {
CommonItem( Navigator.pushNamed(context,
leftTitel: "MAC/ID", Routers.uploadElectricQuantityPage,
rightTitle: itemData.lockMac, arguments: {'lockSetInfoData': state.lockSetInfoData.value});
allHeight: 70.h, }),
isHaveLine: false), CommonItem(
SizedBox( leftTitel: TranslationLoader
height: 10.h, .lanKeys!.periodValidity!.tr,
), rightTitle: getUseDateStr(state.lockBasicInfo.value),
CommonItem( allHeight: 70.h,
leftTitel: TranslationLoader isHaveLine: false),
.lanKeys!.electricQuantity!.tr, SizedBox(
rightTitle: "${itemData.electricQuantity}%", height: 10.h,
isHaveLine: true, ),
isHaveDirection: true, CommonItem(
action: () { leftTitel:
Navigator.pushNamed(context, TranslationLoader.lanKeys!.lockName!.tr,
Routers.uploadElectricQuantityPage, rightTitle: state.lockBasicInfo.value.lockAlias,
arguments: {'keyInfo': keyInfo}); isHaveLine: true,
}), isHaveDirection: true,
CommonItem( action: () async {
leftTitel: TranslationLoader var data = await Get.toNamed(Routers.editLockNamePage, arguments: {'lockSetInfoData': state.lockSetInfoData.value});
.lanKeys!.periodValidity!.tr, if(data != null) {
rightTitle: getUseDateStr(_lockData), setState(() {
allHeight: 70.h, state.lockBasicInfo.value = data["lockBasicInfo"];
isHaveLine: false), });
SizedBox( }
height: 10.h, }),
), CommonItem(
CommonItem( leftTitel:
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
TranslationLoader.lanKeys!.lockName!.tr, // rightTitle: state.getKeyInfosData.value.groupName == "" ? _groupName : itemData.groupName,
rightTitle: itemData.lockName, isHaveLine: true,
isHaveLine: true, isHaveDirection: true,
isHaveDirection: true, action: () async {
action: () { Navigator.pushNamed(
Navigator.pushNamed( context, Routers.lockSeletGroupingPage,
context, Routers.editLockNamePage); arguments: {
}), 'lockSetInfoData': state.lockSetInfoData.value
CommonItem( }).then((val) {
leftTitel: if (val != null) {
TranslationLoader.lanKeys!.lockGrouping!.tr, // mockNetworkDataRequest();
rightTitle: itemData.groupName == "" setState(() {});
? _groupName }
: itemData.groupName, });
isHaveLine: true, }),
isHaveDirection: true, CommonItem(
action: () async { leftTitel: TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
Navigator.pushNamed( rightTitle: "",
context, Routers.lockSeletGroupingPage, isHaveLine: true,
arguments: { isHaveDirection: true,
'LockData': _lockData action: () {
}).then((val) { Navigator.pushNamed(context,
if (val != null) { Routers.adminOpenLockPasswordPage);
mockNetworkDataRequest(); }),
setState(() {}); CommonItem(
} leftTitel:
}); TranslationLoader.lanKeys!.unlockQRCode!.tr,
}), rightTitle: "",
CommonItem( isHaveLine: true,
leftTitel: TranslationLoader isHaveDirection: true,
.lanKeys!.adminOpenLockPassword!.tr, action: () {
rightTitle: "", Get.toNamed(Routers.unlockQRCodePage);
isHaveLine: true, }),
isHaveDirection: true, ],
action: () { )
Navigator.pushNamed(context, );
Routers.adminOpenLockPasswordPage);
}),
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.unlockQRCode!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.unlockQRCodePage);
}),
],
),
),
],
);
}
} else {
// loading
return Container();
}
}));
} }
//使 //使
String getUseDateStr(LockData indexEntity) { String getUseDateStr(LockBasicInfo indexEntity) {
String useDateStr = ''; String useDateStr = '';
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
// //
@ -202,16 +174,16 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
return keyTypeStr; return keyTypeStr;
} }
// // //
Future<LockData> mockNetworkDataRequest() async { // Future<LockData> mockNetworkDataRequest() async {
KeyDetailEntity entity = // KeyDetailEntity entity =
await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString()); // await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { // if (entity.errorCode!.codeIsSuccessful) {
// print("电子钥匙列表成功:${entity.data?.itemList}"); // // print("电子钥匙列表成功:${entity.data?.itemList}");
_lockData = entity.data!; // _lockData = entity.data!;
return entity.data!; // return entity.data!;
} // }
LockData data = LockData(); // LockData data = LockData();
return data; // return data;
} // }
} }

View File

@ -0,0 +1,18 @@
import 'package:get/get.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class BasicInformationState {
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
var groupName = "未分组".obs;
BasicInformationState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
}
}

View File

@ -0,0 +1,27 @@
import 'package:get/get.dart';
import '../../../../../network/api_repository.dart';
import '../../../../../tools/baseGetXController.dart';
import '../../../../../tools/toast.dart';
import '../../../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'editLockName_state.dart';
class EditLockNameLogic extends BaseGetXController{
final EditLockNameState state = EditLockNameState();
//
Future<void> modifyKeyNameRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to.updateLockName(
lockId: state.lockSetInfoData.value.lockId.toString(),
lockName:state.changeLockNameController.text);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "修改成功");
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
Get.back(result: {
"lockBasicInfo":state.lockBasicInfo.value
});
}
}
}

View File

@ -2,15 +2,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/tf_loginInput.dart'; import '../../../../../tools/tf_loginInput.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart'; import '../../../../../translations/trans_lib.dart';
import 'editLockName_logic.dart';
class EditLockNamePage extends StatefulWidget { class EditLockNamePage extends StatefulWidget {
const EditLockNamePage({Key? key}) : super(key: key); const EditLockNamePage({Key? key}) : super(key: key);
@ -20,24 +17,8 @@ class EditLockNamePage extends StatefulWidget {
} }
class _EditLockNamePageState extends State<EditLockNamePage> { class _EditLockNamePageState extends State<EditLockNamePage> {
final TextEditingController _changeLockNameController = final logic = Get.put(EditLockNameLogic());
TextEditingController(); final state = Get.find<EditLockNameLogic>().state;
@override
void initState() {
super.initState();
_changeLockNameController.text = "MCBN0c_8f3106";
}
//
Future<void> modifyKeyNameRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to
.modifyKeyName('63', '28', _changeLockNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) {
print("修改锁名称成功啦啦啦啦啦");
Toast.show(msg: "修改成功");
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -54,7 +35,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () { onPressed: () {
modifyKeyNameRequest(); logic.modifyKeyNameRequest();
}, },
), ),
], ],
@ -62,7 +43,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
body: Container( body: Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w), margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: LoginInput( child: LoginInput(
controller: _changeLockNameController, controller: state.changeLockNameController,
leftWidget: const SizedBox(), leftWidget: const SizedBox(),
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
inputFormatters: [ inputFormatters: [

View File

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class EditLockNameState {
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
final TextEditingController changeLockNameController = TextEditingController();
EditLockNameState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
changeLockNameController.text = lockBasicInfo.value.lockAlias!;
}
}

View File

@ -0,0 +1,72 @@
class LockGroupListEntity {
int? errorCode;
String? description;
String? errorMsg;
LockGroupData? data;
LockGroupListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
LockGroupListEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? LockGroupData.fromJson(json['data']) : null;
}
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;
}
}
class LockGroupData {
List<LockGroupItem>? itemList;
LockGroupData({this.itemList});
LockGroupData.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
itemList = <LockGroupItem>[];
json['list'].forEach((v) {
itemList!.add(LockGroupItem.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (itemList != null) {
data['list'] = itemList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class LockGroupItem {
int? lockNum;
int? keyGroupId;
String? keyGroupName;
LockGroupItem({this.lockNum, this.keyGroupId, this.keyGroupName});
LockGroupItem.fromJson(Map<String, dynamic> json) {
lockNum = json['lockNum'];
keyGroupId = json['keyGroupId'];
keyGroupName = json['keyGroupName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lockNum'] = lockNum;
data['keyGroupId'] = keyGroupId;
data['keyGroupName'] = keyGroupName;
return data;
}
}

View File

@ -0,0 +1,64 @@
import 'package:get/get.dart';
import '../../../../../network/api_repository.dart';
import '../../../../../tools/baseGetXController.dart';
import '../../../../../tools/toast.dart';
import '../../../electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'lockSeletGrouping_state.dart';
class LockSeletGroupingLogic extends BaseGetXController {
final LockSeletGroupingState state = LockSeletGroupingState();
//
Future<void> addLockGroupRequest() async {
MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "创建成功");
mockNetworkDataRequest();
}
}
//
Future<void> setLockGroupRequest(GroupListItem itemData) async {
MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
state.lockSetInfoData.value.lockId.toString(), itemData.keyGroupId.toString());
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "设置锁分组成功");
state.lockBasicInfo.value.groupId = itemData.keyGroupId;
mockNetworkDataRequest();
}
}
//
void mockNetworkDataRequest() async {
MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
if (entity.errorCode!.codeIsSuccessful) {
state.groupList.value = entity.data!.groupList!;
}
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
print("onReady()");
mockNetworkDataRequest();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
print("lockDetail_onInit()");
}
@override
void onClose() {
// TODO: implement onClose
}
}

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/network/api_repository.dart'; 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/tools/showTFView.dart'; import 'package:star_lock/tools/showTFView.dart';
@ -10,9 +9,11 @@ import 'package:star_lock/tools/toast.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart'; import '../../../../../tools/commonItem.dart';
import '../../../../../tools/noData.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart'; import '../../../../../translations/trans_lib.dart';
import 'lockSeletGrouping_logic.dart';
class LockSeletGroupingPage extends StatefulWidget { class LockSeletGroupingPage extends StatefulWidget {
const LockSeletGroupingPage({Key? key}) : super(key: key); const LockSeletGroupingPage({Key? key}) : super(key: key);
@ -22,15 +23,11 @@ class LockSeletGroupingPage extends StatefulWidget {
} }
class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> { class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
final TextEditingController _changeNameController = TextEditingController(); final logic = Get.put(LockSeletGroupingLogic());
late LockData _lockData; final state = Get.find<LockSeletGroupingLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["LockData"] != null)) {
_lockData = obj["LockData"];
}
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
@ -38,51 +35,32 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
barTitle: TranslationLoader.lanKeys!.selectGroup!.tr, barTitle: TranslationLoader.lanKeys!.selectGroup!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: FutureBuilder<List<GroupListItem>>( body: Column(
future: mockNetworkDataRequest(), children: [
builder: (BuildContext context, Expanded(child: _buildMainUI()),
AsyncSnapshot<List<GroupListItem>> snapshot) { SubmitBtn(
// btnName: TranslationLoader.lanKeys!.createNewGroup!.tr,
if (snapshot.connectionState == ConnectionState.done) { borderRadius: 20.w,
if (snapshot.hasError) { margin: EdgeInsets.only(
// left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
return const Text('请求失败'); padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
} else { onClick: () {
// showCupertinoAlertDialog(context);
final List<GroupListItem> itemData = snapshot.data!; // Navigator.pop(context);
}),
return Column( SizedBox(
children: [ height: 40.h,
Expanded(child: _buildMainUI(context, itemData)), )
SubmitBtn( ],
btnName: TranslationLoader.lanKeys!.createNewGroup!.tr, ),
borderRadius: 20.w,
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
showCupertinoAlertDialog(context);
// Navigator.pop(context);
}),
SizedBox(
height: 40.h,
)
],
);
}
} else {
// loading
return Container();
}
}),
); );
} }
Widget _buildMainUI(BuildContext context, List itemList) { Widget _buildMainUI() {
return ListView.builder( return Obx(() => state.groupList.value.isNotEmpty ? ListView.builder(
itemCount: itemList.length, itemCount: state.groupList.value.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
GroupListItem itemData = itemList[index]; GroupListItem itemData = state.groupList.value[index];
return CommonItem( return CommonItem(
leftTitel: itemData.keyGroupName, leftTitel: itemData.keyGroupName,
rightTitle: "", rightTitle: "",
@ -90,7 +68,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
isHaveLine: true, isHaveLine: true,
isHaveDirection: false, isHaveDirection: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: _lockData.groupId == itemData.keyGroupId rightWidget: state.lockBasicInfo.value.groupId == itemData.keyGroupId
? Image( ? Image(
image: const AssetImage("images/icon_item_checked.png"), image: const AssetImage("images/icon_item_checked.png"),
width: 30.w, width: 30.w,
@ -99,47 +77,9 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
) )
: Container(), : Container(),
action: () { action: () {
Navigator.pop(context, true); logic.setLockGroupRequest(itemData);
setLockGroupRequest(itemData);
}); });
}); }) : const NoData());
}
//
Future<void> addLockGroupRequest() async {
MassSendLockGroupListEntity entity =
await ApiRepository.to.addLockGroup(_changeNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "创建成功");
mockNetworkDataRequest();
setState(() {});
}
}
//
Future<void> setLockGroupRequest(GroupListItem itemData) async {
MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
_lockData.lockId.toString(), itemData.keyGroupId.toString());
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "设置锁分组成功");
mockNetworkDataRequest();
}
}
//
Future<List<GroupListItem>> mockNetworkDataRequest() async {
MassSendLockGroupListEntity entity =
await ApiRepository.to.lockGroupList('1');
if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) {
return entity.data!.groupList!;
} else {
List<GroupListItem> dataList = [];
return dataList;
}
} else {
return [];
}
} }
void showCupertinoAlertDialog(BuildContext context) { void showCupertinoAlertDialog(BuildContext context) {
@ -149,11 +89,11 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
return ShowTFView( return ShowTFView(
title: TranslationLoader.lanKeys!.createNewGroup!.tr, title: TranslationLoader.lanKeys!.createNewGroup!.tr,
tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr, tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr,
controller: _changeNameController, controller: state.changeNameController,
sureClick: () { sureClick: () {
// //
if (_changeNameController.text.isNotEmpty) { if (state.changeNameController.text.isNotEmpty) {
addLockGroupRequest(); logic.addLockGroupRequest();
Navigator.pop(context); Navigator.pop(context);
} else { } else {
Toast.show(msg: '请输入分组名称'); Toast.show(msg: '请输入分组名称');

View File

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class LockSeletGroupingState {
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
var groupList = <GroupListItem>[].obs;
final TextEditingController changeNameController = TextEditingController();
LockSeletGroupingState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
}
}

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart'; 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/tools/toast.dart'; import 'package:star_lock/tools/toast.dart';
@ -11,6 +10,7 @@ import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart'; import '../../../../../translations/trans_lib.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class UploadElectricQuantityPage extends StatefulWidget { class UploadElectricQuantityPage extends StatefulWidget {
const UploadElectricQuantityPage({Key? key}) : super(key: key); const UploadElectricQuantityPage({Key? key}) : super(key: key);
@ -20,14 +20,13 @@ class UploadElectricQuantityPage extends StatefulWidget {
_UploadElectricQuantityPageState(); _UploadElectricQuantityPageState();
} }
class _UploadElectricQuantityPageState class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage> {
extends State<UploadElectricQuantityPage> { late LockSetInfoData lockSetInfoData;
late KeyInfos keyInfo;
// //
Future<void> uploadElectricQuantityRequest() async { Future<void> uploadElectricQuantityRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to KeyOperationRecordEntity entity = await ApiRepository.to
.uploadElectricQuantity('100', keyInfo.lockId.toString()); .uploadElectricQuantity('100', lockSetInfoData.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
print("锁电量更新成功啦啦啦啦啦"); print("锁电量更新成功啦啦啦啦啦");
Toast.show(msg: "锁电量更新成功"); Toast.show(msg: "锁电量更新成功");
@ -37,8 +36,8 @@ class _UploadElectricQuantityPageState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments; dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["keyInfo"] != null)) { if (obj != null && (obj["lockSetInfoData"] != null)) {
keyInfo = obj["keyInfo"]; lockSetInfoData = obj["lockSetInfoData"];
} }
return Scaffold( return Scaffold(

View File

@ -7,7 +7,6 @@ import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.da
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_reply.dart'; import '../../../../blue/io_reply.dart';
import '../../../../blue/io_tool/io_manager.dart';
import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/io_tool.dart';
import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../blue/sender_manage.dart'; import '../../../../blue/sender_manage.dart';
@ -22,18 +21,16 @@ class BurglarAlarmLogic extends BaseGetXController{
// -> // ->
Future<void> _setLockSetGeneralSetting() async{ Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData( var entity = await ApiRepository.to.setBurglarAlarmData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId!,
changeType:"1", antiPrySwitch:state.burglarAlarmEnable.value == 1 ? 0 : 1, // 1-2-;
isOn:state.burglarAlarmEnable.value == 1 ? "2" : "1", // 1-2-;
type:"3", // 3
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 2 : 1; state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 0 : 1;
state.getKeyInfosData.value.tamperAlert = state.burglarAlarmEnable.value; state.lockSetInfoData.value.lockSettingInfo!.antiPrySwitch = state.burglarAlarmEnable.value;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功"); Toast.show(msg: "操作成功");
} }
} }
@ -127,7 +124,7 @@ class BurglarAlarmLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsNoParametersCommand( IoSenderManage.readSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 30, featureBit: 30,
token: getTokenList, token: getTokenList,
@ -153,7 +150,7 @@ class BurglarAlarmLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand( IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 30, featureBit: 30,
featureEnable: state.burglarAlarmEnable.value == 1 ? 0 : 1, featureEnable: state.burglarAlarmEnable.value == 1 ? 0 : 1,

View File

@ -1,16 +1,18 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../lockSet/lockSetInfo_entity.dart';
class BurglarAlarmState{ class BurglarAlarmState{
var getKeyInfosData = KeyInfos().obs; var lockSetInfoData = LockSetInfoData().obs;
var burglarAlarmEnable = 1.obs; var burglarAlarmEnable = 0.obs;
BurglarAlarmState() { BurglarAlarmState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
burglarAlarmEnable.value = getKeyInfosData.value.tamperAlert!; lockSetInfoData.value = map["lockSetInfoData"];
burglarAlarmEnable.value = lockSetInfoData.value.lockSettingInfo!.antiPrySwitch!;
} }
} }

View File

@ -13,7 +13,7 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
// //
void setCheckInCreateCompany() async{ void setCheckInCreateCompany() async{
var entity = await ApiRepository.to.setCheckInCreateCompanyData( var entity = await ApiRepository.to.setCheckInCreateCompanyData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
attendanceType: state.isCustom.value ? "0" :"1", attendanceType: state.isCustom.value ? "0" :"1",
companyName: state.companyNameController.text, companyName: state.companyNameController.text,
workDay: state.weekDays.value, workDay: state.weekDays.value,
@ -28,7 +28,7 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
// //
void setLockSetGeneralSetting() async{ void setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData( var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
changeType:"1", changeType:"1",
isOn:"1", isOn:"1",
type:"1", type:"1",
@ -36,8 +36,8 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.isAttendance = 1; state.lockSetInfoData.value.lockSettingInfo!.attendance = 1;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Get.back(); Get.back();
Toast.show(msg: "设置成功"); Toast.show(msg: "设置成功");
} }

View File

@ -46,7 +46,7 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: { var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: {
"getKeyInfosData": state.getKeyInfosData.value, "getKeyInfosData": state.lockSetInfoData.value,
"companyId": "1", "companyId": "1",
"pushType": "0", "pushType": "0",
"checkingInSetInfo": CheckingInSetInfo(), "checkingInSetInfo": CheckingInSetInfo(),
@ -68,8 +68,8 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: { var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: {
"getKeyInfosData": state.getKeyInfosData.value, "getKeyInfosData": state.lockSetInfoData.value,
"companyId": "0", "companyId": "0",
"pushType": "0", "pushType": "0",
"checkingInSetInfo": CheckingInSetInfo(), "checkingInSetInfo": CheckingInSetInfo(),

View File

@ -2,10 +2,11 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class CheckInCreatCompanyState{ class CheckInCreatCompanyState{
var getKeyInfosData = KeyInfos().obs; var lockSetInfoData = LockSetInfoData().obs;
TextEditingController companyNameController = TextEditingController(); TextEditingController companyNameController = TextEditingController();
@ -19,6 +20,7 @@ class CheckInCreatCompanyState{
var beginTimeTimestamp = "".obs;// var beginTimeTimestamp = "".obs;//
var endTimeTimestamp = "".obs;// var endTimeTimestamp = "".obs;//
CheckInCreatCompanyState() { CheckInCreatCompanyState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
} }
} }

View File

@ -108,7 +108,7 @@ class ConfiguringWifiLogic extends BaseGetXController{
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList"); print("openDoorTokenPubToken:$getTokenList");
print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}"); // print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}");
IoSenderManage.senderConfiguringWifiCommand( IoSenderManage.senderConfiguringWifiCommand(
keyID: "1", keyID: "1",
userID: await Storage.getUid(), userID: await Storage.getUid(),

View File

@ -12,7 +12,7 @@ class DiagnoseLogic extends BaseGetXController{
// //
Future<void> setLockDiagnose() async{ Future<void> setLockDiagnose() async{
var entity = await ApiRepository.to.setLockDiagnoseData( var entity = await ApiRepository.to.setLockDiagnoseData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
electricQuantity:"23", electricQuantity:"23",
firmwareRevision:"1.0", // 1-2-; firmwareRevision:"1.0", // 1-2-;
hardwareRevision:"1.3", // 4 hardwareRevision:"1.3", // 4

View File

@ -1,12 +1,15 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class DiagnoseState{ class DiagnoseState{
var getKeyInfosData = KeyInfos().obs; var lockSetInfoData = LockSetInfoData().obs;
DiagnoseState() { DiagnoseState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
} }
} }

View File

@ -8,14 +8,14 @@ import 'lockEscalation_state.dart';
class LockEscalationLogic extends BaseGetXController{ class LockEscalationLogic extends BaseGetXController{
LockEscalationState state = LockEscalationState(); LockEscalationState state = LockEscalationState();
// //
Future<void> setLockSetGeneralSetting() async{ Future<void> setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.getLockVersionInfoData( // var entity = await ApiRepository.to.getLockVersionInfoData(
lockId: state.getKeyInfosData.value.lockId.toString(), // lockId: state.getKeyInfosData.value.lockId.toString(),
); // );
if(entity.errorCode!.codeIsSuccessful){ // if(entity.errorCode!.codeIsSuccessful){
//
} // }
} }
@override @override

View File

@ -1,8 +1,6 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class LockEscalationState{ class LockEscalationState{
var getKeyInfosData = KeyInfos().obs;
} }

View File

@ -0,0 +1,60 @@
class CheckingInInfoDataEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
CheckingInInfoDataEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
CheckingInInfoDataEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
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;
}
}
class Data {
int? workEndTime;
int? attendanceType;
int? companyId;
int? workStartTime;
List<int>? workDay;
Data(
{this.workEndTime,
this.attendanceType,
this.companyId,
this.workStartTime,
this.workDay});
Data.fromJson(Map<String, dynamic> json) {
workEndTime = json['workEndTime'];
attendanceType = json['attendanceType'];
companyId = json['companyId'];
workStartTime = json['workStartTime'];
workDay = json['workDay'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['workEndTime'] = workEndTime;
data['attendanceType'] = attendanceType;
data['companyId'] = companyId;
data['workStartTime'] = workStartTime;
data['workDay'] = workDay;
return data;
}
}

View File

@ -0,0 +1,490 @@
class LockSetInfoEntity {
int? errorCode;
String? description;
String? errorMsg;
LockSetInfoData? data;
LockSetInfoEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
LockSetInfoEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? LockSetInfoData.fromJson(json['data']) : null;
}
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;
}
}
class LockSetInfoData {
int? lockId;
LockStatus? lockStatus;
LockFeature? lockFeature;
LockBasicInfo? lockBasicInfo;
LockSettingInfo? lockSettingInfo;
LockSetInfoData({
this.lockId,
this.lockStatus,
this.lockFeature,
this.lockBasicInfo,
this.lockSettingInfo});
LockSetInfoData.fromJson(Map<String, dynamic> json) {
lockId = json['lockId'];
lockStatus = json['lockStatus'] != null
? LockStatus.fromJson(json['lockStatus'])
: null;
lockFeature = json['lockFeature'] != null
? LockFeature.fromJson(json['lockFeature'])
: null;
lockBasicInfo = json['lockBasicInfo'] != null
? LockBasicInfo.fromJson(json['lockBasicInfo'])
: null;
lockSettingInfo = json['lockSettingInfo'] != null
? LockSettingInfo.fromJson(json['lockSettingInfo'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lockId'] = lockId;
if (lockStatus != null) {
data['lockStatus'] = lockStatus!.toJson();
}
if (lockFeature != null) {
data['lockFeature'] = lockFeature!.toJson();
}
if (lockBasicInfo != null) {
data['lockBasicInfo'] = lockBasicInfo!.toJson();
}
if (lockSettingInfo != null) {
data['lockSettingInfo'] = lockSettingInfo!.toJson();
}
return data;
}
}
class LockStatus {
int? roomStatus;
LockStatus({this.roomStatus});
LockStatus.fromJson(Map<String, dynamic> json) {
roomStatus = json['roomStatus'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['roomStatus'] = roomStatus;
return data;
}
}
class LockFeature {
int? password;
int? icCard;
int? fingerprint;
int? fingerVein;
int? palmVein;
int? d3Face;
int? qrCode;
int? bluetoothRemoteControl;
int? wirelessKey;
int? gatewayUnlock;
int? lockCommand;
int? firmwareUpgrade;
int? passwordIssue;
int? cardIssue;
int? fingerprintIssue;
int? fingerVeinIssue;
int? palmVeinIssue;
int? d3FaceIssue;
int? lockFreeze;
int? readAdminPassword;
int? passwordManagement;
int? passwordWithDelete;
int? remoteUnlock;
int? autoLock;
int? antiPrySwitch;
int? resetSwitch;
int? lockSwitch;
int? lockSound;
int? languageSetting;
int? realTimeClock;
int? wifi;
int? videoIntercom;
int? cyclePassword;
int? cycleFingerprintCard;
int? doubleAuthentication;
int? openDirection;
int? proximitySensing;
int? doorStatus;
int? wiredDoorMagnet;
int? wirelessDoorMagnet;
int? doorNotClosedAlarm;
int? unlockReminder;
int? wirelessKeyboard;
int? lightingTime;
int? passageMode;
int? hotelLockCardSystem;
int? appUnlockOnline;
int? bluetoothBroadcast;
int? attendance;
LockFeature(
{this.password,
this.icCard,
this.fingerprint,
this.fingerVein,
this.palmVein,
this.d3Face,
this.qrCode,
this.bluetoothRemoteControl,
this.wirelessKey,
this.gatewayUnlock,
this.lockCommand,
this.firmwareUpgrade,
this.passwordIssue,
this.cardIssue,
this.fingerprintIssue,
this.fingerVeinIssue,
this.palmVeinIssue,
this.d3FaceIssue,
this.lockFreeze,
this.readAdminPassword,
this.passwordManagement,
this.passwordWithDelete,
this.remoteUnlock,
this.autoLock,
this.antiPrySwitch,
this.resetSwitch,
this.lockSwitch,
this.lockSound,
this.languageSetting,
this.realTimeClock,
this.wifi,
this.videoIntercom,
this.cyclePassword,
this.cycleFingerprintCard,
this.doubleAuthentication,
this.openDirection,
this.proximitySensing,
this.doorStatus,
this.wiredDoorMagnet,
this.wirelessDoorMagnet,
this.doorNotClosedAlarm,
this.unlockReminder,
this.wirelessKeyboard,
this.lightingTime,
this.passageMode,
this.hotelLockCardSystem,
this.appUnlockOnline,
this.bluetoothBroadcast,
this.attendance});
LockFeature.fromJson(Map<String, dynamic> json) {
password = json['password'];
icCard = json['icCard'];
fingerprint = json['fingerprint'];
fingerVein = json['fingerVein'];
palmVein = json['palmVein'];
d3Face = json['d3Face'];
qrCode = json['qrCode'];
bluetoothRemoteControl = json['bluetoothRemoteControl'];
wirelessKey = json['wirelessKey'];
gatewayUnlock = json['gatewayUnlock'];
lockCommand = json['lockCommand'];
firmwareUpgrade = json['firmwareUpgrade'];
passwordIssue = json['passwordIssue'];
cardIssue = json['cardIssue'];
fingerprintIssue = json['fingerprintIssue'];
fingerVeinIssue = json['fingerVeinIssue'];
palmVeinIssue = json['palmVeinIssue'];
d3FaceIssue = json['d3FaceIssue'];
lockFreeze = json['lockFreeze'];
readAdminPassword = json['readAdminPassword'];
passwordManagement = json['passwordManagement'];
passwordWithDelete = json['passwordWithDelete'];
remoteUnlock = json['remoteUnlock'];
autoLock = json['autoLock'];
antiPrySwitch = json['antiPrySwitch'];
resetSwitch = json['resetSwitch'];
lockSwitch = json['lockSwitch'];
lockSound = json['lockSound'];
languageSetting = json['languageSetting'];
realTimeClock = json['realTimeClock'];
wifi = json['wifi'];
videoIntercom = json['videoIntercom'];
cyclePassword = json['cyclePassword'];
cycleFingerprintCard = json['cycleFingerprintCard'];
doubleAuthentication = json['doubleAuthentication'];
openDirection = json['openDirection'];
proximitySensing = json['proximitySensing'];
doorStatus = json['doorStatus'];
wiredDoorMagnet = json['wiredDoorMagnet'];
wirelessDoorMagnet = json['wirelessDoorMagnet'];
doorNotClosedAlarm = json['doorNotClosedAlarm'];
unlockReminder = json['unlockReminder'];
wirelessKeyboard = json['wirelessKeyboard'];
lightingTime = json['lightingTime'];
passageMode = json['passageMode'];
hotelLockCardSystem = json['hotelLockCardSystem'];
appUnlockOnline = json['appUnlockOnline'];
bluetoothBroadcast = json['bluetoothBroadcast'];
attendance = json['attendance'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['password'] = password;
data['icCard'] = icCard;
data['fingerprint'] = fingerprint;
data['fingerVein'] = fingerVein;
data['palmVein'] = palmVein;
data['d3Face'] = d3Face;
data['qrCode'] = qrCode;
data['bluetoothRemoteControl'] = bluetoothRemoteControl;
data['wirelessKey'] = wirelessKey;
data['gatewayUnlock'] = gatewayUnlock;
data['lockCommand'] = lockCommand;
data['firmwareUpgrade'] = firmwareUpgrade;
data['passwordIssue'] = passwordIssue;
data['cardIssue'] = cardIssue;
data['fingerprintIssue'] = fingerprintIssue;
data['fingerVeinIssue'] = fingerVeinIssue;
data['palmVeinIssue'] = palmVeinIssue;
data['d3FaceIssue'] = d3FaceIssue;
data['lockFreeze'] = lockFreeze;
data['readAdminPassword'] = readAdminPassword;
data['passwordManagement'] = passwordManagement;
data['passwordWithDelete'] = passwordWithDelete;
data['remoteUnlock'] = remoteUnlock;
data['autoLock'] = autoLock;
data['antiPrySwitch'] = antiPrySwitch;
data['resetSwitch'] = resetSwitch;
data['lockSwitch'] = lockSwitch;
data['lockSound'] = lockSound;
data['languageSetting'] = languageSetting;
data['realTimeClock'] = realTimeClock;
data['wifi'] = wifi;
data['videoIntercom'] = videoIntercom;
data['cyclePassword'] = cyclePassword;
data['cycleFingerprintCard'] = cycleFingerprintCard;
data['doubleAuthentication'] = doubleAuthentication;
data['openDirection'] = openDirection;
data['proximitySensing'] = proximitySensing;
data['doorStatus'] = doorStatus;
data['wiredDoorMagnet'] = wiredDoorMagnet;
data['wirelessDoorMagnet'] = wirelessDoorMagnet;
data['doorNotClosedAlarm'] = doorNotClosedAlarm;
data['unlockReminder'] = unlockReminder;
data['wirelessKeyboard'] = wirelessKeyboard;
data['lightingTime'] = lightingTime;
data['passageMode'] = passageMode;
data['hotelLockCardSystem'] = hotelLockCardSystem;
data['appUnlockOnline'] = appUnlockOnline;
data['bluetoothBroadcast'] = bluetoothBroadcast;
data['attendance'] = attendance;
return data;
}
}
class LockBasicInfo {
int? keyId;
String? model;
int? electricQuantity;
int? indate;
int? isLockOwner;
String? lockAlias;
int? groupId;
List<GroupData>? groupData;
String? adminPwd;
int? keyType;
int? startDate;
int? endDate;
LockBasicInfo(
{this.keyId,
this.model,
this.electricQuantity,
this.indate,
this.isLockOwner,
this.lockAlias,
this.groupId,
this.groupData,
this.adminPwd,
this.keyType,
this.startDate,
this.endDate,});
LockBasicInfo.fromJson(Map<String, dynamic> json) {
keyId = json['keyId'];
model = json['model'];
electricQuantity = json['electricQuantity'];
indate = json['indate'];
isLockOwner = json['isLockOwner'];
lockAlias = json['lockAlias'];
groupId = json['groupId'];
if (json['groupData'] != null) {
groupData = <GroupData>[];
json['groupData'].forEach((v) {
groupData!.add(GroupData.fromJson(v));
});
}
adminPwd = json['adminPwd'];
keyType = json['keyType'];
startDate = json['startDate'];
endDate = json['endDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['keyId'] = keyId;
data['model'] = model;
data['electricQuantity'] = electricQuantity;
data['indate'] = indate;
data['isLockOwner'] = isLockOwner;
data['lockAlias'] = lockAlias;
data['groupId'] = groupId;
if (groupData != null) {
data['groupData'] = groupData!.map((v) => v.toJson()).toList();
}
data['adminPwd'] = adminPwd;
data['keyType'] = keyType;
data['startDate'] = startDate;
data['endDate'] = endDate;
return data;
}
}
class GroupData {
int? id;
String? name;
GroupData({this.id, this.name});
GroupData.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['name'] = name;
return data;
}
}
class LockSettingInfo {
int? remoteUnlock;
int? autoLock;
int? autoLockSecond;
int? antiPrySwitch;
int? resetSwitch;
int? lockSwitch;
int? lockSound;
int? lockSoundVolume;
int? languageSettingLang;
int? openDirectionValue;
int? doorNotClosedAlarm;
int? unlockReminder;
int? lightingTime;
int? lightingSecond;
int? passageMode;
List<int>? passageModeConfig;
int? attendance;
int? appUnlockOnline;
int? bluetoothBroadcast;
String? adminPwd;
int? unlockReminderPush;
String? languageSettingLangText;
LockSettingInfo(
{this.remoteUnlock,
this.autoLock,
this.autoLockSecond,
this.antiPrySwitch,
this.resetSwitch,
this.lockSwitch,
this.lockSound,
this.lockSoundVolume,
this.languageSettingLang,
this.openDirectionValue,
this.doorNotClosedAlarm,
this.unlockReminder,
this.lightingTime,
this.lightingSecond,
this.passageMode,
this.passageModeConfig,
this.attendance,
this.appUnlockOnline,
this.bluetoothBroadcast,
this.adminPwd,
this.unlockReminderPush,
this.languageSettingLangText});
LockSettingInfo.fromJson(Map<String, dynamic> json) {
remoteUnlock = json['remoteUnlock'];
autoLock = json['autoLock'];
autoLockSecond = json['autoLockSecond'];
antiPrySwitch = json['antiPrySwitch'];
resetSwitch = json['resetSwitch'];
lockSwitch = json['lockSwitch'];
lockSound = json['lockSound'];
lockSoundVolume = json['lockSoundVolume'];
languageSettingLang = json['languageSettingLang'];
openDirectionValue = json['openDirectionValue'];
doorNotClosedAlarm = json['doorNotClosedAlarm'];
unlockReminder = json['unlockReminder'];
lightingTime = json['lightingTime'];
lightingSecond = json['lightingSecond'];
passageMode = json['passageMode'];
passageModeConfig = json['passageModeConfig'].cast<int>();
attendance = json['attendance'];
appUnlockOnline = json['appUnlockOnline'];
bluetoothBroadcast = json['bluetoothBroadcast'];
adminPwd = json['adminPwd'];
unlockReminderPush = json['unlockReminderPush'];
languageSettingLangText = json['languageSettingLangText'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['remoteUnlock'] = remoteUnlock;
data['autoLock'] = autoLock;
data['autoLockSecond'] = autoLockSecond;
data['antiPrySwitch'] = antiPrySwitch;
data['resetSwitch'] = resetSwitch;
data['lockSwitch'] = lockSwitch;
data['lockSound'] = lockSound;
data['lockSoundVolume'] = lockSoundVolume;
data['languageSettingLang'] = languageSettingLang;
data['openDirectionValue'] = openDirectionValue;
data['doorNotClosedAlarm'] = doorNotClosedAlarm;
data['unlockReminder'] = unlockReminder;
data['lightingTime'] = lightingTime;
data['lightingSecond'] = lightingSecond;
data['passageMode'] = passageMode;
data['passageModeConfig'] = passageModeConfig;
data['attendance'] = attendance;
data['appUnlockOnline'] = appUnlockOnline;
data['bluetoothBroadcast'] = bluetoothBroadcast;
data['adminPwd'] = adminPwd;
data['unlockReminderPush'] = unlockReminderPush;
data['languageSettingLangText'] = languageSettingLangText;
return data;
}
}

View File

@ -17,7 +17,7 @@ import '../../../../tools/baseGetXController.dart';
import '../../../../tools/eventBusEventManage.dart'; import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/toast.dart'; import '../../../../tools/toast.dart';
import 'CheckingInInfoDataEntity.dart'; import 'checkingInInfoData_entity.dart';
import 'lockSet_state.dart'; import 'lockSet_state.dart';
typedef BlockSetStateCallback = void Function(); typedef BlockSetStateCallback = void Function();
@ -71,8 +71,7 @@ class LockSetLogic extends BaseGetXController {
List<int> publicKeyDataList = changeStringListToIntList(publicKey!); List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
IoSenderManage.deletUser( IoSenderManage.deletUser(
lockID: lockID: BlueManage().connectDeviceName,
state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
authUserID: await Storage.getUid(), authUserID: await Storage.getUid(),
keyID: "1", keyID: "1",
delUserID: await Storage.getUid(), delUserID: await Storage.getUid(),
@ -171,7 +170,7 @@ class LockSetLogic extends BaseGetXController {
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.deletUser( IoSenderManage.deletUser(
lockID: state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, lockID: BlueManage().connectDeviceName,
authUserID: "100001", authUserID: "100001",
keyID: "1", keyID: "1",
delUserID: "100001", delUserID: "100001",
@ -209,10 +208,23 @@ class LockSetLogic extends BaseGetXController {
}); });
} }
//
void getLockSettingInfoData() async {
var entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value = entity.data!;
state.lockSettingInfo.value = state.lockSetInfoData.value.lockSettingInfo!;
state.lockFeature.value = state.lockSetInfoData.value.lockFeature!;
state.lockStatus.value = state.lockSetInfoData.value.lockStatus!;
}
}
// //
void deletLockInfoData() async { void deletLockInfoData() async {
var entity = await ApiRepository.to.deletOwnerLockData( var entity = await ApiRepository.to.deletOwnerLockData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
Get.offAllNamed(Routers.starLockMain); Get.offAllNamed(Routers.starLockMain);
@ -222,8 +234,8 @@ class LockSetLogic extends BaseGetXController {
// //
void deletKeyData() async { void deletKeyData() async {
var entity = await ApiRepository.to.deletOwnerKeyData( var entity = await ApiRepository.to.deletOwnerKeyData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
keyId: state.getKeyInfosData.value.keyId.toString(), keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
Get.offAllNamed(Routers.starLockMain); Get.offAllNamed(Routers.starLockMain);
@ -246,7 +258,7 @@ class LockSetLogic extends BaseGetXController {
// if(state.currentDeviceUUid.value[31] == "1"){ // if(state.currentDeviceUUid.value[31] == "1"){
// //
if(state.getKeyInfosData.value.isLockOwner == 1){ if(state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1){
// //
factoryDataResetAction(); factoryDataResetAction();
}else{ }else{
@ -271,7 +283,7 @@ class LockSetLogic extends BaseGetXController {
void openCheckingInData( void openCheckingInData(
BlockSetCheckInCallback blockSetCheckInCallback) async { BlockSetCheckInCallback blockSetCheckInCallback) async {
var entity = await ApiRepository.to.openCheckingInData( var entity = await ApiRepository.to.openCheckingInData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
blockSetCheckInCallback(entity); blockSetCheckInCallback(entity);
@ -281,7 +293,7 @@ class LockSetLogic extends BaseGetXController {
// //
void setLockSetGeneralSetting(String isOn) async { void setLockSetGeneralSetting(String isOn) async {
var entity = await ApiRepository.to.setLockSetGeneralSettingData( var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
changeType: "1", changeType: "1",
isOn: isOn, isOn: isOn,
type: "1", type: "1",
@ -289,9 +301,8 @@ class LockSetLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.isAttendance = int.parse(isOn); // state.lockSetInfoData.value.attendance = int.parse(isOn);
eventBus // eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "设置成功"); Toast.show(msg: "设置成功");
} else {} } else {}
} }
@ -299,18 +310,15 @@ class LockSetLogic extends BaseGetXController {
// //
void setLockPickingReminder() async { void setLockPickingReminder() async {
var entity = await ApiRepository.to.setLockPickingReminderData( var entity = await ApiRepository.to.setLockPickingReminderData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
keyId: state.getKeyInfosData.value.keyId.toString(), keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
monitorFlag: monitorFlag: state.isLockPickingReminder.value == 1 ? "1" : "2", // 12
state.isLockPickingReminder.value == 1 ? "1" : "2", // 12
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.monitorFlag = // state.lockSetInfoData.value.unlockReminder = state.isLockPickingReminder.value;
state.isLockPickingReminder.value; // eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
eventBus
.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "设置成功"); Toast.show(msg: "设置成功");
} else {} } else {}
} }
@ -320,7 +328,7 @@ class LockSetLogic extends BaseGetXController {
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) { _passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
state.getKeyInfosData.value = event.keyInfo; // state.lockSetInfoData.value = event.keyInfo;
blockSetStateCallback(); blockSetStateCallback();
}); });
} }
@ -340,6 +348,8 @@ class LockSetLogic extends BaseGetXController {
super.onReady(); super.onReady();
print("onReady()"); print("onReady()");
getLockSettingInfoData();
_initReplySubscription(); _initReplySubscription();
initLoadDataScanAllDeviceFindCurrentDeviceAction(); initLoadDataScanAllDeviceFindCurrentDeviceAction();
} }
@ -349,6 +359,7 @@ class LockSetLogic extends BaseGetXController {
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
print("onInit()"); print("onInit()");
} }
@override @override

View File

@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -10,8 +9,7 @@ import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/showTFView.dart'; import '../../../../tools/showTFView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
@ -29,7 +27,6 @@ class LockSetPage extends StatefulWidget {
class _LockSetPageState extends State<LockSetPage> with RouteAware { class _LockSetPageState extends State<LockSetPage> with RouteAware {
final logic = Get.put(LockSetLogic()); final logic = Get.put(LockSetLogic());
final state = Get.find<LockSetLogic>().state; final state = Get.find<LockSetLogic>().state;
StreamSubscription? _passCurrentLockInformationEvent;
@override @override
void initState() { void initState() {
@ -56,47 +53,45 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
children: [ children: [
// //
CommonItem( CommonItem(
leftTitel: leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr,
TranslationLoader.lanKeys!.basicInformation!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.basicInformationPage, arguments: { Get.toNamed(Routers.basicInformationPage, arguments: {
'keyInfo': state.getKeyInfosData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}), }),
SizedBox( SizedBox(height: 10.h),
height: 10.h,
),
// //
Visibility( Obx(() => Visibility(
visible: true, visible: state.lockFeature.value.doorStatus == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: leftTitel:
TranslationLoader.lanKeys!.doorMagnetic!.tr, TranslationLoader.lanKeys!.doorMagnetic!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.doorMagneticPage); Get.toNamed(Routers.doorMagneticPage);
// Toast.show(msg: "功能暂未开放"); // Toast.show(msg: "功能暂未开放");
})), }))),
// 线 // 线
Visibility( Obx(() => Visibility(
visible: true, visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: leftTitel:
TranslationLoader.lanKeys!.wirelessKeyboard!.tr, TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.wirelessKeyboardPage); Get.toNamed(Routers.wirelessKeyboardPage);
// Toast.show(msg: "功能暂未开放"); // Toast.show(msg: "功能暂未开放");
})), }))),
Visibility( //
visible: true, Obx(() => Visibility(
visible: state.lockFeature.value.lightingTime == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: '照明', leftTitel: '照明',
rightTitle: "", rightTitle: "",
@ -104,7 +99,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Toast.show(msg: "功能暂未开放"); Toast.show(msg: "功能暂未开放");
})), }))),
//
Visibility( Visibility(
visible: true, visible: true,
child: CommonItem( child: CommonItem(
@ -118,26 +114,28 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
SizedBox(height: 10.h), SizedBox(height: 10.h),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: true, visible: state.lockFeature.value.autoLock == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
TranslationLoader.lanKeys!.automaticBlocking!.tr, rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
rightTitle: state ? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s"
.getKeyInfosData.value.autoLockTime! >
-1
? "${state.getKeyInfosData.value.autoLockTime!.toString()}s"
: TranslationLoader.lanKeys!.closed!.tr, : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () { action: () {
Get.toNamed(Routers.automaticBlockingPage, Get.toNamed(Routers.automaticBlockingPage, arguments: {
arguments: state.getKeyInfosData.value); 'lockSetInfoData': state.lockSetInfoData.value
});
}))), }))),
// //
Obx(() { Obx(() {
var titleStr = ""; var titleStr = "";
if (state.getKeyInfosData.value.lockSound == 1) { if ((state.lockSettingInfo.value.lockSound ?? 0) == 1) {
switch (state.getKeyInfosData.value.volume) { switch (state.lockSettingInfo.value.lockSoundVolume ?? 0) {
case 1: case 1:
titleStr = TranslationLoader.lanKeys!.low!.tr; titleStr = TranslationLoader.lanKeys!.low!.tr;
break; break;
@ -158,80 +156,81 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
titleStr = TranslationLoader.lanKeys!.closed!.tr; titleStr = TranslationLoader.lanKeys!.closed!.tr;
} }
return Visibility( return Visibility(
visible: true, visible: state.lockFeature.value.lockSound == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockSound!.tr, leftTitel: TranslationLoader.lanKeys!.lockSound!.tr,
rightTitle: titleStr, rightTitle: titleStr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockSoundSetPage, Get.toNamed(Routers.lockSoundSetPage, arguments: {
arguments: state.getKeyInfosData.value); 'lockSetInfoData': state.lockSetInfoData.value
});
})); }));
}), }),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: true, visible: state.lockFeature.value.antiPrySwitch == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: leftTitel:
TranslationLoader.lanKeys!.burglarAlarm!.tr, TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: rightTitle:
state.getKeyInfosData.value.tamperAlert == 1 (state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr ? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr, : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.burglarAlarmPage, Get.toNamed(Routers.burglarAlarmPage, arguments: {
arguments: state.getKeyInfosData.value); 'lockSetInfoData': state.lockSetInfoData.value
});
}))), }))),
SizedBox(height: 10.h), SizedBox(height: 10.h),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: true, // visible: state.lockFeature.value.passageMode == 1 ? true : false,
visible:true,
child: CommonItem( child: CommonItem(
leftTitel: leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
TranslationLoader.lanKeys!.normallyOpenMode!.tr, rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
rightTitle:
state.getKeyInfosData.value.passageMode == 1
? TranslationLoader.lanKeys!.opened!.tr ? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr, : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.normallyOpenModePage, Get.toNamed(Routers.normallyOpenModePage, arguments: {
arguments: state.getKeyInfosData.value); 'lockSetInfoData': state.lockSetInfoData.value
});
}))), }))),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: true, visible: state.lockFeature.value.remoteUnlock == 1 ? true : false,
child: CommonItem( child: CommonItem(leftTitel:
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
TranslationLoader.lanKeys!.remoteUnlocking!.tr, rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1
rightTitle:
state.getKeyInfosData.value.remoteEnable == 1
? TranslationLoader.lanKeys!.opened!.tr ? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr, : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.remoteUnlockingPage, Get.toNamed(Routers.remoteUnlockingPage, arguments: {
arguments: state.getKeyInfosData.value); 'lockSetInfoData': state.lockSetInfoData.value
});
}))), }))),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: true, visible: state.lockFeature.value.resetSwitch == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr, leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
state.getKeyInfosData.value.resetButton == 1
? TranslationLoader.lanKeys!.opened!.tr ? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr, : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.resetButtonPage, Get.toNamed(Routers.resetButtonPage, arguments: {
arguments: state.getKeyInfosData.value); 'lockSetInfoData': state.lockSetInfoData.value
});
}))), }))),
SizedBox(height: 10.h), SizedBox(height: 10.h),
//--- //---
@ -318,100 +317,104 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// ), // ),
SizedBox(height: 10.h), SizedBox(height: 10.h),
//----- //-----
//
Obx(() { Obx(() {
var title = ""; var title = "";
if (state.getKeyInfosData.value.roomStatus == 1) { if (state.lockSettingInfo.value.passageMode == 1) {
title = TranslationLoader.lanKeys!.checkedIn!.tr; title = TranslationLoader.lanKeys!.checkedIn!.tr;
} else if (state.getKeyInfosData.value.roomStatus == 2) { } else if (state.lockSettingInfo.value.passageMode == 2) {
title = TranslationLoader.lanKeys!.leisure!.tr; title = TranslationLoader.lanKeys!.leisure!.tr;
} }
return Visibility( return Visibility(
visible: true, visible: state.lockStatus.value.roomStatus == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr,
TranslationLoader.lanKeys!.markedHouseState!.tr,
rightTitle: title, rightTitle: title,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.markedHouseStatePage, Get.toNamed(Routers.markedHouseStatePage, arguments: state.lockSetInfoData.value);
arguments: state.getKeyInfosData.value);
})); }));
}), }),
// Obx(() => //
Visibility( Obx(() =>
visible: true, Visibility(
child: CommonItem( visible: state.lockFeature.value.attendance == 1 ? true : false,
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr, child: CommonItem(
rightTitle: "", leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
isHaveLine: true, rightTitle: "",
isHaveRightWidget: true, isHaveLine: true,
rightWidget: SizedBox( isHaveRightWidget: true,
width: 60.w, child: _openCheckInSwitch()))), rightWidget: SizedBox(
// ), width: 60.w, child: _openCheckInSwitch()))),
// Obx(() => ),
Visibility( //
visible: true, Obx(() =>
child: CommonItem( Visibility(
leftTitel: visible: state.lockFeature.value.unlockReminder == 1 ? true : false,
TranslationLoader.lanKeys!.unlockReminder!.tr, child: CommonItem(
rightTitle: "", leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
isHaveLine: false, rightTitle: "",
isHaveRightWidget: true, isHaveLine: false,
rightWidget: SizedBox( isHaveRightWidget: true,
width: 60.w, child: _lockRemindSwitch()))), rightWidget: SizedBox(
// ), width: 60.w, child: _lockRemindSwitch()))),
),
SizedBox(height: 10.h), SizedBox(height: 10.h),
// wifi配网
Obx(() =>
Visibility(
visible: state.lockFeature.value.wifi == 1 ? true : false,
child: CommonItem(leftTitel: TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.configuringWifiPage);
})),
),
// Obx(() => // Obx(() =>
Visibility( //
visible: true, Visibility(
child: CommonItem( visible: true,
leftTitel: TranslationLoader child: CommonItem(
.lanKeys!.wifiDistributionNetwork!.tr, leftTitel: TranslationLoader.lanKeys!.lockTime!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.configuringWifiPage); Get.toNamed(Routers.lockTimePage, arguments: {
})), 'lockSetInfoData': state.lockSetInfoData.value
});
})),
// ), // ),
// Obx(() => // Obx(() =>
Visibility( //
visible: true, Visibility(
child: CommonItem( visible: true,
leftTitel: TranslationLoader.lanKeys!.lockTime!.tr, child: CommonItem(
rightTitle: "", leftTitel: TranslationLoader.lanKeys!.diagnose!.tr,
isHaveLine: true, rightTitle: "",
isHaveDirection: true, isHaveLine: true,
action: () { isHaveDirection: true,
Get.toNamed(Routers.lockTimePage, action: () {
arguments: state.getKeyInfosData.value); Get.toNamed(Routers.diagnosePage, arguments: {
})), 'lockSetInfoData': state.lockSetInfoData.value
});
})),
// ), // ),
// Obx(() => // Obx(() =>
Visibility( //
visible: true, Visibility(
child: CommonItem( visible: true,
leftTitel: TranslationLoader.lanKeys!.diagnose!.tr, child: CommonItem(
rightTitle: "", leftTitel: TranslationLoader.lanKeys!.uploadData!.tr,
isHaveLine: true, rightTitle: "",
isHaveDirection: true, isHaveLine: true,
action: () { isHaveDirection: true,
Get.toNamed(Routers.diagnosePage, action: () {
arguments: state.getKeyInfosData.value); Get.toNamed(Routers.uploadDataPage);
})), })),
// ),
// Obx(() =>
Visibility(
visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.uploadData!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.uploadDataPage);
})),
// ), // ),
// Obx(() => // Obx(() =>
// Visibility( // Visibility(
@ -427,17 +430,18 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// })), // })),
// ), // ),
// Obx(() => // Obx(() =>
Visibility( //
visible: true, Visibility(
child: CommonItem( visible: true,
leftTitel: child: CommonItem(
TranslationLoader.lanKeys!.lockEscalation!.tr, leftTitel:
rightTitle: "", TranslationLoader.lanKeys!.lockEscalation!.tr,
isHaveLine: false, rightTitle: "",
isHaveDirection: true, isHaveLine: false,
action: () { isHaveDirection: true,
Get.toNamed(Routers.lockEscalationPage); action: () {
})), Get.toNamed(Routers.lockEscalationPage);
})),
// ), // ),
SizedBox(height: 30.h), SizedBox(height: 30.h),
Container( Container(
@ -461,12 +465,16 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
)); ));
} }
Widget rightText(String rightTitle){
return Text(rightTitle ?? "", textAlign: TextAlign.end, style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor));
}
CupertinoSwitch _openCheckInSwitch() { CupertinoSwitch _openCheckInSwitch() {
return CupertinoSwitch( return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: (state.getKeyInfosData.value.isAttendance == 1) ? true : false, value: ((state.lockSettingInfo.value.attendance ?? 0) == 1) ? true : false,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
int isOnStr; int isOnStr;
@ -493,11 +501,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isLockPickingReminder.value == 1 ? true : false, value: (state.lockSettingInfo.value.unlockReminder ?? 0) == 1 ? true : false,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
state.isLockPickingReminder.value = state.isLockPickingReminder.value = state.isLockPickingReminder.value == 1 ? 2 : 1;
state.isLockPickingReminder.value == 1 ? 2 : 1;
logic.setLockPickingReminder(); logic.setLockPickingReminder();
}); });
}, },
@ -535,8 +542,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
child: Text(TranslationLoader.lanKeys!.sure!.tr), child: Text(TranslationLoader.lanKeys!.sure!.tr),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
Get.toNamed(Routers.checkInCreatCompanyPage, Get.toNamed(Routers.checkInCreatCompanyPage, arguments: {
arguments: state.getKeyInfosData.value); 'lockSetInfoData': state.lockSetInfoData.value
});
}, },
), ),
], ],

View File

@ -1,11 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'lockSetInfo_entity.dart';
class LockSetState { class LockSetState {
final getKeyInfosData = KeyInfos().obs; final lockSetInfoData = LockSetInfoData().obs;
final lockFeature = LockFeature().obs;
final lockSettingInfo = LockSettingInfo().obs;
final lockStatus = LockStatus().obs;
final lockId = 0.obs;
var isAttendance = 1.obs;// var isAttendance = 1.obs;//
var currentDeviceUUid = "".obs;// uuid var currentDeviceUUid = "".obs;// uuid
@ -13,8 +17,11 @@ class LockSetState {
var passwordTF = TextEditingController(); var passwordTF = TextEditingController();
LockSetState() { LockSetState() {
getKeyInfosData.value = Get.arguments as KeyInfos; Map map = Get.arguments;
isAttendance.value = getKeyInfosData.value.isAttendance!; lockId.value = map["lockId"];
isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!;
// getKeyInfosData.value = Get.arguments as KeyInfos;
// isAttendance.value = getKeyInfosData.value.isAttendance!;
// isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!;
} }
} }

View File

@ -22,27 +22,17 @@ class LockSoundSetLogic extends BaseGetXController {
// -> // ->
void _setLockSetGeneralSetting() async{ void _setLockSetGeneralSetting() async{
int isOn; var entity = await ApiRepository.to.setLockSound(
int type; lockId: state.lockSetInfoData.value.lockId!,
if(state.isOpenLockSound.value == false){ lockSound:state.isOpenLockSound.value == true ? 1 : 0,
// lockSoundVolume:state.lockSoundLevel.value
isOn = 2; type = 6;
}else{
//
isOn = state.lockSoundLevel.value; type = 8;
}
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
changeType:"1",
isOn:isOn.toString(), // 1-2-; 15;
type:type.toString(), // 6- 8-
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.lockSound = state.isOpenLockSound.value == true ? 1 :2; state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :2;
state.getKeyInfosData.value.volume = state.lockSoundLevel.value; state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功"); Toast.show(msg: "操作成功");
} }
} }
@ -51,6 +41,7 @@ class LockSoundSetLogic extends BaseGetXController {
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
// ()
if(reply is SetSupportFunctionsWithParametersReply) { if(reply is SetSupportFunctionsWithParametersReply) {
_replySetSupportFunctionsWithParameters(reply); _replySetSupportFunctionsWithParameters(reply);
} }
@ -95,7 +86,7 @@ class LockSoundSetLogic extends BaseGetXController {
} }
} }
// //
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async { Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
switch(status){ switch(status){
@ -141,7 +132,7 @@ class LockSoundSetLogic extends BaseGetXController {
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsWithParametersCommand( IoSenderManage.readSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 33, featureBit: 33,
token: getTokenList, token: getTokenList,
@ -175,7 +166,7 @@ class LockSoundSetLogic extends BaseGetXController {
type = state.lockSoundLevel.value; type = state.lockSoundLevel.value;
} }
IoSenderManage.setSupportFunctionsWithParametersCommand( IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 33, featureBit: 33,
featureParaLength: 1, featureParaLength: 1,

View File

@ -1,16 +1,19 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class LockSoundSetState { class LockSoundSetState {
var getKeyInfosData = KeyInfos().obs; var lockSetInfoData = LockSetInfoData().obs;
var isOpenLockSound = false.obs;// var isOpenLockSound = false.obs;//
var lockSoundLevel = 0.obs;// var lockSoundLevel = 0.obs;//
LockSoundSetState() { LockSoundSetState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
isOpenLockSound.value = getKeyInfosData.value.lockSound == 1 ? true : false; lockSetInfoData.value = map["lockSetInfoData"];
lockSoundLevel.value = getKeyInfosData.value.volume!;
isOpenLockSound.value = lockSetInfoData.value.lockSettingInfo!.lockSound == 1 ? true : false;
lockSoundLevel.value = lockSetInfoData.value.lockSettingInfo!.lockSoundVolume!;
} }
} }

View File

@ -0,0 +1,45 @@
class GetServerDatetimeEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
GetServerDatetimeEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
GetServerDatetimeEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
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;
}
}
class Data {
String? date;
Data(
{this.date});
Data.fromJson(Map<String, dynamic> json) {
date = json['date'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['date'] = date;
return data;
}
}

View File

@ -173,7 +173,7 @@ class LockTimeLogic extends BaseGetXController{
// //
void getLockTimeFromGateway() async{ void getLockTimeFromGateway() async{
var entity = await ApiRepository.to.getLockTimeFromGateway( var entity = await ApiRepository.to.getLockTimeFromGateway(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
@ -183,7 +183,7 @@ class LockTimeLogic extends BaseGetXController{
// //
void getServerDatetime() async{ void getServerDatetime() async{
var entity = await ApiRepository.to.getServerDatetimeData( var entity = await ApiRepository.to.getServerDatetimeData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
String dataEime = DateTool().dateToYMDHNSString("${int.parse(entity.data!.date!)}"); String dataEime = DateTool().dateToYMDHNSString("${int.parse(entity.data!.date!)}");

View File

@ -1,15 +1,14 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class LockTimeState{ class LockTimeState{
var lockSetInfoData = LockSetInfoData().obs;
var dateTime = "".obs; var dateTime = "".obs;
var getKeyInfosData = KeyInfos().obs;
LockTimeState() { LockTimeState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
} }
} }

View File

@ -10,7 +10,7 @@ import 'markedHouseState_state.dart';
class MarkedHouseStateLogic extends BaseGetXController{ class MarkedHouseStateLogic extends BaseGetXController{
MarkedHouseStateState state = MarkedHouseStateState(); MarkedHouseStateState state = MarkedHouseStateState();
// //
Future<void> setLockSetGeneralSetting() async{ Future<void> setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData( var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.getKeyInfosData.value.lockId.toString(),
@ -22,8 +22,8 @@ class MarkedHouseStateLogic extends BaseGetXController{
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.roomStatus.value = state.roomStatus.value; state.roomStatus.value = state.roomStatus.value;
state.getKeyInfosData.value.roomStatus = state.roomStatus.value; // state.getKeyInfosData.value.antiPrySwitch = state.roomStatus.value;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); // eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value.lockSetting!));
Toast.show(msg: "操作成功"); Toast.show(msg: "操作成功");
}else if(entity.errorCode! == 1){ }else if(entity.errorCode! == 1){
// //

View File

@ -1,16 +1,18 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class MarkedHouseStateState{ class MarkedHouseStateState{
var getKeyInfosData = KeyInfos().obs; var lockSetInfoData = LockSetInfoData().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
var roomStatus = 0.obs; var roomStatus = 0.obs;
MarkedHouseStateState() { MarkedHouseStateState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
roomStatus.value = getKeyInfosData.value.roomStatus!; lockSetInfoData.value = map["lockSetInfoData"];
getKeyInfosData.value = map["keyInfo"];
} }
} }

View File

@ -0,0 +1,65 @@
class GetPassageModeConfigEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
GetPassageModeConfigEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
GetPassageModeConfigEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
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;
}
}
class Data {
int? passageMode;
int? startDate;
int? endDate;
int? isAllDay;
List<dynamic>? weekDays;
int? autoUnlock;
Data(
{this.passageMode,
this.startDate,
this.endDate,
this.isAllDay,
this.weekDays,
this.autoUnlock});
Data.fromJson(Map<String, dynamic> json) {
passageMode = json['passageMode'];
startDate = json['startDate'];
endDate = json['endDate'];
isAllDay = json['isAllDay'];
weekDays = json['weekDays'];
autoUnlock = json['autoUnlock'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['passageMode'] = passageMode;
data['startDate'] = startDate;
data['endDate'] = endDate;
data['isAllDay'] = isAllDay;
data['weekDays'] = weekDays;
data['autoUnlock'] = autoUnlock;
return data;
}
}

View File

@ -26,7 +26,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
// //
void getNormallyOpenModeConfig() async{ void getNormallyOpenModeConfig() async{
var entity = await ApiRepository.to.getPassageModeConfig( var entity = await ApiRepository.to.getPassageModeConfig(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
state.getPassageModeConfigData.value = entity; state.getPassageModeConfigData.value = entity;
@ -51,7 +51,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
print("state.isOpenNormallyOpenMode.value:${state.isOpenNormallyOpenMode.value}"); print("state.isOpenNormallyOpenMode.value:${state.isOpenNormallyOpenMode.value}");
var entity = await ApiRepository.to.configPassageModeLoadData( var entity = await ApiRepository.to.configPassageModeLoadData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
passageMode:state.isOpenNormallyOpenMode.value == true ? "1":"2", passageMode:state.isOpenNormallyOpenMode.value == true ? "1":"2",
autoUnlock:state.isOpenAutomaticUnLock.value == true ? "1":"2", autoUnlock:state.isOpenAutomaticUnLock.value == true ? "1":"2",
type: "1", type: "1",
@ -63,8 +63,8 @@ class NormallyOpenModeLogic extends BaseGetXController{
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:2; state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:2;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功"); Toast.show(msg: "操作成功");
} }
} }
@ -163,7 +163,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsWithParametersCommand( IoSenderManage.readSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 50, featureBit: 50,
token: getTokenList, token: getTokenList,
@ -197,7 +197,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
list.add(state.isOpenAutomaticUnLock.value == true ? 1:0); list.add(state.isOpenAutomaticUnLock.value == true ? 1:0);
IoSenderManage.setSupportFunctionsWithParametersCommand( IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 50, featureBit: 50,
featureParaLength: 8, featureParaLength: 8,
@ -216,7 +216,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
super.onReady(); super.onReady();
print("onReady()"); print("onReady()");
if(state.getKeyInfosData.value.passageMode == 1){ if(state.lockSetInfoData.value.lockSettingInfo!.passageMode == 1){
getNormallyOpenModeConfig(); getNormallyOpenModeConfig();
} }

View File

@ -1,12 +1,12 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart'; import 'package:star_lock/main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class NormallyOpenModeState{ class NormallyOpenModeState{
var getKeyInfosData = KeyInfos().obs; var lockSetInfoData = LockSetInfoData().obs;
var getPassageModeConfigData = GetPassageModeConfigEntity().obs; var getPassageModeConfigData = GetPassageModeConfigEntity().obs;
var isOpenNormallyOpenMode = false.obs;// 1-2- var isOpenNormallyOpenMode = false.obs;// 1-2-
@ -19,6 +19,7 @@ class NormallyOpenModeState{
var endTimeMinute = 0.obs;// var endTimeMinute = 0.obs;//
NormallyOpenModeState() { NormallyOpenModeState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
} }
} }

View File

@ -8,7 +8,6 @@ import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_readSupportFunctionsNoParameters.dart'; import '../../../../blue/io_protocol/io_readSupportFunctionsNoParameters.dart';
import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart'; import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
import '../../../../blue/io_reply.dart'; import '../../../../blue/io_reply.dart';
import '../../../../blue/io_tool/io_manager.dart';
import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/io_tool.dart';
import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../blue/sender_manage.dart'; import '../../../../blue/sender_manage.dart';
@ -22,20 +21,16 @@ class RemoteUnlockingLogic extends BaseGetXController{
void _remoteUnlockingOpenOrClose() async{ void _remoteUnlockingOpenOrClose() async{
var entity = await ApiRepository.to.remoteUnlockingOpenOrClose( var entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId!,
// featureValue:state.getKeyInfosData.value.featureValue.toString() remoteUnlock:state.remoteEnable.value == 1 ? 0 : 1
featureValue:"1234"
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
if(state.remoteEnable.value == 1){
state.remoteEnable.value = 2; state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1;
}else if(state.remoteEnable.value == 2){ state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value;
state.remoteEnable.value = 1; print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}");
} eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
state.getKeyInfosData.value.remoteEnable = state.remoteEnable.value;
print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.getKeyInfosData.value.remoteEnable}");
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "操作成功"); Toast.show(msg: "操作成功");
} }
} }
@ -129,7 +124,7 @@ class RemoteUnlockingLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsNoParametersCommand( IoSenderManage.readSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 28, featureBit: 28,
token: getTokenList, token: getTokenList,
@ -155,7 +150,7 @@ class RemoteUnlockingLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand( IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 28, featureBit: 28,
featureEnable: state.remoteEnable.value == 1 ? 0 : 1, featureEnable: state.remoteEnable.value == 1 ? 0 : 1,

View File

@ -1,13 +1,16 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../lockSet/lockSetInfo_entity.dart';
class RemoteUnlockingState{ class RemoteUnlockingState{
var getKeyInfosData = KeyInfos().obs; var lockSetInfoData = LockSetInfoData().obs;
var remoteEnable = 1.obs; var remoteEnable = 1.obs;
RemoteUnlockingState() { RemoteUnlockingState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
remoteEnable.value = getKeyInfosData.value.remoteEnable!; lockSetInfoData.value = map["lockSetInfoData"];
remoteEnable.value = lockSetInfoData.value.lockSettingInfo!.remoteUnlock!;
} }
} }

View File

@ -23,18 +23,16 @@ class ResetButtonLogic extends BaseGetXController{
// -> // ->
Future<void> _setLockSetGeneralSetting() async{ Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData( var entity = await ApiRepository.to.setResetButtonData(
lockId: state.getKeyInfosData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId!,
changeType:"1", resetSwitch:state.resetButtonEnable.value == 1 ? 0 : 1,
isOn:state.resetButtonEnable.value == 1 ? "2" : "1", // 1-2-;
type:"4", // 4
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
state.resetButtonEnable.value = state.resetButtonEnable.value == 1 ? 2 : 1; state.resetButtonEnable.value = state.resetButtonEnable.value == 1 ? 2 : 1;
state.getKeyInfosData.value.resetButton = state.resetButtonEnable.value; state.lockSetInfoData.value.lockSettingInfo!.resetSwitch = state.resetButtonEnable.value;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功"); Toast.show(msg: "操作成功");
} }
} }
@ -128,7 +126,7 @@ class ResetButtonLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsNoParametersCommand( IoSenderManage.readSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 31, featureBit: 31,
token: getTokenList, token: getTokenList,
@ -154,7 +152,7 @@ class ResetButtonLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand( IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
featureBit: 31, featureBit: 31,
featureEnable: state.resetButtonEnable.value == 1 ? 0 : 1, featureEnable: state.resetButtonEnable.value == 1 ? 0 : 1,

View File

@ -1,16 +1,19 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class ResetButtonState{ class ResetButtonState{
var lockSetInfoData = LockSetInfoData().obs;
var getKeyInfosData = KeyInfos().obs;
var resetButtonEnable = 1.obs; var resetButtonEnable = 1.obs;
ResetButtonState() { ResetButtonState() {
getKeyInfosData.value = Get.arguments as KeyInfos; var map = Get.arguments;
resetButtonEnable.value = getKeyInfosData.value.tamperAlert!; lockSetInfoData.value = map["lockSetInfoData"];
resetButtonEnable.value = lockSetInfoData.value.lockSettingInfo!.resetSwitch!;
} }
} }

View File

@ -1,13 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../network/api_repository.dart'; import '../../../network/api_repository.dart';
import '../../../tools/titleAppBar.dart'; import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
import '../../lockMian/entity/lockInfoEntity.dart'; // import '../../lockMian/entity/lockInfoEntity.dart';
import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_page.dart'; import 'lockDetail_page.dart';
class LockDetailMainPage extends StatefulWidget { class LockDetailMainPage extends StatefulWidget {
@ -20,17 +20,17 @@ class LockDetailMainPage extends StatefulWidget {
class _LockDetailMainPageState extends State<LockDetailMainPage> { class _LockDetailMainPageState extends State<LockDetailMainPage> {
void getLockInfo() async{ // void getLockInfo() async{
var entity = await ApiRepository.to.getLockInfo( // var entity = await ApiRepository.to.getLockInfo(
lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(), // lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(),
pageNo:"1", // pageNo:"1",
); // );
if(entity.errorCode!.codeIsSuccessful){ // if(entity.errorCode!.codeIsSuccessful){
//
}else{ // }else{
//
} // }
} // }
@override @override
void initState() { void initState() {
@ -41,14 +41,14 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isFrist; final bool isFrist;
KeyInfos keyInfos = KeyInfos(); LockListInfoItemEntity keyInfos = LockListInfoItemEntity();
LockMainEntity lockEntity = LockMainEntity(); // LockMainEntity lockEntity = LockMainEntity();
dynamic obj = ModalRoute.of(context)?.settings.arguments; dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["lockMainEntity"] != null)) { // if (obj != null && (obj["lockMainEntity"] != null)) {
lockEntity = obj["lockMainEntity"]; // lockEntity = obj["lockMainEntity"];
} // }
if (obj != null && (obj["keyInfo"] != null)) { if (obj != null && (obj["keyInfo"] != null)) {
keyInfos = obj["keyInfo"]; keyInfos = obj["keyInfo"];
} }
@ -58,7 +58,7 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
barTitle: TranslationLoader.lanKeys!.starLock!.tr, barTitle: TranslationLoader.lanKeys!.starLock!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: LockDetailPage(isFrist:true ,lockMainEntity:lockEntity, keyInfo: keyInfos), body: LockDetailPage(isFrist:true, lockListInfoItemEntity: keyInfos),
// body: Container(), // body: Container(),
); );
} }

View File

@ -1,30 +1,25 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart'; import '../../../blue/blue_manage.dart';
import '../../../blue/io_tool/io_manager.dart';
import '../../../blue/io_tool/io_tool.dart'; import '../../../blue/io_tool/io_tool.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/storage.dart'; import '../../../tools/storage.dart';
import '../../../tools/toast.dart'; import '../../../tools/toast.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
import '../../lockMian/entity/lockInfoEntity.dart'; import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_logic.dart'; import 'lockDetail_logic.dart';
class LockDetailPage extends StatefulWidget { class LockDetailPage extends StatefulWidget {
final isFrist; final bool isFrist;
final KeyInfos keyInfo; final LockListInfoItemEntity lockListInfoItemEntity;
final LockMainEntity lockMainEntity;
const LockDetailPage( const LockDetailPage(
{Key? key, {Key? key,
required this.lockMainEntity,
required this.isFrist, required this.isFrist,
required this.keyInfo}) required this.lockListInfoItemEntity})
: super(key: key); : super(key: key);
@override @override
@ -40,7 +35,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
// TODO: implement initState // TODO: implement initState
super.initState(); super.initState();
state.keyInfos.value = widget.keyInfo; state.keyInfos.value = widget.lockListInfoItemEntity;
BlueManage().connectDeviceName = BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!; state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
// BlueManage().connectDeviceMacAddress = // BlueManage().connectDeviceMacAddress =
@ -63,10 +58,6 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
var saveSignKeyList = changeIntListToStringList(signKeyData); var saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList); Storage.setStringList(saveBlueSignKey, saveSignKeyList);
// token
// Storage.setStringList(saveBlueToken, ["0", "0", "0", "0"]);
// print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList");
// logic.startScanAction(); // logic.startScanAction();
listeningAnimations(); listeningAnimations();
@ -79,7 +70,9 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
height: 1.sh - ScreenUtil().statusBarHeight * 2, height: 1.sh - ScreenUtil().statusBarHeight * 2,
color: Colors.white, color: Colors.white,
child: Column( child: Column(
children: [topWidget(), Expanded(child: bottomWidget())], children: [
topWidget(),
Expanded(child: bottomWidget())],
), ),
); );
} }
@ -123,7 +116,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
children: [ children: [
Container( Container(
width: 1.sw - 120.w*2, width: 1.sw - 120.w*2,
child: Center(child: Text(widget.keyInfo!.lockAlias!, style:TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),)) child: Center(child: Text(widget.lockListInfoItemEntity!.lockAlias!, style:TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),))
), ),
Positioned( Positioned(
child: Row( child: Row(
@ -290,15 +283,13 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
return Container( return Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h), margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h),
// color: Colors.blue, // color: Colors.blue,
child: SizedBox( child: GridView.count(
child: GridView.count( crossAxisCount: 4,
crossAxisCount: 4, // childAspectRatio: 3,
// childAspectRatio: 3, crossAxisSpacing: 20.w,
crossAxisSpacing: 20.w, mainAxisSpacing: 0.h,
mainAxisSpacing: 0.h, physics: const NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(), children: getShowWidget()),
children: getShowWidget()),
),
); );
} }
@ -306,7 +297,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
var showWidgetArr = <Widget>[]; var showWidgetArr = <Widget>[];
// //
if (state.keyInfos.value.isAttendance == 1) { if (state.keyInfos.value.lockSetting!.attendance == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr, () { TranslationLoader.lanKeys!.checkingIn!.tr, () {
Get.toNamed(Routers.checkingInListPage, Get.toNamed(Routers.checkingInListPage,
@ -314,81 +305,87 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
})); }));
} }
var defaultWidgetArr = [ //
// showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, () {
bottomItem('images/main/icon_main_electronicKey.png', Get.toNamed(Routers.electronicKeyListPage, arguments: {
TranslationLoader.lanKeys!.electronicKey!.tr, () { "keyInfo": widget.lockListInfoItemEntity
Get.toNamed(Routers.electronicKeyListPage, arguments: { });
"lockMainEntity": widget.lockMainEntity, }));
"keyInfo": widget.keyInfo
//
showWidgetArr.add(bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, () {
Get.toNamed(Routers.passwordKeyListPage, arguments: {
"keyInfo": widget.lockListInfoItemEntity
});
}));
// ic卡
if (state.keyInfos.value.lockFeature!.icCard == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () {
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId,
"fromType": 0
}); });
}), }));
}
// //
bottomItem('images/main/icon_main_password.png', if (state.keyInfos.value.lockFeature!.fingerprint == 1) {
TranslationLoader.lanKeys!.password!.tr, () { showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png',
Get.toNamed(Routers.passwordKeyListPage, arguments: {
"lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo
});
}),
// ic卡
bottomItem('images/main/icon_main_icCard.png',
TranslationLoader.lanKeys!.card!.tr, () {
Get.toNamed(Routers.otherTypeKeyListPage,
arguments: {"lockId": widget.keyInfo.lockId, "fromType": 0});
}),
//
bottomItem('images/main/icon_main_fingerprint.png',
TranslationLoader.lanKeys!.fingerprint!.tr, () { TranslationLoader.lanKeys!.fingerprint!.tr, () {
Get.toNamed(Routers.otherTypeKeyListPage, Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
arguments: {"lockId": widget.keyInfo.lockId, "fromType": 1}); "lockId": widget.lockListInfoItemEntity.lockId,
}), "fromType": 1
});
}));
}
// //
bottomItem('images/main/icon_main_remoteControl.png', if (state.keyInfos.value.lockFeature!.bluetoothRemoteControl == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_remoteControl.png',
TranslationLoader.lanKeys!.remoteControl!.tr, () { TranslationLoader.lanKeys!.remoteControl!.tr, () {
Get.toNamed(Routers.otherTypeKeyListPage, Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
arguments: {"lockId": widget.keyInfo.lockId, "fromType": 2}); "lockId": widget.lockListInfoItemEntity.lockId,
}), "fromType": 2
]; });
showWidgetArr.addAll(defaultWidgetArr); }));
}
//-> //->
showWidgetArr.add( if (state.keyInfos.value.lockFeature!.d3Face == 1) {
bottomItem('images/main/icon_face.png', '人脸', () { showWidgetArr.add(
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage, bottomItem('images/main/icon_face.png', '人脸', () {
// arguments: 1); // Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
Toast.show(msg: "功能暂未开放"); // arguments: 1);
}), Toast.show(msg: "功能暂未开放");
); }),
);
}
//-> //->
showWidgetArr.add( if (state.keyInfos.value.lockFeature!.videoIntercom == 1) {
bottomItem('images/main/icon_catEyes.png', '监控', () { showWidgetArr.add(
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage, bottomItem('images/main/icon_catEyes.png', '监控', () {
// arguments: 1); // Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
Toast.show(msg: "功能暂未开放"); // arguments: 1);
}), Toast.show(msg: "功能暂未开放");
); }),
);
}
var endWiddget = [ var endWiddget = [
// //
bottomItem('images/main/icon_main_authorizedAdmin.png', bottomItem('images/main/icon_main_authorizedAdmin.png',
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () { TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
Get.toNamed(Routers.authorizedAdminListPage, arguments: { Get.toNamed(Routers.authorizedAdminListPage, arguments: {
"lockMainEntity": widget.lockMainEntity, "keyInfo": widget.lockListInfoItemEntity
"keyInfo": widget.keyInfo
}); });
}), }),
// //
bottomItem('images/main/icon_main_operatingRecord.png', bottomItem('images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr, () { TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: { Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
"lockMainEntity": widget.lockMainEntity, "keyInfo": widget.lockListInfoItemEntity
"keyInfo": widget.keyInfo
}); });
}), }),
// //
@ -396,7 +393,9 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
() { () {
BlueManage().stopScan(); BlueManage().stopScan();
Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo); Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId
});
}), }),
]; ];
showWidgetArr.addAll(endWiddget); showWidgetArr.addAll(endWiddget);

View File

@ -3,7 +3,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../lockMian/entity/lockInfoEntity.dart'; import '../../lockMian/entity/lockListInfo_entity.dart';
// enum RKConnectState { // enum RKConnectState {
// NULL, // NULL,
@ -15,7 +15,7 @@ import '../../lockMian/entity/lockInfoEntity.dart';
// } // }
class LockDetailState { class LockDetailState {
Rx<KeyInfos> keyInfos = KeyInfos().obs; Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
// //
late AnimationController animationController; late AnimationController animationController;

View File

@ -1,12 +1,11 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../tools/storage.dart'; import '../../lockMian/entity/lockListInfo_entity.dart';
import '../../lockMian/entity/lockInfoEntity.dart';
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart'; import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
class LockOperatingRecordState{ class LockOperatingRecordState{
final keyInfos = KeyInfos().obs; final keyInfos = LockListInfoItemEntity().obs;
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs; final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
LockOperatingRecordState() { LockOperatingRecordState() {
keyInfos.value = Get.arguments["keyInfo"]; keyInfos.value = Get.arguments["keyInfo"];

View File

@ -87,7 +87,6 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
onClick: () { onClick: () {
Navigator.pushNamed(context, Routers.passwordKeyManagePage, Navigator.pushNamed(context, Routers.passwordKeyManagePage,
arguments: { arguments: {
"lockMainEntity": state.lockMainEntity.value,
"keyInfo": state.keyInfo.value "keyInfo": state.keyInfo.value
}).then((val) { }).then((val) {
if (val != null) { if (val != null) {

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class PasswordKeyListState { class PasswordKeyListState {
final keyInfo = KeyInfos().obs; final keyInfo = LockListInfoItemEntity().obs;
final lockMainEntity = LockMainEntity().obs;
var pageNum = 1.obs; // var pageNum = 1.obs; //
final pageSize = 20.obs; // final pageSize = 20.obs; //
final itemDataList = <PasswordKeyListItem>[].obs; final itemDataList = <PasswordKeyListItem>[].obs;
@ -13,7 +13,6 @@ class PasswordKeyListState {
PasswordKeyListState() { PasswordKeyListState() {
Map map = Get.arguments; Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"]; keyInfo.value = map["keyInfo"];
} }
} }

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class PasswordKeyManagePage extends StatefulWidget { class PasswordKeyManagePage extends StatefulWidget {
const PasswordKeyManagePage({Key? key}) : super(key: key); const PasswordKeyManagePage({Key? key}) : super(key: key);
@ -16,15 +16,11 @@ class PasswordKeyManagePage extends StatefulWidget {
class _PasswordKeyManagePageState extends State<PasswordKeyManagePage> { class _PasswordKeyManagePageState extends State<PasswordKeyManagePage> {
var index = 0; var index = 0;
late KeyInfos keyInfo; late LockListInfoItemEntity keyInfo;
late LockMainEntity lockMainEntity;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments; dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["lockMainEntity"] != null)) {
lockMainEntity = obj["lockMainEntity"];
}
if (obj != null && (obj["keyInfo"] != null)) { if (obj != null && (obj["keyInfo"] != null)) {
keyInfo = obj["keyInfo"]; keyInfo = obj["keyInfo"];
} }
@ -40,7 +36,6 @@ class _PasswordKeyManagePageState extends State<PasswordKeyManagePage> {
PasswordKeyManageTabbarPage( PasswordKeyManageTabbarPage(
initialIndex: index, initialIndex: index,
keyInfo: keyInfo, keyInfo: keyInfo,
lockMainEntity: lockMainEntity,
), ),
], ],
), ),

View File

@ -1,23 +1,21 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart'; import '../../../../tools/CustomUnderlineTabIndicator.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../passwordKey_Perpetual/passwordKey_perpetual_page.dart'; import '../passwordKey_Perpetual/passwordKey_perpetual_page.dart';
class PasswordKeyManageTabbarPage extends StatefulWidget { class PasswordKeyManageTabbarPage extends StatefulWidget {
var initialIndex = 1; var initialIndex = 1;
final KeyInfos keyInfo; final LockListInfoItemEntity keyInfo;
final LockMainEntity lockMainEntity;
PasswordKeyManageTabbarPage( PasswordKeyManageTabbarPage(
{Key? key, {Key? key,
required this.initialIndex, required this.initialIndex,
required this.keyInfo, required this.keyInfo})
required this.lockMainEntity})
: super(key: key); : super(key: key);
@override @override
State<PasswordKeyManageTabbarPage> createState() => State<PasswordKeyManageTabbarPage> createState() =>
@ -106,7 +104,6 @@ class _PasswordKeyManageTabbarPageState
.map((ItemView item) => PasswordKeyPerpetualPage( .map((ItemView item) => PasswordKeyPerpetualPage(
type: item.type, type: item.type,
getKeyInfo: widget.keyInfo, getKeyInfo: widget.keyInfo,
lockMainEntity: widget.lockMainEntity,
)) ))
.toList(), .toList(),
), ),

View File

@ -9,7 +9,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart'; 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/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
@ -19,21 +18,17 @@ import '../../../../appRouters.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class PasswordKeyPerpetualPage extends StatefulWidget { class PasswordKeyPerpetualPage extends StatefulWidget {
final String type; final String type;
final KeyInfos getKeyInfo; final LockListInfoItemEntity getKeyInfo;
final LockMainEntity lockMainEntity;
const PasswordKeyPerpetualPage( const PasswordKeyPerpetualPage(
{Key? key, {Key? key, required this.type, required this.getKeyInfo}) : super(key: key);
required this.type,
required this.getKeyInfo,
required this.lockMainEntity})
: super(key: key);
@override @override
State<PasswordKeyPerpetualPage> createState() => State<PasswordKeyPerpetualPage> createState() => _PasswordKeyPerpetualPageState();
_PasswordKeyPerpetualPageState();
} }
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> { class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {

View File

@ -7,7 +7,7 @@ import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import '../../entity/lockInfoEntity.dart'; import '../../entity/lockListInfo_entity.dart';
import 'demoModeLockDetail_logic.dart'; import 'demoModeLockDetail_logic.dart';
class DemoModeLockDetailPage extends StatefulWidget { class DemoModeLockDetailPage extends StatefulWidget {
@ -228,7 +228,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr, () { TranslationLoader.lanKeys!.checkingIn!.tr, () {
// gotoLogin(); // gotoLogin();
Get.toNamed(Routers.checkingInListPage, arguments: KeyInfos()); Get.toNamed(Routers.checkingInListPage, arguments: LockListInfoItemEntity());
})); }));
// } // }
@ -239,8 +239,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
// gotoLogin(); // gotoLogin();
Get.toNamed(Routers.electronicKeyListPage, arguments: { Get.toNamed(Routers.electronicKeyListPage, arguments: {
"lockMainEntity": LockMainEntity(), "keyInfo": LockListInfoItemEntity()
"keyInfo": KeyInfos()
}); });
}), }),
@ -250,8 +249,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
// gotoLogin(); // gotoLogin();
Get.toNamed(Routers.passwordKeyListPage, arguments: { Get.toNamed(Routers.passwordKeyListPage, arguments: {
"lockMainEntity": LockMainEntity(), "keyInfo": LockListInfoItemEntity()
"keyInfo": KeyInfos()
}); });
}), }),
@ -315,8 +313,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
// gotoLogin(); // gotoLogin();
Get.toNamed(Routers.authorizedAdminListPage, arguments: { Get.toNamed(Routers.authorizedAdminListPage, arguments: {
"lockMainEntity": LockMainEntity(), "keyInfo": LockListInfoItemEntity()
"keyInfo": KeyInfos()
}); });
}), }),
// //
@ -324,7 +321,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
TranslationLoader.lanKeys!.operatingRecord!.tr, () { TranslationLoader.lanKeys!.operatingRecord!.tr, () {
// gotoLogin(); // gotoLogin();
Get.toNamed(Routers.lockOperatingRecordPage, Get.toNamed(Routers.lockOperatingRecordPage,
arguments: {"keyInfo": KeyInfos()}); arguments: {"keyInfo": LockListInfoItemEntity()});
}), }),
// //
bottomItem( bottomItem(

View File

@ -0,0 +1,304 @@
class LockListInfoEntity {
int? errorCode;
String? description;
String? errorMsg;
LockListInfoGroupEntity? data;
LockListInfoEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
LockListInfoEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? LockListInfoGroupEntity.fromJson(json['data']) : null;
}
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;
}
}
class LockListInfoGroupEntity {
List<GroupList>? groupList;
int? pageNo;
int? pageSize;
int? pages;
int? total;
LockListInfoGroupEntity({this.groupList, this.pageNo, this.pageSize, this.pages, this.total});
LockListInfoGroupEntity.fromJson(Map<String, dynamic> json) {
if (json['groupList'] != null) {
groupList = <GroupList>[];
json['groupList'].forEach((v) {
groupList!.add(GroupList.fromJson(v));
});
}
pageNo = json['pageNo'];
pageSize = json['pageSize'];
pages = json['pages'];
total = json['total'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (groupList != null) {
data['groupList'] = groupList!.map((v) => v.toJson()).toList();
}
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
data['pages'] = pages;
data['total'] = total;
return data;
}
}
class GroupList {
String? groupName;
int? groupId;
List<LockListInfoItemEntity>? lockList;
bool _isChecked = false;
bool get isChecked => _isChecked ?? false;
set isChecked(bool value) => _isChecked = value;
GroupList({this.groupName, this.groupId, this.lockList});
GroupList.fromJson(Map<String, dynamic> json) {
groupName = json['groupName'];
groupId = json['groupId'];
if (json['lockList'] != null) {
lockList = <LockListInfoItemEntity>[];
json['lockList'].forEach((v) {
lockList!.add(LockListInfoItemEntity.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['groupName'] = groupName;
data['groupId'] = groupId;
if (lockList != null) {
data['lockList'] = lockList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class LockListInfoItemEntity {
int? keyId;
int? lockId;
String? lockName;
String? lockAlias;
int? electricQuantity;
String? fwVersion;
String? hwVersion;
int? keyType;
int? passageMode;
int? userType;
int? startDate;
int? endDate;
List? weekDays;
int? remoteEnable;
int? faceAuthentication;
int? lastFaceValidateTime;
int? keyRight;
int? keyStatus;
int? isLockOwner;
Bluetooth? bluetooth;
LockFeature? lockFeature;
LockSetting? lockSetting;
LockListInfoItemEntity(
{this.keyId,
this.lockId,
this.lockName,
this.lockAlias,
this.electricQuantity,
this.fwVersion,
this.hwVersion,
this.keyType,
this.passageMode,
this.userType,
this.startDate,
this.endDate,
this.weekDays,
this.remoteEnable,
this.faceAuthentication,
this.lastFaceValidateTime,
this.keyRight,
this.keyStatus,
this.isLockOwner,
this.bluetooth,
this.lockFeature,
this.lockSetting});
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
keyId = json['keyId'];
lockId = json['lockId'];
lockName = json['lockName'];
lockAlias = json['lockAlias'];
electricQuantity = json['electricQuantity'];
fwVersion = json['fwVersion'];
hwVersion = json['hwVersion'];
keyType = json['keyType'];
passageMode = json['passageMode'];
userType = json['userType'];
startDate = json['startDate'];
endDate = json['endDate'];
weekDays = json['weekDays'];
remoteEnable = json['remoteEnable'];
faceAuthentication = json['faceAuthentication'];
lastFaceValidateTime = json['lastFaceValidateTime'];
keyRight = json['keyRight'];
keyStatus = json['keyStatus'];
isLockOwner = json['isLockOwner'];
bluetooth = json['bluetooth'] != null
? Bluetooth.fromJson(json['bluetooth'])
: null;
lockFeature = json['lockFeature'] != null
? LockFeature.fromJson(json['lockFeature'])
: null;
lockSetting = json['lockSetting'] != null
? LockSetting.fromJson(json['lockSetting'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['keyId'] = keyId;
data['lockId'] = lockId;
data['lockName'] = lockName;
data['lockAlias'] = lockAlias;
data['electricQuantity'] = electricQuantity;
data['fwVersion'] = fwVersion;
data['hwVersion'] = hwVersion;
data['keyType'] = keyType;
data['passageMode'] = passageMode;
data['userType'] = userType;
data['startDate'] = startDate;
data['endDate'] = endDate;
data['weekDays'] = weekDays;
data['remoteEnable'] = remoteEnable;
data['faceAuthentication'] = faceAuthentication;
data['lastFaceValidateTime'] = lastFaceValidateTime;
data['keyRight'] = keyRight;
data['keyStatus'] = keyStatus;
data['isLockOwner'] = isLockOwner;
if (bluetooth != null) {
data['bluetooth'] = bluetooth!.toJson();
}
if (lockFeature != null) {
data['lockFeature'] = lockFeature!.toJson();
}
if (lockSetting != null) {
data['lockSetting'] = lockSetting!.toJson();
}
return data;
}
}
class Bluetooth {
String? bluetoothDeviceId;
String? bluetoothDeviceName;
List<int>? publicKey;
List<int>? privateKey;
List<int>? signKey;
Bluetooth(
{this.bluetoothDeviceId,
this.bluetoothDeviceName,
this.publicKey,
this.privateKey,
this.signKey});
Bluetooth.fromJson(Map<String, dynamic> json) {
bluetoothDeviceId = json['bluetoothDeviceId'];
bluetoothDeviceName = json['bluetoothDeviceName'];
publicKey = json['publicKey'].cast<int>();
privateKey = json['privateKey'].cast<int>();
signKey = json['signKey'].cast<int>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['bluetoothDeviceId'] = bluetoothDeviceId;
data['bluetoothDeviceName'] = bluetoothDeviceName;
data['publicKey'] = publicKey;
data['privateKey'] = privateKey;
data['signKey'] = signKey;
return data;
}
}
class LockFeature {
int? password;
int? icCard;
int? fingerprint;
int? fingerVein;
int? palmVein;
int? d3Face;
int? bluetoothRemoteControl;
int? videoIntercom;
LockFeature(
{this.password,
this.icCard,
this.fingerprint,
this.fingerVein,
this.palmVein,
this.d3Face,
this.bluetoothRemoteControl,
this.videoIntercom});
LockFeature.fromJson(Map<String, dynamic> json) {
password = json['password'];
icCard = json['icCard'];
fingerprint = json['fingerprint'];
fingerVein = json['fingerVein'];
palmVein = json['palmVein'];
d3Face = json['d3Face'];
bluetoothRemoteControl = json['bluetoothRemoteControl'];
videoIntercom = json['videoIntercom'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['password'] = password;
data['icCard'] = icCard;
data['fingerprint'] = fingerprint;
data['fingerVein'] = fingerVein;
data['palmVein'] = palmVein;
data['d3Face'] = d3Face;
data['bluetoothRemoteControl'] = bluetoothRemoteControl;
data['videoIntercom'] = videoIntercom;
return data;
}
}
class LockSetting {
int? attendance;
int? appUnlockOnline;
LockSetting({this.attendance, this.appUnlockOnline});
LockSetting.fromJson(Map<String, dynamic> json) {
attendance = json['attendance'];
appUnlockOnline = json['appUnlockOnline'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['attendance'] = attendance;
data['appUnlockOnline'] = appUnlockOnline;
return data;
}
}

View File

@ -0,0 +1,90 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../app_settings/app_colors.dart';
import '../entity/lockListInfo_entity.dart';
class LockListGroupPage extends StatefulWidget {
const LockListGroupPage({Key? key,
this.child,
this.onTap,
required this.groupItem,
required this.typeImgList})
: super(key: key);
final Widget? child;
final List typeImgList;
final Function()? onTap;
final GroupList groupItem;
@override
State<LockListGroupPage> createState() => _LockListGroupPageState();
}
class _LockListGroupPageState extends State<LockListGroupPage> {
bool _isExpanded = true;
final Duration _animationDuration = const Duration(milliseconds: 200);
bool _isCheck = false;
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
color: Colors.white,
height: 80.h,
child: Row(
children: _buildExpandRowList(),
),
),
ClipRect(
child: AnimatedAlign(
heightFactor: _isExpanded ? 1.0 : 0.0,
alignment: Alignment.center,
duration: _animationDuration,
child: widget.child),
),
],
);
}
List<Widget> _buildExpandRowList() {
List<Widget> widgetList = [];
widgetList.add(GestureDetector(
child: Container(
width: ScreenUtil().screenWidth,
color: Colors.white,
child: Row(
children: [
SizedBox(width: 40.w),
Text(
widget.groupItem.groupName ?? '',
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
),
Expanded(
child: SizedBox(
width: 10.w,
)),
AnimatedRotation(
turns: _isExpanded ? -0.5 : 0,
duration: _animationDuration,
child: const Icon(Icons.keyboard_arrow_down),
),
SizedBox(
width: 30.w,
)
],
),
),
onTap: () {
//
setState(() {
_isExpanded = !_isExpanded;
});
},
));
return widgetList;
}
}

View File

@ -2,46 +2,114 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/mine/mine/starLockMine_page.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../entity/lockInfoEntity.dart'; import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/ExpandedListView.dart';
import '../entity/lockListInfo_entity.dart';
import 'lockListGroup_page.dart';
class LockListPage extends StatefulWidget { class LockListPage extends StatefulWidget {
final LockMainEntity lockMainEntity; final LockListInfoGroupEntity lockListInfoGroupEntity;
const LockListPage({Key? key, required this.lockMainEntity}) : super(key: key); const LockListPage({Key? key, required this.lockListInfoGroupEntity}) : super(key: key);
@override @override
State<LockListPage> createState() => _LockListPageState(); State<LockListPage> createState() => _LockListPageState();
} }
class _LockListPageState extends State<LockListPage> { class _LockListPageState extends State<LockListPage> {
var dataList = <KeyInfos>[]; var groupDataList = <GroupList>[];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if(widget.lockMainEntity.data!.pageNo == 1){ if(widget.lockListInfoGroupEntity.pageNo == 1){
dataList = <KeyInfos>[]; groupDataList = <GroupList>[];
} }
dataList.addAll(widget.lockMainEntity.data!.keyInfos as Iterable<KeyInfos>); groupDataList.addAll(widget.lockListInfoGroupEntity.groupList as Iterable<GroupList>);
return ListView.builder( // return ListView.builder(
itemCount: dataList.length, // itemCount: dataList.length,
itemBuilder: (c, index) { // itemBuilder: (c, index) {
KeyInfos keyInfo = dataList[index]; // GroupList keyInfo = dataList[index];
return lockInfoListItem('images/icon_lock.png', keyInfo.lockAlias, () { // return lockInfoListItem('images/icon_lock.png', keyInfo.groupName, () {
Get.toNamed(Routers.lockDetailMainPage, arguments: { // // Get.toNamed(Routers.lockDetailMainPage, arguments: {
"lockMainEntity": widget.lockMainEntity, // // "lockMainEntity": widget.lockMainEntity,
"keyInfo": keyInfo // // "keyInfo": keyInfo
}); // // });
}); // });
// });
return ListView.separated(
itemCount: groupDataList.length,
itemBuilder: (context, index) {
GroupList itemData = groupDataList[index];
return _buildLockExpandedList(context, index, itemData);
},
shrinkWrap: true,
separatorBuilder: (context, index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
}); });
} }
Widget lockInfoListItem( // //
String lockTypeIcon, String? lockTypeTitle, Function() action) { // Widget _buildListView(BuildContext context, List itemList) {
// return ListView.separated(
// itemCount: itemList.length,
// itemBuilder: (context, index) {
// GroupList itemData = itemList[index];
// return _buildLockExpandedList(context, index, itemData);
// },
// shrinkWrap: true,
// separatorBuilder: (context, index) {
// return const Divider(
// height: 1,
// color: AppColors.greyLineColor,
// );
// });
// }
//
Widget _buildLockExpandedList(context, index, GroupList itemData) {
List lockItemList = itemData.lockList ?? [];
return LockListGroupPage(
onTap: () {
// selectGroupIdList.add(index);
// clickIndex = index;
//
if (itemData.isChecked) {
}else{
}
setState(() {});
print('选中了么0');
},
typeImgList: const [],
groupItem: itemData,
child: ListView.separated(
itemCount: lockItemList.length,
shrinkWrap: true,
separatorBuilder: (context, index) {
return const Divider(height: 1, color: AppColors.greyLineColor);
},
itemBuilder: (c, index) {
LockListInfoItemEntity keyInfo = lockItemList[index];
return lockInfoListItem(keyInfo, () {
Get.toNamed(Routers.lockDetailMainPage, arguments: {
// "lockMainEntity": widget.lockMainEntity,
"keyInfo": keyInfo
});
});
}),
);
}
Widget lockInfoListItem(LockListInfoItemEntity keyInfo, Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
@ -66,7 +134,7 @@ class _LockListPageState extends State<LockListPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
lockTypeTitle!, keyInfo.lockAlias!,
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w500), fontSize: 24.sp, fontWeight: FontWeight.w500),
), ),
@ -75,7 +143,7 @@ class _LockListPageState extends State<LockListPage> {
), ),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Text( Text(
"100%", "${keyInfo.electricQuantity!}%",
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 18.sp, color: AppColors.darkGrayTextColor),
), ),
@ -95,7 +163,7 @@ class _LockListPageState extends State<LockListPage> {
children: [ children: [
SizedBox(width: 30.w), SizedBox(width: 30.w),
Text( Text(
"永久/管理员", "${getUseDateStr(keyInfo)}/${keyInfo.isLockOwner == 1 ? '超级管理员' : (keyInfo.keyRight == 1 ? "授权管理员" : "普通用户")}",
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 18.sp, color: AppColors.darkGrayTextColor),
), ),
@ -109,4 +177,33 @@ class _LockListPageState extends State<LockListPage> {
), ),
); );
} }
String getUseDateStr(LockListInfoItemEntity indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
//
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)} ${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
//
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
useDateStr = '永久';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
useDateStr = '单次';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环';
}
return useDateStr;
}
} }

View File

@ -7,6 +7,7 @@ import '../../../blue/io_tool/manager_event_bus.dart';
import '../../../network/api_repository.dart'; import '../../../network/api_repository.dart';
import '../../../tools/baseGetXController.dart'; import '../../../tools/baseGetXController.dart';
import '../../../tools/eventBusEventManage.dart'; import '../../../tools/eventBusEventManage.dart';
import '../entity/lockListInfo_entity.dart';
import 'lockMain_state.dart'; import 'lockMain_state.dart';
class LockMainLogic extends BaseGetXController { class LockMainLogic extends BaseGetXController {
@ -27,10 +28,41 @@ class LockMainLogic extends BaseGetXController {
// getLockInfo(); // getLockInfo();
// } // }
void getLockInfo() async{ // void getLockInfo() async{
var entity = await ApiRepository.to.getLockInfo( // var entity = await ApiRepository.to.getLockInfo(
lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(), // lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(),
pageNo:page.toString(), // pageNo:page.toString(),
// );
// if(entity.errorCode!.codeIsSuccessful){
// // if (page == 0) {
// // refreshController.refreshCompleted();
// // } else {
// // if (entity.data!.keyInfos!.isEmpty) {
// // refreshController.loadNoData();
// // } else {
// // refreshController.loadComplete();
// // }
// // }
// // page++;
//
// if(entity.data!.keyInfos!.isEmpty){
// state.dataLength.value = 0;
// }else if(entity.data!.keyInfos!.length == 1){
// state.dataLength.value = 1;
// }else{
// state.dataLength.value = 2;
// }
// state.lockMainEntity.value = entity;
// }else{
// // refreshController.loadFailed();
// }
// // refreshController.refreshCompleted();
// }
void getStarLockInfo() async{
var entity = await ApiRepository.to.getStarLockListInfo(
pageNo:page,
pageSize:20,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
// if (page == 0) { // if (page == 0) {
@ -44,14 +76,19 @@ class LockMainLogic extends BaseGetXController {
// } // }
// page++; // page++;
if(entity.data!.keyInfos!.isEmpty){ if(entity.data!.groupList!.isEmpty){
state.dataLength.value = 0; state.dataLength.value = 0;
}else if(entity.data!.keyInfos!.length == 1){ }else if(entity.data!.groupList!.length == 1){
state.dataLength.value = 1; GroupList groupList = entity.data!.groupList![0];
if(groupList.lockList!.length > 1){
state.dataLength.value = 2;
}else{
state.dataLength.value = 1;
}
}else{ }else{
state.dataLength.value = 2; state.dataLength.value = 2;
} }
state.lockMainEntity.value = entity; state.lockListInfoEntity.value = entity;
}else{ }else{
// refreshController.loadFailed(); // refreshController.loadFailed();
} }
@ -61,7 +98,8 @@ class LockMainLogic extends BaseGetXController {
late StreamSubscription _teamEvent; late StreamSubscription _teamEvent;
void _initLoadDataAction() { void _initLoadDataAction() {
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) { _teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
getLockInfo(); // getLockInfo();
getStarLockInfo();
print("收到消息"); print("收到消息");
}); });
} }
@ -82,7 +120,8 @@ class LockMainLogic extends BaseGetXController {
super.onInit(); super.onInit();
print("onInit()"); print("onInit()");
getLockInfo(); // getLockInfo();
getStarLockInfo();
} }
@override @override

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
@ -76,22 +77,21 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
Widget returnWidget; Widget returnWidget;
switch (type) { switch (type) {
case 0: case 0:
//
returnWidget = unHaveData(); returnWidget = unHaveData();
break; break;
case 1: case 1:
//
Storage.setBool(ifIsDemoModeOrNot, false); Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = LockDetailPage( returnWidget = LockDetailPage(isFrist: true, lockListInfoItemEntity: state.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
lockMainEntity: logic.state.lockMainEntity.value,
isFrist: true,
keyInfo: logic.state.lockMainEntity.value.data!.keyInfos![0]);
break; break;
case 2: case 2:
//
Storage.setBool(ifIsDemoModeOrNot, false); Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = returnWidget = LockListPage(lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
LockListPage(lockMainEntity: logic.state.lockMainEntity.value);
break; break;
default: default:
returnWidget = unHaveData(); returnWidget = const NoData();
break; break;
} }
return returnWidget; return returnWidget;

View File

@ -1,11 +1,10 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../entity/lockListInfo_entity.dart';
import '../entity/lockInfoEntity.dart';
class LockMainState { class LockMainState {
// 0 1 2 // 0 1 2
var dataLength = 0.obs; var dataLength = 100.obs;
Rx<LockMainEntity> lockMainEntity = LockMainEntity().obs; var lockListInfoEntity = LockListInfoEntity().obs;
} }

View File

@ -26,7 +26,6 @@ import 'saveLock_state.dart';
class SaveLockLogic extends BaseGetXController { class SaveLockLogic extends BaseGetXController {
final SaveLockState state = SaveLockState(); final SaveLockState state = SaveLockState();
int userNo = 0;
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
@ -36,11 +35,6 @@ class SaveLockLogic extends BaseGetXController {
_replyAddUserKey(reply); _replyAddUserKey(reply);
} }
//
if(reply is GetLockStatuReply) {
_replyGetLockStatus(reply);
}
// //
if(reply is GetStarLockStatuInfoReply) { if(reply is GetStarLockStatuInfoReply) {
_replyGetStarLockStatusInfo(reply); _replyGetStarLockStatusInfo(reply);
@ -51,22 +45,23 @@ class SaveLockLogic extends BaseGetXController {
Future<void> _replyAddUserKey(Reply reply) async { Future<void> _replyAddUserKey(Reply reply) async {
var lockId = reply.data.sublist(2, 42); var lockId = reply.data.sublist(2, 42);
print("lockId:$lockId"); // print("lockId:$lockId");
var token = reply.data.sublist(42, 46); var token = reply.data.sublist(42, 46);
List<String> strTokenList = changeIntListToStringList(token); List<String> strTokenList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, strTokenList); Storage.setStringList(saveBlueToken, strTokenList);
print("token:$token"); // print("token:$token");
int status = reply.data[46]; int status = reply.data[46];
print("status:$status"); // print("status:$status reply.data:${reply.data}");
userNo = reply.data[46];
print("status:$status"); print("status:$status");
switch(status){ switch(status){
case 0x00: case 0x00:
// //
print("添加用户数据解析成功"); print("添加用户数据解析成功");
state.lockUserNo = reply.data[47];
bindBlueAdmin(); bindBlueAdmin();
break; break;
case 0x06: case 0x06:
@ -113,167 +108,119 @@ class SaveLockLogic extends BaseGetXController {
} }
} }
//
Future<void> _replyGetLockStatus(Reply reply) async {
int status = reply.data[2];
switch(status){
case 0x00:
//
print("${reply.commandType}数据解析成功");
var softVersion = reply.data.sublist(3, 7);
print("softVersion:$softVersion");
var power = reply.data[7];
print("power:$power");
// APP
var appUserCount = reply.data.sublist(50, 53);
print("appUserCount:$appUserCount");
//
var blacklistCount = reply.data[53];
print("blacklistCount:$blacklistCount");
//
var bleKeyCount = reply.data[54];
print("bleKeyCount:$bleKeyCount");
//
var remainCount = reply.data.sublist(54, 56);
print("remainCount:$remainCount");
//
var notUploadCount = reply.data.sublist(56, 58);
print("notUploadCount:$notUploadCount");
//
var pwdCount = reply.data[58];
print("pwdCount:$pwdCount");
//
var fingerprintCount = reply.data[59];
print("fingerprintCount:$fingerprintCount");
//
var lockTime = reply.data.sublist(60, 64);
print("lockTime:$lockTime");
//
var hardVersion = reply.data.sublist(64, 68);
print("hardVersion:$hardVersion");
break;
case 0x06:
//
print("${reply.commandType}需要鉴权");
break;
case 0x07:
//
print("${reply.commandType}用户无权限");
break;
case 0x09:
//
print("${reply.commandType}权限校验错误");
break;
default:
//
print("${reply.commandType}失败");
break;
}
}
Future<void> _replyGetStarLockStatusInfo(Reply reply) async { Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
switch(status){ switch(status){
case 0x00: case 0x00:
// //
print("${reply.commandType}数据解析成功"); print("${reply.commandType}数据解析成功");
// //
var vendor = reply.data.sublist(3, 23); var vendor = reply.data.sublist(3, 23);
var vendorStr = utf8String(vendor); var vendorStr = utf8String(vendor);
print("softVersion:$vendor vendorStr:$vendorStr"); state.lockInfo["vendor"] = vendorStr;
// print("vendor:$vendor vendorStr:$vendorStr vendorStr.length${vendorStr.length}");
// //
var product = reply.data[23]; var product = reply.data[23];
print("product:$product"); state.lockInfo["product"] = product;
// print("product:$product");
// //
var model = reply.data.sublist(24, 44); var model = reply.data.sublist(24, 44);
var modelStr = utf8String(model); var modelStr = utf8String(model);
print("model:$model modelStr:$modelStr"); state.lockInfo["model"] = modelStr;
// print("model:$model modelStr:$modelStr modelStr:${modelStr.length}");
// //
var fwVersion = reply.data.sublist(44, 64); var fwVersion = reply.data.sublist(44, 64);
var fwVersionStr = utf8String(fwVersion); var fwVersionStr = utf8String(fwVersion);
print("fwVersion:$fwVersion fwVersionStr:$fwVersionStr"); state.lockInfo["fwVersion"] = fwVersionStr;
// print("fwVersion:$fwVersion fwVersionStr:$fwVersionStr fwVersionStr:${fwVersionStr.length}");
// //
var hwVersion = reply.data.sublist(64, 84); var hwVersion = reply.data.sublist(64, 84);
print("hwVersion:$hwVersion"); var hwVersionStr = utf8String(hwVersion);
state.lockInfo["hwVersion"] = hwVersionStr;
// print("hwVersion:$hwVersion hwVersionStr:${hwVersionStr.length}");
// //
var serialNum0 = reply.data.sublist(84, 100); var serialNum0 = reply.data.sublist(84, 100);
print("serialNum0:$serialNum0"); var serialNum0Str = utf8String(serialNum0);
state.lockInfo["serialNum0"] = serialNum0Str;
// print("serialNum0Str:$serialNum0Str serialNum0Str:${serialNum0Str.length}");
// //
var serialNum1 = reply.data.sublist(100, 116); var serialNum1 = reply.data.sublist(100, 116);
print("serialNum1:$serialNum1"); var serialNum1Str = utf8String(serialNum1);
state.lockInfo["serialNum1"] = serialNum1Str;
// print("serialNum1Str:$serialNum1Str serialNum1Str:${serialNum1Str.length}");
// //
var btDeviceName = reply.data.sublist(116, 132); var btDeviceName = reply.data.sublist(116, 132);
var btDeviceNameStr = utf8String(btDeviceName); var btDeviceNameStr = utf8String(btDeviceName);
print("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr"); state.lockInfo["btDeviceName"] = btDeviceNameStr;
// print("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr btDeviceNameStr:${btDeviceNameStr.length}");
// //
var battRemCap = reply.data[132]; var battRemCap = reply.data[132];
print("battRemCap:$battRemCap"); state.lockInfo["electricQuantity"] = battRemCap;
// print("battRemCap:$battRemCap");
// //
var restoreCounter = reply.data.sublist(133, 135); var restoreCounter = reply.data.sublist(133, 135);
print("restoreCounter:$restoreCounter"); state.lockInfo["restoreCount"] = restoreCounter[0] * 256 + restoreCounter[1];
// print("restoreCounter:$restoreCounter");
// //
var restoreDate = reply.data.sublist(135, 139); var restoreDate = reply.data.sublist(135, 139);
int restoreDateValue = ((0xff & restoreDate[(0)]) << 24 | (0xff & restoreDate[1]) << 16 | (0xff & restoreDate[2]) << 8 | (0xFF & restoreDate[3])); int restoreDateValue = ((0xff & restoreDate[(0)]) << 24 | (0xff & restoreDate[1]) << 16 | (0xff & restoreDate[2]) << 8 | (0xFF & restoreDate[3]));
String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString()); // String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
print("restoreDate:$restoreDate restoreDateStr:$restoreDateStr"); state.lockInfo["restoreDate"] = restoreDateValue*1000;
// print("restoreDate:$restoreDate restoreDateValue:$restoreDateValue");
// //
var icPartNo = reply.data.sublist(139, 149); var icPartNo = reply.data.sublist(139, 149);
var icPartNoStr = utf8String(icPartNo); var icPartNoStr = utf8String(icPartNo);
print("icPartNo:$icPartNo icPartNoStr:$icPartNoStr"); state.lockInfo["icPartNo"] = icPartNoStr;
// print("icPartNo:$icPartNo icPartNoStr:$icPartNoStr");
// //
var indate = reply.data.sublist(149, 153); var indate = reply.data.sublist(149, 153);
int indateValue = ((0xff & restoreDate[(0)]) << 24 | (0xff & restoreDate[1]) << 16 | (0xff & restoreDate[2]) << 8 | (0xFF & restoreDate[3])); int indateValue = ((0xff & indate[(0)]) << 24 | (0xff & indate[1]) << 16 | (0xff & indate[2]) << 8 | (0xFF & indate[3]));
String indateStr = DateTool().dateToYMDHNSString("$indateValue"); // String indateStr = DateTool().dateToYMDHNSString("$indateValue");
print("indate:$indate indateStr:$indateStr"); state.lockInfo["indate"] = indateValue*1000;
// print("indate:$indate indateValue:$indateValue");
// var index = 153; var index = 153;
// // //
// var featureValueLength = reply.data[153]; var featureValueLength = reply.data[153];
// // () // ()
// // //
// var featureValue = reply.data.sublist(index+1, index + featureValueLength+1); var featureValue = reply.data.sublist(index+1, index + featureValueLength+1);
String featureValueStr = asciiString(featureValue);
state.featureValue = featureValueStr;
// List allFeatureValueTwoList = charListChangeIntList(featureValue); // List allFeatureValueTwoList = charListChangeIntList(featureValue);
// // print("featureValueLength:$featureValueLength featureValue:$featureValue \n allFeatureValueTwoList:$allFeatureValueTwoList"); // print("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr");
// index = index + featureValueLength + 1; index = index + featureValueLength + 1;
// // 使 // 使
// var featureEnValLength = reply.data[index]; var featureEnValLength = reply.data[index];
// // 使() // 使()
// var featureEnVal = reply.data.sublist(index+1, index + featureEnValLength+1); var featureEnVal = reply.data.sublist(index+1, index + featureEnValLength+1);
String featureEnValStr = asciiString(featureValue);
state.featureSettingValue = featureEnValStr;
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal); // List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
// // print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n allFeatureEnValTwoList:$allFeatureEnValTwoList"); // print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr");
// index = index + featureEnValLength + 1; index = index + featureEnValLength + 1;
// // //
// var featureParaTotal = reply.data[index]; // var featureParaTotal = reply.data[index];
var featureParaTotalList = reply.data.sublist(index);
state.featureSettingParams = featureParaTotalList;
// print("featureParaTotalList:$featureParaTotalList");
break; break;
case 0x06: case 0x06:
// //
@ -307,8 +254,10 @@ class SaveLockLogic extends BaseGetXController {
for(int i = 0;i<featureValueTwoStr.length;i++){ for(int i = 0;i<featureValueTwoStr.length;i++){
featureValueTwoList.add(int.parse(featureValueTwoStr[i])); featureValueTwoList.add(int.parse(featureValueTwoStr[i]));
} }
//
featureValueTwoList = featureValueTwoList.reversed.toList(); featureValueTwoList = featureValueTwoList.reversed.toList();
List allFeatureValueTwoList = getFixedLengthList(featureValueTwoList, 60 - featureValueTwoList.length); List allFeatureValueTwoList = getFixedLengthList(featureValueTwoList, 60 - featureValueTwoList.length);
// print("featureValueStr:$featureValueStr featureValueTwoStr:$featureValueTwoStr featureValueTwoList:$featureValueTwoList allFeatureValueTwoList:$allFeatureValueTwoList");
return allFeatureValueTwoList; return allFeatureValueTwoList;
} }
@ -356,10 +305,7 @@ class SaveLockLogic extends BaseGetXController {
} }
void bindBlueAdmin() async{ void bindBlueAdmin() async{
var lockDataMap = {}; print("state.lockInfo:${state.lockInfo}");
lockDataMap['lockName'] = BlueManage().connectDeviceName;
lockDataMap['lockMac'] = getRandomNumber();
// lockDataMap['lockMac'] = BlueManage().connectDeviceMacAddress;
var positionMap = {}; var positionMap = {};
positionMap['longitude'] = state.addressInfo["longitude"]; positionMap['longitude'] = state.addressInfo["longitude"];
@ -390,17 +336,15 @@ class SaveLockLogic extends BaseGetXController {
// print("addUser:publicKeyDataList$publicKeyDataList getPrivateKeyList:$getPrivateKeyList signKeyDataList:$signKeyDataList"); // print("addUser:publicKeyDataList$publicKeyDataList getPrivateKeyList:$getPrivateKeyList signKeyDataList:$signKeyDataList");
var entity = await ApiRepository.to.bindingBlueAdmin( var entity = await ApiRepository.to.bindingBlueAdmin(
bindingDate:DateTime.now().millisecondsSinceEpoch.toString(),
hotelMode:"2",
lockAlias:state.aliName.value, lockAlias:state.aliName.value,
lockData:lockDataMap,
nbInitSuccess:"0",
position:positionMap, position:positionMap,
bluetooth:bluetooth, bluetooth:bluetooth,
deviceNo:"123456", lockInfo: state.lockInfo,
// lockUserNo:userNo.toString(), lockUserNo:state.lockUserNo.toString(),
lockUserNo:"1234", pwdTimestamp:state.pwdTimestamp.value.toString(),
pwdTimestamp:state.pwdTimestamp.value.toString() featureValue:state.featureValue,
featureSettingValue:state.featureSettingValue,
featureSettingParams:state.featureSettingParams,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
@ -408,23 +352,9 @@ class SaveLockLogic extends BaseGetXController {
} }
} }
String getRandomNumber(){
String str = "";
for(int i = 0; i<6; i++){
var a = Random().nextInt(99);
if(a<10){
a = a*10;
}
str = "$str$a:";
}
String result = str.substring(0, str.length - 1);
print("result:$result");
return result;
}
// //
Future<void> _getLockStatus() async { Future<void> _getStarLockStatus() async {
print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}"); // print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}");
// //
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
if (state == DeviceConnectionState.connected) { if (state == DeviceConnectionState.connected) {
@ -451,6 +381,8 @@ class SaveLockLogic extends BaseGetXController {
print("onReady()"); print("onReady()");
_initReplySubscription(); _initReplySubscription();
_getStarLockStatus();
} }
@override @override
@ -459,7 +391,6 @@ class SaveLockLogic extends BaseGetXController {
super.onInit(); super.onInit();
print("onInit()"); print("onInit()");
_getLockStatus();
} }
@override @override

View File

@ -11,6 +11,12 @@ class SaveLockState {
var addressInfo = {}.obs; var addressInfo = {}.obs;
TextEditingController aliNameController = TextEditingController(); TextEditingController aliNameController = TextEditingController();
var lockUserNo = 0;
var lockInfo = {};
var featureValue = '';
var featureSettingValue = '';
var featureSettingParams = [];
SaveLockState() { SaveLockState() {
aliName.value = BlueManage().connectDeviceName; aliName.value = BlueManage().connectDeviceName;
aliNameController.text = aliName.value; aliNameController.text = aliName.value;

View File

@ -1,7 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../main/lockMian/entity/lockListInfo_entity.dart';
class AddAuthorizedAdministratorState { class AddAuthorizedAdministratorState {
late TabController? tabController; late TabController? tabController;
@ -28,12 +29,10 @@ class AddAuthorizedAdministratorState {
var isSendSuccess = false.obs; var isSendSuccess = false.obs;
final isRemoteUnlock = false.obs; // final isRemoteUnlock = false.obs; //
final isAuthentication = false.obs; // final isAuthentication = false.obs; //
final keyInfo = KeyInfos().obs; final keyInfo = LockListInfoItemEntity().obs;
final lockMainEntity = LockMainEntity().obs;
AddAuthorizedAdministratorState() { AddAuthorizedAdministratorState() {
Map map = Get.arguments; Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"]; keyInfo.value = map["keyInfo"];
} }
} }

View File

@ -1,10 +1,11 @@
abstract class Api { abstract class Api {
static String baseAddress = "https://pre.lock.star-lock.cn:8093"; // static String baseAddress = "https://pre.lock.star-lock.cn:8093"; //
final String baseUrl = "$baseAddress/api";
// final String baseUrl = "$baseAddress/api";
// final String baseUrl = "http://test.lock.star-lock.cn/api"; // // final String baseUrl = "http://test.lock.star-lock.cn/api"; //
// final String baseUrl = "https://lock.star-lock.cn/api"; // // final String baseUrl = "https://lock.star-lock.cn/api"; //
// final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; // // final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; //
// final String baseUrl = "http://192.168.56.101:8099/api"; // final String baseUrl = "http://192.168.56.101:8099/api"; //
// final String baseUrl = "http://192.168.1.14:8099/api"; // // final String baseUrl = "http://192.168.1.14:8099/api"; //
// //
@ -27,6 +28,7 @@ abstract class Api {
final String bindingBlueAdminURL = '/lock/bindAdmin'; // final String bindingBlueAdminURL = '/lock/bindAdmin'; //
final String modifyKeyNameURL = '/key/modifyKeyName'; // final String modifyKeyNameURL = '/key/modifyKeyName'; //
final String updateLockNameURL = '/lock/updateLockName'; //()
final String modifyKeyNameForAdminURL = final String modifyKeyNameForAdminURL =
'/key/modifyKeyNameForAdmin'; // '/key/modifyKeyNameForAdmin'; //
final String updateKeyDateURL = '/key/updateKeyDate'; // final String updateKeyDateURL = '/key/updateKeyDate'; //
@ -35,6 +37,8 @@ abstract class Api {
final String deleteElectronicKeyURL = '/key/delete'; // final String deleteElectronicKeyURL = '/key/delete'; //
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; // final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //
final String getLockInfoURL = '/lock/syncDataPage'; // final String getLockInfoURL = '/lock/syncDataPage'; //
final String getStarLockInfoURL = '/lock/list'; //
final String getLockSettingURL = '/lock/getLockSettingData'; //
final String deletLockURL = '/lock/delete'; // final String deletLockURL = '/lock/delete'; //
final String checkPasswordURL = '/user/checkPassword'; // final String checkPasswordURL = '/user/checkPassword'; //
@ -51,12 +55,13 @@ abstract class Api {
final String keyGroupListURL = '/keyGroup/list'; // final String keyGroupListURL = '/keyGroup/list'; //
final String lockListByGroupURL = '/room/listByGroup'; // final String lockListByGroupURL = '/room/listByGroup'; //
final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // Wifi锁服务器 final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // Wifi锁服务器
final String updateSpecialValueUrl = '/room/updateSpecialValue'; // / final String updateLockSettingUrl = '/lockSetting/updateLockSetting'; // /
final String setAutoLockTimeUrl = '/room/setAutoLockTime'; // final String setAutoLockTimeUrl = '/room/setAutoLockTime'; //
final String getPassageModeConfigUrl =
'/room/getPassageModeConfig'; // final String getPassageModeConfigUrl = '/room/getPassageModeConfig'; //
final String configPassageModeUrl = '/room/configPassageMode'; // final String configPassageModeUrl = '/room/configPassageMode'; //
final String updateSettingUrl = '/room/updateSetting'; // /// final String updateSettingUrl = '/room/updateSetting'; // ///
final String roomQueryDateUrl = '/room/queryDate'; // final String roomQueryDateUrl = '/room/queryDate'; //
final String lockDiagnoseUrl = '/room/uploadLockInfo'; // final String lockDiagnoseUrl = '/room/uploadLockInfo'; //
final String getServerDatetimeUrl = '/check/getServerDatetime'; // final String getServerDatetimeUrl = '/check/getServerDatetime'; //

View File

@ -169,10 +169,9 @@ class ApiProvider extends BaseProvider {
})); }));
Future<Response> modifyKeyName( Future<Response> modifyKeyName(
String keyId, String keyId,
String lockId, String lockId,
String keyName, String keyName,
String operatorUid,
) => ) =>
post( post(
modifyKeyNameURL.toUrl, modifyKeyNameURL.toUrl,
@ -180,7 +179,6 @@ class ApiProvider extends BaseProvider {
'keyId': keyId, 'keyId': keyId,
'lockId': lockId, 'lockId': lockId,
'keyName': keyName, 'keyName': keyName,
'operatorUid': operatorUid,
})); }));
Future<Response> modifyKeyNameForAdmin( Future<Response> modifyKeyNameForAdmin(
@ -273,29 +271,27 @@ class ApiProvider extends BaseProvider {
// //
Future<Response> bindingBlueAdmin( Future<Response> bindingBlueAdmin(
String bindingDate,
String hotelMode,
String lockAlias, String lockAlias,
Map lockData,
String nbInitSuccess,
Map position, Map position,
Map bluetooth, Map bluetooth,
String deviceNo, Map lockInfo,
String lockUserNo, String lockUserNo,
String pwdTimestamp) => String pwdTimestamp,
String featureValue,
String featureSettingValue,
List featureSettingParams) =>
post( post(
bindingBlueAdminURL.toUrl, bindingBlueAdminURL.toUrl,
jsonEncode({ jsonEncode({
'bindingDate': bindingDate,
'hotelMode': hotelMode,
"lockAlias": lockAlias, "lockAlias": lockAlias,
'lockData': lockData,
"nbInitSuccess": nbInitSuccess,
'position': position, 'position': position,
'bluetooth': bluetooth, 'bluetooth': bluetooth,
'deviceNo': deviceNo, 'lockInfo': lockInfo,
'lockUserNo': lockUserNo, 'lockUserNo': lockUserNo,
'pwdTimestamp': pwdTimestamp, 'pwdTimestamp': pwdTimestamp,
'featureValue': featureValue,
'featureSettingValue': featureSettingValue,
'featureSettingParams': featureSettingParams,
})); }));
// //
@ -306,6 +302,21 @@ class ApiProvider extends BaseProvider {
"pageNo": pageNo, "pageNo": pageNo,
})); }));
//
Future<Response> getStarLockListInfo(int pageNo, int pageSize) => post(
getStarLockInfoURL.toUrl,
jsonEncode({
"pageNo": pageNo,
'pageSize': pageSize,
}));
//
Future<Response> getLockSettingInfoData(String lockId) => post(
getLockSettingURL.toUrl,
jsonEncode({
'lockId': lockId,
}));
// //
Future<Response> deletLockInfo(String lockId) => post( Future<Response> deletLockInfo(String lockId) => post(
deletLockURL.toUrl, deletLockURL.toUrl,
@ -496,19 +507,8 @@ class ApiProvider extends BaseProvider {
jsonEncode({'type': type, 'keyGroupId': keyGroupId})); jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
/// ///
//
Future<Response> remoteUnlockingOpenOrCloseLoadData(
String lockId, String featureValue) =>
post(
updateSpecialValueUrl.toUrl,
jsonEncode({
'lockId': lockId,
'featureValue': featureValue,
}));
// //
Future<Response> setAutoUnlockLoadData( Future<Response> setAutoUnlockLoadData(int lockId, int autoLockTime, int type) =>
String lockId, String autoLockTime, String type) =>
post( post(
setAutoLockTimeUrl.toUrl, setAutoLockTimeUrl.toUrl,
jsonEncode({ jsonEncode({
@ -517,6 +517,44 @@ class ApiProvider extends BaseProvider {
'type': type, 'type': type,
})); }));
//
Future<Response> setLockSoundData(int lockId, int lockSound, int lockSoundVolume) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'lockSound': lockSound,
'lockSoundVolume': lockSoundVolume,
}));
//
Future<Response> setBurglarAlarmData(
int lockId, int antiPrySwitch) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'antiPrySwitch': antiPrySwitch,
}));
//
Future<Response> remoteUnlockingOpenOrCloseLoadData(int lockId, int remoteUnlock) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'remoteUnlock': remoteUnlock,
}));
//
Future<Response> setResetButtonData(int lockId, int resetSwitch) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'resetSwitch': resetSwitch,
}));
// //
Future<Response> getPassageModeConfigLoadData(String lockId) => post( Future<Response> getPassageModeConfigLoadData(String lockId) => post(
getPassageModeConfigUrl.toUrl, getPassageModeConfigUrl.toUrl,
@ -603,6 +641,17 @@ class ApiProvider extends BaseProvider {
'lockId': lockId, 'lockId': lockId,
})); }));
Future<Response> updateLockName(
String lockId,
String lockName,
) =>
post(
updateLockNameURL.toUrl,
jsonEncode({
'lockId': lockId,
'lockName': lockName,
}));
// //
Future<Response> openCheckingInGetData(String lockId) => post( Future<Response> openCheckingInGetData(String lockId) => post(
openCheckingInURL.toUrl, openCheckingInURL.toUrl,

View File

@ -30,14 +30,15 @@ import '../main/lockDetail/checkingIn/checkingInSet/checkingInSet_entity.dart';
import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaffSeletKey_entity.dart'; import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaffSeletKey_entity.dart';
import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart'; import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart';
import '../main/lockDetail/lcokSet/configuringWifi/configuringWifiEntity.dart'; import '../main/lockDetail/lcokSet/configuringWifi/configuringWifiEntity.dart';
import '../main/lockDetail/lcokSet/lockSet/CheckingInInfoDataEntity.dart'; import '../main/lockDetail/lcokSet/lockSet/checkingInInfoData_entity.dart';
import '../main/lockDetail/lcokSet/lockTime/GetServerDatetimeEntity.dart'; import '../main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart';
import '../main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart'; import '../main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart';
import '../main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart';
import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart'; import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
import '../main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart'; import '../main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart';
import '../main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart'; import '../main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart';
import '../main/lockDetail/otherTypeKey/otherTypeKeyList/fingerprintListData_entity.dart'; import '../main/lockDetail/otherTypeKey/otherTypeKeyList/fingerprintListData_entity.dart';
import '../main/lockMian/entity/lockInfoEntity.dart'; import '../main/lockMian/entity/lockListInfo_entity.dart';
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart'; import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart'; import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart';
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart'; import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
@ -230,27 +231,25 @@ class ApiRepository {
// //
Future<SaveLockEntity> bindingBlueAdmin( Future<SaveLockEntity> bindingBlueAdmin(
{required String bindingDate, { required String lockAlias,
required String hotelMode, required Map position,
required String lockAlias, required Map bluetooth,
required Map lockData, required Map lockInfo,
required String nbInitSuccess, required String lockUserNo,
required Map position, required String pwdTimestamp,
required Map bluetooth, required String featureValue,
required String deviceNo, required String featureSettingValue,
required String lockUserNo, required List featureSettingParams}) async {
required String pwdTimestamp}) async {
final res = await apiProvider.bindingBlueAdmin( final res = await apiProvider.bindingBlueAdmin(
bindingDate,
hotelMode,
lockAlias, lockAlias,
lockData,
nbInitSuccess,
position, position,
bluetooth, bluetooth,
deviceNo, lockInfo,
lockUserNo, lockUserNo,
pwdTimestamp); pwdTimestamp,
featureValue,
featureSettingValue,
featureSettingParams);
return SaveLockEntity.fromJson(res.body); return SaveLockEntity.fromJson(res.body);
} }
@ -264,13 +263,24 @@ class ApiRepository {
// //
Future<KeyOperationRecordEntity> modifyKeyName( Future<KeyOperationRecordEntity> modifyKeyName(
String keyId, {
String lockId, required String keyId,
String keyName, required String lockId,
String operatorUid, required String keyName
) async { }) async {
final res = final res =
await apiProvider.modifyKeyName(keyId, lockId, keyName, operatorUid); await apiProvider.modifyKeyName(keyId, lockId, keyName);
return KeyOperationRecordEntity.fromJson(res.body);
}
//()
Future<KeyOperationRecordEntity> updateLockName(
{
required String lockId,
required String lockName
}) async {
final res =
await apiProvider.updateLockName(lockId, lockName);
return KeyOperationRecordEntity.fromJson(res.body); return KeyOperationRecordEntity.fromJson(res.body);
} }
@ -321,28 +331,41 @@ class ApiRepository {
} }
// //
Future<LockMainEntity> getLockInfo( // Future<LockMainEntity> getLockInfo(
{required String lastUpdateDate, required String pageNo}) async { // {required String lastUpdateDate, required String pageNo}) async {
final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo); // final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo);
return LockMainEntity.fromJson(res.body); // return LockMainEntity.fromJson(res.body);
// }
//
Future<LockListInfoEntity> getStarLockListInfo(
{required int pageNo, required int pageSize}) async {
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize);
return LockListInfoEntity.fromJson(res.body);
}
//
Future<LockSetInfoEntity> getLockSettingInfoData({required String lockId}) async {
final res = await apiProvider.getLockSettingInfoData(lockId);
return LockSetInfoEntity.fromJson(res.body);
} }
// //
Future<LockMainEntity> deletOwnerLockData({required String lockId}) async { Future<LockListInfoEntity> deletOwnerLockData({required String lockId}) async {
final res = await apiProvider.deletLockInfo(lockId); final res = await apiProvider.deletLockInfo(lockId);
return LockMainEntity.fromJson(res.body); return LockListInfoEntity.fromJson(res.body);
} }
// //
Future<LockMainEntity> deletOwnerKeyData({required String lockId, required String keyId}) async { Future<LockListInfoEntity> deletOwnerKeyData({required String lockId, required String keyId}) async {
final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId); final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId);
return LockMainEntity.fromJson(res.body); return LockListInfoEntity.fromJson(res.body);
} }
// //
Future<LockMainEntity> checkLoginPassword({required String password}) async { Future<LockListInfoEntity> checkLoginPassword({required String password}) async {
final res = await apiProvider.checkLoginPassword(password); final res = await apiProvider.checkLoginPassword(password);
return LockMainEntity.fromJson(res.body); return LockListInfoEntity.fromJson(res.body);
} }
// //
@ -508,27 +531,57 @@ class ApiRepository {
} }
/// ///
// /
Future<LoginEntity> remoteUnlockingOpenOrClose({
required String lockId,
required String featureValue,
}) async {
final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData(
lockId, featureValue);
return LoginEntity.fromJson(res.body);
}
// //
Future<LoginEntity> setAutoUnlock({ Future<LoginEntity> setAutoUnlock({
required String lockId, required int lockId,
required String autoLockTime, required int autoLockTime,
required String type, required int type,
}) async { }) async {
final res = final res =
await apiProvider.setAutoUnlockLoadData(lockId, autoLockTime, type); await apiProvider.setAutoUnlockLoadData(lockId, autoLockTime, type);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
//
Future<LoginEntity> setLockSound({
required int lockId,
required int lockSound,
required int lockSoundVolume,
}) async {
final res =
await apiProvider.setLockSoundData(lockId, lockSound, lockSoundVolume);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setBurglarAlarmData({
required int lockId,
required int antiPrySwitch,
}) async {
final res =
await apiProvider.setBurglarAlarmData(lockId, antiPrySwitch);
return LoginEntity.fromJson(res.body);
}
// /
Future<LoginEntity> remoteUnlockingOpenOrClose({
required int lockId,
required int remoteUnlock,
}) async {
final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData(
lockId, remoteUnlock);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setResetButtonData({
required int lockId,
required int resetSwitch,
}) async {
final res = await apiProvider.setResetButtonData(lockId, resetSwitch);
return LoginEntity.fromJson(res.body);
}
// configPassageMode // configPassageMode
Future<GetPassageModeConfigEntity> getPassageModeConfig({ Future<GetPassageModeConfigEntity> getPassageModeConfig({
required String lockId, required String lockId,

View File

@ -36,13 +36,12 @@ class CommonItem extends StatelessWidget {
Container( Container(
height: allHeight ?? 60.h, height: allHeight ?? 60.h,
color: Colors.white, color: Colors.white,
padding: EdgeInsets.only( padding: EdgeInsets.only(left: 20.w, right: 10.w), // , top: 20.w, bottom: 20.w
left: 20.w, right: 10.w), // , top: 20.w, bottom: 20.w
child: Row( child: Row(
children: [ children: [
SizedBox(width: 20.w), SizedBox(width: 20.w),
SizedBox( SizedBox(
width: isHaveRightWidget! ? 100.w : 300.w, width: isHaveRightWidget! ? 100.w : 300.w,
child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp)) child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp))
), ),
SizedBox(width: 6.w), SizedBox(width: 6.w),
@ -59,26 +58,20 @@ class CommonItem extends StatelessWidget {
children: [ children: [
isHaveRightWidget! isHaveRightWidget!
? rightWidget! ? rightWidget!
: Text( : Text(rightTitle ?? "", textAlign: TextAlign.end,
rightTitle ?? "", overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end, maxLines: 1,
// overflow: TextOverflow.ellipsis,
// maxLines: 1,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 22.sp,
color: AppColors.darkGrayTextColor), color: AppColors.darkGrayTextColor),
) )
], ],
), ),
isHaveDirection! ? SizedBox(width: 8.w) : Container(), isHaveDirection! ? SizedBox(width: 3.w) : Container(),
isHaveDirection! isHaveDirection!
? Image.asset( ? Image.asset('images/icon_right_grey.png', width: 12.w, height: 21.w,)
'images/icon_right_grey.png', : SizedBox(width: 10.w),
width: 12.w, isHaveDirection! ? SizedBox(width: 5.w) : Container(),
height: 21.w,
)
: SizedBox(width: 20.w),
isHaveDirection! ? SizedBox(width: 20.w) : Container(),
], ],
), ),
), ),

View File

@ -1,6 +1,6 @@
import 'package:event_bus/event_bus.dart'; import 'package:event_bus/event_bus.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:uuid/uuid.dart'; import '../main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart';
/// EventBus /// EventBus
EventBus eventBus = EventBus(); EventBus eventBus = EventBus();
@ -17,8 +17,8 @@ class RefreshCheckInStaffListDataEvent{
/// ///
class PassCurrentLockInformationEvent{ class PassCurrentLockInformationEvent{
KeyInfos keyInfo; LockSetInfoData lockSetInfoData;
PassCurrentLockInformationEvent(this.keyInfo); PassCurrentLockInformationEvent(this.lockSetInfoData);
} }
/// ///