Merge branch 'develop_sky_liyi' into 'develop_sky'

Develop sky liyi

See merge request StarlockTeam/app-starlock!277
This commit is contained in:
李仪 2025-09-15 01:17:34 +00:00
commit 7feb282f13
9 changed files with 1713 additions and 2067 deletions

View File

@ -30,39 +30,41 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(
barTitle: '注册'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: ListView(
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: <Widget>[
topSelectCountryAndRegionWidget(),
middleTFWidget(),
Obx(() {
return SubmitBtn(
btnName: '注册'.tr,
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
if (state.agree.value == false) {
logic.showToast('请先同意用户协议及隐私政策'.tr);
return;
} else {
logic.register();
appBar: TitleAppBar(barTitle: '注册'.tr, haveBack: true, backgroundColor: AppColors.mainColor),
body: GestureDetector(
onTap: () {
FocusScope.of(context).unfocus();
},
child: ListView(
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: <Widget>[
topSelectCountryAndRegionWidget(),
middleTFWidget(),
Obx(() {
return SubmitBtn(
btnName: '注册'.tr,
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
if (state.agree.value == false) {
logic.showToast('请先同意用户协议及隐私政策'.tr);
return;
} else {
logic.register();
}
}
}
: null);
}),
SizedBox(
height: 20.h,
),
_buildBottomAgreement()
],
: null);
}),
SizedBox(
height: 20.h,
),
_buildBottomAgreement()
],
),
));
}
@ -77,9 +79,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
width: 340.w,
height: 60.h,
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(
children: <Widget>[
GestureDetector(
@ -93,18 +93,13 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
decoration: state.isIphoneType.value
? BoxDecoration(
color: AppColors.mainColor,
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))
: null,
child: Center(
child: Text(
'手机'.tr,
style: TextStyle(
color: state.isIphoneType.value
? Colors.white
: Colors.black),
style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black),
),
),
),
@ -121,19 +116,14 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
decoration: !state.isIphoneType.value
? BoxDecoration(
color: AppColors.mainColor,
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))
: null,
child: Center(
child: Text(
'邮箱'.tr,
style: TextStyle(
color: !state.isIphoneType.value
? Colors.white
: Colors.black,
color: !state.isIphoneType.value ? Colors.white : Colors.black,
),
),
),
@ -163,21 +153,15 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
child: Row(
children: <Widget>[
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),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
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,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor),
style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor),
)
],
),
@ -212,9 +196,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Padding(
padding: EdgeInsets.only(right: 5.w, left: 5.w),
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,
height: 30.w,
),
@ -248,8 +230,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
SizedBox(height: 15.w),
Text(
'密码必须是8-20位至少包括数字/字母/符号中的2种'.tr,
style:
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
style: TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
),
SizedBox(height: 10.w),
LoginInput(
@ -299,14 +280,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
onTap: (state.canSendCode.value && state.canResend.value)
? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
final Object? result = await Navigator.pushNamed(
context, Routers.safetyVerificationPage,
arguments: <String, Object>{
'countryCode': state.countryCode,
'account': state.phoneOrEmailStr.value
});
state.xWidth.value =
(result! as Map<String, dynamic>)['xWidth'];
final Object? result = await Navigator.pushNamed(context, Routers.safetyVerificationPage,
arguments: <String, Object>{'countryCode': state.countryCode, 'account': state.phoneOrEmailStr.value});
state.xWidth.value = (result! as Map<String, dynamic>)['xWidth'];
logic.sendValidationCode();
}
: null,
@ -315,10 +291,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
// height: 60.h,
padding: EdgeInsets.all(10.h),
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)),
child: Center(
child: Text(state.btnText.value,
@ -347,9 +320,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
logic.changeAgreeState();
},
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,
height: 30.w,
))),
@ -365,29 +336,17 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
WidgetSpan(
alignment: PlaceholderAlignment.middle,
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: () {
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(
alignment: PlaceholderAlignment.middle,
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: () {
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,8 +82,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
backgroundColor: AppColors.mainColor,
actionsList: <Widget>[
Visibility(
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 ||
CommonDataManage().currentKeyInfo.keyRight == 1,
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || CommonDataManage().currentKeyInfo.keyRight == 1,
child: GestureDetector(
child: Image.asset(
'images/icon_tips_Q.png',
@ -92,27 +91,20 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
color: Colors.white,
),
onTap: () {
ShowTipView().showSureAlertDialog(
'1.锁没有联网密码、IC卡、指纹等开门记录无法实时上传可以点击右上角按钮然后读取记录。'.tr +
'\n' +
'2.如果您需要保留历史记录,可以点击右上角按钮,然后导出记录'.tr,
tipTitle: '看不到操作记录,可能原因有'.tr,
sureStr: '我知道了'.tr);
ShowTipView().showSureAlertDialog('1.锁没有联网密码、IC卡、指纹等开门记录无法实时上传可以点击右上角按钮然后读取记录。'.tr + '\n' + '2.如果您需要保留历史记录,可以点击右上角按钮,然后导出记录'.tr,
tipTitle: '看不到操作记录,可能原因有'.tr, sureStr: '我知道了'.tr);
},
)),
Visibility(
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 ||
CommonDataManage().currentKeyInfo.keyRight == 1,
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || CommonDataManage().currentKeyInfo.keyRight == 1,
child: PopupMenuButton<String>(
onSelected: _onMenuItemSelected,
color: Colors.black,
itemBuilder: (BuildContext context) {
return <PopupMenuEntry<String>>[
_buildCustomPopupMenuItem('读取记录'.tr),
if (CommonDataManage().currentKeyInfo.isLockOwner == 1)
const PopupMenuDivider(),
if (CommonDataManage().currentKeyInfo.isLockOwner == 1)
_buildCustomPopupMenuItem('清空记录'.tr),
if (CommonDataManage().currentKeyInfo.isLockOwner == 1) const PopupMenuDivider(),
if (CommonDataManage().currentKeyInfo.isLockOwner == 1) _buildCustomPopupMenuItem('清空记录'.tr),
const PopupMenuDivider(),
_buildCustomPopupMenuItem('导出记录'.tr),
];
@ -130,11 +122,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
body: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
topAdvancedCalendarWidget(),
eventDropDownWidget(),
Expanded(child: timeLineView())
],
children: <Widget>[topAdvancedCalendarWidget(), eventDropDownWidget(), Expanded(child: timeLineView())],
),
floatingActionButton: Visibility(
visible: _isAtBottom,
@ -193,8 +181,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
builder: (BuildContext context) {
return ExportRecordDialog(
onExport: (String filePath) {
Get.toNamed(Routers.exportSuccessPage,
arguments: <String, String>{'filePath': filePath});
Get.toNamed(Routers.exportSuccessPage, arguments: <String, String>{'filePath': filePath});
},
);
},
@ -271,8 +258,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
String formatTimestampToDateTimeYYYYMMDD(int 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);
}
@ -300,103 +286,71 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
final recordType = item.recordType;
switch (recordType) {
case 10:
if (item.username != null && item.username != '') {
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'指纹'.tr +
'开锁'.tr +
'ID${item.username}';
} else {
return item.recordStr ?? '';
}
return '${formatTimestampToHHmm(item.operateDate!)} ' + '指纹'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
case 20:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'密码'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}' +
'${_formatUserNameOrId(item)}' +
'${'密码'.tr}${item.keyboardPwd}';
case 30:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
''.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + ''.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
case 40:
if (item.username != null && item.username != '') {
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'蓝牙'.tr +
'开锁'.tr +
'' +
'${'昵称'.tr}'.tr +
'${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '蓝牙'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
} else {
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'蓝牙'.tr +
'开锁'.tr +
'' +
'ID'.tr +
'${item.userid}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '蓝牙'.tr + '开锁'.tr + '' + 'ID'.tr + '${item.userid}';
}
case 50:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'组合模式'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '组合模式'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
case 60:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'添加'.tr +
'指纹'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '指纹'.tr + '${_formatUserNameOrId(item)}';
case 70:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'添加'.tr +
'密码'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '密码'.tr + '${_formatUserNameOrId(item)}';
case 80:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'添加'.tr +
''.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + ''.tr + '${_formatUserNameOrId(item)}';
case 90:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'删除'.tr +
'指纹'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '指纹'.tr + '${_formatUserNameOrId(item)}';
case 100:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'删除'.tr +
'密码'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '密码'.tr + '${_formatUserNameOrId(item)}';
case 110:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'删除'.tr +
''.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + ''.tr + '${_formatUserNameOrId(item)}';
case 160:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'人脸'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '人脸'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
case 190:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'胁迫指纹'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫指纹'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
case 200:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'胁迫密码'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫密码'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
case 210:
return '${formatTimestampToHHmm(item.operateDate!)} ' +
'胁迫卡片'.tr +
'开锁'.tr +
'${'昵称'.tr}${item.username}';
return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫卡片'.tr + '开锁'.tr + '${_formatUserNameOrId(item)}';
default:
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) {
final recordType = item.recordType;
switch (recordType) {
@ -420,12 +374,9 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
contentsBuilder: (BuildContext context, int index) {
final DoorLockLogDataItem timelineData = state.lockLogItemList[index];
// 👇 videoUrl build
int? firstVideoIndex = state.lockLogItemList
.indexWhere((item) => _checkIsVideoOrImagesType(item));
int? firstVideoIndex = state.lockLogItemList.indexWhere((item) => _checkIsVideoOrImagesType(item));
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 = '';
if (timelineData.recordType == 130) {
@ -446,8 +397,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}',
Text('${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}',
style: TextStyle(
fontSize: 20.sp,
)),
@ -464,12 +414,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
),
children: [
TextSpan(
text: _buildIDByType(timelineData) +
(isInvalid
? '${typeText}' +
'已失效'.tr +
''
: ''),
text: _buildIDByType(timelineData) + (isInvalid ? '${typeText}' + '已失效'.tr + '' : ''),
),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
@ -504,8 +449,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
height: 12.h,
),
Visibility(
visible: _checkIsVideoOrImagesType(timelineData) &&
index == firstVideoIndex,
visible: _checkIsVideoOrImagesType(timelineData) && index == firstVideoIndex,
child: GestureDetector(
onTap: () async {
await logic.getWebPlayUrl();
@ -580,9 +524,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) {
final lockLogItemList = state.lockLogItemList.value;
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(
(e) => RecordListData(
videoUrl: e.videoUrl,
@ -593,16 +535,13 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
),
)
.toList();
final selectDateString =
DateTool().dateToYMDString(state.startDate.value.toString());
final cloudStorageData =
CloudStorageData(date: selectDateString, recordList: list);
final selectDateString = DateTool().dateToYMDString(state.startDate.value.toString());
final cloudStorageData = CloudStorageData(date: selectDateString, recordList: list);
Get.toNamed(Routers.videoLogDetailPage, arguments: <String, Object>{
'recordData': recordData,
'videoDataList': [cloudStorageData]
});
} else if (recordData.imagesUrl != null &&
recordData.imagesUrl!.isNotEmpty) {
} else if (recordData.imagesUrl != null && recordData.imagesUrl!.isNotEmpty) {
Navigator.push(
context,
MaterialPageRoute(
@ -613,8 +552,7 @@ 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(
width: 260.w,
height: 260.h,
@ -632,8 +570,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
_buildImageOrVideoItem(RecordListData recordData) {
if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) {
return _buildVideoItem(recordData);
} else if (recordData.imagesUrl != null &&
recordData.imagesUrl!.isNotEmpty) {
} else if (recordData.imagesUrl != null && recordData.imagesUrl!.isNotEmpty) {
return _buildImageItem(recordData);
} else {
return SizedBox.shrink();
@ -650,8 +587,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
child: Image.network(
recordData.imagesUrl!,
fit: BoxFit.cover,
errorBuilder:
(BuildContext context, Object error, StackTrace? stackTrace) {
errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) {
//
return Image.asset(
'images/icon_unHaveData.png', //
@ -749,11 +685,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
print('外部收到选中: $date');
state.operateDate = date.millisecondsSinceEpoch;
state.startDate.value =
DateTime(date.year, date.month, date.day).millisecondsSinceEpoch;
state.endDate.value =
DateTime(date.year, date.month, date.day, 23, 59, 59, 999)
.millisecondsSinceEpoch;
state.startDate.value = 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);
},
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; //
RxInt nextAuthTime = 0.obs; //
// LockDetailState() {
// Map map = Get.arguments;
// lockCount = map["lockCount"];
// }
int countReq = 10;//
RxInt indexCount = 0.obs;// 0/5
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;
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);
}
//
if (reply is UpdataLockCardListReply &&
(state.ifCurrentScreen.value == true)) {
if (reply is UpdataLockCardListReply && (state.ifCurrentScreen.value == true)) {
_replyUpdataLockCardListReply(reply);
}
//
if (reply is UpdataLockFingerprintListReply &&
(state.ifCurrentScreen.value == true)) {
if (reply is UpdataLockFingerprintListReply && (state.ifCurrentScreen.value == true)) {
_replyUpdataLockFingerprintListReply(reply);
}
//
if (reply is UpdataLockFaceListReply &&
(state.ifCurrentScreen.value == true)) {
if (reply is UpdataLockFaceListReply && (state.ifCurrentScreen.value == true)) {
_replyUpdataLockFaceListReply(reply);
}
//
if (reply is UpdataLockPalmVeinListReply &&
(state.ifCurrentScreen.value == true)) {
if (reply is UpdataLockPalmVeinListReply && (state.ifCurrentScreen.value == true)) {
_replyUpdataLockPalmVeinListReply(reply);
}
//
if (reply is UpdataLockRemoteControlListReply &&
(state.ifCurrentScreen.value == true)) {
if (reply is UpdataLockRemoteControlListReply && (state.ifCurrentScreen.value == true)) {
_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);
}
});
@ -86,8 +78,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
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) {
// 10
state.uploadPasswordPage = state.uploadPasswordPage + 1;
@ -105,10 +96,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{
// //
state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(
uploadType: 2,
recordType: 2,
records: state.uploadPasswordDataList);
_lockDataUpload(uploadType: 2, recordType: 2, records: state.uploadPasswordDataList);
// }
}
break;
@ -139,8 +127,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
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) {
// 10
state.uploadCardPage = state.uploadCardPage + 1;
@ -157,8 +144,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{
// //
state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(
uploadType: 2, recordType: 3, records: state.uploadCardDataList);
_lockDataUpload(uploadType: 2, recordType: 3, records: state.uploadCardDataList);
// }
}
break;
@ -188,8 +174,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
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) {
// 10
state.uploadFingerprintPage = state.uploadFingerprintPage + 1;
@ -206,10 +191,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{
// //
state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(
uploadType: 2,
recordType: 4,
records: state.uploadFingerprintDataList);
_lockDataUpload(uploadType: 2, recordType: 4, records: state.uploadFingerprintDataList);
// }
}
break;
@ -239,8 +221,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
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) {
// 10
state.uploadFacePage = state.uploadFacePage + 1;
@ -257,8 +238,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{
//
state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(
uploadType: 2, recordType: 5, records: state.uploadFaceDataList);
_lockDataUpload(uploadType: 2, recordType: 5, records: state.uploadFaceDataList);
// }
}
break;
@ -288,8 +268,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
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) {
// 10
state.uploadPalmVeinPage = state.uploadPalmVeinPage + 1;
@ -306,10 +285,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{
// //
state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(
uploadType: 2,
recordType: 6,
records: state.uploadPalmVeinDataList);
_lockDataUpload(uploadType: 2, recordType: 6, records: state.uploadPalmVeinDataList);
// }
}
break;
@ -339,8 +315,7 @@ class UploadDataLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
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) {
// 10
state.uploadRemoteControlPage = state.uploadRemoteControlPage + 1;
@ -357,10 +332,7 @@ class UploadDataLogic extends BaseGetXController {
// }else{
// //
state.indexCount.value = state.indexCount.value + 1;
_lockDataUpload(
uploadType: 2,
recordType: 7,
records: state.uploadRemoteControlDataList);
_lockDataUpload(uploadType: 2, recordType: 7, records: state.uploadRemoteControlDataList);
// }
}
break;
@ -390,10 +362,8 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = state.indexCount.value + 1;
cancelBlueConnetctToastTimer();
state.uploadLockSetDataList
.addAll(reply.data.sublist(7, reply.data.length));
_lockDataUpload(
uploadType: 1, recordType: 0, records: state.uploadLockSetDataList);
state.uploadLockSetDataList.addAll(reply.data.sublist(7, reply.data.length));
_lockDataUpload(uploadType: 1, recordType: 0, records: state.uploadLockSetDataList);
break;
case 0x06:
//
@ -418,22 +388,18 @@ class UploadDataLogic extends BaseGetXController {
return;
}
state.sureBtnState.value = 1;
showEasyLoading();
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
AppLog.log('上传密码列表获取超时 关闭加载菊花');
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
updataLockPasswordList(getTokenList, state.uploadPasswordPage);
} else if (connectionState == BluetoothConnectionState.disconnected) {
AppLog.log('上传密码列表连接失败 关闭加载菊花');
dismissEasyLoading();
cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0;
@ -446,8 +412,7 @@ class UploadDataLogic extends BaseGetXController {
//
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<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -472,8 +437,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0;
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
@ -493,8 +457,7 @@ class UploadDataLogic extends BaseGetXController {
// Card列表
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<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -519,8 +482,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0;
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
@ -540,8 +502,7 @@ class UploadDataLogic extends BaseGetXController {
//
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<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -566,8 +527,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0;
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
@ -587,8 +547,7 @@ class UploadDataLogic extends BaseGetXController {
//
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<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -613,8 +572,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0;
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
@ -634,8 +592,7 @@ class UploadDataLogic extends BaseGetXController {
//
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<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -660,14 +617,12 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0;
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
updataLockRemoteControlList(
getTokenList, state.uploadRemoteControlPage);
updataLockRemoteControlList(getTokenList, state.uploadRemoteControlPage);
} else if (connectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
@ -682,8 +637,7 @@ class UploadDataLogic extends BaseGetXController {
//
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<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -708,8 +662,7 @@ class UploadDataLogic extends BaseGetXController {
state.indexCount.value = 0;
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
@ -729,8 +682,7 @@ class UploadDataLogic extends BaseGetXController {
//
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<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -746,16 +698,9 @@ 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(
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 (uploadType == 1) {
// 1
@ -806,32 +751,32 @@ class UploadDataLogic extends BaseGetXController {
} else {
// 2
switch (recordType) {
// case 1:
// //
//
// break;
// case 1:
// //
//
// break;
case 2:
//
//
getUpdataLockCardList();
break;
case 3:
// IC卡上传成功
// IC卡上传成功
getUpdataLockFingerprintList();
break;
case 4:
//
//
getUpdataLockFaceList();
break;
case 5:
//
//
getUpdataLockPalmVeinList();
break;
case 6:
//
//
getUpdataLockRemoteControlList();
break;
case 7:
//
//
getUpdataLockSet();
break;
default:

View File

@ -58,7 +58,7 @@ class LockVoiceSettingLogic extends BaseGetXController {
handleSetResult(reply);
}
});
initList();
await initList();
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.timeout = timeout!.seconds;
// AppLog.log('timeout:$timeout httpClient.timeout:${httpClient.timeout}');
var res = await super.post(url, body,
contentType: contentType,
headers: headers,
query: query,
decoder: decoder,
uploadProgress: uploadProgress);
debugPrint("====1===$url---> ${res.bodyString}");
contentType: contentType, headers: headers, query: query, decoder: decoder, uploadProgress: uploadProgress);
if (EasyLoading.isShow && !isUnShowLoading!) {
await EasyLoading.dismiss(animation: true);
}
debugPrint("===2====$url---> ${res.bodyString}");
if (res.body == null) {
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
if (res.statusCode == null && isShowErrMsg!) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr,
duration: 2000.milliseconds);
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, 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(
request: res.request,
statusCode: -1,
@ -84,6 +74,7 @@ class BaseProvider extends GetConnect with Api {
statusText: res.statusText,
);
} else {}
print('isShowNetworkErrorMsg:${isShowNetworkErrorMsg}');
if (isShowNetworkErrorMsg ?? true) {
getDataResult(res.body);
}
@ -111,25 +102,15 @@ class BaseProvider extends GetConnect with Api {
} else {
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!) {
await EasyLoading.dismiss(animation: true);
}
if (res.body == null) {
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(
request: res.request,
statusCode: -1,
@ -166,8 +147,7 @@ class BaseProvider extends GetConnect with Api {
EasyLoading.showToast('数据不存在'.tr, duration: 2000.milliseconds);
break;
case 434: //
ShowTipView()
.showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: '');
ShowTipView().showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: '');
break;
}
}

File diff suppressed because it is too large Load Diff