merge:合并代码

This commit is contained in:
anfe 2024-05-18 09:01:31 +08:00
commit a8a61e3711
64 changed files with 1422 additions and 1046 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -337,8 +337,7 @@
"customSMSTemplate": "Custom SMS Template",
"customMailTemplate": "Custom Mail Template",
"record": "Record",
"buyRealNameTip": "When an electronic key is sent to the user, the user can be required to authenticate with his real name before unlocking to ensure that he is operating. The real-name authentication calls the interface of the national Public security system. For the payment function, please purchase the number of times before using it.",
"buyRealNameSelectYouWantBuyTip": "Please select the frequency of real name authentication you want",
"forTheFirstTime": "For the first time",
"onceDay": "once a day",
"weekOnce": "once a week",
@ -680,6 +679,8 @@
"型号": "Model",
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "After the password is generated, please use it once for activation before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. After the password is activated, it can be used unlimited times within the validity period.",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. The clear code is used to clear all the passwords generated before 0 o'clock today.",
"密码生成后请在当日2359前使用否则过0点后失效。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock.",
"清空密码底部提示": "The password is valid until 24 o 'clock on the day of emptying\nEmpty content 1: All passwords except custom generated before 0 o 'clock on the same day (passwords generated after 0 o 'clock on the same day are not affected by the empty password and can continue to be used) \nEmpty content 2: Clear passwords Clear all custom passwords (used and unused) immediately after use \nTo completely clear all passwords, use the Reset All Passwords feature",
"相机": "camera",
"相册": "photos",
"读写": "storage",
@ -711,7 +712,7 @@
"请输入手机号": "Please enter mobile phone number",
"家人到家": "Family gets home",
"添加家人": "Add family",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择": "If the lock is not connected to the Internet, in addition to the electronic key, the password, card, fingerprint and other door reminders can not be sent in time, please choose according to your actual situation",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择": "If the lock is not connected to the Internet, in addition to the electronic key, the password, card, fingerprint and other door reminders can not be sent in time, please choose according to your actual situation",
"消息提醒": "Message reminder",
"开门通知": "Opening notice",
"N天未开门": "N days without opening the door",
@ -839,8 +840,19 @@
"固件版本": "Firmware version",
"手动升级": "Manual upgrade",
"设备连接中...": "Device Connecting...",
"升级过程中无法开锁,请先开锁后再升级": "The lock cannot be unlocked during the upgrade, please unlock the lock before upgrading",
"未避免异常情况,请在门打开时升级": "Unavoidable exceptions, please upgrade when the door is open",
"钥匙无效": "The key is invalid",
"操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "The operation failed. Please confirm whether the lock is nearby, or restart your phone's Bluetooth and try again.",
"如果是全自动锁,请使屏幕变亮": "If it is a fully automatic lock, please make the screen brighter"
"如果是全自动锁,请使屏幕变亮": "If it is a fully automatic lock, please make the screen brighter",
"正在尝试闭锁……": "Attempting to lock...",
"清空记录":"Clear record",
"是否要删除操作记录?":"Do you want to delete the operation record?",
"被删除的记录不能恢复":"The deleted record cannot be restored",
"全部事件":"All events",
"开锁事件":"Unlock event",
"异常事件":"Abnormal event",
"门铃事件":"Doorbell event",
"视频事件":"Video event",
"请开启蓝牙":"Please turn on Bluetooth",
"请选择有效日":"Please select the effective day"
}

View File

@ -707,6 +707,8 @@
"型号": "型号",
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。",
"密码生成后请在当日2359前使用否则过0点后失效。": "密码生成后请在当日2359前使用否则过0点后失效。",
"清空密码底部提示": "清空密码底部提示",
"密码不一致哦":"密码不一致哦",
"相机": "相机",
@ -739,7 +741,7 @@
"请输入手机号":"请输入手机号",
"家人到家":"家人到家",
"添加家人":"添加家人",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
"消息提醒":"消息提醒",
"开门通知":"开门通知",
"N天未开门":"N天未开门",
@ -867,8 +869,19 @@
"固件版本": "固件版本",
"手动升级": "手动升级",
"设备连接中...": "设备连接中...",
"升级过程中无法开锁,请先开锁后再升级": "升级过程中无法开锁,请先开锁后再升级",
"未避免异常情况,请在门打开时升级": "未避免异常情况,请在门打开时升级",
"钥匙无效": "钥匙无效",
"操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。",
"如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮"
"如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮",
"正在尝试闭锁……": "正在尝试闭锁……",
"清空记录":"清空记录",
"是否要删除操作记录?":"是否要删除操作记录?",
"被删除的记录不能恢复":"被删除的记录不能恢复",
"全部事件":"全部事件",
"开锁事件":"开锁事件",
"异常事件":"异常事件",
"门铃事件":"门铃事件",
"视频事件":"视频事件",
"请开启蓝牙":"请开启蓝牙",
"请选择有效日":"请选择有效日"
}

View File

@ -682,6 +682,8 @@
"型号": "型号",
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。",
"密码生成后请在当日2359前使用否则过0点后失效。": "密码生成后请在当日2359前使用否则过0点后失效。",
"清空密码底部提示": "清空密码当日24点前有效\n清空内容1当日0点前生成的除自定义以外所有密码当日0点后生成的密码不受清空密码影响可继续使用\n清空内容2清空密码使用后立即清除所有自定义密码含使用过和未使用过的\n如需彻底清除所有密码请使用重置所有密码功能",
"密码不一致哦": "密码不一致哦",
"相机": "相机",
"相册": "相册",
@ -711,7 +713,7 @@
"请输入手机号": "请输入手机号",
"家人到家": "家人到家",
"添加家人": "添加家人",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择": "若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择": "若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
"消息提醒": "消息提醒",
"开门通知": "开门通知",
"N天未开门": "N天未开门",
@ -837,8 +839,19 @@
"固件版本": "固件版本",
"手动升级": "手动升级",
"设备连接中...": "设备连接中...",
"升级过程中无法开锁,请先开锁后再升级": "升级过程中无法开锁,请先开锁后再升级",
"未避免异常情况,请在门打开时升级": "未避免异常情况,请在门打开时升级",
"钥匙无效": "钥匙无效",
"操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。",
"如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮"
"如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮",
"正在尝试闭锁……": "正在尝试闭锁……",
"清空记录":"清空记录",
"是否要删除操作记录?":"是否要删除操作记录?",
"被删除的记录不能恢复":"被删除的记录不能恢复",
"全部事件":"全部事件",
"开锁事件":"开锁事件",
"异常事件":"异常事件",
"门铃事件":"门铃事件",
"视频事件":"视频事件",
"请开启蓝牙":"请开启蓝牙",
"请选择有效日":"请选择有效日"
}

View File

@ -309,7 +309,7 @@ SPEC CHECKSUMS:
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
DKImagePickerController: 0a24ebfe7b48beeb74c27531540aaa2cc1dac6cf
@ -322,12 +322,12 @@ SPEC CHECKSUMS:
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
fluwx: daa284756ce53442b3d0417ceeda66e981906811
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
google_maps_flutter_ios: f135b968a67c05679e0a53538e900b5c174b0d99
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425
image_picker_ios: b545a5f16c0fa88e3ecbbce3ed4de45567a8ec18
ios-voice-processor: 8e32d7f980a06d392d128ef1cd19cf6ddcaca3c1
JCore: 05f0f3489672ea3fa55338bae4866224bc092b1f
JPush: 76668b765fcfd7c15f86b05ca0e5cdc01945ce23
@ -335,18 +335,18 @@ SPEC CHECKSUMS:
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
ReachabilitySwift: 2128f3a8c9107e1ad33574c6e58e8285d460b149
SDWebImage: 40b0b4053e36c660a764958bff99eed16610acbb
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
system_settings: 8f5cdbfa72c677fc8d665b863bcc20d393d87e9d
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36
WechatOpenSDK-XCFramework: 36fb2bea0754266c17184adf4963d7e6ff98b69f
PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc

View File

@ -853,6 +853,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 7D53BZAN75;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -868,6 +869,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerProfile-dev.entitlements";
DEVELOPMENT_TEAM = 7D53BZAN75;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -882,6 +884,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-dev.entitlements";
DEVELOPMENT_TEAM = 7D53BZAN75;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -896,6 +899,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerDebug-pre.entitlements";
DEVELOPMENT_TEAM = 7D53BZAN75;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -910,6 +914,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerProfile-pre.entitlements";
DEVELOPMENT_TEAM = 7D53BZAN75;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -924,6 +929,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-pre.entitlements";
DEVELOPMENT_TEAM = 7D53BZAN75;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -938,6 +944,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerDebug-sky.entitlements";
DEVELOPMENT_TEAM = NAQ5PL2DYC;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -952,6 +959,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerProfile-sky.entitlements";
DEVELOPMENT_TEAM = NAQ5PL2DYC;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -966,6 +974,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-sky.entitlements";
DEVELOPMENT_TEAM = NAQ5PL2DYC;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -980,6 +989,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
DEVELOPMENT_TEAM = P8997RW3V8;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -994,6 +1004,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
DEVELOPMENT_TEAM = P8997RW3V8;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
@ -1008,6 +1019,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-xhj.entitlements";
DEVELOPMENT_TEAM = P8997RW3V8;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;

View File

@ -373,7 +373,7 @@ abstract class Routers {
static const getDeviceListPage = '/getDeviceListPage'; //
static const getNameListPage = '/getNameListPage'; //
static const authorityManagementPage = '/authorityManagementPage'; //
static const massSendLockGroupPage = '/massSendLockGroupPage'; //
static const massSendLockGroupListPage = '/massSendLockGroupListPage'; //
static const massSendReceiverPage = '/massSendReceiverPage'; //
static const lockUserListPage = '/lockUserListPage'; //
static const administratorDetailsPage = '/administratorDetailsPage'; //
@ -911,7 +911,7 @@ abstract class AppRouters {
name: Routers.configuringWifiPage,
page: () => const ConfiguringWifiPage()),
GetPage(
name: Routers.massSendLockGroupPage,
name: Routers.massSendLockGroupListPage,
page: () => const MassSendLockGroupListPage()),
GetPage(
name: Routers.massSendReceiverPage,

View File

@ -14,6 +14,7 @@ class AppLog {
_onlyError = onlyError ?? false;
}
static log(String msg,{bool? error}){
msg = '${DateTime.now().toIso8601String()} : $msg';
DebugConsole.info(msg);
if(!kDebugMode)return;
error = error ?? false;

View File

@ -1,9 +1,13 @@
import 'dart:async';
import 'dart:io';
import 'package:app_settings/app_settings.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/widget/permission/permission_dialog.dart';
import 'package:url_launcher/url_launcher.dart';
import 'io_tool/io_model.dart';
import 'io_tool/io_tool.dart';
@ -623,7 +627,7 @@ class BlueManage {
}
}
} on Exception catch (e, s) {
AppLog.log('APP写入失败: $e');
AppLog.log('APP写入失败: $e $s');
rethrow;
}
}
@ -654,6 +658,29 @@ class BlueManage {
// }
}
//
Future<void> writeNull() async {
List<BluetoothService> services =
await bluetoothConnectDevice!.discoverServices();
for (BluetoothService service in services) {
if (service.uuid == _serviceIdConnect) {
for (BluetoothCharacteristic characteristic
in service.characteristics) {
if (characteristic.characteristicUuid == _characteristicIdWrite) {
try {
List<int> valueList = [1];
AppLog.log('APP写入 writeNull ');
await characteristic.write(valueList);
} on Exception catch (e, s) {
AppLog.log('APP写入失败 writeNull : $e $s');
rethrow;
}
}
}
}
}
}
//
// Future<List<int>> _readCharacteristic(QualifiedCharacteristic characteristic) async {
// try {
@ -696,7 +723,10 @@ class BlueManage {
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
connectDeviceMacAddress = "";
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
await bluetoothConnectDevice!.disconnect();
// await writeNull();
// await Future.delayed(const Duration(milliseconds: 1000));
//
await bluetoothConnectDevice!.disconnect(timeout: 2);
AppLog.log("断开连接成功");
}
// }
@ -712,7 +742,7 @@ class BlueManage {
await FlutterBluePlus.turnOn();
}
if (Platform.isIOS) {
EasyLoading.showToast("请开启蓝牙", duration: 2000.milliseconds);
EasyLoading.showToast("请开启蓝牙".tr, duration: 2000.milliseconds);
}
}

View File

