Merge branch 'release_sky' into 'master_sky'

Release sky

See merge request StarlockTeam/app-starlock!280
This commit is contained in:
李仪 2025-09-15 07:36:08 +00:00
commit bc24ca6146
9 changed files with 1713 additions and 2067 deletions

View File

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

View File

@ -82,8 +82,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: <Widget>[ actionsList: <Widget>[
Visibility( Visibility(
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || CommonDataManage().currentKeyInfo.keyRight == 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',
@ -92,27 +91,20 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
color: Colors.white, color: Colors.white,
), ),
onTap: () { onTap: () {
ShowTipView().showSureAlertDialog( ShowTipView().showSureAlertDialog('1.锁没有联网密码、IC卡、指纹等开门记录无法实时上传可以点击右上角按钮然后读取记录。'.tr + '\n' + '2.如果您需要保留历史记录,可以点击右上角按钮,然后导出记录'.tr,
'1.锁没有联网密码、IC卡、指纹等开门记录无法实时上传可以点击右上角按钮然后读取记录。'.tr + tipTitle: '看不到操作记录,可能原因有'.tr, sureStr: '我知道了'.tr);
'\n' +
'2.如果您需要保留历史记录,可以点击右上角按钮,然后导出记录'.tr,
tipTitle: '看不到操作记录,可能原因有'.tr,
sureStr: '我知道了'.tr);
}, },
)), )),
Visibility( Visibility(
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || CommonDataManage().currentKeyInfo.keyRight == 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) if (CommonDataManage().currentKeyInfo.isLockOwner == 1) const PopupMenuDivider(),
const PopupMenuDivider(), if (CommonDataManage().currentKeyInfo.isLockOwner == 1) _buildCustomPopupMenuItem('清空记录'.tr),
if (CommonDataManage().currentKeyInfo.isLockOwner == 1)
_buildCustomPopupMenuItem('清空记录'.tr),
const PopupMenuDivider(), const PopupMenuDivider(),
_buildCustomPopupMenuItem('导出记录'.tr), _buildCustomPopupMenuItem('导出记录'.tr),
]; ];
@ -130,11 +122,7 @@ 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>[ children: <Widget>[topAdvancedCalendarWidget(), eventDropDownWidget(), Expanded(child: timeLineView())],
topAdvancedCalendarWidget(),
eventDropDownWidget(),
Expanded(child: timeLineView())
],
), ),
floatingActionButton: Visibility( floatingActionButton: Visibility(
visible: _isAtBottom, visible: _isAtBottom,
@ -193,8 +181,7 @@ 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, Get.toNamed(Routers.exportSuccessPage, arguments: <String, String>{'filePath': filePath});
arguments: <String, String>{'filePath': filePath});
}, },
); );
}, },
@ -271,8 +258,7 @@ 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 formatter = DateFormat('MM${''.tr}dd${''.tr}'); // 2025-08-18 14:30
DateFormat('MM${''.tr}dd${''.tr}'); // 2025-08-18 14:30
return formatter.format(dateTime); return formatter.format(dateTime);
} }
@ -300,103 +286,71 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
final recordType = item.recordType; final recordType = item.recordType;
switch (recordType) { switch (recordType) {
case 10: case 10:
if (item.username != null && item.username != '') { return '${formatTimestampToHHmm(item.operateDate!)} ' + '指纹'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
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 +
'${'昵称'.tr}${item.username}' + '${_formatUserNameOrId(item)}' +
'${'密码'.tr}${item.keyboardPwd}'; '${'密码'.tr}${item.keyboardPwd}';
case 30: case 30:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + ''.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
''.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!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '蓝牙'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
'蓝牙'.tr +
'开锁'.tr +
'' +
'${'昵称'.tr}'.tr +
'${item.username}';
} else { } else {
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '蓝牙'.tr + '开锁'.tr + '' + 'ID'.tr + '${item.userid}';
'蓝牙'.tr +
'开锁'.tr +
'' +
'ID'.tr +
'${item.userid}';
} }
case 50: case 50:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '组合模式'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
'组合模式'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 60: case 60:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '指纹'.tr + '${_formatUserNameOrId(item)}';
'添加'.tr +
'指纹'.tr +
'${'昵称'.tr}${item.username}';
case 70: case 70:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '密码'.tr + '${_formatUserNameOrId(item)}';
'添加'.tr +
'密码'.tr +
'${'昵称'.tr}${item.username}';
case 80: case 80:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + ''.tr + '${_formatUserNameOrId(item)}';
'添加'.tr +
''.tr +
'${'昵称'.tr}${item.username}';
case 90: case 90:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '指纹'.tr + '${_formatUserNameOrId(item)}';
'删除'.tr +
'指纹'.tr +
'${'昵称'.tr}${item.username}';
case 100: case 100:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '密码'.tr + '${_formatUserNameOrId(item)}';
'删除'.tr +
'密码'.tr +
'${'昵称'.tr}${item.username}';
case 110: case 110:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + ''.tr + '${_formatUserNameOrId(item)}';
'删除'.tr +
''.tr +
'${'昵称'.tr}${item.username}';
case 160: case 160:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '人脸'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
'人脸'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 190: case 190:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫指纹'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
'胁迫指纹'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 200: case 200:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫密码'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
'胁迫密码'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
case 210: case 210:
return '${formatTimestampToHHmm(item.operateDate!)} ' + return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫卡片'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
'胁迫卡片'.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) {
@ -420,12 +374,9 @@ 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 int? firstVideoIndex = state.lockLogItemList.indexWhere((item) => _checkIsVideoOrImagesType(item));
.indexWhere((item) => _checkIsVideoOrImagesType(item));
bool isInvalid = _checkIsVideoOrImagesType(timelineData) && bool isInvalid = _checkIsVideoOrImagesType(timelineData) &&
((timelineData.imagesUrl == null && ((timelineData.imagesUrl == null && timelineData.videoUrl == null) || (timelineData.videoUrl == '' && timelineData.imagesUrl == ''));
timelineData.videoUrl == null) ||
(timelineData.videoUrl == '' && timelineData.imagesUrl == ''));
String typeText = ''; String typeText = '';
if (timelineData.recordType == 130) { if (timelineData.recordType == 130) {
@ -446,8 +397,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text('${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}',
'${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}',
style: TextStyle( style: TextStyle(
fontSize: 20.sp, fontSize: 20.sp,
)), )),
@ -464,12 +414,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
), ),
children: [ children: [
TextSpan( TextSpan(
text: _buildIDByType(timelineData) + text: _buildIDByType(timelineData) + (isInvalid ? '${typeText}' + '已失效'.tr + '' : ''),
(isInvalid
? '${typeText}' +
'已失效'.tr +
''
: ''),
), ),
WidgetSpan( WidgetSpan(
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
@ -504,8 +449,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
height: 12.h, height: 12.h,
), ),
Visibility( Visibility(
visible: _checkIsVideoOrImagesType(timelineData) && visible: _checkIsVideoOrImagesType(timelineData) && index == firstVideoIndex,
index == firstVideoIndex,
child: GestureDetector( child: GestureDetector(
onTap: () async { onTap: () async {
await logic.getWebPlayUrl(); await logic.getWebPlayUrl();
@ -580,9 +524,7 @@ 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) => .where((e) => (e.videoUrl != null && e.videoUrl!.isNotEmpty) || (e.imagesUrl != null && e.imagesUrl!.isNotEmpty))
(e.videoUrl != null && e.videoUrl!.isNotEmpty) ||
(e.imagesUrl != null && e.imagesUrl!.isNotEmpty))
.map( .map(
(e) => RecordListData( (e) => RecordListData(
videoUrl: e.videoUrl, videoUrl: e.videoUrl,
@ -593,16 +535,13 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
), ),
) )
.toList(); .toList();
final selectDateString = final selectDateString = DateTool().dateToYMDString(state.startDate.value.toString());
DateTool().dateToYMDString(state.startDate.value.toString()); final cloudStorageData = CloudStorageData(date: selectDateString, recordList: list);
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 && } else if (recordData.imagesUrl != null && recordData.imagesUrl!.isNotEmpty) {
recordData.imagesUrl!.isNotEmpty) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
@ -613,8 +552,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
); );
} }
}, },
child: ((recordData.imagesUrl != null && recordData.imagesUrl != '') || child: ((recordData.imagesUrl != null && recordData.imagesUrl != '') || (recordData.videoUrl != null && recordData.videoUrl != ''))
(recordData.videoUrl != null && recordData.videoUrl != ''))
? Container( ? Container(
width: 260.w, width: 260.w,
height: 260.h, height: 260.h,
@ -632,8 +570,7 @@ 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 && } else if (recordData.imagesUrl != null && recordData.imagesUrl!.isNotEmpty) {
recordData.imagesUrl!.isNotEmpty) {
return _buildImageItem(recordData); return _buildImageItem(recordData);
} else { } else {
return SizedBox.shrink(); return SizedBox.shrink();
@ -650,8 +587,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
child: Image.network( child: Image.network(
recordData.imagesUrl!, recordData.imagesUrl!,
fit: BoxFit.cover, fit: BoxFit.cover,
errorBuilder: errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) {
(BuildContext context, Object error, StackTrace? stackTrace) {
// //
return Image.asset( return Image.asset(
'images/icon_unHaveData.png', // 'images/icon_unHaveData.png', //
@ -749,11 +685,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
print('外部收到选中: $date'); print('外部收到选中: $date');
state.operateDate = date.millisecondsSinceEpoch; state.operateDate = date.millisecondsSinceEpoch;
state.startDate.value = state.startDate.value = DateTime(date.year, date.month, date.day).millisecondsSinceEpoch;
DateTime(date.year, date.month, date.day).millisecondsSinceEpoch; state.endDate.value = DateTime(date.year, date.month, date.day, 23, 59, 59, 999).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,8 +58,26 @@ class LockDetailState {
int logCountPage = 10; // int logCountPage = 10; //
RxInt nextAuthTime = 0.obs; // RxInt nextAuthTime = 0.obs; //
// LockDetailState() { int countReq = 10;//
// Map map = Get.arguments; RxInt indexCount = 0.obs;// 0/5
// 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,49 +29,41 @@ class UploadDataLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
// //
if (reply is UpdataLockPasswordListReply && if (reply is UpdataLockPasswordListReply && (state.ifCurrentScreen.value == true)) {
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockPasswordListReply(reply); _replyUpdataLockPasswordListReply(reply);
} }
// //
if (reply is UpdataLockCardListReply && if (reply is UpdataLockCardListReply && (state.ifCurrentScreen.value == true)) {
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockCardListReply(reply); _replyUpdataLockCardListReply(reply);
} }
// //
if (reply is UpdataLockFingerprintListReply && if (reply is UpdataLockFingerprintListReply && (state.ifCurrentScreen.value == true)) {
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockFingerprintListReply(reply); _replyUpdataLockFingerprintListReply(reply);
} }
// //
if (reply is UpdataLockFaceListReply && if (reply is UpdataLockFaceListReply && (state.ifCurrentScreen.value == true)) {
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockFaceListReply(reply); _replyUpdataLockFaceListReply(reply);
} }
// //
if (reply is UpdataLockPalmVeinListReply && if (reply is UpdataLockPalmVeinListReply && (state.ifCurrentScreen.value == true)) {
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockPalmVeinListReply(reply); _replyUpdataLockPalmVeinListReply(reply);
} }
// //
if (reply is UpdataLockRemoteControlListReply && if (reply is UpdataLockRemoteControlListReply && (state.ifCurrentScreen.value == true)) {
(state.ifCurrentScreen.value == true)) {
_replyUpdataLockRemoteControlListReply(reply); _replyUpdataLockRemoteControlListReply(reply);
} }
// //
if (reply is UpdataLockSetReply && if (reply is UpdataLockSetReply && (state.ifCurrentScreen.value == true) && (state.ifSeletUpdataBtnState == true)) {
(state.ifCurrentScreen.value == true) &&
(state.ifSeletUpdataBtnState == true)) {
_replyUpdataLockSetReply(reply); _replyUpdataLockSetReply(reply);
} }
}); });
@ -86,8 +78,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadPasswordDataList state.uploadPasswordDataList.addAll(reply.data.sublist(9, reply.data.length));
.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;
@ -105,10 +96,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload( _lockDataUpload(uploadType: 2, recordType: 2, records: state.uploadPasswordDataList);
uploadType: 2,
recordType: 2,
records: state.uploadPasswordDataList);
// } // }
} }
break; break;
@ -139,8 +127,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadCardDataList state.uploadCardDataList.addAll(reply.data.sublist(9, reply.data.length));
.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;
@ -157,8 +144,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload( _lockDataUpload(uploadType: 2, recordType: 3, records: state.uploadCardDataList);
uploadType: 2, recordType: 3, records: state.uploadCardDataList);
// } // }
} }
break; break;
@ -188,8 +174,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadFingerprintDataList state.uploadFingerprintDataList.addAll(reply.data.sublist(9, reply.data.length));
.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;
@ -206,10 +191,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload( _lockDataUpload(uploadType: 2, recordType: 4, records: state.uploadFingerprintDataList);
uploadType: 2,
recordType: 4,
records: state.uploadFingerprintDataList);
// } // }
} }
break; break;
@ -239,8 +221,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadFaceDataList state.uploadFaceDataList.addAll(reply.data.sublist(9, reply.data.length));
.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;
@ -257,8 +238,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload( _lockDataUpload(uploadType: 2, recordType: 5, records: state.uploadFaceDataList);
uploadType: 2, recordType: 5, records: state.uploadFaceDataList);
// } // }
} }
break; break;
@ -288,8 +268,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadPalmVeinDataList state.uploadPalmVeinDataList.addAll(reply.data.sublist(9, reply.data.length));
.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;
@ -306,10 +285,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload( _lockDataUpload(uploadType: 2, recordType: 6, records: state.uploadPalmVeinDataList);
uploadType: 2,
recordType: 6,
records: state.uploadPalmVeinDataList);
// } // }
} }
break; break;
@ -339,8 +315,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
final int dataLength = reply.data[8]; final int dataLength = reply.data[8];
state.uploadRemoteControlDataList state.uploadRemoteControlDataList.addAll(reply.data.sublist(9, reply.data.length));
.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;
@ -357,10 +332,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{ // }else{
// // // //
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload( _lockDataUpload(uploadType: 2, recordType: 7, records: state.uploadRemoteControlDataList);
uploadType: 2,
recordType: 7,
records: state.uploadRemoteControlDataList);
// } // }
} }
break; break;
@ -390,10 +362,8 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = state.indexCount.value + 1; state.indexCount.value = state.indexCount.value + 1;
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.uploadLockSetDataList state.uploadLockSetDataList.addAll(reply.data.sublist(7, reply.data.length));
.addAll(reply.data.sublist(7, reply.data.length)); _lockDataUpload(uploadType: 1, recordType: 0, records: state.uploadLockSetDataList);
_lockDataUpload(
uploadType: 1, recordType: 0, records: state.uploadLockSetDataList);
break; break;
case 0x06: case 0x06:
// //
@ -418,22 +388,18 @@ 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, BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
(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;
@ -446,8 +412,7 @@ 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 = final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
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);
@ -472,8 +437,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
(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!);
@ -493,8 +457,7 @@ 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 = final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
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);
@ -519,8 +482,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
(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!);
@ -540,8 +502,7 @@ 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 = final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
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);
@ -566,8 +527,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
(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!);
@ -587,8 +547,7 @@ 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 = final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
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);
@ -613,8 +572,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
(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!);
@ -634,8 +592,7 @@ 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 = final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
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);
@ -660,14 +617,12 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
(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( updataLockRemoteControlList(getTokenList, state.uploadRemoteControlPage);
getTokenList, state.uploadRemoteControlPage);
} else if (connectionState == BluetoothConnectionState.disconnected) { } else if (connectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
@ -682,8 +637,7 @@ 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 = final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
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);
@ -708,8 +662,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0; state.indexCount.value = 0;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
(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!);
@ -729,8 +682,7 @@ class UploadDataLogic extends BaseGetXController {
// //
Future<void> updataLockSet(List<int> token) async { Future<void> updataLockSet(List<int> token) async {
final List<String>? privateKey = final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
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);
@ -746,16 +698,9 @@ class UploadDataLogic extends BaseGetXController {
} }
// //
Future<void> _lockDataUpload( Future<void> _lockDataUpload({required int uploadType, required int recordType, required List records}) async {
{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!, lockId: CommonDataManage().currentKeyInfo.lockId!, uploadType: uploadType, recordType: recordType, records: records, isUnShowLoading: false);
uploadType: uploadType,
recordType: recordType,
records: records,
isUnShowLoading: false);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (uploadType == 1) { if (uploadType == 1) {
// 1 // 1
@ -806,32 +751,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);
} }
}); });
initList(); await initList();
readLockLanguage(); readLockLanguage();
} }

