Merge branch 'master' of gitee.com:starlock-cn/app-starlock

This commit is contained in:
Daisy 2024-04-11 17:58:36 +08:00
commit 7eac75be82
50 changed files with 570 additions and 746 deletions

View File

@ -628,6 +628,40 @@
"根据提示,抬起手指后再进行下一次指纹采集": "According to the prompt, lift your finger and then collect the fingerprint again", "根据提示,抬起手指后再进行下一次指纹采集": "According to the prompt, lift your finger and then collect the fingerprint again",
"添加成功": "Add success", "添加成功": "Add success",
"搜索": "Search", "搜索": "Search",
"重置后,该锁的卡都将被删除哦,确认要重置吗?": "After resetting, the card of the lock will be deleted, do you want to reset?",
"已失效": "Invalid",
"卡详情": "Card details",
"请输入": "Please enter",
"关闭后,智能锁将设置为全天常开模式,直到手动关闭": "After closing, the smart lock will be set to all-day open mode until manually closed",
"请输入小于1000的数字": "Please enter a number less than 1000",
"操作成功": "Operation success",
"管理员密码相同,无需修改": "The administrator password is the same and does not need to be modified",
"修改密码": "Modify password",
"请输入6位管理员密码": "Please enter a 6-digit administrator password",
"请输入新的管理员密码": "Please enter a new administrator password",
"未分组": "Not grouped",
"请输入分组名称": "Please enter the group name",
"创建成功": "Create success",
"设置锁分组成功": "Set the lock group successfully",
"电池1": "Battery 1",
"电池2": "Battery 2",
"电量更新时间": "Electric quantity update time",
"锁电量更新成功": "Lock power update success",
"您的钥匙未生效": "Your key is not effective",
"您的钥匙已冻结": "Your key has been frozen",
"您的钥匙已过期": "Your key has expired",
"常开模式开启": "Open mode on",
"超级管理员": "Super administrator",
"授权管理员": "Authorized administrator",
"普通用户": "Ordinary user",
"余": "Balance",
"天": "Day",
"删除锁后,所有信息都会一起删除,确定删除锁吗?": "After deleting the lock, all information will be deleted together, are you sure you want to delete the lock?",
"请输入登录密码": "Please enter the login password",
"删除设备失败,请确保在设备附近,设备未被连接,设备已打开": "Failed to delete the device, please make sure that the device is near the device, the device is not connected, and the device is turned on",
"。如果是全自动锁,请使屏幕变亮": ". If it is a fully automatic lock, please make the screen brighter",
"用户无权限": "User has no permission",
"创建公司后,考勤功能才能使用": "After creating the company, the attendance function can be used",
"相机": "camera", "相机": "camera",
"相册": "photos", "相册": "photos",

View File

@ -628,6 +628,40 @@
"根据提示,抬起手指后再进行下一次指纹采集": "根据提示,抬起手指后再进行下一次指纹采集", "根据提示,抬起手指后再进行下一次指纹采集": "根据提示,抬起手指后再进行下一次指纹采集",
"添加成功": "添加成功", "添加成功": "添加成功",
"搜索": "搜索", "搜索": "搜索",
"重置后,该锁的卡都将被删除哦,确认要重置吗?": "重置后,该锁的卡都将被删除哦,确认要重置吗?",
"已失效": "已失效",
"卡详情": "卡详情",
"请输入": "请输入",
"关闭后,智能锁将设置为全天常开模式,直到手动关闭": "关闭后,智能锁将设置为全天常开模式,直到手动关闭",
"请输入小于1000的数字": "请输入小于1000的数字",
"操作成功": "操作成功",
"管理员密码相同,无需修改": "管理员密码相同,无需修改",
"修改密码": "修改密码",
"请输入6位管理员密码": "请输入6位管理员密码",
"请输入新的管理员密码": "请输入新的管理员密码",
"未分组": "未分组",
"请输入分组名称": "请输入分组名称",
"创建成功": "创建成功",
"设置锁分组成功": "设置锁分组成功",
"电池1": "电池1",
"电池2": "电池2",
"电量更新时间": "电量更新时间",
"锁电量更新成功": "锁电量更新成功",
"您的钥匙未生效": "您的钥匙未生效",
"您的钥匙已冻结": "您的钥匙已冻结",
"您的钥匙已过期": "您的钥匙已过期",
"常开模式开启": "常开模式开启",
"超级管理员": "超级管理员",
"授权管理员": "授权管理员",
"普通用户": "普通用户",
"余": "余",
"天": "天",
"删除锁后,所有信息都会一起删除,确定删除锁吗?": "删除锁后,所有信息都会一起删除,确定删除锁吗?",
"请输入登录密码": "请输入登录密码",
"删除设备失败,请确保在设备附近,设备未被连接,设备已打开": "删除设备失败,请确保在设备附近,设备未被连接,设备已打开",
"。如果是全自动锁,请使屏幕变亮": "。如果是全自动锁,请使屏幕变亮",
"用户无权限": "用户无权限",
"创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用",
"相机": "相机", "相机": "相机",
"相册": "相册", "相册": "相册",

View File

@ -629,6 +629,40 @@
"根据提示,抬起手指后再进行下一次指纹采集": "根据提示,抬起手指后再进行下一次指纹采集", "根据提示,抬起手指后再进行下一次指纹采集": "根据提示,抬起手指后再进行下一次指纹采集",
"添加成功": "添加成功", "添加成功": "添加成功",
"搜索": "搜索", "搜索": "搜索",
"重置后,该锁的卡都将被删除哦,确认要重置吗?": "重置后,该锁的卡都将被删除哦,确认要重置吗?",
"已失效": "已失效",
"卡详情": "卡详情",
"请输入": "请输入",
"关闭后,智能锁将设置为全天常开模式,直到手动关闭": "关闭后,智能锁将设置为全天常开模式,直到手动关闭",
"请输入小于1000的数字": "请输入小于1000的数字",
"操作成功": "操作成功",
"管理员密码相同,无需修改": "管理员密码相同,无需修改",
"修改密码": "修改密码",
"请输入6位管理员密码": "请输入6位管理员密码",
"请输入新的管理员密码": "请输入新的管理员密码",
"未分组": "未分组",
"请输入分组名称": "请输入分组名称",
"创建成功": "创建成功",
"设置锁分组成功": "设置锁分组成功",
"电池1": "电池1",
"电池2": "电池2",
"电量更新时间": "电量更新时间",
"锁电量更新成功": "锁电量更新成功",
"您的钥匙未生效": "您的钥匙未生效",
"您的钥匙已冻结": "您的钥匙已冻结",
"您的钥匙已过期": "您的钥匙已过期",
"常开模式开启": "常开模式开启",
"超级管理员": "超级管理员",
"授权管理员": "授权管理员",
"普通用户": "普通用户",
"余": "余",
"天": "天",
"删除锁后,所有信息都会一起删除,确定删除锁吗?": "删除锁后,所有信息都会一起删除,确定删除锁吗?",
"请输入登录密码": "请输入登录密码",
"删除设备失败,请确保在设备附近,设备未被连接,设备已打开": "删除设备失败,请确保在设备附近,设备未被连接,设备已打开",
"。如果是全自动锁,请使屏幕变亮": "。如果是全自动锁,请使屏幕变亮",
"用户无权限": "用户无权限",
"创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用",
"相机": "相机", "相机": "相机",
"相册": "相册", "相册": "相册",

View File

@ -94,5 +94,4 @@ class AddCardTypeLogic extends BaseGetXController{
super.onInit(); super.onInit();
} }
} }

View File

