Compare commits

..

No commits in common. "bc24ca6146602a42c0cd93075b3f462cedd59d23" and "c9683b4cbaac36da07574d9f7a7fa76f2abd530c" have entirely different histories.

11 changed files with 2073 additions and 1754 deletions

View File

@ -144,7 +144,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
break; break;
case AppLifecycleState.paused: case AppLifecycleState.paused:
// AppLog.log('App--->进入后台'); // AppLog.log('App--->进入后台');
BlueManage.instance.disconnect(); BlueManage().disconnect();
break; break;
case AppLifecycleState.resumed: case AppLifecycleState.resumed:
// AppLog.log('App--->进入前台'); // AppLog.log('App--->进入前台');

View File

@ -85,12 +85,6 @@ class BlueManage {
return _manager; return _manager;
} }
// 访
static BlueManage get instance {
_manager ??= BlueManage._init();
return _manager!;
}
BlueManage? get manager => shareManager(); BlueManage? get manager => shareManager();
void _initBlue() { void _initBlue() {
@ -100,13 +94,9 @@ class BlueManage {
} }
void _initGetMtuSubscription() { void _initGetMtuSubscription() {
// _mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((int value) {
_mtuSubscription?.cancel();
_mtuSubscription = null;
_mtuSubscription = bluetoothConnectDevice!.mtu.listen((int value) {
_mtuSize = value - 3; _mtuSize = value - 3;
AppLog.log('设备MTU变化 - 原始值:$value 计算后MTU:$_mtuSize 设备:${bluetoothConnectDevice?.remoteId.str}'); AppLog.log('_mtuSizeValue:$value mtuSize:$_mtuSize');
}); });
} }
@ -964,12 +954,6 @@ class BlueManage {
Future<void> disconnect() async { Future<void> disconnect() async {
try { try {
connectDeviceMacAddress = ''; connectDeviceMacAddress = '';
// MTU监听
_mtuSubscription?.cancel();
_mtuSubscription = null;
_mtuSize = 20; // MTU为默认值
if (bluetoothConnectionState == BluetoothConnectionState.connected) { if (bluetoothConnectionState == BluetoothConnectionState.connected) {
// //
await bluetoothConnectDevice!.disconnect(timeout: 3); await bluetoothConnectDevice!.disconnect(timeout: 3);
@ -991,29 +975,10 @@ class BlueManage {
} }
} }
// MTU信息
String getMtuDebugInfo() {
return 'MTU Debug Info:\n'
'- Current MTU Size: $_mtuSize\n'
'- Connected Device: ${bluetoothConnectDevice?.remoteId.str ?? "None"}\n'
'- Device Name: $connectDeviceName\n'
'- Connection State: $bluetoothConnectionState\n'
'- MTU Subscription Active: ${_mtuSubscription != null}';
}
void disposed() { void disposed() {
_sendStreamSubscription?.cancel(); _sendStreamSubscription?.cancel();
_mtuSubscription?.cancel(); _mtuSubscription!.cancel();
_adapterStateStateSubscription?.cancel(); _adapterStateStateSubscription!.cancel();
_connectionStateSubscription?.cancel(); _connectionStateSubscription!.cancel();
//
_mtuSize = 20;
connectDeviceName = '';
connectDeviceMacAddress = '';
bluetoothConnectDevice = null;
scanDevices.clear();
allData.clear();
lastTimeData.clear();
} }
} }

View File

@ -30,41 +30,39 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF), backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(barTitle: '注册'.tr, haveBack: true, backgroundColor: AppColors.mainColor), appBar: TitleAppBar(
body: GestureDetector( barTitle: '注册'.tr,
onTap: () { haveBack: true,
FocusScope.of(context).unfocus(); backgroundColor: AppColors.mainColor),
}, body: ListView(
child: ListView( padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w), children: <Widget>[
children: <Widget>[ topSelectCountryAndRegionWidget(),
topSelectCountryAndRegionWidget(), middleTFWidget(),
middleTFWidget(), Obx(() {
Obx(() { return SubmitBtn(
return SubmitBtn( btnName: '注册'.tr,
btnName: '注册'.tr, // backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey], fontSize: 30.sp,
fontSize: 30.sp, borderRadius: 20.w,
borderRadius: 20.w, padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), isDisabled: state.canSub.value,
isDisabled: state.canSub.value, onClick: state.canSub.value
onClick: state.canSub.value ? () {
? () { if (state.agree.value == false) {
if (state.agree.value == false) { logic.showToast('请先同意用户协议及隐私政策'.tr);
logic.showToast('请先同意用户协议及隐私政策'.tr); return;
return; } else {
} else { logic.register();
logic.register();
}
} }
: null); }
}), : null);
SizedBox( }),
height: 20.h, SizedBox(
), height: 20.h,
_buildBottomAgreement() ),
], _buildBottomAgreement()
), ],
)); ));
} }
@ -79,7 +77,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
width: 340.w, width: 340.w,
height: 60.h, height: 60.h,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30.h)), border: Border.all(width: 1.0, color: AppColors.greyLineColor)), borderRadius: BorderRadius.all(Radius.circular(30.h)),
border:
Border.all(width: 1.0, color: AppColors.greyLineColor)),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
GestureDetector( GestureDetector(
@ -93,13 +93,18 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
decoration: state.isIphoneType.value decoration: state.isIphoneType.value
? BoxDecoration( ? BoxDecoration(
color: AppColors.mainColor, color: AppColors.mainColor,
borderRadius: BorderRadius.all(Radius.circular(30.h)), borderRadius:
border: Border.all(width: 1.0, color: AppColors.greyLineColor)) BorderRadius.all(Radius.circular(30.h)),
border: Border.all(
width: 1.0, color: AppColors.greyLineColor))
: null, : null,
child: Center( child: Center(
child: Text( child: Text(
'手机'.tr, '手机'.tr,
style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black), style: TextStyle(
color: state.isIphoneType.value
? Colors.white
: Colors.black),
), ),
), ),
), ),
@ -116,14 +121,19 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
decoration: !state.isIphoneType.value decoration: !state.isIphoneType.value
? BoxDecoration( ? BoxDecoration(
color: AppColors.mainColor, color: AppColors.mainColor,
borderRadius: BorderRadius.all(Radius.circular(30.h)), borderRadius:
border: Border.all(width: 1.0, color: AppColors.greyLineColor)) BorderRadius.all(Radius.circular(30.h)),
border: Border.all(
width: 1.0,
color: AppColors.greyLineColor))
: null, : null,
child: Center( child: Center(
child: Text( child: Text(
'邮箱'.tr, '邮箱'.tr,
style: TextStyle( style: TextStyle(
color: !state.isIphoneType.value ? Colors.white : Colors.black, color: !state.isIphoneType.value
? Colors.white
: Colors.black,
), ),
), ),
), ),
@ -153,15 +163,21 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SizedBox(width: 5.w), SizedBox(width: 5.w),
Expanded(child: Text('你所在的国家/地区'.tr, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor))), Expanded(
child: Text('你所在的国家/地区'.tr,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor))),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Text( Text(
state.isIphoneType.value ? '${state.countryName.value} +${state.countryCode.value}' : state.countryName.value, state.isIphoneType.value
? '${state.countryName.value} +${state.countryCode.value}'
: state.countryName.value,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor), style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor),
) )
], ],
), ),
@ -196,7 +212,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Padding( Padding(
padding: EdgeInsets.only(right: 5.w, left: 5.w), padding: EdgeInsets.only(right: 5.w, left: 5.w),
child: Image.asset( child: Image.asset(
state.isIphoneType.value ? 'images/icon_login_account.png' : 'images/icon_login_email.png', state.isIphoneType.value
? 'images/icon_login_account.png'
: 'images/icon_login_email.png',
width: 30.w, width: 30.w,
height: 30.w, height: 30.w,
), ),
@ -230,7 +248,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
SizedBox(height: 15.w), SizedBox(height: 15.w),
Text( Text(
'密码必须是8-20位至少包括数字/字母/符号中的2种'.tr, '密码必须是8-20位至少包括数字/字母/符号中的2种'.tr,
style: TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp), style:
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
), ),
SizedBox(height: 10.w), SizedBox(height: 10.w),
LoginInput( LoginInput(
@ -280,9 +299,14 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
onTap: (state.canSendCode.value && state.canResend.value) onTap: (state.canSendCode.value && state.canResend.value)
? () async { ? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
final Object? result = await Navigator.pushNamed(context, Routers.safetyVerificationPage, final Object? result = await Navigator.pushNamed(
arguments: <String, Object>{'countryCode': state.countryCode, 'account': state.phoneOrEmailStr.value}); context, Routers.safetyVerificationPage,
state.xWidth.value = (result! as Map<String, dynamic>)['xWidth']; arguments: <String, Object>{
'countryCode': state.countryCode,
'account': state.phoneOrEmailStr.value
});
state.xWidth.value =
(result! as Map<String, dynamic>)['xWidth'];
logic.sendValidationCode(); logic.sendValidationCode();
} }
: null, : null,
@ -291,7 +315,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
// height: 60.h, // height: 60.h,
padding: EdgeInsets.all(10.h), padding: EdgeInsets.all(10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: (state.canSendCode.value && state.canResend.value) ? AppColors.mainColor : Colors.grey, color:
(state.canSendCode.value && state.canResend.value)
? AppColors.mainColor
: Colors.grey,
borderRadius: BorderRadius.circular(5)), borderRadius: BorderRadius.circular(5)),
child: Center( child: Center(
child: Text(state.btnText.value, child: Text(state.btnText.value,
@ -320,7 +347,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
logic.changeAgreeState(); logic.changeAgreeState();
}, },
child: Image.asset( child: Image.asset(
state.agree.value ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', state.agree.value
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w, width: 30.w,
height: 30.w, height: 30.w,
))), ))),
@ -336,17 +365,29 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
WidgetSpan( WidgetSpan(
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
child: GestureDetector( child: GestureDetector(
child: Text('${'用户协议'.tr}', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)), child: Text('${'用户协议'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{'url': XSConstantMacro.userAgreementURL, 'title': '用户协议'.tr}); Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
'url': XSConstantMacro.userAgreementURL,
'title': '用户协议'.tr
});
}, },
)), )),
WidgetSpan( WidgetSpan(
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
child: GestureDetector( child: GestureDetector(
child: Text('${'隐私政策'.tr}', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)), child: Text('${'隐私政策'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{'url': XSConstantMacro.privacyPolicyURL, 'title': '隐私政策'.tr}); Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
'url': XSConstantMacro.privacyPolicyURL,
'title': '隐私政策'.tr
});
}, },
)), )),
], ],