File diff suppressed because it is too large Load Diff

View File

@ -50,31 +50,21 @@ 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, contentType: contentType, headers: headers, query: query, decoder: decoder, uploadProgress: uploadProgress);
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, EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds);
duration: 2000.milliseconds);
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
} }
var rs = { var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'};
'errorMsg': 'Network Error!',
'errorCode': -1,
'data': null,
'description': '表示成功或是。'
};
return Response( return Response(
request: res.request, request: res.request,
statusCode: -1, statusCode: -1,
@ -84,6 +74,7 @@ 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);
} }
@ -111,25 +102,15 @@ class BaseProvider extends GetConnect with Api {
} else { } else {
httpClient.baseUrl = '${F.apiPrefix}/api'; httpClient.baseUrl = '${F.apiPrefix}/api';
} }
var res = await super.get(url, var res = await super.get(url, contentType: contentType, headers: headers, query: query, decoder: decoder);
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, EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds);
duration: 2000.milliseconds);
} }
var rs = { var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'};
'errorMsg': 'Network Error!',
'errorCode': -1,
'data': null,
'description': '表示成功或是。'
};
return Response( return Response(
request: res.request, request: res.request,
statusCode: -1, statusCode: -1,
@ -166,8 +147,7 @@ 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() ShowTipView().showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: '');
.showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: '');
break; break;
} }
} }

File diff suppressed because it is too large Load Diff