@ -172,8 +172,7 @@ class _AddCardPageState extends State<AddCardPage> {
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () async { action: () async {
var result = var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value, 'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value, 'starDate': state.beginTime.value,
'endDate': state.endTime.value, 'endDate': state.endTime.value,
@ -186,14 +185,12 @@ class _AddCardPageState extends State<AddCardPage> {
state.endTime.value = result['endDate']; state.endTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime']; state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime']; state.failureDateTime.value = result['endTime'];
Get.log(
'得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
} }
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.weekdaysList.isNotEmpty ? true : false, visible: state.weekdaysList.isNotEmpty ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: "有效日", leftTitel: "有效日".tr,
rightTitle: state.weekdaysList.value.join(",").toString(), rightTitle: state.weekdaysList.value.join(",").toString(),
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,

View File

@ -10,8 +10,6 @@ class AddCardTypeState{
final isStressFingerprint = false.obs; final isStressFingerprint = false.obs;
final isAdministrator = false.obs;// final isAdministrator = false.obs;//
// var beginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
// var endTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
var beginTime = "".obs;// var beginTime = "".obs;//
var endTime = "".obs;// var endTime = "".obs;//
var effectiveDateTime = "".obs;// var effectiveDateTime = "".obs;//

View File

@ -46,7 +46,6 @@ class AddICCardLogic extends BaseGetXController{
Future<void> _replyAddICCardBegin(Reply reply) async { Future<void> _replyAddICCardBegin(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
print("_replyAddFingerprintStatus:$status");
switch(status){ switch(status){
case 0x00: case 0x00:
@ -144,9 +143,7 @@ class AddICCardLogic extends BaseGetXController{
} }
Future<void> _replyAddICStressCard(Reply reply) async { Future<void> _replyAddICStressCard(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
print("_replyAddFingerprintstatus:$status");
switch(status){ switch(status){
case 0x00: case 0x00:
@ -262,8 +259,6 @@ class AddICCardLogic extends BaseGetXController{
icCardNo:state.isAdministrator.value == "2" ? 254 : 1, icCardNo:state.isAdministrator.value == "2" ? 254 : 1,
cardType:1, cardType:1,
useCountLimit:1, useCountLimit:1,
// startTime:0x11223344,
// endTime:0x11223344,
startTime:int.parse(state.startDate.value)~/1000, startTime:int.parse(state.startDate.value)~/1000,
endTime:int.parse(state.endDate.value)~/1000, endTime:int.parse(state.endDate.value)~/1000,
needAuthor:1, needAuthor:1,
@ -303,15 +298,15 @@ class AddICCardLogic extends BaseGetXController{
cardUserNo: state.cardNumber.value, cardUserNo: state.cardNumber.value,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("添加成功".tr, something:(){
showToast("添加成功"); if(state.fromType.value == 2){
if(state.fromType.value == 2){ //
// eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.cardNumber.value));
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.cardNumber.value)); }else if(state.fromType.value == 1){
}else if(state.fromType.value == 1){ eventBus.fire(OtherTypeRefreshListEvent());
eventBus.fire(OtherTypeRefreshListEvent()); }
} Get.close(2);
Get.close(2); });
} }
} }

View File

@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';

View File

@ -36,19 +36,18 @@ class CardDetailLogic extends BaseGetXController{
// () // ()
Future<void> _replyAddICCardBegin(Reply reply) async { Future<void> _replyAddICCardBegin(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
print("_replyAddFingerprintStatus:$status");
switch(status){ switch(status){
case 0x00: case 0x00:
// //
print("${reply.commandType!.typeValue} 数据解析成功"); Get.log("${reply.commandType!.typeValue} 数据解析成功");
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
dismissEasyLoading(); dismissEasyLoading();
deletICCardData(); deletICCardData();
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType!.typeValue} 需要鉴权"); Get.log("${reply.commandType!.typeValue} 需要鉴权");
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -73,19 +72,16 @@ class CardDetailLogic extends BaseGetXController{
); );
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType!.typeValue} 用户无权限"); Get.log("${reply.commandType!.typeValue} 用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType!.typeValue} 权限校验错误"); Get.log("${reply.commandType!.typeValue} 权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType!.typeValue} 失败"); Get.log("${reply.commandType!.typeValue} 失败");
break; break;
} }
} }
@ -112,7 +108,6 @@ class CardDetailLogic extends BaseGetXController{
var token = await Storage.getStringList(saveBlueToken); var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList");
String? userID = await Storage.getUid(); String? userID = await Storage.getUid();
IoSenderManage.senderAddICCardCommand( IoSenderManage.senderAddICCardCommand(
@ -144,8 +139,8 @@ class CardDetailLogic extends BaseGetXController{
cardId: state.keyId.value.toString(), cardId: state.keyId.value.toString(),
lockId: state.fingerprintItemData.value.lockId.toString(), lockId: state.fingerprintItemData.value.lockId.toString(),
weekDay: state.weekDay.value, weekDay: state.weekDay.value,
startDate: state.starDate.value*1000, startDate: state.starDate.value,
endDate: state.endDate.value*1000, endDate: state.endDate.value,
isCoerced: state.isStressFingerprint.value ? "2" : "1", isCoerced: state.isStressFingerprint.value ? "2" : "1",
cardName: state.changeNameController.text, cardName: state.changeNameController.text,
changeType: "1", changeType: "1",
@ -154,7 +149,7 @@ class CardDetailLogic extends BaseGetXController{
cardType:state.keyType.value, cardType:state.keyType.value,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("修改成功", something: (){ showToast("修改成功".tr, something: (){
eventBus.fire(OtherTypeRefreshListEvent()); eventBus.fire(OtherTypeRefreshListEvent());
}); });
} }
@ -169,7 +164,7 @@ class CardDetailLogic extends BaseGetXController{
deleteType:"1" deleteType:"1"
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("删除成功", something: (){ showToast("删除成功".tr, something: (){
Get.back(result: "addScuess"); Get.back(result: "addScuess");
}); });
} }
@ -178,7 +173,7 @@ class CardDetailLogic extends BaseGetXController{
String getKeyTypeShowDateTime(){ String getKeyTypeShowDateTime(){
String useDateStr = ''; String useDateStr = '';
if(state.keyType.value == 1){ if(state.keyType.value == 1){
useDateStr = "永久"; useDateStr = "永久".tr;
}else if(state.keyType.value == 2){ }else if(state.keyType.value == 2){
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}"; useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
} else if(state.keyType.value == 4){ } else if(state.keyType.value == 4){

View File

@ -11,9 +11,8 @@ import '../../../../blue/blue_manage.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/dateTool.dart'; import '../../../../tools/dateTool.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/showTFView.dart'; import '../../../../tools/showTFView.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
@ -35,7 +34,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: "卡详情", barTitle: "卡详情".tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
@ -59,7 +58,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 70.h, allHeight: 70.h,
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
rightTitle: logic.getKeyTypeShowDateTime(), rightTitle: logic.getKeyTypeShowDateTime(),
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
@ -85,12 +83,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
}); });
if(data != null) { if(data != null) {
setState(() { setState(() {
print("state.starDate.value:${data["starDate"]} "
"state.endDate.value:${data["endDate"]} "
"state.starTime.value:${data["starTime"]} "
"state.endTime.value:${data["endTime"]} "
"state.weekDay.value:${data["weekDay"]}");
state.starDate.value = data["starDate"]; state.starDate.value = data["starDate"];
state.endDate.value = data["endDate"]; state.endDate.value = data["endDate"];
state.starTime.value = data["starTime"]; state.starTime.value = data["starTime"];
@ -126,7 +118,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false, visible: state.keyType.value == 4 ? true : false,
child: Obx(() => CommonItem( child: Obx(() => CommonItem(
leftTitel: "有效时间", leftTitel: "有效时间".tr,
rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}", rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
@ -180,7 +172,9 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () { onClick: () {
showIosTipViewDialog(context); ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
logic.senderAddICCard();
});
}), }),
], ],
), ),
@ -203,97 +197,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
); );
} }
// Widget addControlsBtn(int type) {
// List<Widget> widgetList = [];
// List<Map<String, dynamic>> routerList = [];
// //
// if (type == 0) {
// routerList.add({
// 'btnTitle': '设置密码',
// 'routerName': Routers.passwordKeyDetailPage,
// 'type': 9
// });
// routerList.add({
// 'btnTitle': '设置指纹',
// 'routerName': Routers.otherTypeKeyManagePage,
// 'type': 1
// });
// routerList.add({
// 'btnTitle': '设置遥控',
// 'routerName': Routers.otherTypeKeyManagePage,
// 'type': 2
// });
// } else if (type == 1) {
// //
// routerList.add({
// 'btnTitle': '设置密码',
// 'routerName': Routers.passwordKeyDetailPage,
// 'type': 9
// });
// routerList.add({
// 'btnTitle': '设置卡',
// 'routerName': Routers.otherTypeKeyManagePage,
// 'type': 0
// });
// routerList.add({
// 'btnTitle': '设置遥控',
// 'routerName': Routers.otherTypeKeyManagePage,
// 'type': 2
// });
// } else if (type == 2) {
// //
// routerList.add({
// 'btnTitle': '设置密码',
// 'routerName': Routers.passwordKeyDetailPage,
// 'type': 9
// });
// routerList.add({
// 'btnTitle': '设置卡',
// 'routerName': Routers.otherTypeKeyManagePage,
// 'type': 0
// });
// routerList.add({
// 'btnTitle': '设置指纹',
// 'routerName': Routers.otherTypeKeyManagePage,
// 'type': 1
// });
// }
//
// for (int i = 0; i < routerList.length; i++) {
// widgetList.add(SizedBox(
// width: ScreenUtil().screenWidth - 40.w,
// height: 60.h,
// child: OutlinedButton(
// style: OutlinedButton.styleFrom(
// // backgroundColor: Colors.white,
// side: BorderSide(width: 1, color: AppColors.mainColor)),
// onPressed: () {
// if (routerList[i]['type'] == 9) {
// Navigator.pushNamed(context, Routers.passwordKeyManagePage);
// } else {
// Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
// arguments: routerList[i]['type']);
// }
// },
// child: Text(
// routerList[i]['btnTitle'],
// style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
// )),
// ));
//
// widgetList.add(
// SizedBox(
// height: 10.h,
// ),
// );
// }
//
// return Column(
// children: widgetList,
// );
// }
void showCupertinoAlertDialog(BuildContext context) { void showCupertinoAlertDialog(BuildContext context) {
showDialog( showDialog(
context: context, context: context,
@ -304,7 +207,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
controller: state.changeNameController, controller: state.changeNameController,
sureClick: () { sureClick: () {
if(state.changeNameController.text.isEmpty){ if(state.changeNameController.text.isEmpty){
logic.showToast("请输入姓名"); logic.showToast("请输入姓名".tr);
return; return;
} }
Get.back(); Get.back();
@ -317,25 +220,24 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
}); });
} }
void showIosTipViewDialog(BuildContext context) { // void showIosTipViewDialog(BuildContext context) {
showDialog( // showDialog(
context: context, // context: context,
builder: (BuildContext context) { // builder: (BuildContext context) {
return ShowIosTipView( // return ShowIosTipView(
title: "提示", // title: "提示",
tipTitle: "确定要删除吗?", // tipTitle: "确定要删除吗?",
sureClick: () async { // sureClick: () async {
Get.back(); // Get.back();
String? idStr = await Storage.getUid(); // logic.senderAddICCard();
logic.senderAddICCard(); // },
}, // cancelClick: () {
cancelClick: () { // Get.back();
Get.back(); // },
}, // );
); // }
} // );
); // }
}
@override @override
void didChangeDependencies() { void didChangeDependencies() {

View File

@ -327,13 +327,13 @@ class CardListLogic extends BaseGetXController {
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
if(state.isDeletAll == false){ if(state.isDeletAll == false){
showToast("删除成功", something: (){ showToast("删除成功".tr, something: (){
state.isDeletCardData = false; state.isDeletCardData = false;
pageNo = 1; pageNo = 1;
getICCardListData(); getICCardListData();
}); });
}else{ }else{
showToast("重置成功", something: (){ showToast("重置成功".tr, something: (){
state.isDeletCardData = false; state.isDeletCardData = false;
pageNo = 1; pageNo = 1;
getICCardListData(); getICCardListData();
@ -356,11 +356,11 @@ class CardListLogic extends BaseGetXController {
var keyTypeStr = "";// var keyTypeStr = "";//
if(fingerprintItemData.cardStatus == 1){ if(fingerprintItemData.cardStatus == 1){
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){ if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
keyTypeStr = "未生效"; keyTypeStr = "未生效".tr;
} }
}else if(fingerprintItemData.cardStatus == 2){ }else if(fingerprintItemData.cardStatus == 2){
keyTypeStr = "已失效"; keyTypeStr = "已失效".tr;
} }
return keyTypeStr; return keyTypeStr;
} }

View File

@ -64,7 +64,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
onPressed: () async { onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog("重置后,该锁的卡都将被删除哦,确认要重置吗?", () async { ShowTipView().showIosTipWithContentDialog("重置后,该锁的卡都将被删除哦,确认要重置吗?".tr, () async {
state.isDeletCardData = true; state.isDeletCardData = true;
state.isDeletAll = true; state.isDeletAll = true;
state.deletKeyID = "1"; state.deletKeyID = "1";
@ -74,7 +74,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
}); });
// showDeletAlertDialog(context); // showDeletAlertDialog(context);
} else { } else {
logic.showToast("演示模式"); logic.showToast("演示模式".tr);
} }
}, },
), ),
@ -148,7 +148,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
}, },
backgroundColor: Colors.red, backgroundColor: Colors.red,
foregroundColor: Colors.white, foregroundColor: Colors.white,
label: '删除', label: '删除'.tr,
padding: EdgeInsets.only(left: 5.w, right: 5.w), padding: EdgeInsets.only(left: 5.w, right: 5.w),
), ),
], ],
@ -187,10 +187,6 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
height: 90.h, height: 90.h,
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
color: Colors.white, color: Colors.white,
// decoration: BoxDecoration(
// color: Colors.white,
// // borderRadius: BorderRadius.circular(10.w),
// ),
child: Row( child: Row(
children: [ children: [
SizedBox(width: 30.w), SizedBox(width: 30.w),

View File

@ -14,12 +14,12 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1); var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1); var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) { if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间"); showToast("失效时间需大于生效时间".tr);
return; return;
} }
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) { if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
showToast("生效时间需大于当前时间"); showToast("生效时间需大于当前时间".tr);
return; return;
} }
var entity = await ApiRepository.to.editFingerprintsData( var entity = await ApiRepository.to.editFingerprintsData(
@ -36,7 +36,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
fingerprintType: state.fingerprintItemData.value.fingerprintType! == 4 ? 4 : 2, fingerprintType: state.fingerprintItemData.value.fingerprintType! == 4 ? 4 : 2,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("修改成功", something: (){ showToast("修改成功".tr, something: (){
eventBus.fire(OtherTypeRefreshListEvent()); eventBus.fire(OtherTypeRefreshListEvent());
Get.back(result: { Get.back(result: {
"beginTimeTimestamp":beginTimeTimestamp.toString(), "beginTimeTimestamp":beginTimeTimestamp.toString(),
@ -51,12 +51,12 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1); var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1); var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) { if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间"); showToast("失效时间需大于生效时间".tr);
return; return;
} }
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) { if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
showToast("生效时间需大于当前时间"); showToast("生效时间需大于当前时间".tr);
return; return;
} }
@ -74,7 +74,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
cardType: 2,// 2: cardType: 2,// 2:
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("修改成功", something: (){ showToast("修改成功".tr, something: (){
Get.back(result: { Get.back(result: {
"beginTimeTimestamp":beginTimeTimestamp.toString(), "beginTimeTimestamp":beginTimeTimestamp.toString(),
"endTimeTimestamp":endTimeTimestamp.toString(), "endTimeTimestamp":endTimeTimestamp.toString(),

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -40,7 +41,6 @@ class _OtherTypeKeyChangeDatePageState
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () { onPressed: () {
// print("state.pushType.value:${state.pushType.value}");
switch (state.pushType.value) { switch (state.pushType.value) {
case 0: case 0:
// //

View File

@ -18,12 +18,12 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0); var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
if (starDateTimestamp >= endDateTimestamp) { if (starDateTimestamp >= endDateTimestamp) {
showToast("失效日期要大于生效日期"); showToast("失效日期要大于生效日期".tr);
return; return;
} }
if (starTimeTimestamp >= endTimeTimestamp) { if (starTimeTimestamp >= endTimeTimestamp) {
showToast("失效时间要大于生效时间"); showToast("失效时间要大于生效时间".tr);
return; return;
} }
var entity = await ApiRepository.to.editFingerprintsData( var entity = await ApiRepository.to.editFingerprintsData(
@ -40,7 +40,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
fingerprintType: state.fingerprintItemData.value.fingerprintType!, fingerprintType: state.fingerprintItemData.value.fingerprintType!,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("修改成功", something: (){ showToast("修改成功".tr, something: (){
eventBus.fire(OtherTypeRefreshListEvent()); eventBus.fire(OtherTypeRefreshListEvent());
Get.back(result: { Get.back(result: {
"starDate":starDateTimestamp.toString(), "starDate":starDateTimestamp.toString(),
@ -61,12 +61,12 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0); var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
if (starDateTimestamp >= endDateTimestamp) { if (starDateTimestamp >= endDateTimestamp) {
showToast("失效日期要大于生效日期"); showToast("失效日期要大于生效日期".tr);
return; return;
} }
if (starTimeTimestamp >= endTimeTimestamp) { if (starTimeTimestamp >= endTimeTimestamp) {
showToast("失效时间要大于生效时间"); showToast("失效时间要大于生效时间".tr);
return; return;
} }
var entity = await ApiRepository.to.editICCardData( var entity = await ApiRepository.to.editICCardData(
@ -83,7 +83,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
cardType: state.fingerprintItemData.value.cardType!, cardType: state.fingerprintItemData.value.cardType!,
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast("修改成功", something: (){ showToast("修改成功".tr, something: (){
eventBus.fire(OtherTypeRefreshListEvent()); eventBus.fire(OtherTypeRefreshListEvent());
Get.back(result: { Get.back(result: {
"starDate":starDateTimestamp.toString(), "starDate":starDateTimestamp.toString(),

View File

@ -29,7 +29,7 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: "修改有效期", barTitle: "修改有效期".tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: ListView( body: ListView(
@ -63,7 +63,7 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
child: Column( child: Column(
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: "生效日期", leftTitel: "生效日期".tr,
rightTitle: state.starDate.value, rightTitle: state.starDate.value,
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
@ -74,7 +74,7 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
}); });
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: "失效日期", leftTitel: "失效日期".tr,
rightTitle: state.endDate.value, rightTitle: state.endDate.value,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {

View File

@ -38,6 +38,7 @@ class CheckingInSetLogic extends BaseGetXController{
state.weekDays.value = state.checkingInSetInfo.value.workDay!; state.weekDays.value = state.checkingInSetInfo.value.workDay!;
state.weekDaysStr.value = state.weekDays.value.join(","); state.weekDaysStr.value = state.weekDays.value.join(",");
state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0) ? true : false;
state.staffNumber.value = state.checkingInSetInfo.value.staffNum!.toString(); state.staffNumber.value = state.checkingInSetInfo.value.staffNum!.toString();
state.companyName.value = state.checkingInSetInfo.value.companyName!; state.companyName.value = state.checkingInSetInfo.value.companyName!;

View File

@ -84,7 +84,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: leftTitel:
"${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.tr}", "${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.tr}",
rightTitle: state.weekDaysStr.value, rightTitle: state.isCustom.value == true ? state.weekDaysStr.value : (state.weekDaysStr.value.length == 5 ? "单休" : "双休"),
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
@ -95,12 +95,10 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
"checkingInSetInfo": state.checkingInSetInfo.value, "checkingInSetInfo": state.checkingInSetInfo.value,
}); });
if(data != null) { if(data != null) {
print("data: $data"); Get.log("data: $data");
state.isCustom.value = data["attendanceType"]; state.isCustom.value = data["attendanceType"];
state.weekDays.value = data["weekDays"]; state.weekDays.value = data["weekDays"];
state.weekDaysStr.value = state.weekDays.value.join(","); state.weekDaysStr.value = state.weekDays.value.join(",");
// logic.getCheckInSetInfoData();
setState(() {});
} }
})), })),
CommonItem( CommonItem(

View File

@ -9,7 +9,7 @@ class CheckingInSetState{
final getKeyInfosData = LockListInfoItemEntity().obs; final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs; final companyId = "".obs;
var isCustom = true.obs; var isCustom = false.obs;
var weekDays = <int>[].obs;// var weekDays = <int>[].obs;//
var weekDaysStr = "".obs;// var weekDaysStr = "".obs;//

View File

@ -51,11 +51,6 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0, isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0,
remoteEnable: state.isRemoteUnlock.value ? 1 : 2); remoteEnable: state.isRemoteUnlock.value ? 1 : 2);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
// if(updateType == 1){
// state.onlyManageYouCreatesUser.value = !state.onlyManageYouCreatesUser.value;
// }else if(updateType == 2){
// state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
// }
showToast("修改成功".tr, something: () { showToast("修改成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI()); eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI()); eventBus.fire(AuthorizedAdminPageRefreshUI());

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -85,18 +86,11 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
}); });
if(data != null) { if(data != null) {
setState(() { setState(() {
print("state.starDate.value:${data["starDate"]} "
"state.endDate.value:${data["endDate"]} "
"state.starTime.value:${data["starTime"]} "
"state.endTime.value:${data["endTime"]} "
"state.weekDay.value:${data["validityValue"]}");
state.starDate.value = data["starDate"]; state.starDate.value = data["starDate"];
state.endDate.value = data["endDate"]; state.endDate.value = data["endDate"];
state.starTime.value = data["starTime"]; state.starTime.value = data["starTime"];
state.endTime.value = data["endTime"]; state.endTime.value = data["endTime"];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data["validityValue"];
}); });
} }
} }
@ -266,9 +260,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: title: "${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}", tipTitle: "请输入".tr,
tipTitle: "请输入",
controller: state.changeNameController, controller: state.changeNameController,
sureClick: () { sureClick: () {
// //

View File

@ -38,7 +38,6 @@ class ElectronicKeyDetailState {
starTime.value = itemData.value.startDate!.toString(); starTime.value = itemData.value.startDate!.toString();
endTime.value = itemData.value.endDate!.toString(); endTime.value = itemData.value.endDate!.toString();
weekDay.value = itemData.value.weekDays!; weekDay.value = itemData.value.weekDays!;
// Get.log("starTime.value: ${starTime.value} endTime.value: ${endTime.value}");
keyType.value = itemData.value.keyType!; keyType.value = itemData.value.keyType!;
} }
} }

View File

@ -32,8 +32,7 @@ class LockDetailLogic extends BaseGetXController {
// //
void initReplySubscription() { void initReplySubscription() {
state.replySubscription = state.replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}"); Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
// //
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) { if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
@ -85,9 +84,6 @@ class LockDetailLogic extends BaseGetXController {
timer.cancel(); timer.cancel();
eventBus.fire(RefreshLockDetailInfoDataEvent()); eventBus.fire(RefreshLockDetailInfoDataEvent());
}); });
// Future.delayed(const Duration(seconds: 3), () {
// state.iSClosedUnlockSuccessfulPopup.value = false;
// });
// //
int power = reply.data[7]; int power = reply.data[7];
@ -381,9 +377,7 @@ class LockDetailLogic extends BaseGetXController {
eventBus.fire(RefreshLockDetailInfoDataEvent()); eventBus.fire(RefreshLockDetailInfoDataEvent());
}); });
BlueManage() BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
// //
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
@ -397,8 +391,8 @@ class LockDetailLogic extends BaseGetXController {
if (token != null) { if (token != null) {
getTokenList = changeStringListToIntList(token); getTokenList = changeStringListToIntList(token);
} }
Get.log(
"BlueManage().connectDeviceName:${BlueManage().connectDeviceName} authUserID:${state.senderUserId.toString()} keyID:${state.keyInfos.value.keyId.toString()} userID:${await Storage.getUid()}"); Get.log("BlueManage().connectDeviceName:${BlueManage().connectDeviceName} authUserID:${state.senderUserId.toString()} keyID:${state.keyInfos.value.keyId.toString()} userID:${await Storage.getUid()}");
IoSenderManage.senderAddUser( IoSenderManage.senderAddUser(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
authUserID: state.senderUserId.toString(), authUserID: state.senderUserId.toString(),

View File

@ -1,3 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -947,9 +948,6 @@ class _LockDetailPageState extends State<LockDetailPage>
// } // }
startOpenLock() { startOpenLock() {
// print("11111111");
// checkBlueIsOpen((){
// print("33333333");
if (state.openLockBtnState.value == 1) { if (state.openLockBtnState.value == 1) {
return; return;
} }

View File

@ -6,14 +6,6 @@ import 'package:get/get.dart';
import '../../../blue/io_reply.dart'; import '../../../blue/io_reply.dart';
import '../../lockMian/entity/lockListInfo_entity.dart'; import '../../lockMian/entity/lockListInfo_entity.dart';
// enum RKConnectState {
// NULL,
// STOPPED, // 0
// CONNECTING, //1
// CONNECTED, //2
// CHECKING, // 3
// CONNECTFAIL, // 4
// }
class LockDetailState { class LockDetailState {
Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs; Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;

View File

@ -27,7 +27,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
if(state.isCustomLockTime.value == true){ if(state.isCustomLockTime.value == true){
autoTime = state.timeController.text; autoTime = state.timeController.text;
if(int.parse(autoTime) >= 1000){ if(int.parse(autoTime) >= 1000){
showToast("请输入小于1000的数字"); showToast("请输入小于1000的数字".tr);
return; return;
} }
}else{ }else{
@ -44,7 +44,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
state.autoLockTime.value = autoTime; state.autoLockTime.value = autoTime;
state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond = int.parse(state.autoLockTime.value); state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond = int.parse(state.autoLockTime.value);
showToast("操作成功", something: (){ showToast("操作成功".tr, something: (){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Get.back(); Get.back();
@ -167,7 +167,6 @@ class AutomaticBlockingLogic extends BaseGetXController{
autoTime = state.autoLockTime.value; autoTime = state.autoLockTime.value;
} }
} }
// print("autoTimeautoTimeautoTime:${autoTime}");
IoSenderManage.setSupportFunctionsWithParametersCommand( IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(), userID: await Storage.getUid(),
@ -205,7 +204,6 @@ class AutomaticBlockingLogic extends BaseGetXController{
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady
super.onReady(); super.onReady();
print("onReady()");
_initReplySubscription(); _initReplySubscription();
} }
@ -214,7 +212,6 @@ class AutomaticBlockingLogic extends BaseGetXController{
void onInit() { void onInit() {
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
print("onInit()");
// _readSupportFunctionsWithParameters(); // _readSupportFunctionsWithParameters();
} }

View File

@ -10,6 +10,7 @@ import '../../../../blue/blue_manage.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/showBottomSheetTool.dart'; import '../../../../tools/showBottomSheetTool.dart';
import '../../../../tools/showTipView.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'automaticBlocking_logic.dart'; import 'automaticBlocking_logic.dart';
@ -44,7 +45,9 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
// } // }
if(state.isOpen.value == false){ if(state.isOpen.value == false){
showDeletAlertTipDialog(context); ShowTipView().showIosTipWithContentDialog('关闭后,智能锁将设置为全天常开模式,直到手动关闭'.tr, (){
logic.sendAutoLock();
});
}else{ }else{
logic.sendAutoLock(); logic.sendAutoLock();
} }
@ -72,7 +75,7 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
Builder(builder: (context) { Builder(builder: (context) {
return Obx(() => CommonItem( return Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.delayTime!.tr, leftTitel: TranslationLoader.lanKeys!.delayTime!.tr,
rightTitle: state.isCustomLockTime.value == true ? "自定义" : (state.autoLockTime.value.isNotEmpty && state.autoLockTime.value != "0") ? "${state.autoLockTime}s" : "", rightTitle: state.isCustomLockTime.value == true ? "自定义".tr : (state.autoLockTime.value.isNotEmpty && state.autoLockTime.value != "0") ? "${state.autoLockTime}s" : "",
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -195,32 +198,32 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
); );
} }
void showDeletAlertTipDialog(BuildContext context) { // void showDeletAlertTipDialog(BuildContext context) {
showCupertinoDialog( // showCupertinoDialog(
context: context, // context: context,
builder: (context) { // builder: (context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
// title: const Text("提示"), // // title: const Text("提示"),
content: const Text('关闭后,智能锁将设置为全天常开模式,直到手动关闭'), // content: Text('关闭后,智能锁将设置为全天常开模式,直到手动关闭'.tr),
actions: [ // actions: [
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr), // child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () { // onPressed: () {
Get.back(); // Get.back();
}, // },
), // ),
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.sure!.tr), // child: Text(TranslationLoader.lanKeys!.sure!.tr),
onPressed: () { // onPressed: () {
Get.back(); // Get.back();
logic.sendAutoLock(); // logic.sendAutoLock();
}, // },
), // ),
], // ],
); // );
}, // },
); // );
} // }
@override @override
void didChangeDependencies() { void didChangeDependencies() {

View File

@ -3,6 +3,7 @@ import 'dart:async';
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; // import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/blue/io_type.dart'; import 'package:star_lock/blue/io_type.dart';
import '../../../../../blue/blue_manage.dart'; import '../../../../../blue/blue_manage.dart';
@ -40,16 +41,13 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
Future<void> _replyChangeAdministratorPassword(Reply reply) async { Future<void> _replyChangeAdministratorPassword(Reply reply) async {
var token = reply.data.sublist(5, 9); var token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token); var saveStrList = changeIntListToStringList(token);
print("_replyFactoryDataResetKeyToken:$token");
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[2]; int status = reply.data[2];
print("status:$status");
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
print("${reply.commandType!.typeValue} 数据解析成功"); Get.log("${reply.commandType!.typeValue} 数据解析成功");
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
@ -57,9 +55,8 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
addLockAdminPassword(true); addLockAdminPassword(true);
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType!.typeValue} 需要鉴权"); Get.log("${reply.commandType!.typeValue} 需要鉴权");
var signKey = await Storage.getStringList(saveBlueSignKey); var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!); List<int> signKeyDataList = changeStringListToIntList(signKey!);
@ -104,12 +101,11 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[2]; int status = reply.data[2];
print("status:$status"); Get.log("status:$status");
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
print("${reply.commandType!.typeValue} 数据解析成功"); Get.log("${reply.commandType!.typeValue} 数据解析成功");
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
@ -117,16 +113,14 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
reply.data.removeRange(0, 6); reply.data.removeRange(0, 6);
// 8 // 8
var getList = splitList(reply.data, 13); var getList = splitList(reply.data, 13);
print("getList:$getList");
for(int i = 0; i<getList.length; i++){ for(int i = 0; i<getList.length; i++){
var indexList = getList[i]; var indexList = getList[i];
print("indexList:$indexList");
var pwd = indexList.sublist(1, 11); var pwd = indexList.sublist(1, 11);
var pwdStr = utf8String(pwd); var pwdStr = utf8String(pwd);
print("pwd:$pwd pwdStr:$pwdStr state.adminPwd.value:${state.adminPwd.value}"); Get.log("pwd:$pwd pwdStr:$pwdStr state.adminPwd.value:${state.adminPwd.value}");
if(pwdStr == state.adminPwd.value){ if(pwdStr == state.adminPwd.value){
showToast("管理员密码相同,无需修改"); showToast("管理员密码相同,无需修改".tr);
return; return;
} }
state.adminPwd.value = pwdStr; state.adminPwd.value = pwdStr;
@ -136,7 +130,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType!.typeValue} 需要鉴权"); Get.log("${reply.commandType!.typeValue} 需要鉴权");
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -159,19 +153,16 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
); );
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType!.typeValue} 用户无权限"); Get.log("${reply.commandType!.typeValue} 用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType!.typeValue} 权限校验错误"); Get.log("${reply.commandType!.typeValue} 权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType!.typeValue} 失败"); Get.log("${reply.commandType!.typeValue} 失败");
break; break;
} }
} }
@ -282,12 +273,12 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if(isChange == true){ if(isChange == true){
showToast("修改成功", something: (){ showToast("修改成功".tr, something: (){
state.lockBasicInfo.value.adminPwd = state.adminPwd.value; state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
}); });
}else{ }else{
showToast("上传成功", something: (){ showToast("上传成功".tr, something: (){
state.lockBasicInfo.value.adminPwd = state.adminPwd.value; state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
}); });
@ -299,7 +290,6 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady
super.onReady(); super.onReady();
print("onReady()");
_initReplySubscription(); _initReplySubscription();
} }
@ -308,7 +298,6 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
void onInit() { void onInit() {
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
print("onInit()");
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -14,8 +15,7 @@ class AdminOpenLockPasswordPage extends StatefulWidget {
const AdminOpenLockPasswordPage({Key? key}) : super(key: key); const AdminOpenLockPasswordPage({Key? key}) : super(key: key);
@override @override
State<AdminOpenLockPasswordPage> createState() => State<AdminOpenLockPasswordPage> createState() => _AdminOpenLockPasswordPageState();
_AdminOpenLockPasswordPageState();
} }
class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> { class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
@ -38,7 +38,7 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
showCupertinoAlertDialog(context); showCupertinoAlertDialog();
})), })),
Container( Container(
margin: EdgeInsets.all(30.w), margin: EdgeInsets.all(30.w),
@ -81,15 +81,13 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
)); ));
} }
void showCupertinoAlertDialog( void showCupertinoAlertDialog() {
BuildContext context,
) {
showDialog( showDialog(
context: context, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: "修改密码", title: "修改密码".tr,
tipTitle: "请输入", tipTitle: "请输入".tr,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9]')), FilteringTextInputFormatter.allow(RegExp('[0-9]')),
@ -98,12 +96,12 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
controller: state.changePwdController, controller: state.changePwdController,
sureClick: () { sureClick: () {
if(state.changePwdController.text.length < 6){ if(state.changePwdController.text.length < 6){
logic.showToast("请输入6位管理员密码"); logic.showToast("请输入6位管理员密码".tr);
return; return;
} }
if(state.changePwdController.text == state.lockBasicInfo.value.adminPwd!){ if(state.changePwdController.text == state.lockBasicInfo.value.adminPwd!){
logic.showToast("请输入新的管理员密码"); logic.showToast("请输入新的管理员密码".tr);
return; return;
} }
Get.back(); Get.back();

View File

@ -23,7 +23,6 @@ class BasicInformationLogic extends BaseGetXController{
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady
super.onReady(); super.onReady();
print("onReady()");
} }
@ -31,7 +30,6 @@ class BasicInformationLogic extends BaseGetXController{
void onInit() { void onInit() {
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
print("onInit()");
} }

View File

@ -84,7 +84,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false, visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: "有效时间", leftTitel: "有效时间".tr,
rightTitle: "${DateTool().dateToHNString((state.lockBasicInfo.value.startDate ?? 0).toString())}-${DateTool().dateToHNString((state.lockBasicInfo.value.endDate ?? 0).toString())}", rightTitle: "${DateTool().dateToHNString((state.lockBasicInfo.value.startDate ?? 0).toString())}-${DateTool().dateToHNString((state.lockBasicInfo.value.endDate ?? 0).toString())}",
allHeight: 70.h, allHeight: 70.h,
isHaveLine: true), isHaveLine: true),
@ -101,27 +101,24 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
var data = await Get.toNamed(Routers.editLockNamePage, var data = await Get.toNamed(Routers.editLockNamePage, arguments: {
arguments: {
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.lockBasicInfo.value = data["lockBasicInfo"]; state.lockBasicInfo.value = data["lockBasicInfo"];
print("state.lockBasicInfo.value.lockAlias:${state.lockBasicInfo.value.lockAlias}");
}); });
} }
}))), }))),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr, leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
rightTitle: state.lockBasicInfo.value.groupName ?? "", rightTitle: state.lockBasicInfo.value.groupName!.tr ?? "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
Get.toNamed(Routers.lockSelectGroupingPage, arguments: { Get.toNamed(Routers.lockSelectGroupingPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
})! })!.then((val) {
.then((val) {
if (val != null) { if (val != null) {
// mockNetworkDataRequest(); // mockNetworkDataRequest();
setState(() {}); setState(() {});
@ -136,7 +133,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
leftTitel: leftTitel:
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr, TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
rightTitle: rightTitle:
state.lockBasicInfo!.value.adminPwd, state.lockBasicInfo.value.adminPwd,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -159,32 +156,4 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
], ],
)); ));
} }
//1: 2: 3: 4:
String getKeyTypeStr(int keyType) {
String keyTypeStr = "";
if (keyType == 1) {
keyTypeStr = "限期";
} else if (keyType == 2) {
keyTypeStr = '永久';
} else if (keyType == 3) {
keyTypeStr = '单次';
} else if (keyType == 4) {
keyTypeStr = '循环';
}
return keyTypeStr;
}
// //
// Future<LockData> mockNetworkDataRequest() async {
// KeyDetailEntity entity =
// await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString());
// if (entity.errorCode!.codeIsSuccessful) {
// // print("电子钥匙列表成功:${entity.data?.itemList}");
// _lockData = entity.data!;
// return entity.data!;
// }
// LockData data = LockData();
// return data;
// }
} }