@ -66,8 +66,8 @@ class AddUserCommand extends SenderProtocol {
return 'AddUserCommand{lockID: $lockID, authUserID: $authUserID,'
'keyID: $keyID, userID: $userID, openMode: $openMode, '
'keyType: $keyType, '
'startDate:${DateTool().dateIntToYMDHNString(startDate)} , '
'expireDate: ${DateTool().dateIntToYMDHNString(expireDate)} , '
'startDate:$startDate startDateStr:${ DateTool().dateIntToYMDHNString(startDate)} , '
'expireDate:$expireDate expireDateStr: ${DateTool().dateIntToYMDHNString(expireDate)} , '
'useCountLimit: $useCountLimit, isRound: $isRound, '
'weekRound: $weekRound, startHour: $startHour, '
'startMin: $startMin, endHour: $endHour, '

View File

@ -26,7 +26,7 @@ class GetStarLockStatuInfoCommand extends SenderProtocol {
@override
String toString() {
return 'GetStarLockStatuInfoCommand{lockID: $lockID, '
'utcTimeStamp: ${DateTool().dateIntToYMDHNString(utcTimeStamp)}, unixTimeStamp: ${DateTool().dateIntToYMDHNString(unixTimeStamp)}, '
'utcTimeStamp:$utcTimeStamp utcTimeStamp: ${DateTool().dateIntToYMDHNString(utcTimeStamp)}, unixTimeStamp:unixTimeStamp unixTimeStamp: ${DateTool().dateIntToYMDHNString(unixTimeStamp)}, '
'userID: $userID, privateKey: $privateKey}';
}

View File

@ -34,7 +34,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
@override
String toString() {
return 'SenderReferEventRecordTimeCommand{keyID: $keyID, '
'userID: $userID, logsCount: $logsCount, time: ${DateTool().dateIntToYMDHNString(time)}, '
'userID: $userID, logsCount: $logsCount, time:$time timeStr: ${DateTool().dateIntToYMDHNString(time)}, '
'token: $token, needAuthor: $needAuthor, publicKey: $publicKey, '
'privateKey: $privateKey}';
}

View File

@ -51,8 +51,8 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
return 'SenderCustomPasswordsCommand{keyID: $keyID, userID: $userID, '
'pwdNo: $pwdNo, pwd: $pwd, useCountLimit: $useCountLimit, operate: $operate, isAdmin: $isAdmin,'
'token: $token, '
'startTime: ${DateTool().dateIntToYMDHNString(startTime)}, '
'endTime: ${DateTool().dateIntToYMDHNString(endTime)}, '
'startTime:$startTime startTimeStr: ${DateTool().dateIntToYMDHNString(startTime)}, '
'endTime:$endTime endTimeStr: ${DateTool().dateIntToYMDHNString(endTime)}, '
'needAuthor: $needAuthor, signKey: $signKey, privateKey: $privateKey}';
}

View File

@ -16,7 +16,6 @@ abstract class Reply{
Reply.parseData(this.commandType, List<int> dataDetail);
void errorWithStstus(int status){
switch(status){
case 0x00:
//
@ -119,7 +118,7 @@ abstract class Reply{
break;
case 0x16:
// ...
AppLog.log("$logTag ${commandType!.typeName}正在开锁中...");
AppLog.log("$logTag ${commandType!.typeName} $status 正在开锁中...");
showErrorMessage("正在开锁中...");
break;
case 0xff:
@ -129,7 +128,7 @@ abstract class Reply{
break;
default:
//
AppLog.log("$logTag ${commandType!.typeName} 蓝牙返回其他错误问题");
AppLog.log("$logTag ${commandType!.typeName} $status 蓝牙返回其他错误问题");
break;
}
}

View File

@ -35,7 +35,8 @@ abstract class SenderProtocol extends IOData {
void printLog(List<int> data) {
AppLog.log(
"App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
"App -> 锁,指令类型:${commandType!.typeName} ${commandType!.typeValue == 0x3030
? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data :${data.length}");
}
//TODO:Ï

View File

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
@ -156,17 +157,30 @@ class SenderBeforeDataManage {
}
LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo;
DateTime startTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000);
DateTime endTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000);
bool isRound = currentKeyInfo.keyType == XSConstantMacro.keyTypeLoop;
DateTime? startTime;
DateTime? endTime;
var startDateTime = 0;
var endDateTime = 0;
bool isRound = false;
var useCountLimit = 0xffff;
if(currentKeyInfo.keyType == XSConstantMacro.keyTypeTime){
//
startDateTime = currentKeyInfo.startDate! ~/ 1000;
endDateTime = currentKeyInfo.endDate! ~/ 1000;
}else if(currentKeyInfo.keyType == XSConstantMacro.keyTypeLoop){
//
isRound = true;
startTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate!);
endTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate!);
var startDateTime = currentKeyInfo.startDate! ~/ 1000;
var endDateTime = currentKeyInfo.endDate! ~/ 1000;
if (isRound) {
//
startDateTime = DateTool().dateToTimestamp(DateTool().dateToYMDString(currentKeyInfo.startDate!.toString()), 1) ~/ 1000;
endDateTime = (DateTool().dateToTimestamp(DateTool().dateToYMDString(currentKeyInfo.endDate!.toString()), 1) + CommonDataManage().dayLatestTime) ~/ 1000;
}
}else if(currentKeyInfo.keyType == XSConstantMacro.keyTypeOnce){
//
useCountLimit = 1;
}
// AppLog.log("startTime.hour:${startTime!.hour} startTime.minute:${startTime!.minute} endTime.hour:${endTime!.hour} endTime.minute:${endTime!.minute}}");
var addUserData = AddUserCommand(
lockID: BlueManage().connectDeviceName,
authUserID: currentKeyInfo.senderUserId!.toString(),
@ -176,16 +190,16 @@ class SenderBeforeDataManage {
keyType: 0,
startDate: startDateTime,
expireDate: endDateTime,
useCountLimit: 0xFFFF,
useCountLimit: useCountLimit,
isRound: isRound ? 1 : 0,
weekRound: isRound
? DateTool().accordingTheCycleIntoTheCorrespondingNumber(
currentKeyInfo.weekDays!)
: 0,
startHour: isRound ? startTime.hour : 0,
startMin: isRound ? startTime.minute : 0,
endHour: isRound ? endTime.hour : 0,
endMin: isRound ? endTime.minute : 0,
startHour: isRound ? startTime!.hour : 0,
startMin: isRound ? startTime!.minute : 0,
endHour: isRound ? endTime!.hour : 0,
endMin: isRound ? endTime!.minute : 0,
role: currentKeyInfo.keyRight == 1 ? 1 : 0,
password: "123456",
needAuthor: 1,

View File

@ -214,8 +214,9 @@ class _VolumeAuthorizationLockPageState extends State<VolumeAuthorizationLockPag
: _lockIdList.length.toString(),
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
.then((value) {
Navigator.pushNamed(context, Routers.massSendLockGroupListPage, arguments: {
"keyLimits":"1"
}).then((value) {
//ID列表
if (value != null) {
value as Map<String, dynamic>;

View File

@ -183,7 +183,8 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
'type': 2,
'id': state.fingerprintItemData.value.cardId.toString()
'id': state.fingerprintItemData.value.cardId.toString(),
'recordName': state.fingerprintItemData.value.cardName
});
}),
// SizedBox(height: 40.h),

View File

@ -33,13 +33,13 @@ class CardListLogic extends BaseGetXController {
_replyAddICCardBegin(reply);
}
if(reply is SenderCheckingCardStatusReply) {
_replyReferEventRecordNumber(reply);
}
if(reply is SenderCheckingUserInfoCountReply){
_replyCheckingUserInfoCount(reply);
}
// if(reply is SenderCheckingCardStatusReply) {
// _replyReferEventRecordNumber(reply);
// }
//
// if(reply is SenderCheckingUserInfoCountReply){
// _replyCheckingUserInfoCount(reply);
// }
});
}
@ -94,134 +94,134 @@ class CardListLogic extends BaseGetXController {
}
}
//
Future<void> _replyReferEventRecordNumber(Reply reply) async {
int status = reply.data[2];
switch(status){
case 0x00:
//
// _getLockStatus();
break;
case 0x06:
//
break;
default:
//
break;
}
}
// //
// Future<void> _replyReferEventRecordNumber(Reply reply) async {
// int status = reply.data[2];
// switch(status){
// case 0x00:
// //
// // _getLockStatus();
// break;
// case 0x06:
// //
// break;
// default:
// //
// break;
// }
// }
//
// // ()
// Future<void> _replyCheckingUserInfoCount(Reply reply) async {
// int status = reply.data[2];
//
// //
// int userNum = reply.data[5];
//
// //
// int fingerNum = reply.data[6];
//
// //
// int pwdNum = reply.data[7];
//
// //
// int cardNum = reply.data[8];
//
// //
// int logsNum = reply.data[9];
//
// //
// int verNo = reply.data[10];
//
// //
// int maxAdminFingerNum = reply.data[11];
//
// //
// int maxUserFingerNum = reply.data[12];
//
// //
// int maxAdminPassNum = reply.data[13];
//
// //
// int maxUserPassNum = reply.data[14];
//
// //
// int maxAdminCardNum = reply.data[15];
//
// //
// int maxUserCardNum = reply.data[16];
//
// //
// var serialNo = reply.data.sublist(17, 21);
//
// switch(status){
// case 0x00:
// //
// // _getLockStatus();
// break;
// case 0x06:
// //
// break;
// default:
// //
// break;
// }
// }
// ()
Future<void> _replyCheckingUserInfoCount(Reply reply) async {
int status = reply.data[2];
//
int userNum = reply.data[5];
//
int fingerNum = reply.data[6];
//
int pwdNum = reply.data[7];
//
int cardNum = reply.data[8];
//
int logsNum = reply.data[9];
//
int verNo = reply.data[10];
//
int maxAdminFingerNum = reply.data[11];
//
int maxUserFingerNum = reply.data[12];
//
int maxAdminPassNum = reply.data[13];
//
int maxUserPassNum = reply.data[14];
//
int maxAdminCardNum = reply.data[15];
//
int maxUserCardNum = reply.data[16];
//
var serialNo = reply.data.sublist(17, 21);
switch(status){
case 0x00:
//
// _getLockStatus();
break;
case 0x06:
//
break;
default:
//
break;
}
}
//
Future<void> senderCheckingCardStatus() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.senderCheckingCardStatusCommand(
keyID:BlueManage().connectDeviceName,
userID:await Storage.getUid(),
role:0xff,
cardCount:20,
cardNo:1,
token:getTokenList,
needAuthor:1,
publicKey:getPublicKeyList,
privateKey:getPrivateKeyList,
);
}
});
}
// ()
Future<void> senderCheckingUserInfoCount() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.senderCheckingUserInfoCountCommand(
keyID:BlueManage().connectDeviceName,
userID:await Storage.getUid(),
role:0xff,
nowTime:DateTime.now().millisecondsSinceEpoch~/1000,
token:getTokenList,
needAuthor:1,
publicKey:getPublicKeyList,
privateKey:getPrivateKeyList,
);
}
});
}
// //
// Future<void> senderCheckingCardStatus() async {
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
// if (state == BluetoothConnectionState.connected) {
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var token = await Storage.getStringList(saveBlueToken);
// List<int> getTokenList = changeStringListToIntList(token!);
//
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
//
// IoSenderManage.senderCheckingCardStatusCommand(
// keyID:BlueManage().connectDeviceName,
// userID:await Storage.getUid(),
// role:0xff,
// cardCount:20,
// cardNo:1,
// token:getTokenList,
// needAuthor:1,
// publicKey:getPublicKeyList,
// privateKey:getPrivateKeyList,
// );
// }
// });
// }
//
// // ()
// Future<void> senderCheckingUserInfoCount() async {
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
// if (state == BluetoothConnectionState.connected) {
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var token = await Storage.getStringList(saveBlueToken);
// List<int> getTokenList = changeStringListToIntList(token!);
//
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
//
// IoSenderManage.senderCheckingUserInfoCountCommand(
// keyID:BlueManage().connectDeviceName,
// userID:await Storage.getUid(),
// role:0xff,
// nowTime:DateTime.now().millisecondsSinceEpoch~/1000,
// token:getTokenList,
// needAuthor:1,
// publicKey:getPublicKeyList,
// privateKey:getPrivateKeyList,
// );
// }
// });
// }
//
Future<void> senderAddICCard() async {
@ -262,19 +262,6 @@ class CardListLogic extends BaseGetXController {
privateKey:getPrivateKeyList,
token: getTokenList,
);
// IoSenderManage.senderAddICCardCommand(
// keyID:state.deletKeyID,
// userID:state.deletUserID,
// cardNo:state.deletCardNo,
// useCountLimit:0,
// startTime:0x11223344,
// endTime:0x11223344,
// needAuthor:1,
// signKey:signKeyDataList,
// privateKey:getPrivateKeyList,
// token: getTokenList,
// );
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();

View File

@ -1,5 +1,6 @@
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import '../../../../tools/dateTool.dart';
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
@ -25,7 +26,8 @@ class OtherTypeKeyChangeDateState{
fingerprintItemData.value = map["fingerprintItemData"];
}
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
AppLog.log("fingerprintItemData.value.startDate:${fingerprintItemData.value.startDate} fingerprintItemData.value.endDate:${fingerprintItemData.value.endDate}");
if(fingerprintItemData.value.startDate == 0){
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
beginTimeTimestamp.value = DateTime.now().millisecondsSinceEpoch;
@ -36,5 +38,7 @@ class OtherTypeKeyChangeDateState{
beginTimeTimestamp.value = fingerprintItemData.value.startDate!;
endTimeTimestamp.value = fingerprintItemData.value.endDate!;
}
AppLog.log("beginTime.value:${beginTime.value} endTime.value:${endTime.value} beginTimeTimestamp.value:${beginTimeTimestamp.value} endTimeTimestamp.value:${endTimeTimestamp.value}");
}
}

View File