View File

@ -82,7 +82,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: <Widget>[ actionsList: <Widget>[
Visibility( Visibility(
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || CommonDataManage().currentKeyInfo.keyRight == 1, visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 ||
CommonDataManage().currentKeyInfo.keyRight == 1,
child: GestureDetector( child: GestureDetector(
child: Image.asset( child: Image.asset(
'images/icon_tips_Q.png', 'images/icon_tips_Q.png',
@ -91,20 +92,27 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
color: Colors.white, color: Colors.white,
), ),
onTap: () { onTap: () {
ShowTipView().showSureAlertDialog('1.锁没有联网密码、IC卡、指纹等开门记录无法实时上传可以点击右上角按钮然后读取记录。'.tr + '\n' + '2.如果您需要保留历史记录,可以点击右上角按钮,然后导出记录'.tr, ShowTipView().showSureAlertDialog(
tipTitle: '看不到操作记录,可能原因有'.tr, sureStr: '我知道了'.tr); '1.锁没有联网密码、IC卡、指纹等开门记录无法实时上传可以点击右上角按钮然后读取记录。'.tr +
'\n' +
'2.如果您需要保留历史记录,可以点击右上角按钮,然后导出记录'.tr,
tipTitle: '看不到操作记录,可能原因有'.tr,
sureStr: '我知道了'.tr);
}, },
)), )),
Visibility( Visibility(
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || CommonDataManage().currentKeyInfo.keyRight == 1, visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 ||
CommonDataManage().currentKeyInfo.keyRight == 1,
child: PopupMenuButton<String>( child: PopupMenuButton<String>(
onSelected: _onMenuItemSelected, onSelected: _onMenuItemSelected,
color: Colors.black, color: Colors.black,
itemBuilder: (BuildContext context) { itemBuilder: (BuildContext context) {
return <PopupMenuEntry<String>>[ return <PopupMenuEntry<String>>[
_buildCustomPopupMenuItem('读取记录'.tr), _buildCustomPopupMenuItem('读取记录'.tr),
if (CommonDataManage().currentKeyInfo.isLockOwner == 1) const PopupMenuDivider(), if (CommonDataManage().currentKeyInfo.isLockOwner == 1)
if (CommonDataManage().currentKeyInfo.isLockOwner == 1) _buildCustomPopupMenuItem('清空记录'.tr), const PopupMenuDivider(),
if (CommonDataManage().currentKeyInfo.isLockOwner == 1)
_buildCustomPopupMenuItem('清空记录'.tr),
const PopupMenuDivider(), const PopupMenuDivider(),
_buildCustomPopupMenuItem('导出记录'.tr), _buildCustomPopupMenuItem('导出记录'.tr),
]; ];
@ -122,7 +130,11 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
body: Column( body: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[topAdvancedCalendarWidget(), eventDropDownWidget(), Expanded(child: timeLineView())], children: <Widget>[
topAdvancedCalendarWidget(),
eventDropDownWidget(),
Expanded(child: timeLineView())
],
), ),
floatingActionButton: Visibility( floatingActionButton: Visibility(
visible: _isAtBottom, visible: _isAtBottom,
@ -181,7 +193,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
builder: (BuildContext context) { builder: (BuildContext context) {
return ExportRecordDialog( return ExportRecordDialog(
onExport: (String filePath) { onExport: (String filePath) {
Get.toNamed(Routers.exportSuccessPage, arguments: <String, String>{'filePath': filePath}); Get.toNamed(Routers.exportSuccessPage,
arguments: <String, String>{'filePath': filePath});
}, },
); );
}, },
@ -258,7 +271,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
String formatTimestampToDateTimeYYYYMMDD(int timestampMs) { String formatTimestampToDateTimeYYYYMMDD(int timestampMs) {
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestampMs); DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestampMs);
DateFormat formatter = DateFormat('MM${''.tr}dd${''.tr}'); // 2025-08-18 14:30 DateFormat formatter =
DateFormat('MM${''.tr}dd${''.tr}'); // 2025-08-18 14:30
return formatter.format(dateTime); return formatter.format(dateTime);
} }
@ -286,71 +300,103 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
final recordType = item.recordType; final recordType = item.recordType;
switch (recordType) { switch (recordType) {
case 10: case 10:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '指纹'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}'; if (item.username != null && item.username != '') {
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'指纹'.tr +
'开锁'.tr +
'ID${item.username}';
} else {
return item.recordStr ?? '';
}
case 20: case 20:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' +
'密码'.tr + '密码'.tr +
'开锁'.tr + '开锁'.tr +
'${_formatUserNameOrId(item)}' + '${'昵称'.tr}${item.username}' +
'${'密码'.tr}${item.keyboardPwd}'; '${'密码'.tr}${item.keyboardPwd}';
case 30: case 30:
return '${formatTimestampToHHmm(item.operateDate!)} ' + ''.tr + '开锁'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
''.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 40: case 40:
if (item.username != null && item.username != '') { if (item.username != null && item.username != '') {
return '${formatTimestampToHHmm(item.operateDate!)} ' + '蓝牙'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'蓝牙'.tr +
'开锁'.tr +
'' +
'${'昵称'.tr}'.tr +
'${item.username}';
} else { } else {
return '${formatTimestampToHHmm(item.operateDate!)} ' + '蓝牙'.tr + '开锁'.tr + '' + 'ID'.tr + '${item.userid}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'蓝牙'.tr +
'开锁'.tr +
'' +
'ID'.tr +
'${item.userid}';
} }
case 50: case 50:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '组合模式'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'组合模式'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 60: case 60:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '指纹'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'添加'.tr +
'指纹'.tr +
'${'昵称'.tr}${item.username}';
case 70: case 70:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '密码'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'添加'.tr +
'密码'.tr +
'${'昵称'.tr}${item.username}';
case 80: case 80:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + ''.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'添加'.tr +
''.tr +
'${'昵称'.tr}${item.username}';
case 90: case 90:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '指纹'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'删除'.tr +
'指纹'.tr +
'${'昵称'.tr}${item.username}';
case 100: case 100:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '密码'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'删除'.tr +
'密码'.tr +
'${'昵称'.tr}${item.username}';
case 110: case 110:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + ''.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'删除'.tr +
''.tr +
'${'昵称'.tr}${item.username}';
case 160: case 160:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '人脸'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'人脸'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 190: case 190:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫指纹'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'胁迫指纹'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 200: case 200:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫密码'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'胁迫密码'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 210: case 210:
return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫卡片'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}'; return '${formatTimestampToHHmm(item.operateDate!)} ' +
'胁迫卡片'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
default: default:
return item.recordStr ?? ''; return item.recordStr ?? '';
} }
} }
//
String _formatUserNameOrId(DoorLockLogDataItem item) {
final recordStr = item.recordStr;
final idMatch = RegExp(r'ID[:](\w+)').firstMatch(recordStr ?? '');
final idValue = idMatch?.group(1) ?? '';
final name = item.username ?? '';
// ID: ID ID:xxx
if (name.isNotEmpty) {
final idInNameMatch = RegExp(r'^ID[:].+').hasMatch(name);
if (idInNameMatch) {
return name; // "ID:123"
} else {
return '${'昵称'.tr}$name'; //
}
}
// 使 recordStr ID
return 'ID$idValue';
}
Color _buildTextColorByType(DoorLockLogDataItem item) { Color _buildTextColorByType(DoorLockLogDataItem item) {
final recordType = item.recordType; final recordType = item.recordType;
switch (recordType) { switch (recordType) {
@ -374,9 +420,12 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
contentsBuilder: (BuildContext context, int index) { contentsBuilder: (BuildContext context, int index) {
final DoorLockLogDataItem timelineData = state.lockLogItemList[index]; final DoorLockLogDataItem timelineData = state.lockLogItemList[index];
// 👇 videoUrl build // 👇 videoUrl build
int? firstVideoIndex = state.lockLogItemList.indexWhere((item) => _checkIsVideoOrImagesType(item)); int? firstVideoIndex = state.lockLogItemList
.indexWhere((item) => _checkIsVideoOrImagesType(item));
bool isInvalid = _checkIsVideoOrImagesType(timelineData) && bool isInvalid = _checkIsVideoOrImagesType(timelineData) &&
((timelineData.imagesUrl == null && timelineData.videoUrl == null) || (timelineData.videoUrl == '' && timelineData.imagesUrl == '')); ((timelineData.imagesUrl == null &&
timelineData.videoUrl == null) ||
(timelineData.videoUrl == '' && timelineData.imagesUrl == ''));
String typeText = ''; String typeText = '';
if (timelineData.recordType == 130) { if (timelineData.recordType == 130) {
@ -397,7 +446,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text('${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}', Text(
'${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}',
style: TextStyle( style: TextStyle(
fontSize: 20.sp, fontSize: 20.sp,
)), )),
@ -414,7 +464,12 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
), ),
children: [ children: [
TextSpan( TextSpan(
text: _buildIDByType(timelineData) + (isInvalid ? '${typeText}' + '已失效'.tr + '' : ''), text: _buildIDByType(timelineData) +
(isInvalid
? '${typeText}' +
'已失效'.tr +
''
: ''),
), ),
WidgetSpan( WidgetSpan(
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
@ -449,7 +504,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
height: 12.h, height: 12.h,
), ),
Visibility( Visibility(
visible: _checkIsVideoOrImagesType(timelineData) && index == firstVideoIndex, visible: _checkIsVideoOrImagesType(timelineData) &&
index == firstVideoIndex,
child: GestureDetector( child: GestureDetector(
onTap: () async { onTap: () async {
await logic.getWebPlayUrl(); await logic.getWebPlayUrl();
@ -524,7 +580,9 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) { if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) {
final lockLogItemList = state.lockLogItemList.value; final lockLogItemList = state.lockLogItemList.value;
final list = lockLogItemList final list = lockLogItemList
.where((e) => (e.videoUrl != null && e.videoUrl!.isNotEmpty) || (e.imagesUrl != null && e.imagesUrl!.isNotEmpty)) .where((e) =>
(e.videoUrl != null && e.videoUrl!.isNotEmpty) ||
(e.imagesUrl != null && e.imagesUrl!.isNotEmpty))
.map( .map(
(e) => RecordListData( (e) => RecordListData(
videoUrl: e.videoUrl, videoUrl: e.videoUrl,
@ -535,13 +593,16 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
), ),
) )
.toList(); .toList();
final selectDateString = DateTool().dateToYMDString(state.startDate.value.toString()); final selectDateString =
final cloudStorageData = CloudStorageData(date: selectDateString, recordList: list); DateTool().dateToYMDString(state.startDate.value.toString());
final cloudStorageData =
CloudStorageData(date: selectDateString, recordList: list);
Get.toNamed(Routers.videoLogDetailPage, arguments: <String, Object>{ Get.toNamed(Routers.videoLogDetailPage, arguments: <String, Object>{
'recordData': recordData, 'recordData': recordData,
'videoDataList': [cloudStorageData] 'videoDataList': [cloudStorageData]
}); });
} else if (recordData.imagesUrl != null && recordData.imagesUrl!.isNotEmpty) { } else if (recordData.imagesUrl != null &&
recordData.imagesUrl!.isNotEmpty) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
@ -552,7 +613,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
); );
} }
}, },
child: ((recordData.imagesUrl != null && recordData.imagesUrl != '') || (recordData.videoUrl != null && recordData.videoUrl != '')) child: ((recordData.imagesUrl != null && recordData.imagesUrl != '') ||
(recordData.videoUrl != null && recordData.videoUrl != ''))
? Container( ? Container(
width: 260.w, width: 260.w,
height: 260.h, height: 260.h,
@ -570,7 +632,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
_buildImageOrVideoItem(RecordListData recordData) { _buildImageOrVideoItem(RecordListData recordData) {
if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) { if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) {
return _buildVideoItem(recordData); return _buildVideoItem(recordData);
} else if (recordData.imagesUrl != null && recordData.imagesUrl!.isNotEmpty) { } else if (recordData.imagesUrl != null &&
recordData.imagesUrl!.isNotEmpty) {
return _buildImageItem(recordData); return _buildImageItem(recordData);
} else { } else {
return SizedBox.shrink(); return SizedBox.shrink();
@ -587,7 +650,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
child: Image.network( child: Image.network(
recordData.imagesUrl!, recordData.imagesUrl!,
fit: BoxFit.cover, fit: BoxFit.cover,
errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) { errorBuilder:
(BuildContext context, Object error, StackTrace? stackTrace) {
// //
return Image.asset( return Image.asset(
'images/icon_unHaveData.png', // 'images/icon_unHaveData.png', //
@ -685,8 +749,11 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
print('外部收到选中: $date'); print('外部收到选中: $date');
state.operateDate = date.millisecondsSinceEpoch; state.operateDate = date.millisecondsSinceEpoch;
state.startDate.value = DateTime(date.year, date.month, date.day).millisecondsSinceEpoch; state.startDate.value =
state.endDate.value = DateTime(date.year, date.month, date.day, 23, 59, 59, 999).millisecondsSinceEpoch; DateTime(date.year, date.month, date.day).millisecondsSinceEpoch;
state.endDate.value =
DateTime(date.year, date.month, date.day, 23, 59, 59, 999)
.millisecondsSinceEpoch;
await logic.mockNetworkDataRequest(isRefresh: true); await logic.mockNetworkDataRequest(isRefresh: true);
}, },
onWeekChanged: (DateTime start, DateTime end) { onWeekChanged: (DateTime start, DateTime end) {

File diff suppressed because it is too large Load Diff

View File

@ -58,26 +58,8 @@ class LockDetailState {
int logCountPage = 10; // int logCountPage = 10; //
RxInt nextAuthTime = 0.obs; // RxInt nextAuthTime = 0.obs; //
int countReq = 10;// // LockDetailState() {
RxInt indexCount = 0.obs;// 0/5 // Map map = Get.arguments;
// lockCount = map["lockCount"];
int uploadPasswordPage = 0;// // }
List<int> uploadPasswordDataList = <int>[];//
int uploadCardPage = 0;//
List<int> uploadCardDataList = <int>[];//
int uploadFingerprintPage = 0;//
List<int> uploadFingerprintDataList = <int>[];//
int uploadFacePage = 0;//
List<int> uploadFaceDataList = <int>[];//
int uploadPalmVeinPage = 0;//
List<int> uploadPalmVeinDataList = <int>[];//
int uploadRemoteControlPage = 0;//
List<int> uploadRemoteControlDataList = <int>[];//
List<int> uploadLockSetDataList = <int>[];//
} }

View File

@ -29,41 +29,49 @@ class UploadDataLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async { _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
// //
if (reply is UpdataLockPasswordListReply && (state.ifCurrentScreen.value == true)) { if (reply is UpdataLockPasswordListReply &&
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockPasswordListReply(reply); _replyUpdataLockPasswordListReply(reply);
} }
// //
if (reply is UpdataLockCardListReply && (state.ifCurrentScreen.value == true)) { if (reply is UpdataLockCardListReply &&
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockCardListReply(reply); _replyUpdataLockCardListReply(reply);
} }
// //
if (reply is UpdataLockFingerprintListReply && (state.ifCurrentScreen.value == true)) { if (reply is UpdataLockFingerprintListReply &&
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockFingerprintListReply(reply); _replyUpdataLockFingerprintListReply(reply);
} }
// //
if (reply is UpdataLockFaceListReply && (state.ifCurrentScreen.value == true)) { if (reply is UpdataLockFaceListReply &&
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockFaceListReply(reply); _replyUpdataLockFaceListReply(reply);
} }
// //
if (reply is UpdataLockPalmVeinListReply && (state.ifCurrentScreen.value == true)) { if (reply is UpdataLockPalmVeinListReply &&
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockPalmVeinListReply(reply); _replyUpdataLockPalmVeinListReply(reply);
} }
// //
if (reply is UpdataLockRemoteControlListReply && (state.ifCurrentScreen.value == true)) { if (reply is UpdataLockRemoteControlListReply &&
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockRemoteControlListReply(reply); _replyUpdataLockRemoteControlListReply(reply);
} }
// //
if (reply is UpdataLockSetReply && (state.ifCurrentScreen.value == true) && (state.ifSeletUpdataBtnState == true)) { if (reply is UpdataLockSetReply &&
(state.ifCurrentScreen.value == true) &&
(state.ifSeletUpdataBtnState == true)) {
_replyUpdataLockSetReply(reply); _replyUpdataLockSetReply(reply);
} }
}); });
@ -78,7 +86,8 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadPasswordDataList.addAll(reply.data.sublist(9, reply.data.length)); state.uploadPasswordDataList
.addAll(reply.data.sublist(9, reply.data.length));
if (dataLength == 10) { if (dataLength == 10) {
// 10 // 10
state.uploadPasswordPage = state.uploadPasswordPage + 1; state.uploadPasswordPage = state.uploadPasswordPage + 1;
@ -96,7 +105,10 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(uploadType: 2, recordType: 2, records: state.uploadPasswordDataList); _lockDataUpload(
uploadType: 2,
recordType: 2,
records: state.uploadPasswordDataList);
// } // }
} }
break; break;
@ -127,7 +139,8 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadCardDataList.addAll(reply.data.sublist(9, reply.data.length)); state.uploadCardDataList
.addAll(reply.data.sublist(9, reply.data.length));
if (dataLength == 10) { if (dataLength == 10) {
// 10 // 10
state.uploadCardPage = state.uploadCardPage + 1; state.uploadCardPage = state.uploadCardPage + 1;
@ -144,7 +157,8 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(uploadType: 2, recordType: 3, records: state.uploadCardDataList); _lockDataUpload(
uploadType: 2, recordType: 3, records: state.uploadCardDataList);
// } // }
} }
break; break;
@ -174,7 +188,8 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadFingerprintDataList.addAll(reply.data.sublist(9, reply.data.length)); state.uploadFingerprintDataList
.addAll(reply.data.sublist(9, reply.data.length));
if (dataLength == 10) { if (dataLength == 10) {
// 10 // 10
state.uploadFingerprintPage = state.uploadFingerprintPage + 1; state.uploadFingerprintPage = state.uploadFingerprintPage + 1;
@ -191,7 +206,10 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(uploadType: 2, recordType: 4, records: state.uploadFingerprintDataList); _lockDataUpload(
uploadType: 2,
recordType: 4,
records: state.uploadFingerprintDataList);
// } // }
} }
break; break;
@ -221,7 +239,8 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadFaceDataList.addAll(reply.data.sublist(9, reply.data.length)); state.uploadFaceDataList
.addAll(reply.data.sublist(9, reply.data.length));
if (dataLength == 10) { if (dataLength == 10) {
// 10 // 10
state.uploadFacePage = state.uploadFacePage + 1; state.uploadFacePage = state.uploadFacePage + 1;
@ -238,7 +257,8 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(uploadType: 2, recordType: 5, records: state.uploadFaceDataList); _lockDataUpload(
uploadType: 2, recordType: 5, records: state.uploadFaceDataList);
// } // }
} }
break; break;
@ -268,7 +288,8 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadPalmVeinDataList.addAll(reply.data.sublist(9, reply.data.length)); state.uploadPalmVeinDataList
.addAll(reply.data.sublist(9, reply.data.length));
if (dataLength == 10) { if (dataLength == 10) {
// 10 // 10
state.uploadPalmVeinPage = state.uploadPalmVeinPage + 1; state.uploadPalmVeinPage = state.uploadPalmVeinPage + 1;
@ -285,7 +306,10 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(uploadType: 2, recordType: 6, records: state.uploadPalmVeinDataList); _lockDataUpload(
uploadType: 2,
recordType: 6,
records: state.uploadPalmVeinDataList);
// } // }
} }
break; break;
@ -315,7 +339,8 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadRemoteControlDataList.addAll(reply.data.sublist(9, reply.data.length)); state.uploadRemoteControlDataList
.addAll(reply.data.sublist(9, reply.data.length));
if (dataLength == 10) { if (dataLength == 10) {
// 10 // 10
state.uploadRemoteControlPage = state.uploadRemoteControlPage + 1; state.uploadRemoteControlPage = state.uploadRemoteControlPage + 1;
@ -332,7 +357,10 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(uploadType: 2, recordType: 7, records: state.uploadRemoteControlDataList); _lockDataUpload(
uploadType: 2,
recordType: 7,
records: state.uploadRemoteControlDataList);
// } // }
} }
break; break;
@ -362,8 +390,10 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.uploadLockSetDataList.addAll(reply.data.sublist(7, reply.data.length)); state.uploadLockSetDataList
_lockDataUpload(uploadType: 1, recordType: 0, records: state.uploadLockSetDataList); .addAll(reply.data.sublist(7, reply.data.length));
_lockDataUpload(
uploadType: 1, recordType: 0, records: state.uploadLockSetDataList);
break; break;
case 0x06: case 0x06:
// //
@ -388,18 +418,22 @@ class UploadDataLogic extends BaseGetXController {
return; return;
} }
state.sureBtnState.value = 1; state.sureBtnState.value = 1;
showEasyLoading(); showEasyLoading();
showBlueConnetctToastTimer(action: () { showBlueConnetctToastTimer(action: () {
dismissEasyLoading(); dismissEasyLoading();
AppLog.log('上传密码列表获取超时 关闭加载菊花');
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
updataLockPasswordList(getTokenList, state.uploadPasswordPage); updataLockPasswordList(getTokenList, state.uploadPasswordPage);
} else if (connectionState == BluetoothConnectionState.disconnected) { } else if (connectionState == BluetoothConnectionState.disconnected) {
AppLog.log('上传密码列表连接失败 关闭加载菊花');
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
@ -412,7 +446,8 @@ class UploadDataLogic extends BaseGetXController {
// //
Future<void> updataLockPasswordList(List<int> token, int page) async { Future<void> updataLockPasswordList(List<int> token, int page) async {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -437,7 +472,8 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -457,7 +493,8 @@ class UploadDataLogic extends BaseGetXController {
// Card列表 // Card列表
Future<void> updataLockCardList(List<int> token, int page) async { Future<void> updataLockCardList(List<int> token, int page) async {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -482,7 +519,8 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -502,7 +540,8 @@ class UploadDataLogic extends BaseGetXController {
// //
Future<void> updataLockFingerprintList(List<int> token, int page) async { Future<void> updataLockFingerprintList(List<int> token, int page) async {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -527,7 +566,8 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -547,7 +587,8 @@ class UploadDataLogic extends BaseGetXController {
// //
Future<void> updataLockFaceList(List<int> token, int page) async { Future<void> updataLockFaceList(List<int> token, int page) async {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -572,7 +613,8 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -592,7 +634,8 @@ class UploadDataLogic extends BaseGetXController {
// //
Future<void> updataLockPalmVeinList(List<int> token, int page) async { Future<void> updataLockPalmVeinList(List<int> token, int page) async {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -617,12 +660,14 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
updataLockRemoteControlList(getTokenList, state.uploadRemoteControlPage); updataLockRemoteControlList(
getTokenList, state.uploadRemoteControlPage);
} else if (connectionState == BluetoothConnectionState.disconnected) { } else if (connectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
@ -637,7 +682,8 @@ class UploadDataLogic extends BaseGetXController {
// //
Future<void> updataLockRemoteControlList(List<int> token, int page) async { Future<void> updataLockRemoteControlList(List<int> token, int page) async {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -662,7 +708,8 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -682,7 +729,8 @@ class UploadDataLogic extends BaseGetXController {
// //
Future<void> updataLockSet(List<int> token) async { Future<void> updataLockSet(List<int> token) async {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -698,9 +746,16 @@ class UploadDataLogic extends BaseGetXController {
} }
// //
Future<void> _lockDataUpload({required int uploadType, required int recordType, required List records}) async { Future<void> _lockDataUpload(
{required int uploadType,
required int recordType,
required List records}) async {
final LoginEntity entity = await ApiRepository.to.lockDataUpload( final LoginEntity entity = await ApiRepository.to.lockDataUpload(
lockId: CommonDataManage().currentKeyInfo.lockId!, uploadType: uploadType, recordType: recordType, records: records, isUnShowLoading: false); lockId: CommonDataManage().currentKeyInfo.lockId!,
uploadType: uploadType,
recordType: recordType,
records: records,
isUnShowLoading: false);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (uploadType == 1) { if (uploadType == 1) {
// 1 // 1
@ -751,32 +806,32 @@ class UploadDataLogic extends BaseGetXController {
} else { } else {
// 2 // 2
switch (recordType) { switch (recordType) {
// case 1: // case 1:
// // // //
// //
// break; // break;
case 2: case 2:
// //
getUpdataLockCardList(); getUpdataLockCardList();
break; break;
case 3: case 3:
// IC卡上传成功 // IC卡上传成功
getUpdataLockFingerprintList(); getUpdataLockFingerprintList();
break; break;
case 4: case 4:
// //
getUpdataLockFaceList(); getUpdataLockFaceList();
break; break;
case 5: case 5:
// //
getUpdataLockPalmVeinList(); getUpdataLockPalmVeinList();
break; break;
case 6: case 6:
// //
getUpdataLockRemoteControlList(); getUpdataLockRemoteControlList();
break; break;
case 7: case 7:
// //
getUpdataLockSet(); getUpdataLockSet();
break; break;
default: default:

View File

@ -58,7 +58,7 @@ class LockVoiceSettingLogic extends BaseGetXController {
handleSetResult(reply); handleSetResult(reply);
} }
}); });
await initList(); initList();
readLockLanguage(); readLockLanguage();
} }

File diff suppressed because it is too large Load Diff

View File

@ -50,21 +50,31 @@ class BaseProvider extends GetConnect with Api {
httpClient.baseUrl = '${F.apiPrefix}/api'; httpClient.baseUrl = '${F.apiPrefix}/api';
} }
httpClient.timeout = timeout!.seconds; httpClient.timeout = timeout!.seconds;
// AppLog.log('timeout:$timeout httpClient.timeout:${httpClient.timeout}');
var res = await super.post(url, body, var res = await super.post(url, body,
contentType: contentType, headers: headers, query: query, decoder: decoder, uploadProgress: uploadProgress); contentType: contentType,
headers: headers,
query: query,
decoder: decoder,
uploadProgress: uploadProgress);
debugPrint("====1===$url---> ${res.bodyString}");
if (EasyLoading.isShow && !isUnShowLoading!) { if (EasyLoading.isShow && !isUnShowLoading!) {
await EasyLoading.dismiss(animation: true); await EasyLoading.dismiss(animation: true);
} }
debugPrint("===2====$url---> ${res.bodyString}");
if (res.body == null) { if (res.body == null) {
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
if (res.statusCode == null && isShowErrMsg!) { if (res.statusCode == null && isShowErrMsg!) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds); EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr,
duration: 2000.milliseconds);
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
} }
var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'}; var rs = {
'errorMsg': 'Network Error!',
'errorCode': -1,
'data': null,
'description': '表示成功或是。'
};
return Response( return Response(
request: res.request, request: res.request,
statusCode: -1, statusCode: -1,
@ -74,7 +84,6 @@ class BaseProvider extends GetConnect with Api {
statusText: res.statusText, statusText: res.statusText,
); );
} else {} } else {}
print('isShowNetworkErrorMsg:${isShowNetworkErrorMsg}');
if (isShowNetworkErrorMsg ?? true) { if (isShowNetworkErrorMsg ?? true) {
getDataResult(res.body); getDataResult(res.body);
} }
@ -102,15 +111,25 @@ class BaseProvider extends GetConnect with Api {
} else { } else {
httpClient.baseUrl = '${F.apiPrefix}/api'; httpClient.baseUrl = '${F.apiPrefix}/api';
} }
var res = await super.get(url, contentType: contentType, headers: headers, query: query, decoder: decoder); var res = await super.get(url,
contentType: contentType,
headers: headers,
query: query,
decoder: decoder);
if (EasyLoading.isShow && !isUnShowLoading!) { if (EasyLoading.isShow && !isUnShowLoading!) {
await EasyLoading.dismiss(animation: true); await EasyLoading.dismiss(animation: true);
} }
if (res.body == null) { if (res.body == null) {
if (res.statusCode == null && isShowErrMsg!) { if (res.statusCode == null && isShowErrMsg!) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds); EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr,
duration: 2000.milliseconds);
} }
var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'}; var rs = {
'errorMsg': 'Network Error!',
'errorCode': -1,
'data': null,
'description': '表示成功或是。'
};
return Response( return Response(
request: res.request, request: res.request,
statusCode: -1, statusCode: -1,
@ -147,7 +166,8 @@ class BaseProvider extends GetConnect with Api {
EasyLoading.showToast('数据不存在'.tr, duration: 2000.milliseconds); EasyLoading.showToast('数据不存在'.tr, duration: 2000.milliseconds);
break; break;
case 434: // case 434: //
ShowTipView().showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: ''); ShowTipView()
.showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: '');
break; break;
} }
} }

File diff suppressed because it is too large Load Diff