View File

@ -7,7 +7,7 @@ class BasicInformationState {
var lockSetInfoData = LockSetInfoData().obs; var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs; var lockBasicInfo = LockBasicInfo().obs;
var groupName = "未分组".obs; var groupName = "未分组".tr.obs;
BasicInformationState() { BasicInformationState() {
var map = Get.arguments; var map = Get.arguments;

View File

@ -16,13 +16,11 @@ class EditLockNameLogic extends BaseGetXController {
lockName: state.changeLockNameController.text); lockName: state.changeLockNameController.text);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text; state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
showToast("修改成功", something: () { showToast("修改成功".tr, something: () {
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType( eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!));
3, state.lockBasicInfo.value.lockAlias!));
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
Get.back(result: {"lockBasicInfo": state.lockBasicInfo.value});
}); });
Get.back(result: {"lockBasicInfo": state.lockBasicInfo.value});
} }
} }
} }

View File

@ -45,7 +45,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
child: LoginInput( child: LoginInput(
controller: state.changeLockNameController, controller: state.changeLockNameController,
leftWidget: const SizedBox(), leftWidget: const SizedBox(),
hintText: "请输入名称", hintText: "请输入名称".tr,
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter(50), LengthLimitingTextInputFormatter(50),
]), ]),

View File