@ -70,7 +70,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderAddFaceCommand(
keyID:state.fingerprintItemData.value.cardId!.toString(),
keyID:state.fingerprintItemData.value.faceId!.toString(),
userID:await Storage.getUid(),
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
useCountLimit:0xffff,
@ -119,7 +119,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
List<int> signKeyDataList = changeStringListToIntList(signKey!);
IoSenderManage.senderAddFaceCommand(
keyID:state.fingerprintItemData.value.cardId!.toString(),
keyID:state.fingerprintItemData.value.faceId!.toString(),
userID:await Storage.getUid(),
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
useCountLimit:0xffff,
@ -426,7 +426,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
endDate: state.endDateTimestamp.value,
startTime: state.starTimeTimestamp.value,
endTime: state.endTimeTimestamp.value,
faceType: 2,
faceType: 4,
weekDay: state.weekDay.value,
faceName: state.fingerprintItemData.value.faceName!,
addType: "1",
@ -435,6 +435,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: () {
eventBus.fire(OtherTypeRefreshListEvent());
Get.back(result: {
"starDate":state.starDateTimestamp.value.toString(),
"endDate":state.endDateTimestamp.value.toString(),

View File

@ -62,6 +62,11 @@ class _OtherTypeKeyChangeValidityDatePageState
return;
}
if(state.weekDay.value.isEmpty){
logic.showToast("请选择有效日".tr);
return;
}
if (state.starTimeTimestamp.value >=
state.endTimeTimestamp.value) {
logic.showToast("失效时间要大于生效时间".tr);

View File

@ -1,36 +1,44 @@
import 'dart:async';
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../network/api_repository.dart';
import '../../../../../tools/eventBusEventManage.dart';
import 'checkingInAddStaffSelectKey_entity.dart';
import 'checkingInAddStaff_state.dart';
typedef KeyClickCallback = void Function(List<CheckingInAddStaffKeyEntity> selectKeyList);
class CheckingInAddStaffLogic extends BaseGetXController{
typedef KeyClickCallback = void Function(
List<CheckingInAddStaffKeyEntity> selectKeyList);
class CheckingInAddStaffLogic extends BaseGetXController {
CheckingInAddStaffState state = CheckingInAddStaffState();
//
StreamSubscription? _getNumberEvent;
void _initLoadDataAction() {
// eventBus
_getNumberEvent = eventBus.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>().listen((event) {
state.attendanceWayNumber.value = event.number;
isCanClickAction();
});
_getNumberEvent = eventBus
.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>()
.listen((event) {
state.attendanceWayNumber.value = event.number;
isCanClickAction();
});
}
//
void addStaffLoadData() async{
void addStaffLoadData() async {
var usernameType = "1";
if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){
if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) {
usernameType = "2";
}
// app且没有钥匙时attendanceWayNumber
if(state.appUnHaveAccount.value && state.selectPrintingMethodType.value == "1"){
if (state.appUnHaveAccount.value &&
state.selectPrintingMethodType.value == "1") {
state.attendanceWayNumber.value = state.staffAccountController.text;
}
@ -41,36 +49,38 @@ class CheckingInAddStaffLogic extends BaseGetXController{
have: state.appUnHaveAccount.value ? "2" : "1",
staffName: state.staffNameController.text,
countryCode: state.countryCode.value,
usernameType:usernameType,
usernameType: usernameType,
);
if(entity.errorCode!.codeIsSuccessful){
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshCheckInSetDataEvent());
eventBus.fire(RefreshCheckInListEvent());
Get.back(result: "addScuess");
}else if(entity.errorCode! == 425){
} else if (entity.errorCode! == 425) {
showToast(entity.errorMsg!);
}
}
// - 1APP234attendanceWay分别为用户名
void addStaffSelectKey(KeyClickCallback kyClickCallback) async{
// - 1APP234
// attendanceWay分别为用户名
void addStaffSelectKey(KeyClickCallback kyClickCallback) async {
var entity = await ApiRepository.to.addStaffSelectKeyData(
companyId: state.companyId.value,
type:state.selectPrintingMethodType.value,
type: state.selectPrintingMethodType.value,
);
if(entity.errorCode!.codeIsSuccessful){
if (entity.errorCode!.codeIsSuccessful) {
state.keyEntity.value = entity.data!;
kyClickCallback(state.keyEntity.value);
}
}
//
void editStaffLoadData() async{
void editStaffLoadData() async {
var usernameType = "1";
if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){
if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) {
usernameType = "2";
}
var entity = await ApiRepository.to.editStaffData(
attendanceType: state.selectPrintingMethodType.value,
attendanceWay: state.attendanceWayNumber.value,
@ -126,11 +136,14 @@ class CheckingInAddStaffLogic extends BaseGetXController{
//
void isCanClickAction() {
if(state.selectPrintingMethodType.value == "1" && state.appUnHaveAccount.value){
if (state.selectPrintingMethodType.value == "1" &&
state.appUnHaveAccount.value) {
//
state.isCanClick.value = state.staffNameIsNotEmpty && state.staffAccountIsNotEmpty;
}else{
state.isCanClick.value = state.staffNameIsNotEmpty && state.attendanceWayNumberIsNotEmpty;
state.isCanClick.value =
state.staffNameIsNotEmpty && state.staffAccountIsNotEmpty;
} else {
state.isCanClick.value =
state.staffNameIsNotEmpty && state.attendanceWayNumberIsNotEmpty;
}
}
@ -145,7 +158,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@ -156,5 +168,4 @@ class CheckingInAddStaffLogic extends BaseGetXController{
_getNumberEvent!.cancel();
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@ -6,7 +5,7 @@ import '../../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
import 'checkingInAddStaffSelectKey_entity.dart';
class CheckingInAddStaffState{
class CheckingInAddStaffState {
final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs;
final staffListItemData = CheckingInAddStaffListItemEntity().obs;
@ -14,36 +13,41 @@ class CheckingInAddStaffState{
final TextEditingController staffNameController = TextEditingController();
final TextEditingController staffAccountController = TextEditingController();
final selectPrintingMethodType = "1".obs;// 1APP 2 3 4 5
final selectPrintingMethodStr = "APP".obs;//
final selectPrintingMethodType = "1".obs; // 1APP 2 3 4 5
final selectPrintingMethodStr = "APP".obs; //
final countryName = "中国".tr.obs;
final countryCode = "86".obs;
final appUnHaveAccount = true.obs;//
final keyEntity = <CheckingInAddStaffKeyEntity>[].obs;//
final appUnHaveAccount = true.obs; //
final keyEntity = <CheckingInAddStaffKeyEntity>[].obs; //
final isAdd = "1".obs; // 1 2
final attendanceWayNumber = "".obs;
final isCanClick = false.obs;
var staffName = ''.obs;
var staffAccount = ''.obs;
bool get staffNameIsNotEmpty => staffName.value.isNotEmpty;
bool get staffAccountIsNotEmpty => staffAccount.value.isNotEmpty;
bool get attendanceWayNumberIsNotEmpty => attendanceWayNumber.value.isNotEmpty;
bool get attendanceWayNumberIsNotEmpty =>
attendanceWayNumber.value.isNotEmpty;
CheckingInAddStaffState() {
Map map = Get.arguments;
getKeyInfosData.value = map["getKeyInfosData"];
companyId.value = map["companyId"];
getKeyInfosData.value = map["getKeyInfosData"];
companyId.value = map["companyId"];
isAdd.value = map["isAdd"];
if(isAdd.value == "2"){
staffListItemData.value = map["staffListItem"];
if (isAdd.value == "2") {
staffListItemData.value = map["staffListItem"];
staffNameController.text = staffListItemData.value.staffName!;
selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString();
switch(staffListItemData.value.attendanceType){
selectPrintingMethodType.value =
staffListItemData.value.attendanceType.toString();
switch (staffListItemData.value.attendanceType) {
case 1:
selectPrintingMethodStr.value = "APP";
break;
@ -58,17 +62,12 @@ class CheckingInAddStaffState{
break;
}
if(staffListItemData.value.attendanceWay!.isNotEmpty){
if(staffListItemData.value.cardStatus != 0){
appUnHaveAccount.value = false;
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
}else{
appUnHaveAccount.value = true;
}
}else{
if (staffListItemData.value.attendanceWay!.isNotEmpty) {
appUnHaveAccount.value = false;
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
} else {
appUnHaveAccount.value = true;
}
}
}
}

View File

@ -37,7 +37,7 @@ class CheckingInAddStaffListItemEntity {
int? staffId;
int? attendanceType;
int? countryCode;
int? cardStatus;
int? cardStatus;//0 1
String? attendanceWay;
String? reason;

View File

@ -1,14 +1,14 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
import 'package:star_lock/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import '../../../app_settings/app_settings.dart';
import '../../../blue/blue_manage.dart';
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
import '../../../blue/io_reply.dart';
@ -26,16 +26,17 @@ class DoorLockLogLogic extends BaseGetXController {
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
if (reply is SenderReferEventRecordTimeReply && state.ifCurrentScreen.value == true) {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) {
if (reply is SenderReferEventRecordTimeReply &&
state.ifCurrentScreen.value == true) {
_replyReferEventRecordTime(reply);
}
});
}
//
Future<void> _replyReferEventRecordTime(Reply reply) async {
Future<void> _replyReferEventRecordTime(Reply reply) async {
cancelBlueConnetctToastTimer();
int status = reply.data[2];
switch (status) {
@ -47,7 +48,7 @@ class DoorLockLogLogic extends BaseGetXController {
if (dataLength > 0) {
reply.data.removeRange(0, 7);
// 8
if(reply.data.length < 17){
if (reply.data.length < 17) {
return;
}
var getList = splitList(reply.data, 17);
@ -58,28 +59,33 @@ class DoorLockLogLogic extends BaseGetXController {
// AppLog.log("indexList:$indexList");
var indexMap = {};
indexMap["type"] = indexList[0].toString();
if(indexList[0] == 2){
int operateDate = 0;
if (indexList[0] == 2) {
var passwordData = indexList.sublist(7, 17);
var password = utf8String(passwordData);
indexMap["user"] = password.toString();
}else{
int userNo = (indexList[1]*255) + indexList[2];
}else {
int userNo = (indexList[1] * 256) + indexList[2];
indexMap["user"] = userNo.toString();
}
indexMap["success"] = "1";
int time = ((0xff & indexList[(3)]) << 24 |
(0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 |
(0xFF & indexList[6]));
(0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 |
(0xFF & indexList[6]));
indexMap["date"] = "${time * 1000}";
uploadList.add(indexMap);
if (i == getList.length - 1) {
//
state.operateDate = operateDate;
}
}
lockRecordUploadData(uploadList);
if(dataLength == state.logCountPage){
if (dataLength == state.logCountPage) {
state.ifHaveNext = true;
}
}
@ -97,10 +103,11 @@ class DoorLockLogLogic extends BaseGetXController {
// ()
Future<void> senderReferEventRecordTime() async {
showEasyLoading();
showBlueConnetctToastTimer(action: (){
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionStateState) async {
if (connectionStateState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -122,10 +129,11 @@ class DoorLockLogLogic extends BaseGetXController {
publicKey: getPublicKeyList,
privateKey: getPrivateKeyList,
);
} else if (connectionStateState == BluetoothConnectionState.disconnected) {
} else if (connectionStateState ==
BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
if(state.ifCurrentScreen.value == true){
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
}
@ -133,17 +141,24 @@ class DoorLockLogLogic extends BaseGetXController {
}
//
void mockNetworkDataRequest() async {
void mockNetworkDataRequest({required bool isRefresh}) async {
//
if (isRefresh) {
state.lockLogItemList.clear();
pageNo = 1;
}
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
lockId: state.keyInfos.value.lockId!,
lockEventType: state.dropdownValue.value,
pageNo: 1,
pageNo: pageNo,
pageSize: int.parse(pageSize),
startDate: state.startDate.value,
endDate: state.endDate.value);
if (entity.errorCode!.codeIsSuccessful) {
state.lockLogItemList.value = entity.data!.itemList!;
//
state.lockLogItemList.addAll(entity.data!.itemList!);
//
pageNo++;
}
}
@ -152,20 +167,23 @@ class DoorLockLogLogic extends BaseGetXController {
void _getDoorLockLogListRefreshUIAction() {
_getDoorLockLogListRefreshUIEvent =
eventBus.on<DoorLockLogListRefreshUI>().listen((event) {
state.currentSelectDate.value = event.getDoorLockLogTime;
// startDate为当天的0点
state.startDate.value = DateTime(event.getDoorLockLogTime.year,
event.getDoorLockLogTime.month, event.getDoorLockLogTime.day)
state.startDate.value = DateTime(
state.currentSelectDate.value.year,
state.currentSelectDate.value.month,
state.currentSelectDate.value.day)
.millisecondsSinceEpoch;
// endDate为下一天的0点1
state.endDate.value = (DateTime(
event.getDoorLockLogTime.year,
event.getDoorLockLogTime.month,
event.getDoorLockLogTime.day + 1)
state.currentSelectDate.value.year,
state.currentSelectDate.value.month,
state.currentSelectDate.value.day + 1)
.subtract(const Duration(milliseconds: 1)))
.millisecondsSinceEpoch;
pageNo = 1;
mockNetworkDataRequest();
mockNetworkDataRequest(isRefresh: true);
});
}
@ -186,21 +204,24 @@ class DoorLockLogLogic extends BaseGetXController {
.lockRecordUploadData(
lockId: state.keyInfos.value.lockId.toString(), records: list);
if (entity.errorCode!.codeIsSuccessful) {
if(state.ifHaveNext == true){
if (state.ifHaveNext == true) {
getLockRecordLastUploadDataTime();
}else{
pageNo = 1;
mockNetworkDataRequest();
} else {
mockNetworkDataRequest(isRefresh: true);
}
}
}
//
void clearOperationRecordRequest() async {
KeyOperationRecordEntity entity =
await ApiRepository.to.clearOperationRecord('28');
KeyOperationRecordEntity entity = await ApiRepository.to
.clearOperationRecord(
CommonDataManage().currentKeyInfo.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
showToast("清除数据成功");
showToast("清除数据成功", something: () {
pageNo = 1;
mockNetworkDataRequest(isRefresh: true);
});
}
}
@ -214,7 +235,7 @@ class DoorLockLogLogic extends BaseGetXController {
if (isDemoMode == false) {
// _initReplySubscription();
mockNetworkDataRequest();
mockNetworkDataRequest(isRefresh: true);
_getDoorLockLogListRefreshUIAction();
}
}

View File

@ -5,9 +5,12 @@ import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
import 'package:star_lock/tools/EasyRefreshTool.dart';
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:timelines/timelines.dart';
import '../../../app_settings/app_colors.dart';
@ -26,11 +29,6 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
final logic = Get.put(DoorLockLogLogic());
final state = Get.find<DoorLockLogLogic>().state;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -39,6 +37,23 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
Visibility(
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
? true
: false,
child: TextButton(
onPressed: () {
ShowCupertinoAlertView().showClearOperationRecordAlert(
clearClick: () {
logic.clearOperationRecordRequest();
});
},
child: Text(
'清空记录'.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
))),
],
),
body: Column(
mainAxisSize: MainAxisSize.max,
@ -52,7 +67,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
endIndent: 30.w,
),
eventDropDownWidget(),
Expanded(child: Obx(() => timeLineView(state.lockLogItemList)))
Expanded(child: timeLineView())
],
),
);
@ -81,19 +96,34 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
highlightColor: Colors.yellow,
disabledColor: Colors.grey,
),
child: AdvancedCalendar(
controller: state.calendarControllerCustom,
events: state.events,
weekLineHeight: 48.0,
startWeekDay: 1,
innerDot: true,
keepLineSize: true,
calendarTextStyle: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w400,
height: 1.3125,
letterSpacing: 0,
),
child: Stack(
children: [
AdvancedCalendar(
controller: state.calendarControllerCustom,
events: state.events,
weekLineHeight: 48.0,
startWeekDay: 1,
innerDot: true,
keepLineSize: true,
calendarTextStyle: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w400,
height: 1.3125,
letterSpacing: 0,
),
),
Positioned(
top: 8.0,
right: 8.0,
child: Obx(() => Text(
'${state.currentSelectDate.value.year}${state.currentSelectDate.value.month}',
style: theme.textTheme.titleMedium!.copyWith(
fontSize: 16,
color: theme.colorScheme.secondary,
),
)),
),
],
),
);
}
@ -110,7 +140,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
value: state.dropdownTitle.value,
valueChanged: (value) {
state.dropdownValue.value = int.parse(value);
logic.mockNetworkDataRequest();
logic.mockNetworkDataRequest(isRefresh: true);
})),
],
),
@ -118,92 +148,103 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
}
//
Widget timeLineView(List<DoorLockLogDataItem> timelineDataList) {
Widget timeLineView() {
return Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h, top: 20.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.w),
),
child: timelineDataList.isNotEmpty
? Timeline.tileBuilder(
builder: TimelineTileBuilder.fromStyle(
contentsAlign: ContentsAlign.basic,
itemCount: timelineDataList.length,
contentsBuilder: (context, index) {
DoorLockLogDataItem timelineData = timelineDataList[index];
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
timelineData.operateDate!);
String formattedTime =
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
return Padding(
padding: EdgeInsets.only(left: 20.w, top: 20.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'$formattedTime ${timelineData.recordTypeName}',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 24.sp,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 10.h,
),
GestureDetector(
onTap: () {
Get.toNamed(Routers.videoLogDetailPage);
},
child: Stack(
children: [
timelineData.imagesUrl!.isNotEmpty
? Image.network(
timelineData.imagesUrl!,
width: 260.w,
height: 260.h,
)
: Container(),
Positioned(
top: 150.h,
left: 10.w,
child: Image(
image: const AssetImage(
'images/main/icon_lockLog_play.png'),
width: 24.w,
height: 20.w,
),
),
],
),
),
SizedBox(
height: 20.h,
),
],
child: Obx(() => EasyRefreshTool(
onRefresh: () async {
logic.mockNetworkDataRequest(isRefresh: true);
},
onLoad: () async {
logic.mockNetworkDataRequest(isRefresh: false);
},
child: state.lockLogItemList.isNotEmpty
? Timeline.tileBuilder(
builder: _timelineBuilderWidget(),
theme: TimelineThemeData(
nodePosition: 0.04, //
connectorTheme: const ConnectorThemeData(
thickness: 1.0,
color: AppColors.greyLineColor,
indent: 0.5,
),
);
indicatorTheme: const IndicatorThemeData(
size: 8.0,
color: AppColors.greyLineColor,
position: 0.4,
),
),
)
: NoData())),
);
}
TimelineTileBuilder _timelineBuilderWidget() {
return TimelineTileBuilder.fromStyle(
contentsAlign: ContentsAlign.basic,
itemCount: state.lockLogItemList.length,
contentsBuilder: (context, index) {
DoorLockLogDataItem timelineData = state.lockLogItemList[index];
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(timelineData.operateDate!);
String formattedTime =
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
return Padding(
padding: EdgeInsets.only(left: 20.w, top: 20.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}用" : ""}${timelineData.recordTypeName}',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 24.sp,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 10.h,
),
GestureDetector(
onTap: () {
Get.toNamed(Routers.videoLogDetailPage);
},
),
theme: TimelineThemeData(
nodePosition: 0.04, //
connectorTheme: const ConnectorThemeData(
thickness: 1.0,
color: AppColors.greyLineColor,
indent: 0.5,
),
indicatorTheme: const IndicatorThemeData(
size: 8.0,
color: AppColors.greyLineColor,
position: 0.4,
child: Stack(
children: [
timelineData.imagesUrl!.isNotEmpty
? Image.network(
timelineData.imagesUrl!,
width: 260.w,
height: 260.h,
)
: Container(),
Positioned(
top: 150.h,
left: 10.w,
child: Image(
image: const AssetImage(
'images/main/icon_lockLog_play.png'),
width: 24.w,
height: 20.w,
),
),
],
),
),
)
: NoData(),
SizedBox(
height: 20.h,
),
],
),
);
},
);
}

View File

@ -17,31 +17,38 @@ class DoorLockLogState {
DateTime(2024, 10, 10),
];
final startDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day).millisecondsSinceEpoch.obs;
final endDate = (DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1).subtract(const Duration(milliseconds: 1))).millisecondsSinceEpoch.obs;
final startDate =
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
.millisecondsSinceEpoch
.obs;
final endDate = (DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1)
.subtract(const Duration(milliseconds: 1)))
.millisecondsSinceEpoch
.obs;
var dropdownTitle = '全部事件'.obs;
var dropdownTitle = '全部事件'.tr.obs;
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
List<DropDownItem> getDropDownItemList = [
DropDownItem(
itemTitle: "全部事件",
itemTitle: "全部事件".tr,
itemValue: XSConstantMacro.lockEventTypeAll.toString(),
isCheked: false),
DropDownItem(
itemTitle: "开锁事件",
itemTitle: "开锁事件".tr,
itemValue: XSConstantMacro.lockEventTypeOpenDoor.toString(),
isCheked: false),
DropDownItem(
itemTitle: "异常事件",
itemTitle: "异常事件".tr,
itemValue: XSConstantMacro.lockEventTypeAbnormal.toString(),
isCheked: false),
DropDownItem(
itemTitle: "门铃事件",
itemTitle: "门铃事件".tr,
itemValue: XSConstantMacro.lockEventTypeDoorbell.toString(),
isCheked: false),
DropDownItem(
itemTitle: "视频事件",
itemTitle: "视频事件".tr,
itemValue: XSConstantMacro.lockEventTypeVideo.toString(),
isCheked: false),
];
@ -50,6 +57,7 @@ class DoorLockLogState {
var operateDate = 0; //
var ifHaveNext = false; //
var logCountPage = 10; //
var currentSelectDate = DateTime.now().obs; //
DoorLockLogState() {
keyInfos.value = Get.arguments["keyInfo"];

View File

@ -1,9 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
@ -135,16 +137,32 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
Future<void> checkRealNameStatus(int realNameAuthStatus) async {
//
if (realNameAuthStatus == 1) {
if (state.getRealName.value.isEmpty ||
state.getIDCardNumber.value.isEmpty) {
ShowCupertinoAlertView()
.showOpenAuthWithIDCardInfoAlert((idCard, realName) {
state.getIDCardNumber.value = idCard ?? '';
state.getRealName.value = realName ?? '';
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
);
if (entity.errorCode!.codeIsSuccessful) {
if (state.getRealName.value.isEmpty ||
state.getIDCardNumber.value.isEmpty) {
ShowCupertinoAlertView()
.showOpenAuthWithIDCardInfoAlert((idCard, realName) {
state.getIDCardNumber.value = idCard ?? '';
state.getRealName.value = realName ?? '';
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
});
} else {
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
});
} else {
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
}
} else if (entity.errorCode == 432) {
//432--
ShowCupertinoAlertView().showBuyTipWithContentAlert(
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
sureClick: () {
Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': false});
});
} else if (entity.errorCode == 433) {
//
ShowCupertinoAlertView().showContactAdministratorBuyAlert();
}
} else {
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
@ -229,11 +247,14 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
Future openModalBottomSheet(BuildContext context) async {
var textList = <String>[];
if (CommonDataManage().currentKeyInfo.keyRight == 1) {
if (state.itemData.value.keyRight == 1) {
//
textList = [
state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr
state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr,
"取消授权".tr
];
} else if (CommonDataManage().currentKeyInfo.isLockOwner == 1) {
//
if (state.keyType.value == 1 || state.keyType.value == 2) {
textList = [
state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr,
@ -241,9 +262,15 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
];
} else if (state.keyType.value == 4) {
textList = [
state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr
state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen
? '取消冻结'.tr
: "冻结".tr
];
}
}else{
textList = [
state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr,
];
}
showModalBottomSheet(
context: context,
@ -336,13 +363,36 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
return currentController;
}
noModificationAllowedDuringFreeze(){
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
noModificationAllowedDuringFreeze() {
if (state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen) {
showToast("冻结状态下不允许修改钥匙权限".tr);
return;
}
}
//
Future<void> keyCheckFace() async {
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
);
if (entity.errorCode!.codeIsSuccessful) {
//
state.isRequireAuth.value = true;
state.isRealNameAuth.value = true;
} else if (entity.errorCode == 432) {
//432--
ShowCupertinoAlertView().showBuyTipWithContentAlert(
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
sureClick: () {
Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': false});
});
} else if (entity.errorCode == 433) {
//
ShowCupertinoAlertView().showContactAdministratorBuyAlert();
}
}
@override
void onReady() {
// TODO: implement onReady

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -227,13 +228,16 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
Obx(
() => Visibility(
// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
visible: CommonDataManage()
.currentKeyInfo
.lockSetting!
.remoteUnlock ==
1
? true
: false,
// visible: CommonDataManage()
// .currentKeyInfo
// .lockSetting!
// .remoteUnlock ==
// 1
// ? true
// : false,
visible: (CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1 && state.itemData.value.keyRight != 1)
? true
: false,
child: CommonItem(
leftTitel: "远程开锁".tr,
rightTitle: "",
@ -256,7 +260,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
'type': 5,
'id': state.itemData.value.keyId.toString()
'id': state.itemData.value.keyId.toString(),
'recordName': state.itemData.value.keyName
});
}),
Container(height: 40.h),

View File

@ -24,6 +24,7 @@ class ElectronicKeyDetailState {
var isRealNameAuth = false.obs; // 0: 1:
var getRealName = ''.obs; //
var getIDCardNumber = ''.obs; //
var isRequireAuth = false.obs; //
ElectronicKeyDetailState() {
Map map = Get.arguments;

View File

@ -201,8 +201,9 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
: state.lockIdList.length.toString(),
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
.then((value) {
Navigator.pushNamed(context, Routers.massSendLockGroupListPage, arguments:{
"keyLimits":"2",
}).then((value) {
//ID列表
if (value != null) {
value as Map<String, dynamic>;

View File

@ -1,5 +1,4 @@
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:get/get.dart';
@ -25,5 +24,4 @@ class MassSendElectronicKeyState{
var isDemoMode = false;
final sendSucceedType = 0.obs;
}

View File

@ -10,7 +10,7 @@ class MassSendLockGroupListLogic extends BaseGetXController {
//
Future<void> mockNetworkDataRequest() async {
MassSendLockGroupListEntity entity =
await ApiRepository.to.lockGroupList('2');
await ApiRepository.to.lockGroupList(state.keyLimits);
if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) {
state.lockGroupList.value = entity.data!.groupList!;

View File

@ -4,4 +4,12 @@ class MassSendLockGroupListState {
var lockGroupList = [].obs;
var selectLockIdList = [].obs;
var isVip = false.obs;
var keyLimits = '';// 1() 2
MassSendLockGroupListState(){
Map map = Get.arguments;
if(map["keyLimits"] != null){
keyLimits = map['keyLimits'];
}
}
}

View File

@ -1,9 +1,9 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/blue/io_type.dart';
import 'package:star_lock/main/lockDetail/face/addFace/addFace_state.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
@ -23,8 +23,7 @@ class AddFaceLogic extends BaseGetXController {
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
//
if (reply is SenderAddFaceReply && state.ifCurrentScreen.value == true) {
_replyAddFaceBegin(reply);

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/blue/io_type.dart';
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart';
@ -45,7 +46,6 @@ class FaceDetailLogic extends BaseGetXController {
}else{
editFaceData();
}
deletFaceData();
break;
case 0x06:
//

View File

@ -105,7 +105,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
state.endDate.value = data["endDate"];
state.startTime.value = data["starTime"];
state.endTime.value = data["endTime"];
state.weekDay.value = data["weekDay"];
state.weekDay.value = data["validityValue"];
});
}
}
@ -121,7 +121,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage,
arguments: {
"pushType": 0,
"pushType": 3,
"fingerprintItemData": state.faceItemData.value,
});
if (data != null) {
@ -130,7 +130,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
state.endDate.value = data["endDate"];
state.startTime.value = data["starTime"];
state.endTime.value = data["endTime"];
state.weekDay.value = data["weekDay"];
state.weekDay.value = data["validityValue"];
});
}
})))),
@ -139,13 +139,13 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
child: Obx(() => CommonItem(
leftTitel: "有效时间",
rightTitle:
"${DateTool().dateToHNString(state.startDate.value)}-${DateTool().dateToHNString(state.endDate.value)}",
"${DateTool().dateToHNString(state.startTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
isHaveDirection: true,
action: () async {
var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage,
arguments: {
"pushType": 0,
"pushType": 3,
"fingerprintItemData": state.faceItemData.value,
});
if (data != null) {
@ -191,7 +191,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
'type': 4,
'id': state.faceItemData.value.faceId.toString()
'id': state.faceItemData.value.faceId.toString(),
'recordName': state.faceItemData.value.faceName
});
}),
// SizedBox(height: 40.h),

View File

@ -7,6 +7,7 @@ import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/blue/io_protocol/io_queryingFaceStatus.dart';
import 'package:star_lock/main/lockDetail/face/faceList/faceList_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../app_settings/app_settings.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_checkingUserInfoCount.dart';
import '../../../../blue/io_reply.dart';
@ -28,18 +29,18 @@ class FaceListLogic extends BaseGetXController {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) {
// ()
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen == true)) {
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
_replyAddFaceBegin(reply);
}
if (reply is SenderQueryingFaceStatusReply) {
//
_replyQueryingFaceStatus(reply);
}
if (reply is SenderCheckingUserInfoCountReply) {
_replyCheckingUserInfoCount(reply);
}
// if (reply is SenderQueryingFaceStatusReply) {
// //
// _replyQueryingFaceStatus(reply);
// }
//
// if (reply is SenderCheckingUserInfoCountReply) {
// _replyCheckingUserInfoCount(reply);
// }
});
}
@ -89,19 +90,6 @@ class FaceListLogic extends BaseGetXController {
privateKey:getPrivateKeyList,
token: token,
);
// IoSenderManage.senderAddFaceCommand(
// keyID: state.deletKeyID,
// userID: state.deletUserID,
// faceNo: state.deletFaceNo,
// useCountLimit: 0,
// startTime: 0x11223344,
// endTime: 0x11223344,
// needAuthor: 1,
// publicKey: publicKeyDataList,
// privateKey: getPrivateKeyList,
// token: getTokenList,
// );
break;
default:
//
@ -109,158 +97,158 @@ class FaceListLogic extends BaseGetXController {
}
}
//
Future<void> _replyQueryingFaceStatus(Reply reply) async {
int status = reply.data[2];
// //
// Future<void> _replyQueryingFaceStatus(Reply reply) async {
// int status = reply.data[2];
//
// switch (status) {
// case 0x00:
// //
// // _getLockStatus();
// break;
// case 0x06:
// //
//
// break;
// default:
// //
// break;
// }
// }
switch (status) {
case 0x00:
//
// _getLockStatus();
break;
case 0x06:
//
// //
// Future<void> _replyReferEventRecordNumber(Reply reply) async {
// int status = reply.data[2];
// switch (status) {
// case 0x00:
// //
//
// // _getLockStatus();
// break;
// case 0x06:
// //
//
// break;
// default:
// //
// break;
// }
// }
break;
default:
//
break;
}
}
// // ()
// Future<void> _replyCheckingUserInfoCount(Reply reply) async {
// int status = reply.data[2];
//
// //
// int userNum = reply.data[5];
//
// //
// int fingerNum = reply.data[6];
//
// //
// int pwdNum = reply.data[7];
//
// //
// int cardNum = reply.data[8];
//
// //
// int logsNum = reply.data[9];
//
// //
// int verNo = reply.data[10];
//
// //
// int maxAdminFingerNum = reply.data[11];
//
// //
// int maxUserFingerNum = reply.data[12];
//
// //
// int maxAdminPassNum = reply.data[13];
//
// //
// int maxUserPassNum = reply.data[14];
//
// //
// int maxAdminCardNum = reply.data[15];
//
// //
// int maxUserCardNum = reply.data[16];
//
// //
// var serialNo = reply.data.sublist(17, 21);
//
// switch (status) {
// case 0x00:
// //
// // _getLockStatus();
// break;
// case 0x06:
// //
//
// break;
// default:
// //
// break;
// }
// }
//
Future<void> _replyReferEventRecordNumber(Reply reply) async {
int status = reply.data[2];
switch (status) {
case 0x00:
//
// //
// Future<void> senderQueryingFaceStatus() async {
// BlueManage().bludSendData(BlueManage().connectDeviceName,
// (BluetoothConnectionState state) async {
// if (state == BluetoothConnectionState.connected) {
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var token = await Storage.getStringList(saveBlueToken);
// List<int> getTokenList = changeStringListToIntList(token!);
//
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
//
// IoSenderManage.senderQueryingFaceStatusCommand(
// keyID: BlueManage().connectDeviceName,
// userID: await Storage.getUid(),
// role: 0xff,
// faceCount: 20,
// faceNo: 1,
// token: getTokenList,
// needAuthor: 1,
// publicKey: getPublicKeyList,
// privateKey: getPrivateKeyList,
// );
// }
// });
// }
// _getLockStatus();
break;
case 0x06:
//
break;
default:
//
break;
}
}
// ()
Future<void> _replyCheckingUserInfoCount(Reply reply) async {
int status = reply.data[2];
//
int userNum = reply.data[5];
//
int fingerNum = reply.data[6];
//
int pwdNum = reply.data[7];
//
int cardNum = reply.data[8];
//
int logsNum = reply.data[9];
//
int verNo = reply.data[10];
//
int maxAdminFingerNum = reply.data[11];
//
int maxUserFingerNum = reply.data[12];
//
int maxAdminPassNum = reply.data[13];
//
int maxUserPassNum = reply.data[14];
//
int maxAdminCardNum = reply.data[15];
//
int maxUserCardNum = reply.data[16];
//
var serialNo = reply.data.sublist(17, 21);
switch (status) {
case 0x00:
//
// _getLockStatus();
break;
case 0x06:
//
break;
default:
//
break;
}
}
//
Future<void> senderQueryingFaceStatus() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.senderQueryingFaceStatusCommand(
keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
role: 0xff,
faceCount: 20,
faceNo: 1,
token: getTokenList,
needAuthor: 1,
publicKey: getPublicKeyList,
privateKey: getPrivateKeyList,
);
}
});
}
// ()
Future<void> senderCheckingUserInfoCount() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.senderCheckingUserInfoCountCommand(
keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
role: 0xff,
nowTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
token: getTokenList,
needAuthor: 1,
publicKey: getPublicKeyList,
privateKey: getPrivateKeyList,
);
}
});
}
// // ()
// Future<void> senderCheckingUserInfoCount() async {
// BlueManage().bludSendData(BlueManage().connectDeviceName,
// (BluetoothConnectionState state) async {
// if (state == BluetoothConnectionState.connected) {
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var token = await Storage.getStringList(saveBlueToken);
// List<int> getTokenList = changeStringListToIntList(token!);
//
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
//
// IoSenderManage.senderCheckingUserInfoCountCommand(
// keyID: BlueManage().connectDeviceName,
// userID: await Storage.getUid(),
// role: 0xff,
// nowTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
// token: getTokenList,
// needAuthor: 1,
// publicKey: getPublicKeyList,
// privateKey: getPrivateKeyList,
// );
// }
// });
// }
//
Future<void> senderAddFace() async {
@ -311,33 +299,43 @@ class FaceListLogic extends BaseGetXController {
}
//
void getFaceListData() async {
Future<FingerprintListDataEntity> getFaceListData() async {
var entity = await ApiRepository.to.getFaceListData(
lockId: state.lockId.value.toString(),
pageNo: '1',
pageSize: '20',
pageNo: pageNo.toString(),
pageSize: pageSize.toString(),
searchStr: state.searchController.text,
);
if (entity.errorCode!.codeIsSuccessful) {
state.faceItemListData.value = entity.data!.list!;
// state.faceItemListData.value = entity.data!.list!;
if (pageNo == 1) {
state.faceItemListData.value = entity.data!.list!;
pageNo++;
} else {
if (entity.data!.list!.isNotEmpty) {
state.faceItemListData.value.addAll(entity.data!.list!);
pageNo++;
}
}
}
return entity;
}
//
void deletFacesData() async {
var faceId = "";
var type = "1";
if (state.isDeletAll == false) {
faceId = state.deletKeyID;
type = "0";
}
var entity = await ApiRepository.to.deleteFaceData(
faceId: int.parse(faceId),
lockId: state.lockId.value,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功");
getFaceListData();
showToast("删除成功", something: (){
pageNo = 1;
getFaceListData();
});
}
}
@ -353,8 +351,10 @@ class FaceListLogic extends BaseGetXController {
lockId: state.lockId.value,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("重置成功");
getFaceListData();
showToast("重置成功", something: (){
pageNo = 1;
getFaceListData();
});
}
}
@ -388,6 +388,7 @@ class FaceListLogic extends BaseGetXController {
late StreamSubscription _teamEvent;
void _initRefreshAction() {
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((event) {
pageNo = 1;
getFaceListData();
});
}
@ -403,8 +404,6 @@ class FaceListLogic extends BaseGetXController {
_initReplySubscription();
_initRefreshAction();
getFaceListData();
}
}

View File

@ -10,6 +10,7 @@ import 'package:star_lock/tools/showTipView.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/noData.dart';
import '../../../../tools/storage.dart';
@ -29,6 +30,23 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
final logic = Get.put(FaceListLogic());
final state = Get.find<FaceListLogic>().state;
Future<void> getHttpData() async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
logic.getFaceListData().then((FingerprintListDataEntity value){
if(mounted) setState(() {});
});
}
}
@override
void initState() {
super.initState();
getHttpData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -62,34 +80,45 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
),
],
),
body: Column(
children: [
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.getFaceListData();
},
),
SizedBox(
height: 20.h,
),
Expanded(child: _buildMainUI()),
AddBottomWhiteBtn(
btnName:
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}',
onClick: () async {
var data =
await Get.toNamed(Routers.addFaceTypePage, arguments: {
"lockId": state.lockId.value,
"fromType": 1 // 1 2
});
if (data != null) {
logic.getFaceListData();
}
},
),
SizedBox(height: 64.h)
],
body: EasyRefreshTool(
onRefresh: (){
logic.pageNo = 1;
getHttpData();
},
onLoad: (){
getHttpData();
},
child: Column(
children: [
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.pageNo = 1;
getHttpData();
},
),
SizedBox(
height: 20.h,
),
Expanded(child: _buildMainUI()),
AddBottomWhiteBtn(
btnName:
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}',
onClick: () async {
var data =
await Get.toNamed(Routers.addFaceTypePage, arguments: {
"lockId": state.lockId.value,
"fromType": 1 // 1 2
});
if (data != null) {
logic.pageNo = 1;
getHttpData();
}
},
),
SizedBox(height: 64.h)
],
),
),
);
}
@ -122,7 +151,8 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
"faceItemData": getFaceItemData,
});
if (data != null) {
logic.getFaceListData();
logic.pageNo = 1;
getHttpData();
}
}),
);