@ -1,4 +1,6 @@
import 'package:get/get.dart';
import '../../../../../network/api_repository.dart'; import '../../../../../network/api_repository.dart';
import '../../../../../tools/baseGetXController.dart'; import '../../../../../tools/baseGetXController.dart';
import '../../../../../tools/eventBusEventManage.dart'; import '../../../../../tools/eventBusEventManage.dart';
@ -12,8 +14,9 @@ class LockSelectGroupingLogic extends BaseGetXController {
Future<void> addLockGroupRequest() async { Future<void> addLockGroupRequest() async {
MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0'); MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("创建成功"); showToast("创建成功".tr, something: () {
mockNetworkDataRequest(); mockNetworkDataRequest();
});
} }
} }
@ -22,14 +25,15 @@ class LockSelectGroupingLogic extends BaseGetXController {
MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup( MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
state.lockSetInfoData.value.lockId.toString(), itemData.keyGroupId.toString()); state.lockSetInfoData.value.lockId.toString(), itemData.keyGroupId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("设置锁分组成功"); showToast("设置锁分组成功".tr, something: () {
state.lockBasicInfo.value.groupId = itemData.keyGroupId; state.lockBasicInfo.value.groupId = itemData.keyGroupId;
state.lockBasicInfo.value.groupName = itemData.keyGroupName; state.lockBasicInfo.value.groupName = itemData.keyGroupName;
mockNetworkDataRequest(); mockNetworkDataRequest();
state.lockSetInfoData.value.lockBasicInfo!.groupId = itemData.keyGroupId; state.lockSetInfoData.value.lockBasicInfo!.groupId = itemData.keyGroupId;
state.lockSetInfoData.value.lockBasicInfo!.groupName = itemData.keyGroupName; state.lockSetInfoData.value.lockBasicInfo!.groupName = itemData.keyGroupName;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
});
} }
} }
@ -45,8 +49,6 @@ class LockSelectGroupingLogic extends BaseGetXController {
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady
super.onReady(); super.onReady();
print("onReady()");
mockNetworkDataRequest(); mockNetworkDataRequest();
} }
@ -54,11 +56,8 @@ class LockSelectGroupingLogic extends BaseGetXController {
void onInit() { void onInit() {
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
print("lockDetail_onInit()");
} }
@override @override
void onClose() { void onClose() {
// TODO: implement onClose // TODO: implement onClose

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -91,9 +92,9 @@ class _LockSelectGroupingPageState extends State<LockSelectGroupingPage> {
// //
if (state.changeNameController.text.isNotEmpty) { if (state.changeNameController.text.isNotEmpty) {
logic.addLockGroupRequest(); logic.addLockGroupRequest();
Navigator.pop(context); Get.back();
} else { } else {
logic.showToast("请输入分组名称"); logic.showToast("请输入分组名称".tr);
} }
}, },
cancelClick: () { cancelClick: () {

View File

@ -2,6 +2,7 @@ import 'dart:async';
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; // import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
import '../../../../../blue/blue_manage.dart'; import '../../../../../blue/blue_manage.dart';
@ -25,7 +26,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
.uploadElectricQuantity( .uploadElectricQuantity(
electricQuantity, state.lockSetInfoData.value.lockId.toString()); electricQuantity, state.lockSetInfoData.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("锁电量更新成功", something: () { showToast("锁电量更新成功".tr, something: () {
eventBus eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); .fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire( eventBus.fire(
@ -87,7 +88,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
print("${reply.commandType}数据解析成功"); Get.log("${reply.commandType}数据解析成功");
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
@ -104,23 +105,19 @@ class UploadElectricQuantityLogic extends BaseGetXController {
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType}需要鉴权"); Get.log("${reply.commandType}需要鉴权");
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType}用户无权限"); Get.log("${reply.commandType}用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType}权限校验错误"); Get.log("${reply.commandType}权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType}失败"); Get.log("${reply.commandType}失败");
break; break;
} }
} }
@ -129,7 +126,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady
super.onReady(); super.onReady();
print("NearbyLockLogic onReady()");
_initReplySubscription(); _initReplySubscription();
} }
@ -137,7 +133,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
// TODO: implement onInit // TODO: implement onInit
print("NearbyLockLogic onInit()");
super.onInit(); super.onInit();
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -54,7 +55,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"电池1${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockBasicInfo!.value.electricQuantity ?? ""}%", "${"电池1".tr}:${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockBasicInfo!.value.electricQuantity ?? ""}%",
style: TextStyle(fontSize: 20.sp), style: TextStyle(fontSize: 20.sp),
)), )),
], ],
@ -64,7 +65,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"电池2${TranslationLoader.lanKeys!.electricQuantity!.tr}:--%", "${"电池2".tr}:${TranslationLoader.lanKeys!.electricQuantity!.tr}:--%",
style: TextStyle(fontSize: 20.sp), style: TextStyle(fontSize: 20.sp),
)), )),
], ],
@ -75,7 +76,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"电量更新时间:${DateTool().dateToYMDHNString(state.uploadElectricQuantityDate.value.toString())}", "${"电量更新时间".tr}:${DateTool().dateToYMDHNString(state.uploadElectricQuantityDate.value.toString())}",
style: TextStyle(fontSize: 20.sp), style: TextStyle(fontSize: 20.sp),
)), )),
], ],

View File

@ -7,6 +7,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/blue/io_type.dart'; import 'package:star_lock/blue/io_type.dart';
import 'package:star_lock/tools/showTipView.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
@ -121,23 +122,22 @@ class LockSetLogic extends BaseGetXController {
Future<void> _replyFactoryDataResetKey(Reply reply) async { Future<void> _replyFactoryDataResetKey(Reply reply) async {
var token = reply.data.sublist(2, 6); var token = reply.data.sublist(2, 6);
var saveStrList = changeIntListToStringList(token); var saveStrList = changeIntListToStringList(token);
print("_replyFactoryDataResetKeyToken:$token");
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[6]; int status = reply.data[6];
print("status:$status"); Get.log("status:$status");
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
print("${reply.commandType!.typeValue} 数据解析成功"); Get.log("${reply.commandType!.typeValue} 数据解析成功");
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
deletLockInfoData(); deletLockInfoData();
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType!.typeValue} 需要鉴权"); Get.log("${reply.commandType!.typeValue} 需要鉴权");
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -158,21 +158,21 @@ class LockSetLogic extends BaseGetXController {
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType!.typeValue} 用户无权限"); Get.log("${reply.commandType!.typeValue} 用户无权限");
dismissEasyLoading(); dismissEasyLoading();
showToast("用户无权限"); showToast("用户无权限".tr);
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType!.typeValue} "); Get.log("${reply.commandType!.typeValue} ");
dismissEasyLoading(); dismissEasyLoading();
showToast("权限校验错误"); // showToast("权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType!.typeValue} 失败"); Get.log("${reply.commandType!.typeValue} 失败");
dismissEasyLoading(); dismissEasyLoading();
showToast("权限校验错误"); // showToast("权限校验错误");
break; break;
} }
} }
@ -212,7 +212,7 @@ class LockSetLogic extends BaseGetXController {
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
print("${reply.commandType}数据解析成功"); Get.log("${reply.commandType}数据解析成功");
// Toast.show(msg: "操作成功");featureEnable = state.isOpenStayWarn.value == 1 ? 0 : 1; // Toast.show(msg: "操作成功");featureEnable = state.isOpenStayWarn.value == 1 ? 0 : 1;
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
@ -240,26 +240,26 @@ class LockSetLogic extends BaseGetXController {
state.lockSetInfoData.value.lockSettingInfo!.abnormalWarn = state.lockSetInfoData.value.lockSettingInfo!.abnormalWarn =
state.isOpenExceptionWarnings.value; state.isOpenExceptionWarnings.value;
} }
print("isOpenBlueBroadcast111:${state.isOpenBlueBroadcast.value}"); Get.log("isOpenBlueBroadcast111:${state.isOpenBlueBroadcast.value}");
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType}需要鉴权"); Get.log("${reply.commandType}需要鉴权");
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType}用户无权限"); Get.log("${reply.commandType}用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType}权限校验错误"); Get.log("${reply.commandType}权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType}失败"); Get.log("${reply.commandType}失败");
break; break;
} }
@ -463,11 +463,10 @@ class LockSetLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.isAttendance.value = (state.isAttendance.value == 1 ? 0 : 1); state.isAttendance.value = (state.isAttendance.value == 1 ? 0 : 1);
state.lockSettingInfo.value.attendance = state.isAttendance.value; state.lockSettingInfo.value.attendance = state.isAttendance.value;
showToast("设置成功", something: (){ showToast("设置成功".tr, something: (){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, state.lockSettingInfo.value.attendance!.toString())); eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, state.lockSettingInfo.value.attendance!.toString()));
}); });
// print("state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}");
} }
} }
@ -480,7 +479,7 @@ class LockSetLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.isLockPickingReminder.value = (state.isLockPickingReminder.value == 1 ? 0 : 1); state.isLockPickingReminder.value = (state.isLockPickingReminder.value == 1 ? 0 : 1);
state.lockSettingInfo.value.unlockReminderPush = state.isLockPickingReminder.value; state.lockSettingInfo.value.unlockReminderPush = state.isLockPickingReminder.value;
showToast("设置成功", something: (){ showToast("设置成功".tr, something: (){
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
}); });
} }
@ -496,7 +495,7 @@ class LockSetLogic extends BaseGetXController {
state.isOpenLockNeedOnline.value = (state.isOpenLockNeedOnline.value == 1 ? 0 : 1); state.isOpenLockNeedOnline.value = (state.isOpenLockNeedOnline.value == 1 ? 0 : 1);
state.lockSettingInfo.value.appUnlockOnline = state.isOpenLockNeedOnline.value; state.lockSettingInfo.value.appUnlockOnline = state.isOpenLockNeedOnline.value;
showToast("设置成功",something: (){ showToast("设置成功".tr,something: (){
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(1, state.lockSettingInfo.value.appUnlockOnline!.toString())); eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(1, state.lockSettingInfo.value.appUnlockOnline!.toString()));
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
// print("state.lockSettingInfo.value.appUnlockOnline:${state.lockSettingInfo.value.appUnlockOnline}"); // print("state.lockSettingInfo.value.appUnlockOnline:${state.lockSettingInfo.value.appUnlockOnline}");
@ -529,79 +528,87 @@ class LockSetLogic extends BaseGetXController {
// } // }
void showDeletAlertTipDialog({String? showContent = ""}) { void showDeletAlertTipDialog({String? showContent = ""}) {
// bool isContains = BlueManage().connectDeviceName!.contains("T9A");
var content = showContent!.isEmpty ? "删除设备失败,请确保在设备附近,设备未被连接,设备已打开${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮" : ""}" : showContent; var content = showContent!.isEmpty ? "删除设备失败,请确保在设备附近,设备未被连接,设备已打开${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮" : ""}" : showContent;
showCupertinoDialog( ShowTipView().showSureAlertDialog(content);
context: Get.context!,
builder: (context) { // showCupertinoDialog(context: Get.context!, builder: (context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
title: const Text("提示"), // title: const Text("提示"),
content: Text(content), // content: Text(content),
// content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'), // // content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'),
actions: [ // actions: [
// CupertinoDialogAction( // // CupertinoDialogAction(
// child: Text(TranslationLoader.lanKeys!.cancel!.tr), // // child: Text(TranslationLoader.lanKeys!.cancel!.tr),
// onPressed: () { // // onPressed: () {
// Navigator.pop(context); // // Navigator.pop(context);
// }, // // },
// ), // // ),
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.sure!.tr), // child: Text(TranslationLoader.lanKeys!.sure!.tr),
onPressed: () { // onPressed: () {
Navigator.pop(context); // Navigator.pop(context);
// if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) { // // if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
// // // // //
// deletLockInfoData(); // // deletLockInfoData();
// } else { // // } else {
// // // // //
// deletKeyData(); // // deletKeyData();
// } // // }
}, // },
), // ),
], // ],
); // );
}, // },
); // );
} }
// //
void showCupertinoAlertDialog(widgetContext) { // void showCupertinoAlertDialog(widgetContext) {
showCupertinoDialog( // showCupertinoDialog(
context: widgetContext, // context: widgetContext,
builder: (context) { // builder: (context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
title: const Text("提示"), // title: Text("提示".tr),
content: const Text('创建公司后,考勤功能才能使用'), // content: const Text('创建公司后,考勤功能才能使用'),
actions: [ // actions: [
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr), // child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () { // onPressed: () {
Get.back(); // Get.back();
}, // },
), // ),
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.sure!.tr), // child: Text(TranslationLoader.lanKeys!.sure!.tr),
onPressed: () { // onPressed: () {
Navigator.pop(context); // Navigator.pop(context);
Get.toNamed(Routers.checkInCreatCompanyPage, arguments: { // Get.toNamed(Routers.checkInCreatCompanyPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value // 'lockSetInfoData': state.lockSetInfoData.value
}); // });
}, // },
), // ),
], // ],
); // );
}, // },
); // );
} // }
/// ///
deleyLockLogicOfRoles(){ deleyLockLogicOfRoles(){
if (state.lockBasicInfo.value.isLockOwner == 1) { if (state.lockBasicInfo.value.isLockOwner == 1) {
// //
showDeletAlertDialog(); // showDeletAlertDialog();
ShowTipView().showIosTipWithContentDialog("删除锁后,所有信息都会一起删除,确定删除锁吗?".tr, (){
//
showDeletPasswordAlertDialog();
});
} else if (state.lockBasicInfo.value.keyRight == 1){ } else if (state.lockBasicInfo.value.keyRight == 1){
// //
showDeleteAdministratorIsHaveAllDataDialog(); ShowTipView().showDeleteAdministratorIsHaveAllDataDialog("同时删除其发送的所有钥匙,钥匙删除后不能恢复".tr, (a){
//
state.deleteAdministratorIsHaveAllData.value = a;
deletKeyData();
});
// showDeleteAdministratorIsHaveAllDataDialog();
} else{ } else{
// //
deletKeyData(); deletKeyData();
@ -609,54 +616,45 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void showDeletAlertDialog() { // void showDeletAlertDialog() {
showCupertinoDialog( // showCupertinoDialog(
context: Get.context!, // context: Get.context!,
builder: (context) { // builder: (context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
title: const Text("提示"), // title: const Text("提示"),
content: const Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'), // content: const Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'),
actions: [ // actions: [
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr), // child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () { // onPressed: () {
Get.back(); // Get.back();
}, // },
), // ),
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.sure!.tr), // child: Text(TranslationLoader.lanKeys!.sure!.tr),
onPressed: () { // onPressed: () {
Get.back(); // Get.back();
showDeletPasswordAlertDialog(context); // showDeletPasswordAlertDialog();
}, // },
), // ),
], // ],
); // );
}, // },
); // );
} // }
void showDeletPasswordAlertDialog(BuildContext context) { void showDeletPasswordAlertDialog() {
//
// BlueManage().startScan(20, (List<ScanResult> list) async {
// final knownDeviceIndex = list.indexWhere((d) => d.advertisementData.advName == BlueManage().connectDeviceName);
// if (knownDeviceIndex >= 0) {
// //
// state.currentDeviceUUid.value = (list[knownDeviceIndex].advertisementData.serviceUuids.isNotEmpty ? list[knownDeviceIndex].advertisementData.serviceUuids[0] : "").toString();
// await BlueManage().stopScan();
// }
// });
showDialog( showDialog(
context: context, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: "请输入登录密码", title: "请输入登录密码".tr,
tipTitle: "", tipTitle: "",
controller: state.passwordTF, controller: state.passwordTF,
sureClick: () { sureClick: () {
// //
if (state.passwordTF.text.isEmpty) { if (state.passwordTF.text.isEmpty) {
showToast("请输入登录密码"); showToast("请输入登录密码".tr);
return; return;
} }
checkLoginPassword(); checkLoginPassword();
@ -672,51 +670,51 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void showDeleteAdministratorIsHaveAllDataDialog() { // void showDeleteAdministratorIsHaveAllDataDialog() {
showDialog( // showDialog(
context: Get.context!, // context: Get.context!,
builder: (BuildContext context) { // builder: (BuildContext context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
title: const Text("提示"), // title: const Text("提示"),
content: Container( // content: Container(
height: 100.h, // height: 100.h,
child: Row( // child: Row(
children: [ // children: [
GestureDetector( // GestureDetector(
onTap: () { // onTap: () {
state.deleteAdministratorIsHaveAllData.value = !state.deleteAdministratorIsHaveAllData.value; // state.deleteAdministratorIsHaveAllData.value = !state.deleteAdministratorIsHaveAllData.value;
}, // },
child: Obx(() => Image.asset( // child: Obx(() => Image.asset(
state.deleteAdministratorIsHaveAllData.value // state.deleteAdministratorIsHaveAllData.value
? 'images/icon_round_select.png' // ? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png', // : 'images/icon_round_unSelect.png',
width: 30.w, // width: 30.w,
height: 30.w, // height: 30.w,
))), // ))),
SizedBox(width: 15.w,), // SizedBox(width: 15.w,),
Expanded(child: Text('同时删除其发送的所有钥匙,钥匙删除后不能恢复', maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))), // Expanded(child: Text('同时删除其发送的所有钥匙,钥匙删除后不能恢复', maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))),
], // ],
), // ),
), // ),
actions: [ // actions: [
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr), // child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () { // onPressed: () {
Get.back(); // Get.back();
}, // },
), // ),
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.delete!.tr), // child: Text(TranslationLoader.lanKeys!.delete!.tr),
onPressed: () { // onPressed: () {
Get.back(); // Get.back();
deletKeyData(); // deletKeyData();
}, // },
), // ),
], // ],
); // );
}, // },
); // );
} // }
// //
void checkLoginPassword() async { void checkLoginPassword() async {
@ -725,77 +723,7 @@ class LockSetLogic extends BaseGetXController {
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
Get.back(); Get.back();
factoryDataResetAction(); factoryDataResetAction();
// if(BlueManage().bluetoothConnectionState == BluetoothConnectionState.connected){
//
//
// if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
//
// factoryDataResetAction();
// } else {
// //
// if(state.lockSetInfoData.value.lockBasicInfo!.lockUserNo != 0){
// //
// deletUserAction();
// }else{
// //
// deletKeyData();
// }
// }
// return;
// }
// print("state.currentDeviceUUid.value:${state.currentDeviceUUid.value}");
// if (state.currentDeviceUUid.value.isNotEmpty) {
// //
// // BlueManage().stopScan();
// deletLockLogic();
// } else {
// // 5
// var index = 0;
// showEasyLoading();
// state.deletWaitScanCompleter = Completer();
// state.deletWaitScanTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
// //
// if(index >= 7){
// // 10,
// if (state.deletWaitScanTimer != null && state.deletWaitScanTimer!.isActive) {
// state.deletWaitScanTimer!.cancel();
// state.deletWaitScanTimer = null;
// }
// if(state.deletWaitScanCompleter != null){
// state.deletWaitScanCompleter!.complete();
// }
// // BlueManage().stopScan();
// dismissEasyLoading();
// print("555555");
// showDeletAlertTipDialog();
// }else{
// //
// if (state.currentDeviceUUid.isNotEmpty) {
// // BlueManage().stopScan();
// //
// if (state.deletWaitScanTimer != null && state.deletWaitScanTimer!.isActive) {
// state.deletWaitScanTimer!.cancel();
// state.deletWaitScanTimer = null;
// }
// if(state.deletWaitScanCompleter != null){
// state.deletWaitScanCompleter!.complete();
// }
// dismissEasyLoading();
//
// deletLockLogic();
// } else {
// // -1 5
// index++;
// // print("index:$index");
// }
// }
// });
// // Completer完成
// await state.deletWaitScanCompleter!.future;
// }
} }
} }