View File

@ -6,12 +6,9 @@ import 'package:get/get.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/dateTool.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/showTFView.dart';
import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
@ -201,7 +198,8 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
//
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
'type': 3,
'id': state.fingerprintItemData.value.fingerprintId.toString()
'id': state.fingerprintItemData.value.fingerprintId.toString(),
'recordName': state.fingerprintItemData.value.fingerprintName
});
}),
// SizedBox(height: 40.h),

View File

@ -1,3 +1,4 @@
import 'dart:async';
import 'package:flutter/scheduler.dart';
@ -40,26 +41,11 @@ class LockDetailLogic extends BaseGetXController {
_replyOpenLock(reply);
}
//
// if(reply is EditUserReply){
// _replyEditUserKey(reply);
// }
//
// if (reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value == true) {
// _replyGetStarLockStatusInfo(reply);
// }
//
if (reply is SenderReferEventRecordTimeReply &&
state.ifCurrentScreen.value == true) {
_replyReferEventRecordTime(reply);
}
//
// if ((reply is AddUserReply) && (state.ifCurrentScreen.value == true)) {
// _replyAddUserKey(reply);
// }
});
}
@ -74,10 +60,7 @@ class LockDetailLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
state.iSClosedUnlockSuccessfulPopup.value = true;
if (state.closedUnlockSuccessfulTimer != null) {
state.closedUnlockSuccessfulTimer!.cancel();
state.closedUnlockSuccessfulTimer = null;
}
state.closedUnlockSuccessfulTimer?.cancel();
// 3
state.closedUnlockSuccessfulTimer = Timer.periodic(3.seconds, (timer) {
state.iSClosedUnlockSuccessfulPopup.value = false;
@ -98,9 +81,7 @@ class LockDetailLogic extends BaseGetXController {
uploadElectricQuantityRequest();
getLockRecordLastUploadDataTime();
state.openLockBtnState.value = 0;
eventBus.fire(RefreshLockDetailInfoDataEvent());
resetOpenDoorState();
break;
case 0x06:
//
@ -128,49 +109,77 @@ class LockDetailLogic extends BaseGetXController {
break;
case 0x16:
// ...
state.openLockBtnState.value = 0;
eventBus.fire(RefreshLockDetailInfoDataEvent());
resetOpenDoorState();
showToast("正在开锁中...".tr, something: () {
cancelBlueConnetctToastTimer();
});
break;
case 0x0d:
// ...
//
showToast('钥匙无效'.tr);
state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false;
state.animationController!.stop();
// state.animationController!.stop();
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
break;
case 0x0b:
//
showToast('钥匙过期'.tr);
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
break;
case 0x0a:
//
showToast("钥匙不存在");
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
break;
case 0x0c:
//
showToast("钥匙数量已到上限");
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
break;
case 0x0e:
//
showToast("钥匙已存在");
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
break;
case 0x0f:
//
showToast("用户已存在");
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
break;
default:
//
state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false;
state.animationController!.stop();
AppLog.log("开锁失败");
// state.animationController!.stop();
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
break;
}
}
//
// Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
// int status = reply.data[2];
// switch (status) {
// case 0x00:
// //
// dismissEasyLoading();
// cancelBlueConnetctToastTimer();
//
// break;
// case 0x06:
// //
//
// break;
// default:
// //
// break;
// }
// }
//
void closeLuckStatus() {
state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false;
state.animationController!.stop(canceled: true);
cancelBlueConnetctToastTimer();
}
//
Future<void> _replyReferEventRecordTime(Reply reply) async {
@ -179,10 +188,10 @@ class LockDetailLogic extends BaseGetXController {
case 0x00:
//
int dataLength = (reply.data[5] << 8) + reply.data[6];
AppLog.log("dataLength:$dataLength");
// AppLog.log("dataLength:$dataLength");
if (dataLength > 0) {
reply.data.removeRange(0, 7);
// 8
// 17
if (reply.data.length < 17) {
return;
}
@ -194,13 +203,13 @@ class LockDetailLogic extends BaseGetXController {
// AppLog.log("indexList:$indexList");
var indexMap = {};
indexMap["type"] = indexList[0].toString();
int operateDate = 0;
if (indexList[0] == 2) {
var passwordData = reply.data.sublist(7, 17);
var password = utf8String(passwordData);
indexMap["user"] = password.toString();
} else {
int userNo = (indexList[1] * 255) + indexList[2];
int userNo = (indexList[1] * 256) + indexList[2];
indexMap["user"] = userNo.toString();
}
@ -210,8 +219,14 @@ class LockDetailLogic extends BaseGetXController {
(0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 |
(0xFF & indexList[6]));
indexMap["date"] = "${time * 1000}";
operateDate = time * 1000;
indexMap["date"] = "$operateDate";
uploadList.add(indexMap);
if (i == getList.length - 1) {
//
state.operateDate = operateDate;
}
}
lockRecordUploadData(uploadList);
@ -234,123 +249,12 @@ class LockDetailLogic extends BaseGetXController {
}
}
// //
// Future<void> _replyAddUserKey(Reply reply) async {
// var lockId = reply.data.sublist(2, 42);
//
// var token = reply.data.sublist(42, 46);
// List<String> strTokenList = changeIntListToStringList(token);
// Storage.setStringList(saveBlueToken, strTokenList);
//
// int status = reply.data[46];
//
// switch (status) {
// case 0x00:
// //
// cancelBlueConnetctToastTimer();
// state.lockUserNo = reply.data[47];
// _updateLockUserNo();
//
// break;
// case 0x06:
// //
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
//
// IoSenderManage.senderAddUser(
// lockID: BlueManage().connectDeviceName,
// authUserID: state.senderUserId.toString(),
// keyID: state.keyInfos.value.keyId.toString(),
// userID: await Storage.getUid(),
// openMode: 1,
// keyType: 0,
// startDate: state.keyInfos.value.startDate!~/10000,
// expireDate: state.keyInfos.value.endDate!~/10000,
// role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
// password: "0",
// needAuthor: 1,
// publicKey: publicKeyDataList,
// privateKey: getPrivateKeyList,
// token: token);
// break;
// default:
// break;
// }
// }
// ()
// Future<void> addUserConnectBlue() async {
// showBlueConnetctToastTimer(action: () {
// state.openLockBtnState.value = 0;
// eventBus.fire(RefreshLockDetailInfoDataEvent());
// });
//
// // var listData = AddUserCommand(
// // lockID: BlueManage().connectDeviceName,
// // authUserID: state.senderUserId.toString(),
// // keyID: state.keyInfos.value.keyId.toString(),
// // userID: await Storage.getUid(),
// // openMode: 1,
// // keyType: 0,
// // startDate: state.keyInfos.value.startDate!~/10000,
// // expireDate: state.keyInfos.value.endDate!~/10000,
// // role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
// // password: "123456",
// // needAuthor: 1,
// // publicKey: publicKeyDataList,
// // privateKey: getPrivateKeyList,
// // token: getTokenList).packageData();
// BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
// if (deviceConnectionState == BluetoothConnectionState.connected) {
// //
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
//
// var token = await Storage.getStringList(saveBlueToken);
// List<int> getTokenList = [0, 0, 0, 0];
// if (token != null) {
// getTokenList = changeStringListToIntList(token);
// }
//
// IoSenderManage.senderAddUser(
// lockID: BlueManage().connectDeviceName,
// authUserID: state.senderUserId.toString(),
// keyID: state.keyInfos.value.keyId.toString(),
// userID: await Storage.getUid(),
// openMode: 1,
// keyType: 0,
// startDate: state.keyInfos.value.startDate!~/10000,
// expireDate: state.keyInfos.value.endDate!~/10000,
// role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
// password: "0",
// needAuthor: 1,
// publicKey: publicKeyDataList,
// privateKey: getPrivateKeyList,
// token: getTokenList);
// } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
// cancelBlueConnetctToastTimer();
// if (state.ifCurrentScreen.value == true) {
// showBlueConnetctToast();
// }
//
// state.openLockBtnState.value = 0;
// eventBus.fire(RefreshLockDetailInfoDataEvent());
// }
// });
// }
//
Future<void> openDoorAction() async {
showBlueConnetctToastTimer(action: () {
state.openLockBtnState.value = 0;
resetOpenDoorState();
// BlueManage().stopScan();
eventBus.fire(RefreshLockDetailInfoDataEvent());
BlueManage().disconnect();
});
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -383,8 +287,7 @@ class LockDetailLogic extends BaseGetXController {
showBlueConnetctToast();
}
state.openLockBtnState.value = 0;
eventBus.fire(RefreshLockDetailInfoDataEvent());
resetOpenDoorState();
}
});
}
@ -393,6 +296,7 @@ class LockDetailLogic extends BaseGetXController {
Future<void> senderReferEventRecordTime() async {
showBlueConnetctToastTimer(
isShowBlueConnetctToast: false,
outTimer: 10,
action: () {
BlueManage().disconnect();
});
@ -448,8 +352,7 @@ class LockDetailLogic extends BaseGetXController {
openDoorAction();
} else {
showToast("网络访问失败,请检查网络是否正常".tr, something: () {
state.openLockBtnState.value = 0;
state.animationController!.forward();
resetOpenDoorState();
cancelBlueConnetctToastTimer();
state.lockNetToken = "0";
openDoorAction();
@ -473,25 +376,6 @@ class LockDetailLogic extends BaseGetXController {
}
}
// NO
// void _updateLockUserNo() async {
// LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(
// keyId: state.keyInfos.value.keyId.toString(),
// lockUserNo: state.lockUserNo.toString()
// );
// if (entity.errorCode!.codeIsSuccessful) {
// eventBus.fire(RefreshLockDetailInfoDataEvent());
// SchedulerBinding.instance.addPostFrameCallback((_) {
// eventBus.fire(RefreshLockListInfoDataEvent());
// });
// if (state.isOpenLockNeedOnline.value == 0) {
// openDoorAction();
// } else {
// getLockNetToken();
// }
// }
// }
//
void getLockRecordLastUploadDataTime() async {
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
@ -599,6 +483,14 @@ class LockDetailLogic extends BaseGetXController {
return formattedTime;
}
void resetOpenDoorState() {
state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false;
state.animationController!.reset();
state.animationController!.forward();
eventBus.fire(RefreshLockDetailInfoDataEvent());
}
@override
Future<void> onReady() async {
super.onReady();

View File

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
@ -94,8 +95,10 @@ class _LockDetailPageState extends State<LockDetailPage>
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
state.openDoorBtnisUneable.value = false;
state.bottomBtnisEable.value = false;
} else {
state.openDoorBtnisUneable.value = true;
state.bottomBtnisEable.value = true;
}
state.isOnlyOneData = widget.isOnlyOneData;
@ -875,7 +878,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
showWidgetArr.add(bottomItem('images/main/icon_main_addLock.png', '新增配件'.tr,
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
state.bottomBtnisEable.value, () {
Navigator.pushNamed(context, Routers.accessoriesListPage);
}));
@ -914,7 +917,6 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.checkingInListPage,
arguments: state.keyInfos.value);
@ -924,15 +926,14 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.lockOperatingRecordPage,
Get.toNamed(Routers.doorLockLogPage,
arguments: {"keyInfo": state.keyInfos.value});
}));
//
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr, true, true, () {
TranslationLoader.lanKeys!.set!.tr, true, () {
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
"isOnlyOneData": state.isOnlyOneData
@ -950,7 +951,6 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.checkingInListPage,
arguments: state.keyInfos.value);
@ -961,7 +961,6 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_electronicKey.png',
TranslationLoader.lanKeys!.electronicKey!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.electronicKeyListPage);
}));
@ -970,7 +969,6 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_password.png',
TranslationLoader.lanKeys!.password!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.passwordKeyListPage,
arguments: {"keyInfo": state.keyInfos.value});
@ -981,7 +979,6 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_icCard.png',
TranslationLoader.lanKeys!.card!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.cardListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
@ -994,7 +991,6 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_fingerprint.png',
TranslationLoader.lanKeys!.fingerprint!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.fingerprintListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
@ -1007,7 +1003,6 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_remoteControl.png',
TranslationLoader.lanKeys!.remoteControl!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.remoteControlListPage);
}));
@ -1019,7 +1014,6 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem(
'images/main/icon_face.png',
TranslationLoader.lanKeys!.humanFace!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.faceListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
@ -1030,8 +1024,9 @@ class _LockDetailPageState extends State<LockDetailPage>
if (state.keyInfos.value.lockFeature!.isSupportIris == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_iris.png', '虹膜'.tr,
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
bottomItem(
'images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value,
() {
Get.toNamed(Routers.irisListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
@ -1041,8 +1036,9 @@ class _LockDetailPageState extends State<LockDetailPage>
if (state.keyInfos.value.lockFeature!.palmVein == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_palm.png', '手掌'.tr,
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
bottomItem(
'images/main/icon_palm.png', '手掌'.tr, state.bottomBtnisEable.value,
() {
Get.toNamed(Routers.palmListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
@ -1056,7 +1052,6 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem(
'images/main/icon_catEyes.png',
TranslationLoader.lanKeys!.monitoring!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.realTimePicturePage, arguments: {
"lockName": state.keyInfos.value.lockName,
@ -1071,7 +1066,6 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem(
'images/main/icon_main_authorizedAdmin.png',
TranslationLoader.lanKeys!.authorizedAdmin!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.authorizedAdminListPage,
arguments: {"keyInfo": state.keyInfos.value});
@ -1084,7 +1078,6 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem(
'images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
// Get.toNamed(Routers.lockOperatingRecordPage,
// arguments: {"keyInfo": state.keyInfos.value});
@ -1098,7 +1091,6 @@ class _LockDetailPageState extends State<LockDetailPage>
endWiddget.add(bottomItem(
'images/main/icon_lockDetail_videoLog.png',
TranslationLoader.lanKeys!.videoLog!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.videoLogPage, arguments: {
"lockId": state.keyInfos.value.lockId,
@ -1110,7 +1102,6 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem(
'images/main/icon_lockDetail_messageReminding.png',
TranslationLoader.lanKeys!.messageReminding!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.msgNotificationPage, arguments: {
"lockId": state.keyInfos.value.lockId,
@ -1121,7 +1112,7 @@ class _LockDetailPageState extends State<LockDetailPage>
endWiddget.add(
//
bottomItem('images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr, true, true, () {
TranslationLoader.lanKeys!.set!.tr, true, () {
// logic.clickItemBtnAction(10);
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
@ -1133,8 +1124,8 @@ class _LockDetailPageState extends State<LockDetailPage>
return showWidgetArr;
}
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable,
bool bottomBtnisEable, Function() onClick) {
Widget bottomItem(
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
Widget child = F.sw(
defaultCall: () => Container(
color: Colors.white,
@ -1149,10 +1140,8 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Image.asset(iconUrl,
width: 42.w,
height: 42.w,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable)
color: bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable,
fit: BoxFit.fitWidth),
),
@ -1162,10 +1151,8 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Text(name,
style: TextStyle(
fontSize: 20.sp,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable)
color: bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable),
textAlign: TextAlign.center))
],
@ -1186,10 +1173,8 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Image.asset(iconUrl,
width: 42.w,
height: 42.w,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable)
color: bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable,
fit: BoxFit.fitWidth),
),
@ -1199,23 +1184,19 @@ class _LockDetailPageState extends State<LockDetailPage>
name,
style: TextStyle(
fontSize: 20.sp,
color: openDoorBtnisUneable
? (bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable)
color: bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable),
),
],
),
));
return GestureDetector(
onTap: openDoorBtnisUneable
? (bottomBtnisEable
? onClick
: () {
logic.showToast("请在锁旁边完成第一次开锁".tr);
})
: null,
onTap: bottomBtnisEable
? onClick
: () {
logic.showToast("请在锁旁边完成第一次开锁".tr);
},
child: child,
);
}
@ -1290,6 +1271,7 @@ class _LockDetailPageState extends State<LockDetailPage>
left: 155.w,
child: GestureDetector(
onTap: () {
state.closedUnlockSuccessfulTimer?.cancel();
setState(() {
state.iSClosedUnlockSuccessfulPopup.value = false;
});
@ -1345,7 +1327,7 @@ class _LockDetailPageState extends State<LockDetailPage>
state.iSOpenLock.value = true;
state.iSClosedUnlockSuccessfulPopup.value = false;
state.openLockBtnState.value = 1;
// state.animationController!.forward();
state.animationController!.forward();
AppLog.log("点击开锁");
if (state.isOpenLockNeedOnline.value == 0) {
@ -1370,6 +1352,7 @@ class _LockDetailPageState extends State<LockDetailPage>
state.openLockBtnState.value = 1;
state.animationController!.forward();
EasyLoading.showToast("正在尝试闭锁……".tr, duration: 2000.milliseconds);
AppLog.log("长按闭锁");
if (state.isOpenLockNeedOnline.value == 0) {
//
@ -1429,7 +1412,7 @@ class _LockDetailPageState extends State<LockDetailPage>
void didPushNext() {
super.didPushNext();
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
state.openLockBtnState.value = 0;
logic.closeLuckStatus();
BlueManage().disconnect();
}
}

View File

@ -38,7 +38,7 @@ class LockOperatingRecordLogic extends BaseGetXController {
case 0x00:
//
int dataLength = (reply.data[5] << 8) + reply.data[6];
// AppLog.log("dataLength:$dataLength");
AppLog.log("dataLength:$dataLength");
// var dataLength = reply.data[5];
if (dataLength > 0) {
reply.data.removeRange(0, 7);
@ -61,7 +61,7 @@ class LockOperatingRecordLogic extends BaseGetXController {
AppLog.log("password:$password passwordData:$passwordData");
indexMap["user"] = password;
}else{
int userNo = (indexList[1]*255) + indexList[2];
int userNo = (indexList[1]*256) + indexList[2];
indexMap["user"] = userNo.toString();
}
@ -186,10 +186,12 @@ class LockOperatingRecordLogic extends BaseGetXController {
//
void clearOperationRecordRequest() async {
KeyOperationRecordEntity entity =
await ApiRepository.to.clearOperationRecord('28');
KeyOperationRecordEntity entity = await ApiRepository.to.clearOperationRecord(CommonDataManage().currentKeyInfo.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
showToast("清除数据成功");
showToast("清除数据成功", something: (){
pageNo = 1;
mockNetworkDataRequest();
});
}
}

View File

@ -51,30 +51,30 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> with
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr,
barTitle: state.recordName.value.isNotEmpty? state.recordName.value : TranslationLoader.lanKeys!.operatingRecord!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
(CommonDataManage().currentKeyInfo.isLockOwner == 1 ||
CommonDataManage().currentKeyInfo.keyRight == 1)
? IconButton(
icon: Image.asset(
'images/icon_bar_more.png',
height: 30.h,
width: 10.w,
),
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
_openModalBottomSheet();
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式");
}
},
)
: Container(),
],
// actionsList: [
// (CommonDataManage().currentKeyInfo.isLockOwner == 1 ||
// CommonDataManage().currentKeyInfo.keyRight == 1)
// ? IconButton(
// icon: Image.asset(
// 'images/icon_bar_more.png',
// height: 30.h,
// width: 10.w,
// ),
// onPressed: () async {
// var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
// if (isDemoMode == false) {
// _openModalBottomSheet();
// } else {
// // Get.toNamed(Routers.selectLockTypePage);
// logic.showToast("演示模式");
// }
// },
// )
// : Container(),
// ],
),
body: EasyRefreshTool(
onRefresh: (){
@ -86,29 +86,29 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> with
},
child: Column(
children: [
(CommonDataManage().currentKeyInfo.isLockOwner == 1 ||
CommonDataManage().currentKeyInfo.keyRight == 1)
? Column(
children: [
Container(
padding: EdgeInsets.only(left:20.h, right: 20.h, top: 20.h),
child: Text(
TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr,
textAlign: TextAlign.start,
style: TextStyle(fontSize: 20.sp),
),
),
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.pageNo = 1;
getHttpData();
},
),
],
)
: Container(),
SizedBox(height: 10.h),
// (CommonDataManage().currentKeyInfo.isLockOwner == 1 ||
// CommonDataManage().currentKeyInfo.keyRight == 1)
// ? Column(
// children: [
// Container(
// padding: EdgeInsets.only(left:20.h, right: 20.h, top: 20.h),
// child: Text(
// TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr,
// textAlign: TextAlign.start,
// style: TextStyle(fontSize: 20.sp),
// ),
// ),
// KeySearchWidget(
// editingController: state.searchController,
// onSubmittedAction: () {
// logic.pageNo = 1;
// getHttpData();
// },
// ),
// ],
// )
// : Container(),
// SizedBox(height: 10.h),
Expanded(child: _buildMainUI()),
],
),
@ -128,7 +128,9 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> with
DateTime.fromMillisecondsSinceEpoch(operateDate!);
String operateDateStr =
'${dateStr.toLocal().toString().substring(0, 16)} ';
return _operatingRecordItem(getTypeIcon(dataItem.recordType!),
// return _operatingRecordItem(getTypeIcon(dataItem.recordType!),
// dataItem.recordTypeName!, operateDateStr, () {});
return _operatingOneRecordItem(getTypeIcon(dataItem.recordType!),
dataItem.recordTypeName!, operateDateStr, () {});
},
separatorBuilder: (BuildContext context, int index) {
@ -166,63 +168,111 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> with
return title;
}
Widget _operatingRecordItem(String userAvatarStr, String userNameStr,
String unlockDescStr, Function() action) {
Widget _operatingOneRecordItem(String userAvatarStr, String userNameStr, String unlockDescStr, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
height: 90.h,
height: 80.h,
width: 1.sw - 10.w - 34.w - 60.w,
padding: EdgeInsets.only(left: 20.w, right: 20.w),
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
// borderRadius: BorderRadius.circular(10.w),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset(
userAvatarStr,
width: 50.w,
height: 50.w,
),
SizedBox(
width: 20.w,
Icon(Icons.access_time, size: 35.w),
SizedBox(width: 10.w,),
Text(
unlockDescStr,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24.sp,
color: AppColors.darkGrayTextColor),
),
SizedBox(width: 10.h),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Text(
child:Container(
margin: EdgeInsets.only(bottom: 3.w),
child: Row(
children: [
Flexible(
child: Text(
userNameStr,
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
],
),
SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
unlockDescStr,
style: TextStyle(
fontSize: 20.sp,
color: AppColors.darkGrayTextColor),
),
],
),
SizedBox(width: 20.h),
],
// "发的发生大发手动阀手动阀三大发啥打法是打发三大发啥打法是打发",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor)),
),
],
),
),
),
SizedBox(width: 20.h),
],
),
),
);
}
// Widget _operatingRecordItem(String userAvatarStr, String userNameStr,
// String unlockDescStr, Function() action) {
// return GestureDetector(
// onTap: action,
// child: Container(
// height: 90.h,
// padding: EdgeInsets.only(left: 20.w, right: 20.w),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(10.w),
// ),
// child: Row(
// children: [
// Image.asset(
// userAvatarStr,
// width: 50.w,
// height: 50.w,
// ),
// SizedBox(
// width: 20.w,
// ),
// Expanded(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Row(
// children: [
// Text(
// userNameStr,
// style: TextStyle(
// fontSize: 24.sp, color: AppColors.blackColor),
// ),
// ],
// ),
// SizedBox(height: 10.h),
// Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Text(
// unlockDescStr,
// style: TextStyle(
// fontSize: 20.sp,
// color: AppColors.darkGrayTextColor),
// ),
// ],
// ),
// SizedBox(width: 20.h),
// ],
// ),
// ),
// SizedBox(width: 20.h),
// ],
// ),
// ),
// );
// }
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,

View File

@ -14,6 +14,7 @@ class LockOperatingRecordState {
var logCountPage = 10; //
var idStr = ""; //
var type = 0; // 1: 2: 3: 4: 5:
var recordName = "".obs; //
LockOperatingRecordState() {
Map map = Get.arguments;
@ -26,5 +27,8 @@ class LockOperatingRecordState {
if(map["type"] != null){
type = Get.arguments["type"];
}
if(map["recordName"] != null){
recordName.value = Get.arguments["recordName"];
}
}
}

View File

@ -48,8 +48,7 @@ class LockEscalationLogic extends BaseGetXController {
//
Future<void> otaUpdate() async {
var status = await PermissionDialog.request(
Permission.storage, '需要访问读写权限才能使用手动升级固件'.tr);
var status = await PermissionDialog.requestStorage();
if (status != true) {
return;
}
@ -69,8 +68,7 @@ class LockEscalationLogic extends BaseGetXController {
}
String md5Str = md5.convert(otaBin!).toString();
headJson!['fwMd5'] = md5Str;
ShowTipView().showIosTipWithContentDialog("升级过程中无法开锁,请先开锁后再升级".tr,
() async {
ShowTipView().showIosTipWithContentDialog("未避免异常情况,请在门打开时升级".tr, () async {
blueOTAUpgrade(headJson!, [0, 0, 0, 0]);
EasyLoading.show(
status: '设备连接中...'.tr, maskType: EasyLoadingMaskType.black);

View File

@ -72,7 +72,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
child: Text(
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择'.tr,
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择'.tr,
style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp),
));
}

View File

@ -5,7 +5,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/showTFView.dart';
import 'package:star_lock/tools/showTipView.dart';
@ -104,22 +103,21 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
});
if (backData != null) {
state.itemData.value.startDate =
int.parse(backData["beginTimeTimestamp"]) * 1000;
int.parse(backData["beginTimeTimestamp"]);
state.itemData.value.endDate =
int.parse(backData["endTimeTimestamp"]) * 1000;
int.parse(backData["endTimeTimestamp"]);
//
state.itemData.value.keyboardPwdType = 3;
setState(() {});
}
})),
Obx(() => Visibility(
visible: state.isCirculation.value,
child: CommonItem(
leftTitel: "结束时间",
rightTitle: DateTool().dateToYMDHNString(
state.itemData.value.endDate.toString()),
isHaveLine: true),
)),
// Obx(() => Visibility(
// visible: (state.isCirculation.value == false) && (state.itemData.value.isCustom! != 1),
// child: CommonItem(
// leftTitel: "结束时间",
// rightTitle: DateTool().dateToYMDHNString(state.itemData.value.endDate.toString()),
// isHaveLine: true),
// )),
Container(height: 10.h),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
@ -151,12 +149,16 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
rightTitle: "",
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.lockOperatingRecordPage,
arguments: {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
'type': 1,
'id': state.itemData.value.keyboardPwdId.toString()
'id': state.itemData.value.keyboardPwdId.toString(),
'recordName': state.itemData.value.keyboardPwdName
});
}),
Visibility(
visible: state.itemData.value.isCustom == 0 && state.itemData.value.keyboardPwdType != 1 && state.itemData.value.keyboardPwdType != 4,
child:bottomTip()
),
Container(height: 40.h),
SizedBox(
width: ScreenUtil().screenWidth - 40.w,
@ -243,6 +245,27 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
));
}
Widget bottomTip(){
return Column(
children: [
Container(
padding: EdgeInsets.all(20.w),
child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。".tr,
textAlign: TextAlign.start,
style: TextStyle(fontSize: 20.sp),
)),
],
),
),
],
);
}
//
CupertinoSwitch _isAdmin() {
return CupertinoSwitch(

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_state.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
import 'package:star_lock/network/api_repository.dart';
@ -13,6 +14,7 @@ import '../../../../blue/io_reply.dart';
import '../../../../blue/io_tool/io_tool.dart';
import '../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../blue/sender_manage.dart';
import '../../../../tools/dateTool.dart';
import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/storage.dart';
@ -52,10 +54,10 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
pwdNo: state.itemData.value.pwdUserNo!,
pwd: state.itemData.value.keyboardPwd!.toString(),
operate: 1,
isAdmin: 0,
isAdmin: state.itemData.value.pwdUserNo!,
useCountLimit: 0xffff,
startTime:state.itemData.value.startDate! ~/ 1000,
endTime:state.itemData.value.endDate! ~/ 1000,
startTime:DateTool().dateToTimestamp(state.selectEffectiveDate.value, 1) ~/ 1000,
endTime:DateTool().dateToTimestamp(state.selectFailureDate.value, 1) ~/ 1000,
needAuthor: 1,
isBeforeAddUser: false,
signKey: signKeyDataList,
@ -73,15 +75,15 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
//
Future<void> updatePwdRequest() async {
var beginTimeTimestamp = state.itemData.value.startDate! ~/ 1000;
var endTimeTimestamp = state.itemData.value.endDate! ~/ 1000;
var beginTimeTimestamp = DateTool().dateToTimestamp(state.selectEffectiveDate.value, 1);
var endTimeTimestamp = DateTool().dateToTimestamp(state.selectFailureDate.value, 1);
if (beginTimeTimestamp > endTimeTimestamp ||
beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间");
return;
}
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
showToast("生效时间需大于当前时间");
return;
}
@ -91,8 +93,8 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
keyboardPwdId: state.itemData.value.keyboardPwdId.toString(),
keyboardPwdName: state.itemData.value.keyboardPwdName!,
newKeyboardPwd: state.itemData.value.keyboardPwd!,
startDate: state.itemData.value.startDate!,
endDate: state.itemData.value.endDate!,
startDate: beginTimeTimestamp,
endDate: endTimeTimestamp,
changeType: '1',
hoursStart: state.itemData.value.hoursStart!,
hoursEnd: state.itemData.value.hoursEnd!,
@ -102,6 +104,7 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: (){
eventBus.fire(GetPasswordListRefreshUI());
AppLog.log("beginTimeTimestamp:$beginTimeTimestamp endTimeTimestamp:$endTimeTimestamp");
Get.back(result: {
"beginTimeTimestamp": beginTimeTimestamp.toString(),
"endTimeTimestamp": endTimeTimestamp.toString(),
@ -137,8 +140,8 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
operate: 1,
isAdmin: state.itemData.value.pwdUserNo!,
useCountLimit: 0xffff,
startTime:state.itemData.value.startDate! ~/ 1000,
endTime:state.itemData.value.endDate! ~/ 1000,
startTime:DateTool().dateToTimestamp(state.selectEffectiveDate.value, 1) ~/ 1000,
endTime:DateTool().dateToTimestamp(state.selectFailureDate.value, 1) ~/ 1000,
needAuthor: 1,
isBeforeAddUser: false,
signKey: signKeyDataList,

View File

@ -272,7 +272,7 @@ class PasswordKeyListLogic extends BaseGetXController {
switch (getPwdType) {
case 1:
// 1 6使
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
break;
case 2:
// 2 24使
@ -285,57 +285,57 @@ class PasswordKeyListLogic extends BaseGetXController {
break;
case 4:
// 4 使使
useDateStr = '${endDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
break;
case 5:
// 5
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 6:
// 6
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
'${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
break;
case 7:
// 7
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 8:
// 8
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 9:
// 9
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 10:
// 10
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 11:
// 11
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 12:
// 12
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 13:
// 13
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 14:
// 14
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
default:

View File

@ -228,22 +228,18 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
case 0xff:
//
showToast("退出添加".tr);
Get.close(1);
break;
case 0xFE:
//
showToast("管理员已满".tr);
Get.close(1);
break;
case 0xFD:
//
showToast("用户已满".tr);
Get.close(1);
break;
case 0xFC:
//
showToast("锁上面添加密码已满".tr);
Get.close(1);
break;
case 0xFB:
//

View File

@ -193,7 +193,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。".tr)
"清空密码底部提示".tr)
],
),
);

View File

@ -78,7 +78,7 @@ class NearbyLockLogic extends BaseGetXController {
}
//
if (reply is GetStarLockStatuInfoReply) {
if (reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value) {
_replyGetStarLockStatusInfo(reply);
}
@ -431,8 +431,7 @@ class NearbyLockLogic extends BaseGetXController {
//
Future<void> otaUpdate() async {
var status = await PermissionDialog.request(
Permission.storage, '需要访问读写权限才能使用手动升级固件'.tr);
var status = await PermissionDialog.requestStorage();
if (status != true) {
return;
}

View File

@ -59,6 +59,7 @@ class SaveLockLogic extends BaseGetXController {
case 0x00:
//
state.lockUserNo = listChangInt(reply.data.sublist(47, 49));
AppLog.log("state.lockUserNo:${state.lockUserNo}");
//
cancelBlueConnetctToastTimer();
@ -233,7 +234,7 @@ class SaveLockLogic extends BaseGetXController {
userID: await Storage.getUid(),
openMode: 1,
keyType: 1,
startDate: DateTime.now().millisecondsSinceEpoch,
startDate: DateTime.now().millisecondsSinceEpoch ~/ 1000,
expireDate: 0x11223344,
useCountLimit: 0xFFFF,
isRound: 0,

View File

@ -67,8 +67,9 @@ class _AddAuthorizedAdministratorPageState
: state.lockIdList.value.length.toString(),
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
.then((value) {
Navigator.pushNamed(context, Routers.massSendLockGroupListPage, arguments: {
"keyLimits":"1"
}).then((value) {
//ID列表
if (value != null) {
value as Map<String, dynamic>;
@ -109,8 +110,9 @@ class _AddAuthorizedAdministratorPageState
: state.lockIdList.value.length.toString(),
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.massSendLockGroupPage)
.then((value) {
Navigator.pushNamed(context, Routers.massSendLockGroupListPage,arguments:{
"keyLimits":"1",
}).then((value) {
//ID列表
if (value != null) {
value as Map<String, dynamic>;

View File

@ -35,9 +35,9 @@ class BaseProvider extends GetConnect with Api {
bool? isUnShowLoading = false, // loading
bool? isUserBaseUrl = true, // 使baseUrl
}) async {
AppLog.log("post: url:$url body:$body contentType:$contentType");
AppLog.log("post: url:$url body:$body");
if (isUnShowLoading == false){
AppLog.log("post: url:$url show loading");
// AppLog.log("post: url:$url show loading");
EasyLoading.show();
}
if (isUserBaseUrl == false) {

View File

@ -15,8 +15,7 @@ class Header extends StatelessWidget {
this.todayStyle,
}) : super(key: key);
static final _dateFormatter = DateFormat().add_yMMMM();
// static final _dateFormatter = DateFormat('MM月dd日', 'zh_CN');
static final _dateFormatter = DateFormat.yM('zh_CN');
final DateTime monthDate;
final EdgeInsetsGeometry margin;
final VoidCallback? onPressed;

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
@ -24,7 +23,7 @@ class AdvancedCalendar extends StatefulWidget {
this.startWeekDay,
this.events,
this.weekLineHeight = 32.0,
this.preloadMonthViewAmount = 13,
this.preloadMonthViewAmount = 24, //
this.preloadWeekViewAmount = 21,
this.weeksInMonthViewAmount = 6,
this.todayStyle,

View File

@ -66,12 +66,14 @@ class BaseGetXController extends GetxController {
// CancelableOperation? _operation;
void showBlueConnetctToastTimer(
{bool isShowBlueConnetctToast = true, Function? action}) {
{bool isShowBlueConnetctToast = true,
int outTimer = 15,
Function? action}) {
if (_timer != null && _timer!.isActive) {
_timer!.cancel();
_timer = null;
}
_timer = Timer.periodic(15.seconds, (timer) {
_timer = Timer.periodic(outTimer.seconds, (timer) {
if (action != null) {
action();
}

View File

@ -51,9 +51,14 @@ class _SeletKeyCyclicDatePageState extends State<SeletKeyCyclicDatePage> {
state.starTime.value.isNotEmpty &&
state.endTime.value.isNotEmpty &&
state.weekDay.value.isNotEmpty),
onClick: () {
onClick: (state.starDate.value.isNotEmpty &&
state.endDate.value.isNotEmpty &&
state.starTime.value.isNotEmpty &&
state.endTime.value.isNotEmpty &&
state.weekDay.value.isNotEmpty)
? () {
logic.subBtnAction();
}),
} : null),
)),
],
));

View File

@ -364,4 +364,36 @@ class ShowCupertinoAlertView {
},
);
}
//
void showClearOperationRecordAlert({required Function clearClick}) {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: Text('是否要删除操作记录?'.tr),
content: Text('被删除的记录不能恢复'.tr),
actions: [
CupertinoDialogAction(
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child:
Text('删除'.tr, style: TextStyle(color: AppColors.mainColor)),
onPressed: () {
Get.back();
clearClick();
},
),
],
);
},
);
}
}

View File

@ -32,14 +32,30 @@ class PermissionDialog {
return false;
}
bool application = true;
Map<Permission, PermissionStatus> statuses = await [
List<Permission> permissions = [
Permission.bluetooth,
Permission.bluetoothScan,
Permission.bluetoothConnect,
].request();
];
Future<bool> getPermissionStatus(List<Permission> permissions) async {
bool isGranted = true;
List<PermissionStatus> permissionStatus = [];
for (Permission per in permissions) {
permissionStatus.add(await per.status);
}
for (PermissionStatus per in permissionStatus) {
isGranted = isGranted && per.isGranted;
}
if (GetPlatform.isIOS) {
isGranted = permissionStatus[0].isGranted;
}
return isGranted;
}
Permission permission = Permission.bluetoothScan;
dynamic cache = await Storage.getString(titles[permission]);
bool isGranted = statuses.values.every((element) => element.isGranted);
if (AppPlatform.isAndroid && !isGranted && cache is! String) {
bool isGranted = await getPermissionStatus(permissions);
if (GetPlatform.isAndroid && !isGranted && cache is! String) {
application = await showCupertinoDialog(
context: Get.context!,
builder: (context) {
@ -69,16 +85,19 @@ class PermissionDialog {
if (application) {
await Storage.setString(titles[permission], titles[permission]);
}
} else if (cache is String) {
bool isDenied = statuses.values.every((element) => element.isDenied);
if (isDenied) {
} else if (cache is! String) {
await Storage.setString(titles[permission], titles[permission]);
} else {
bool isGranted = await getPermissionStatus(permissions);
if (!isGranted) {
showSet(permission);
return false;
}
}
if (application) {
PermissionStatus status = await permission.request();
return status.isGranted;
await permissions.request();
bool isGranted = await getPermissionStatus(permissions);
return isGranted;
}
return false;
}
@ -171,6 +190,98 @@ class PermissionDialog {
return false;
}
//
static Future<bool> requestStorage() async {
if (Get.context == null) {
return false;
}
bool isAndroid33 =
AppPlatform.isAndroid && AppPlatform.getSdkIntValue() >= 33;
//
List<Permission> requestPermission() {
List<Permission> permissions;
if (isAndroid33) {
permissions = [
Permission.mediaLibrary,
Permission.photos,
// Permission.audio,
Permission.videos,
Permission.manageExternalStorage,
];
} else {
permissions = [
Permission.storage,
];
}
return permissions;
}
Future<bool> permissionStatus(List<Permission> permissions) async {
bool isGranted = true;
for (Permission permission in permissions) {
isGranted =
isGranted && (await permission.status) == PermissionStatus.granted;
}
if (isAndroid33) {
// android 33
isGranted = (await Permission.mediaLibrary.status) ==
PermissionStatus.granted ||
(await Permission.manageExternalStorage.status) ==
PermissionStatus.granted;
}
return isGranted;
}
bool application = true;
Permission permission = Permission.photos;
List<Permission> permissions = requestPermission();
dynamic cache = await Storage.getString(titles[permission]);
bool isGranted = await permissionStatus(permissions);
if (AppPlatform.isAndroid && !isGranted && cache is! String) {
application = await showCupertinoDialog(
context: Get.context!,
builder: (context) {
return PopScope(
canPop: false,
child: CupertinoAlertDialog(
title: Text('${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr}'),
content: Text('需要访问读写权限才能使用手动升级固件'.tr),
actions: [
CupertinoDialogAction(
child: Text('不允许'.tr),
onPressed: () {
Get.back(result: false);
},
),
CupertinoDialogAction(
child: Text('允许'.tr),
onPressed: () {
Get.back(result: true);
},
),
],
));
},
);
if (application) {
await Storage.setString(titles[permission], titles[permission]);
}
} else if (cache is String) {
bool isDenied = !(await permissionStatus(permissions));
if (isDenied) {
showSet(permission);
return false;
}
}
if (application) {
Map<Permission, PermissionStatus> statuses = await permissions.request();
bool isGranted = await permissionStatus(statuses.keys.toList());
return isGranted;
}
return false;
}
//
static Future<bool> request(Permission permission, [String? content]) async {
if (Get.context == null) {

View File

@ -42,8 +42,15 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.32+2024051001打包给欧阳回归测试
# 1.0.33+2024051401打包给欧阳回归测试
# 1.0.34+2024051402打包给欧阳回归测试
# 1.0.35+2024051501打包给欧阳回归测试
# 1.0.36+2024051601打包给欧阳回归测试
# 1.0.37+2024051701打包给欧阳回归测试
# 1.0.38+2024051702打包给欧阳回归测试
# 1.0.39+2024051703打包给欧阳回归测试
# 1.0.40+2024051704打包给欧阳回归测试
# 1.0.41+2024051705打包给公司测试
version: 1.0.34+2024051402
version: 1.0.41+2024051705
environment:
sdk: '>=2.12.0 <3.0.0'
@ -178,6 +185,10 @@ dependencies:
file_picker: ^5.3.1
dependency_overrides:
#强制设置google_maps_flutter_ios 为 2.5.2
google_maps_flutter_ios: 2.5.2
dev_dependencies:
flutter_test:
sdk: flutter