View File

@ -10,6 +10,7 @@ import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
@ -423,7 +424,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () { action: () {
// Toast.show(msg: "功能暂未开放");
Get.toNamed(Routers.openDoorDirectionPage, arguments: { Get.toNamed(Routers.openDoorDirectionPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
@ -437,7 +437,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
// Toast.show(msg: "功能暂未开放");
Get.toNamed(Routers.motorPowerPage); Get.toNamed(Routers.motorPowerPage);
})), })),
// 广使 // 广使
@ -636,7 +635,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// //
CupertinoSwitch _openCheckInSwitch() { CupertinoSwitch _openCheckInSwitch() {
// print("111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}");
return CupertinoSwitch( return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
@ -645,7 +643,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
onChanged: (value) { onChanged: (value) {
logic.openCheckingInData((checkingInInfoDataEntity) { logic.openCheckingInData((checkingInInfoDataEntity) {
if (checkingInInfoDataEntity.data!.companyId == 0) { if (checkingInInfoDataEntity.data!.companyId == 0) {
logic.showCupertinoAlertDialog(context); // logic.showCupertinoAlertDialog(context);
ShowTipView().showIosTipWithContentDialog("创建公司后,考勤功能才能使用".tr, (){
//
Get.toNamed(Routers.checkInCreatCompanyPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
});
} else { } else {
logic.setLockSetGeneralSetting(); logic.setLockSetGeneralSetting();
} }

View File

@ -44,28 +44,20 @@ class LockListLogic extends BaseGetXController{
Future<void> _replyFactoryDataResetKey(Reply reply) async { Future<void> _replyFactoryDataResetKey(Reply reply) async {
var token = reply.data.sublist(2, 6); var token = reply.data.sublist(2, 6);
var saveStrList = changeIntListToStringList(token); var saveStrList = changeIntListToStringList(token);
print("_replyFactoryDataResetKeyToken:$token");
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[6]; int status = reply.data[6];
print("status:$status");
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
print("${reply.commandType!.typeValue} 数据解析成功"); Get.log("${reply.commandType!.typeValue} 数据解析成功");
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
deletLockInfoData(); deletLockInfoData();
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType!.typeValue} 需要鉴权"); Get.log("${reply.commandType!.typeValue} 需要鉴权");
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
var token = await Storage.getStringList(saveBlueToken); var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
@ -80,20 +72,20 @@ class LockListLogic extends BaseGetXController{
token: getTokenList); token: getTokenList);
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType!.typeValue} 用户无权限"); Get.log("${reply.commandType!.typeValue} 用户无权限");
dismissEasyLoading(); dismissEasyLoading();
showToast("用户无权限"); showToast("用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType!.typeValue} "); Get.log("${reply.commandType!.typeValue} ");
dismissEasyLoading(); dismissEasyLoading();
showToast("权限校验错误"); showToast("权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType!.typeValue} 失败"); Get.log("${reply.commandType!.typeValue} 失败");
dismissEasyLoading(); dismissEasyLoading();
showToast("权限校验错误"); showToast("权限校验错误");
break; break;
@ -120,7 +112,7 @@ class LockListLogic extends BaseGetXController{
if(keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop){ if(keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop){
// 使 // 使
if(keyInfo.keyStatus == XSConstantMacro.keyStatusNormalUse || keyInfo.keyStatus == XSConstantMacro.keyStatusWaitReceive) { if(keyInfo.keyStatus == XSConstantMacro.keyStatusNormalUse || keyInfo.keyStatus == XSConstantMacro.keyStatusWaitReceive) {
return "${DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!)}"; return "${"".tr}${DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!)}${"".tr}";
} else { } else {
return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!); return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!);
} }
@ -148,8 +140,8 @@ class LockListLogic extends BaseGetXController{
context: Get.context!, context: Get.context!,
builder: (context) { builder: (context) {
return CupertinoAlertDialog( return CupertinoAlertDialog(
title: const Text("提示"), title: Text("提示".tr),
content: const Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'), content: Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr),
actions: [ actions: [
CupertinoDialogAction( CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr), child: Text(TranslationLoader.lanKeys!.cancel!.tr),
@ -176,13 +168,13 @@ class LockListLogic extends BaseGetXController{
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: "请输入登录密码", title: "请输入登录密码".tr,
tipTitle: "", tipTitle: "",
controller: state.passwordTF, controller: state.passwordTF,
sureClick: () { sureClick: () {
// //
if (state.passwordTF.text.isEmpty) { if (state.passwordTF.text.isEmpty) {
showToast("请输入登录密码"); showToast("请输入登录密码".tr);
return; return;
} }
checkLoginPassword(); checkLoginPassword();
@ -203,8 +195,8 @@ class LockListLogic extends BaseGetXController{
context: Get.context!, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
return CupertinoAlertDialog( return CupertinoAlertDialog(
title: const Text("提示"), title: Text("提示".tr),
content: Container( content: SizedBox(
height: 100.h, height: 100.h,
child: Row( child: Row(
children: [ children: [
@ -220,7 +212,7 @@ class LockListLogic extends BaseGetXController{
height: 30.w, height: 30.w,
))), ))),
SizedBox(width: 15.w,), SizedBox(width: 15.w,),
Expanded(child: Text('同时删除其发送的所有钥匙,钥匙删除后不能恢复', maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))), Expanded(child: Text('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))),
], ],
), ),
), ),
@ -292,15 +284,6 @@ class LockListLogic extends BaseGetXController{
}); });
BlueManage().bludSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async { BlueManage().bludSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
//
// var token = await Storage.getStringList(saveBlueToken);
// List<int> getTokenList = changeStringListToIntList(token!);
List<int> publicKeyData = state.lockListInfoItemEntity.bluetooth!.publicKey!.cast<int>(); List<int> publicKeyData = state.lockListInfoItemEntity.bluetooth!.publicKey!.cast<int>();
var saveStrList = changeIntListToStringList(publicKeyData); var saveStrList = changeIntListToStringList(publicKeyData);
Storage.setStringList(saveBluePublicKey, saveStrList); Storage.setStringList(saveBluePublicKey, saveStrList);
@ -338,32 +321,18 @@ class LockListLogic extends BaseGetXController{
void showDeletAlertTipDialog({String? showContent = ""}) { void showDeletAlertTipDialog({String? showContent = ""}) {
// bool isContains = BlueManage().connectDeviceName!.contains("T9A"); // bool isContains = BlueManage().connectDeviceName!.contains("T9A");
var content = showContent!.isEmpty ? "删除设备失败,请确保在设备附近,设备未被连接,设备已打开${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮" : ""}" : showContent; var content = showContent!.isEmpty ? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}" : showContent;
showCupertinoDialog( showCupertinoDialog(
context: Get.context!, context: Get.context!,
builder: (context) { builder: (context) {
return CupertinoAlertDialog( return CupertinoAlertDialog(
title: const Text("提示"), title: Text("提示".tr),
content: Text(content), content: Text(content),
// content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'),
actions: [ actions: [
// CupertinoDialogAction(
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
// onPressed: () {
// Navigator.pop(context);
// },
// ),
CupertinoDialogAction( CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.sure!.tr), child: Text(TranslationLoader.lanKeys!.sure!.tr),
onPressed: () { onPressed: () {
Navigator.pop(context); Get.back();
// if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
// //
// deletLockInfoData();
// } else {
// //
// deletKeyData();
// }
}, },
), ),
], ],

View File

@ -82,7 +82,6 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
} }
setState(() {}); setState(() {});
print('选中了么0');
}, },
typeImgList: const [], typeImgList: const [],
groupItem: itemData, groupItem: itemData,
@ -113,22 +112,22 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
}, },
backgroundColor: Colors.red, backgroundColor: Colors.red,
foregroundColor: Colors.white, foregroundColor: Colors.white,
label: '删除', label: '删除'.tr,
padding: EdgeInsets.only(left: 5.w, right: 5.w), padding: EdgeInsets.only(left: 5.w, right: 5.w),
), ),
], ],
), ),
child: lockInfoListItem(keyInfo, isLast, () { child: lockInfoListItem(keyInfo, isLast, () {
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)){ if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)){
logic.showToast("您的钥匙未生效"); logic.showToast("您的钥匙未生效".tr);
return; return;
} }
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)){ if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)){
logic.showToast("您的钥匙已冻结"); logic.showToast("您的钥匙已冻结".tr);
return; return;
} }
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)){ if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)){
logic.showToast("您的钥匙已过期"); logic.showToast("您的钥匙已过期".tr);
return; return;
} }
Get.toNamed(Routers.lockDetailMainPage, arguments: { Get.toNamed(Routers.lockDetailMainPage, arguments: {
@ -223,7 +222,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
borderRadius: BorderRadius.circular(5.w), borderRadius: BorderRadius.circular(5.w),
color: AppColors.openPassageModeColor, color: AppColors.openPassageModeColor,
), ),
child: Text("常开模式开启", style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)), child: Text("常开模式开启".tr, style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)),
), ),
], ],
@ -235,7 +234,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
children: [ children: [
SizedBox(width: 30.w), SizedBox(width: 30.w),
Text( Text(
"远程开锁", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor), "远程开锁".tr, style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
), ),
], ],
)), )),
@ -267,7 +266,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
children: [ children: [
SizedBox(width: 30.w), SizedBox(width: 30.w),
Text( Text(
"${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)}/${keyInfo.isLockOwner == 1 ? '超级管理员' : (keyInfo.keyRight == 1 ? "授权管理员" : "普通用户")}", "${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)}/${keyInfo.isLockOwner == 1 ? '超级管理员'.tr : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr)}",
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 18.sp, color: AppColors.darkGrayTextColor),
), ),

View File

@ -1,10 +1,13 @@
import 'dart:async'; import 'dart:async';
import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:get/get.dart';
import '../../../blue/blue_manage.dart'; import '../../../blue/blue_manage.dart';
import '../../../network/api_repository.dart'; import '../../../network/api_repository.dart';
import '../../../talk/udp/udp_help.dart'; import '../../../talk/udp/udp_help.dart';
import '../../../tools/baseGetXController.dart'; import '../../../tools/baseGetXController.dart';
import '../../../tools/storage.dart';
import '../entity/lockListInfo_entity.dart'; import '../entity/lockListInfo_entity.dart';
import 'lockMain_state.dart'; import 'lockMain_state.dart';
@ -17,27 +20,35 @@ class LockMainLogic extends BaseGetXController {
pageSize: 50, pageSize: 50,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (entity.data!.groupList!.isEmpty) { loadMainDataLogic(entity.data!);
state.dataLength.value = 0; Storage.saveMainListData(entity.data!);
} else if (entity.data!.groupList!.length == 1) {
GroupList groupList = entity.data!.groupList![0];
if (groupList.lockList!.length > 1) {
state.dataLength.value = 2;
} else {
state.dataLength.value = 1;
}
} else {
state.dataLength.value = 2;
}
state.lockListInfoEntity.value = entity;
// return entity.data!; // return entity.data!;
} else { } else {
print("首页锁列表请求失败"); Get.log("首页锁列表请求失败");
state.dataLength.value = 0; // showToast("数据请求失败");
// state.dataLength.value = 0;
LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData();
loadMainDataLogic(lockListInfoGroupEntity!);
} }
return entity; return entity;
} }
loadMainDataLogic(LockListInfoGroupEntity entity){
if (entity.groupList!.isEmpty) {
state.dataLength.value = 0;
} else if (entity.groupList!.length == 1) {
GroupList groupList = entity.groupList![0];
if (groupList.lockList!.length > 1) {
state.dataLength.value = 2;
} else {
state.dataLength.value = 1;
}
} else {
state.dataLength.value = 2;
}
state.lockListInfoGroupEntity.value = entity;
}
/// ///
void getConnectType() async { void getConnectType() async {
var connectResult = await (Connectivity().checkConnectivity()); var connectResult = await (Connectivity().checkConnectivity());
@ -45,16 +56,16 @@ class LockMainLogic extends BaseGetXController {
if (connectResult == ConnectivityResult.mobile) { if (connectResult == ConnectivityResult.mobile) {
// _netType = "4G"; // _netType = "4G";
state.networkConnectionStatus.value = 1; state.networkConnectionStatus.value = 1;
print("4G 4G 4G 4G 4G"); Get.log("4G 4G 4G 4G 4G");
} else if (connectResult == ConnectivityResult.wifi) { } else if (connectResult == ConnectivityResult.wifi) {
// _netType = "wifi"; // _netType = "wifi";
state.networkConnectionStatus.value = 1; state.networkConnectionStatus.value = 1;
print("wifi wifi wifi wifi wifi"); Get.log("wifi wifi wifi wifi wifi");
} else { } else {
// _netType = "未连接"; // _netType = "未连接";
state.networkConnectionStatus.value = 0; state.networkConnectionStatus.value = 0;
print("未连接 未连接 未连接 未连接 未连接"); Get.log("未连接 未连接 未连接 未连接 未连接");
showToast("网络访问失败,请检查网络是否正常"); // showToast("网络访问失败,请检查网络是否正常");
} }
} }
@ -67,9 +78,8 @@ class LockMainLogic extends BaseGetXController {
/// ///
connectListener() async { connectListener() async {
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
print("设置网络切换监听:$result"); Get.log("设置网络切换监听:$result");
if (state.networkConnectionStatus.value == 0 && if (state.networkConnectionStatus.value == 0 && result != ConnectivityResult.none) {
result != ConnectivityResult.none) {
// //
state.networkConnectionStatus.value = 1; state.networkConnectionStatus.value = 1;
getStarLockInfo(); getStarLockInfo();
@ -81,7 +91,6 @@ class LockMainLogic extends BaseGetXController {
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady
super.onReady(); super.onReady();
print("onReady()");
// UDP // UDP
UdpHelp().openUDP(); UdpHelp().openUDP();
@ -93,7 +102,6 @@ class LockMainLogic extends BaseGetXController {
void onInit() { void onInit() {
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
print("onInit()");
// getLockInfo(); // getLockInfo();
// //

View File

@ -140,17 +140,17 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
case 1: case 1:
// //
Storage.setBool(ifIsDemoModeOrNot, false); Storage.setBool(ifIsDemoModeOrNot, false);
print("state.lockListInfoEntity.value.data!.groupList![0].lockList![0]:${state.lockListInfoEntity.value.data!.groupList![0].lockList![0].endDate}"); print("state.lockListInfoEntity.value.data!.groupList![0].lockList![0]:${state.lockListInfoGroupEntity.value.groupList![0].lockList![0].endDate}");
returnWidget = LockDetailPage( returnWidget = LockDetailPage(
isOnlyOneData: true, isOnlyOneData: true,
lockListInfoItemEntity: state lockListInfoItemEntity: state
.lockListInfoEntity.value.data!.groupList![0].lockList![0]); .lockListInfoGroupEntity.value.groupList![0].lockList![0]);
break; break;
case 2: case 2:
// //
Storage.setBool(ifIsDemoModeOrNot, false); Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = LockListPage( returnWidget = LockListPage(
lockListInfoGroupEntity: state.lockListInfoEntity.value.data!); lockListInfoGroupEntity: state.lockListInfoGroupEntity.value);
break; break;
default: default:
returnWidget = NoData(); returnWidget = NoData();

View File

@ -8,7 +8,7 @@ class LockMainState {
// 0 1 2 // 0 1 2
var dataLength = 100.obs; var dataLength = 100.obs;
var lockListInfoEntity = LockListInfoEntity().obs; var lockListInfoGroupEntity = LockListInfoGroupEntity().obs;
// 0 1 // 0 1
var networkConnectionStatus = 0.obs; var networkConnectionStatus = 0.obs;

View File

@ -127,31 +127,27 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
)); ));
} }
// //
void showPermissionDeniedDialog() { // void showPermissionDeniedDialog() {
showDialog( // showDialog(
context: context, // context: context,
builder: (BuildContext context) { // builder: (BuildContext context) {
return AlertDialog( // return AlertDialog(
title: const Text('权限被拒绝'), // title: const Text('权限被拒绝'),
content: const Text('请手动在系统设置中开启相册权限以继续使用应用。'), // content: const Text('请手动在系统设置中开启相册权限以继续使用应用。'),
actions: <Widget>[ // actions: <Widget>[
TextButton( // TextButton(
child: const Text('去设置'), // child: const Text('去设置'),
onPressed: () { // onPressed: () {
Navigator.of(context).pop(); // // Navigator.of(context).pop(); //
openAppSettings(); // // openAppSettings(); //
}, // },
), // ),
], // ],
); // );
}, // },
); // );
} // }
Future _openModalBottomSheet() async { Future _openModalBottomSheet() async {
showModalBottomSheet( showModalBottomSheet(

View File

@ -42,7 +42,7 @@ class BaseProvider extends GetConnect with Api {
} else { } else {
httpClient.baseUrl = '${F.apiPrefix}/api'; httpClient.baseUrl = '${F.apiPrefix}/api';
} }
print('请求body体======>$body'); // print('请求body体======>$body');
var res = await super.post(url, body, var res = await super.post(url, body,
contentType: contentType, contentType: contentType,
headers: headers, headers: headers,
@ -51,7 +51,8 @@ class BaseProvider extends GetConnect with Api {
uploadProgress: uploadProgress); uploadProgress: uploadProgress);
// print('res.body======>${res.body}'); // print('res.body======>${res.body}');
if (res.body == null) { if (res.body == null) {
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true);
EasyLoading.showToast("数据请求失败", duration: 2000.milliseconds);
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
if (res.statusCode == null) { if (res.statusCode == null) {
EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
@ -71,7 +72,7 @@ class BaseProvider extends GetConnect with Api {
statusText: res.statusText, statusText: res.statusText,
); );
} else {} } else {}
print('得到的数据======>${res.bodyString}'); // print('得到的数据======>${res.bodyString}');
getDataResult(res.body); getDataResult(res.body);
return res; return res;
} }

View File

@ -4,7 +4,7 @@ import 'package:get/get.dart';
import 'package:get/get_connect/http/src/request/request.dart'; import 'package:get/get_connect/http/src/request/request.dart';
FutureOr<dynamic> responseLogInterceptor(Request request, Response response) { FutureOr<dynamic> responseLogInterceptor(Request request, Response response) {
// Get.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString} ${response.headers}'); Get.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString} ${response.headers}');
EasyLoading.dismiss(animation: true); EasyLoading.dismiss(animation: true);
return response; return response;
} }

View File

@ -170,20 +170,20 @@ class BaseGetXController extends GetxController {
String useDateStr = ''; String useDateStr = '';
if (keyType == XSConstantMacro.keyTypeTime) { if (keyType == XSConstantMacro.keyTypeTime) {
// //
useDateStr = "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} 限时"; useDateStr = "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} ${"限时".tr}";
} else if (keyType == XSConstantMacro.keyTypeLong) { } else if (keyType == XSConstantMacro.keyTypeLong) {
// //
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久'; // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
useDateStr = '永久'; useDateStr = '永久'.tr;
} else if (keyType == XSConstantMacro.keyTypeOnce) { } else if (keyType == XSConstantMacro.keyTypeOnce) {
// //
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次'; // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
useDateStr = '单次'; useDateStr = '单次'.tr;
} else if (keyType == XSConstantMacro.keyTypeLoop) { } else if (keyType == XSConstantMacro.keyTypeLoop) {
// //
useDateStr = "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} 循环"; useDateStr = "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} ${"循环".tr}";
} }
return useDateStr; return useDateStr;

View File

@ -6,6 +6,7 @@ import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../login/login/entity/LoginData.dart'; import '../login/login/entity/LoginData.dart';
import '../main/lockMian/entity/lockListInfo_entity.dart';
const saveBluePublicKey = "BluePublicKey"; const saveBluePublicKey = "BluePublicKey";
const saveBluePrivateKey = "BluePrivateKey"; const saveBluePrivateKey = "BluePrivateKey";
@ -23,6 +24,7 @@ const saveLockAlias = "saveLockAlias"; //锁别名
const pushDeviceID = 'pushDeviceID'; //ID const pushDeviceID = 'pushDeviceID'; //ID
const saveUserLoginData = "userLoginData"; const saveUserLoginData = "userLoginData";
const saveLockMainListData = "lockMainListData";
class Storage { class Storage {
Storage._internal(); Storage._internal();
@ -194,4 +196,18 @@ class Storage {
static Future<void> saveLoginData(LoginData? data) async { static Future<void> saveLoginData(LoginData? data) async {
await Storage.setString(saveUserLoginData, jsonEncode(data)); await Storage.setString(saveUserLoginData, jsonEncode(data));
} }
static Future<void> saveMainListData(LockListInfoGroupEntity? data) async {
await Storage.setString(saveLockMainListData, jsonEncode(data));
}
static Future<LockListInfoGroupEntity?> getLockMainListData() async {
LockListInfoGroupEntity? lockListInfoGroupEntity;
final data = await Storage.getString(saveLockMainListData);
if (data != null && data.isNotEmpty) {
lockListInfoGroupEntity = LockListInfoGroupEntity.fromJson(jsonDecode(data));
}
print("lockListInfoEntity:$lockListInfoGroupEntity");
return lockListInfoGroupEntity;
}
} }