Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
7eac75be82
@ -628,6 +628,40 @@
|
||||
"根据提示,抬起手指后再进行下一次指纹采集": "According to the prompt, lift your finger and then collect the fingerprint again",
|
||||
"添加成功": "Add success",
|
||||
"搜索": "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",
|
||||
"相册": "photos",
|
||||
|
||||
@ -628,6 +628,40 @@
|
||||
"根据提示,抬起手指后再进行下一次指纹采集": "根据提示,抬起手指后再进行下一次指纹采集",
|
||||
"添加成功": "添加成功",
|
||||
"搜索": "搜索",
|
||||
"重置后,该锁的卡都将被删除哦,确认要重置吗?": "重置后,该锁的卡都将被删除哦,确认要重置吗?",
|
||||
"已失效": "已失效",
|
||||
"卡详情": "卡详情",
|
||||
"请输入": "请输入",
|
||||
"关闭后,智能锁将设置为全天常开模式,直到手动关闭": "关闭后,智能锁将设置为全天常开模式,直到手动关闭",
|
||||
"请输入小于1000的数字": "请输入小于1000的数字",
|
||||
"操作成功": "操作成功",
|
||||
"管理员密码相同,无需修改": "管理员密码相同,无需修改",
|
||||
"修改密码": "修改密码",
|
||||
"请输入6位管理员密码": "请输入6位管理员密码",
|
||||
"请输入新的管理员密码": "请输入新的管理员密码",
|
||||
"未分组": "未分组",
|
||||
"请输入分组名称": "请输入分组名称",
|
||||
"创建成功": "创建成功",
|
||||
"设置锁分组成功": "设置锁分组成功",
|
||||
"电池1": "电池1",
|
||||
"电池2": "电池2",
|
||||
"电量更新时间": "电量更新时间",
|
||||
"锁电量更新成功": "锁电量更新成功",
|
||||
"您的钥匙未生效": "您的钥匙未生效",
|
||||
"您的钥匙已冻结": "您的钥匙已冻结",
|
||||
"您的钥匙已过期": "您的钥匙已过期",
|
||||
"常开模式开启": "常开模式开启",
|
||||
"超级管理员": "超级管理员",
|
||||
"授权管理员": "授权管理员",
|
||||
"普通用户": "普通用户",
|
||||
"余": "余",
|
||||
"天": "天",
|
||||
"删除锁后,所有信息都会一起删除,确定删除锁吗?": "删除锁后,所有信息都会一起删除,确定删除锁吗?",
|
||||
"请输入登录密码": "请输入登录密码",
|
||||
"删除设备失败,请确保在设备附近,设备未被连接,设备已打开": "删除设备失败,请确保在设备附近,设备未被连接,设备已打开",
|
||||
"。如果是全自动锁,请使屏幕变亮": "。如果是全自动锁,请使屏幕变亮",
|
||||
"用户无权限": "用户无权限",
|
||||
"创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用",
|
||||
|
||||
"相机": "相机",
|
||||
"相册": "相册",
|
||||
|
||||
@ -629,6 +629,40 @@
|
||||
"根据提示,抬起手指后再进行下一次指纹采集": "根据提示,抬起手指后再进行下一次指纹采集",
|
||||
"添加成功": "添加成功",
|
||||
"搜索": "搜索",
|
||||
"重置后,该锁的卡都将被删除哦,确认要重置吗?": "重置后,该锁的卡都将被删除哦,确认要重置吗?",
|
||||
"已失效": "已失效",
|
||||
"卡详情": "卡详情",
|
||||
"请输入": "请输入",
|
||||
"关闭后,智能锁将设置为全天常开模式,直到手动关闭": "关闭后,智能锁将设置为全天常开模式,直到手动关闭",
|
||||
"请输入小于1000的数字": "请输入小于1000的数字",
|
||||
"操作成功": "操作成功",
|
||||
"管理员密码相同,无需修改": "管理员密码相同,无需修改",
|
||||
"修改密码": "修改密码",
|
||||
"请输入6位管理员密码": "请输入6位管理员密码",
|
||||
"请输入新的管理员密码": "请输入新的管理员密码",
|
||||
"未分组": "未分组",
|
||||
"请输入分组名称": "请输入分组名称",
|
||||
"创建成功": "创建成功",
|
||||
"设置锁分组成功": "设置锁分组成功",
|
||||
"电池1": "电池1",
|
||||
"电池2": "电池2",
|
||||
"电量更新时间": "电量更新时间",
|
||||
"锁电量更新成功": "锁电量更新成功",
|
||||
"您的钥匙未生效": "您的钥匙未生效",
|
||||
"您的钥匙已冻结": "您的钥匙已冻结",
|
||||
"您的钥匙已过期": "您的钥匙已过期",
|
||||
"常开模式开启": "常开模式开启",
|
||||
"超级管理员": "超级管理员",
|
||||
"授权管理员": "授权管理员",
|
||||
"普通用户": "普通用户",
|
||||
"余": "余",
|
||||
"天": "天",
|
||||
"删除锁后,所有信息都会一起删除,确定删除锁吗?": "删除锁后,所有信息都会一起删除,确定删除锁吗?",
|
||||
"请输入登录密码": "请输入登录密码",
|
||||
"删除设备失败,请确保在设备附近,设备未被连接,设备已打开": "删除设备失败,请确保在设备附近,设备未被连接,设备已打开",
|
||||
"。如果是全自动锁,请使屏幕变亮": "。如果是全自动锁,请使屏幕变亮",
|
||||
"用户无权限": "用户无权限",
|
||||
"创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用",
|
||||
|
||||
"相机": "相机",
|
||||
"相册": "相册",
|
||||
|
||||
@ -94,5 +94,4 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -172,8 +172,7 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result =
|
||||
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.beginTime.value,
|
||||
'endDate': state.endTime.value,
|
||||
@ -186,14 +185,12 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
state.endTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
Get.log(
|
||||
'得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效日",
|
||||
leftTitel: "有效日".tr,
|
||||
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
|
||||
@ -10,8 +10,6 @@ class AddCardTypeState{
|
||||
final isStressFingerprint = 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 endTime = "".obs;// 结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
|
||||
@ -46,7 +46,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
|
||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFingerprintStatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -144,9 +143,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
Future<void> _replyAddICStressCard(Reply reply) async {
|
||||
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFingerprintstatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -262,8 +259,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
icCardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
cardType:1,
|
||||
useCountLimit:1,
|
||||
// startTime:0x11223344,
|
||||
// endTime:0x11223344,
|
||||
startTime:int.parse(state.startDate.value)~/1000,
|
||||
endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
@ -303,15 +298,15 @@ class AddICCardLogic extends BaseGetXController{
|
||||
cardUserNo: state.cardNumber.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
|
||||
showToast("添加成功");
|
||||
if(state.fromType.value == 2){
|
||||
// 回调指纹号
|
||||
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.cardNumber.value));
|
||||
}else if(state.fromType.value == 1){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
Get.close(2);
|
||||
showToast("添加成功".tr, something:(){
|
||||
if(state.fromType.value == 2){
|
||||
// 回调指纹号
|
||||
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.cardNumber.value));
|
||||
}else if(state.fromType.value == 1){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
Get.close(2);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@ -36,19 +36,18 @@ class CardDetailLogic extends BaseGetXController{
|
||||
// 添加卡片开始(此处用作删除卡片)
|
||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFingerprintStatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
deletICCardData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -73,19 +72,16 @@ class CardDetailLogic extends BaseGetXController{
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -112,7 +108,6 @@ class CardDetailLogic extends BaseGetXController{
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
String? userID = await Storage.getUid();
|
||||
IoSenderManage.senderAddICCardCommand(
|
||||
@ -144,8 +139,8 @@ class CardDetailLogic extends BaseGetXController{
|
||||
cardId: state.keyId.value.toString(),
|
||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||
weekDay: state.weekDay.value,
|
||||
startDate: state.starDate.value*1000,
|
||||
endDate: state.endDate.value*1000,
|
||||
startDate: state.starDate.value,
|
||||
endDate: state.endDate.value,
|
||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||
cardName: state.changeNameController.text,
|
||||
changeType: "1",
|
||||
@ -154,7 +149,7 @@ class CardDetailLogic extends BaseGetXController{
|
||||
cardType:state.keyType.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功", something: (){
|
||||
showToast("修改成功".tr, something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
});
|
||||
}
|
||||
@ -169,7 +164,7 @@ class CardDetailLogic extends BaseGetXController{
|
||||
deleteType:"1"
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("删除成功", something: (){
|
||||
showToast("删除成功".tr, something: (){
|
||||
Get.back(result: "addScuess");
|
||||
});
|
||||
}
|
||||
@ -178,7 +173,7 @@ class CardDetailLogic extends BaseGetXController{
|
||||
String getKeyTypeShowDateTime(){
|
||||
String useDateStr = '';
|
||||
if(state.keyType.value == 1){
|
||||
useDateStr = "永久";
|
||||
useDateStr = "永久".tr;
|
||||
}else if(state.keyType.value == 2){
|
||||
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||
} else if(state.keyType.value == 4){
|
||||
|
||||
@ -11,9 +11,8 @@ import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/showTFView.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -35,7 +34,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: "卡详情",
|
||||
barTitle: "卡详情".tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
@ -59,7 +58,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
allHeight: 70.h,
|
||||
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
||||
rightTitle: logic.getKeyTypeShowDateTime(),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
@ -85,12 +83,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
});
|
||||
if(data != null) {
|
||||
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.endDate.value = data["endDate"];
|
||||
state.starTime.value = data["starTime"];
|
||||
@ -126,7 +118,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
Obx(() => Visibility(
|
||||
visible: state.keyType.value == 4 ? true : false,
|
||||
child: Obx(() => CommonItem(
|
||||
leftTitel: "有效时间",
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||
isHaveDirection: true,
|
||||
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),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
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) {
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -304,7 +207,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
controller: state.changeNameController,
|
||||
sureClick: () {
|
||||
if(state.changeNameController.text.isEmpty){
|
||||
logic.showToast("请输入姓名");
|
||||
logic.showToast("请输入姓名".tr);
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
@ -317,25 +220,24 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
});
|
||||
}
|
||||
|
||||
void showIosTipViewDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "确定要删除吗?",
|
||||
sureClick: () async {
|
||||
Get.back();
|
||||
String? idStr = await Storage.getUid();
|
||||
logic.senderAddICCard();
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
// void showIosTipViewDialog(BuildContext context) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return ShowIosTipView(
|
||||
// title: "提示",
|
||||
// tipTitle: "确定要删除吗?",
|
||||
// sureClick: () async {
|
||||
// Get.back();
|
||||
// logic.senderAddICCard();
|
||||
// },
|
||||
// cancelClick: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
|
||||
@ -327,13 +327,13 @@ class CardListLogic extends BaseGetXController {
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
if(state.isDeletAll == false){
|
||||
showToast("删除成功", something: (){
|
||||
showToast("删除成功".tr, something: (){
|
||||
state.isDeletCardData = false;
|
||||
pageNo = 1;
|
||||
getICCardListData();
|
||||
});
|
||||
}else{
|
||||
showToast("重置成功", something: (){
|
||||
showToast("重置成功".tr, something: (){
|
||||
state.isDeletCardData = false;
|
||||
pageNo = 1;
|
||||
getICCardListData();
|
||||
@ -356,11 +356,11 @@ class CardListLogic extends BaseGetXController {
|
||||
var keyTypeStr = "";//
|
||||
if(fingerprintItemData.cardStatus == 1){
|
||||
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
||||
keyTypeStr = "未生效";
|
||||
keyTypeStr = "未生效".tr;
|
||||
}
|
||||
|
||||
}else if(fingerprintItemData.cardStatus == 2){
|
||||
keyTypeStr = "已失效";
|
||||
keyTypeStr = "已失效".tr;
|
||||
}
|
||||
return keyTypeStr;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
ShowTipView().showIosTipWithContentDialog("重置后,该锁的卡都将被删除哦,确认要重置吗?", () async {
|
||||
ShowTipView().showIosTipWithContentDialog("重置后,该锁的卡都将被删除哦,确认要重置吗?".tr, () async {
|
||||
state.isDeletCardData = true;
|
||||
state.isDeletAll = true;
|
||||
state.deletKeyID = "1";
|
||||
@ -74,7 +74,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
});
|
||||
// showDeletAlertDialog(context);
|
||||
} else {
|
||||
logic.showToast("演示模式");
|
||||
logic.showToast("演示模式".tr);
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -148,7 +148,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
label: '删除'.tr,
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
@ -187,10 +187,6 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
height: 90.h,
|
||||
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
color: Colors.white,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// // borderRadius: BorderRadius.circular(10.w),
|
||||
// ),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 30.w),
|
||||
|
||||
@ -14,12 +14,12 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
showToast("失效时间需大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
showToast("生效时间需大于当前时间".tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.editFingerprintsData(
|
||||
@ -36,7 +36,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
fingerprintType: state.fingerprintItemData.value.fingerprintType! == 4 ? 4 : 2,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功", something: (){
|
||||
showToast("修改成功".tr, something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":beginTimeTimestamp.toString(),
|
||||
@ -51,12 +51,12 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
showToast("失效时间需大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
showToast("生效时间需大于当前时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
cardType: 2,// 2:限时 无论之前是永久还是限时,修改之后都是限时
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功", something: (){
|
||||
showToast("修改成功".tr, something: (){
|
||||
Get.back(result: {
|
||||
"beginTimeTimestamp":beginTimeTimestamp.toString(),
|
||||
"endTimeTimestamp":endTimeTimestamp.toString(),
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -40,7 +41,6 @@ class _OtherTypeKeyChangeDatePageState
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
// print("state.pushType.value:${state.pushType.value}");
|
||||
switch (state.pushType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
|
||||
@ -18,12 +18,12 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
|
||||
|
||||
if (starDateTimestamp >= endDateTimestamp) {
|
||||
showToast("失效日期要大于生效日期");
|
||||
showToast("失效日期要大于生效日期".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (starTimeTimestamp >= endTimeTimestamp) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
showToast("失效时间要大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.editFingerprintsData(
|
||||
@ -40,7 +40,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功", something: (){
|
||||
showToast("修改成功".tr, something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
Get.back(result: {
|
||||
"starDate":starDateTimestamp.toString(),
|
||||
@ -61,12 +61,12 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
|
||||
|
||||
if (starDateTimestamp >= endDateTimestamp) {
|
||||
showToast("失效日期要大于生效日期");
|
||||
showToast("失效日期要大于生效日期".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (starTimeTimestamp >= endTimeTimestamp) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
showToast("失效时间要大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.editICCardData(
|
||||
@ -83,7 +83,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
cardType: state.fingerprintItemData.value.cardType!,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast("修改成功", something: (){
|
||||
showToast("修改成功".tr, something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
Get.back(result: {
|
||||
"starDate":starDateTimestamp.toString(),
|
||||
|
||||
@ -29,7 +29,7 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: "修改有效期",
|
||||
barTitle: "修改有效期".tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
@ -63,7 +63,7 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
|
||||
child: Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "生效日期",
|
||||
leftTitel: "生效日期".tr,
|
||||
rightTitle: state.starDate.value,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
@ -74,7 +74,7 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "失效日期",
|
||||
leftTitel: "失效日期".tr,
|
||||
rightTitle: state.endDate.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
|
||||
@ -38,6 +38,7 @@ class CheckingInSetLogic extends BaseGetXController{
|
||||
|
||||
state.weekDays.value = state.checkingInSetInfo.value.workDay!;
|
||||
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.companyName.value = state.checkingInSetInfo.value.companyName!;
|
||||
|
||||
@ -84,7 +84,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
Obx(() => CommonItem(
|
||||
leftTitel:
|
||||
"${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,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
@ -95,12 +95,10 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
"checkingInSetInfo": state.checkingInSetInfo.value,
|
||||
});
|
||||
if(data != null) {
|
||||
print("data: $data");
|
||||
Get.log("data: $data");
|
||||
state.isCustom.value = data["attendanceType"];
|
||||
state.weekDays.value = data["weekDays"];
|
||||
state.weekDaysStr.value = state.weekDays.value.join(",");
|
||||
// logic.getCheckInSetInfoData();
|
||||
setState(() {});
|
||||
}
|
||||
})),
|
||||
CommonItem(
|
||||
|
||||
@ -9,7 +9,7 @@ class CheckingInSetState{
|
||||
final getKeyInfosData = LockListInfoItemEntity().obs;
|
||||
final companyId = "".obs;
|
||||
|
||||
var isCustom = true.obs;
|
||||
var isCustom = false.obs;
|
||||
|
||||
var weekDays = <int>[].obs;// 工作天数
|
||||
var weekDaysStr = "".obs;// 拼接显示的字符串天数
|
||||
|
||||
@ -51,11 +51,6 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0,
|
||||
remoteEnable: state.isRemoteUnlock.value ? 1 : 2);
|
||||
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: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -85,18 +86,11 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
});
|
||||
if(data != null) {
|
||||
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.endDate.value = data["endDate"];
|
||||
state.starTime.value = data["starTime"];
|
||||
state.endTime.value = data["endTime"];
|
||||
state.weekDay.value = data["validityValue"];
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -266,9 +260,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title:
|
||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
||||
tipTitle: "请输入",
|
||||
title: "${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
||||
tipTitle: "请输入".tr,
|
||||
controller: state.changeNameController,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
|
||||
@ -38,7 +38,6 @@ class ElectronicKeyDetailState {
|
||||
starTime.value = itemData.value.startDate!.toString();
|
||||
endTime.value = itemData.value.endDate!.toString();
|
||||
weekDay.value = itemData.value.weekDays!;
|
||||
// Get.log("starTime.value: ${starTime.value} endTime.value: ${endTime.value}");
|
||||
keyType.value = itemData.value.keyType!;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,8 +32,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
// 监听设备返回的数据
|
||||
void initReplySubscription() {
|
||||
state.replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
state.replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
|
||||
// 开门
|
||||
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||
@ -85,9 +84,6 @@ class LockDetailLogic extends BaseGetXController {
|
||||
timer.cancel();
|
||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||
});
|
||||
// Future.delayed(const Duration(seconds: 3), () {
|
||||
// state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
// });
|
||||
|
||||
// 电量
|
||||
int power = reply.data[7];
|
||||
@ -381,9 +377,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||
});
|
||||
|
||||
BlueManage()
|
||||
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
// 私钥
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
@ -397,8 +391,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
if (token != null) {
|
||||
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(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID: state.senderUserId.toString(),
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@ -947,9 +948,6 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// }
|
||||
|
||||
startOpenLock() {
|
||||
// print("11111111");
|
||||
// checkBlueIsOpen((){
|
||||
// print("33333333");
|
||||
if (state.openLockBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -6,14 +6,6 @@ import 'package:get/get.dart';
|
||||
import '../../../blue/io_reply.dart';
|
||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
// enum RKConnectState {
|
||||
// NULL,
|
||||
// STOPPED, //已暂停连接 0
|
||||
// CONNECTING, //1 连接开锁中
|
||||
// CONNECTED, //2 已连接开锁成功
|
||||
// CHECKING, //检测可用性 3
|
||||
// CONNECTFAIL, //蓝牙连接失败 4
|
||||
// }
|
||||
|
||||
class LockDetailState {
|
||||
Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
|
||||
|
||||
@ -27,7 +27,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
if(state.isCustomLockTime.value == true){
|
||||
autoTime = state.timeController.text;
|
||||
if(int.parse(autoTime) >= 1000){
|
||||
showToast("请输入小于1000的数字");
|
||||
showToast("请输入小于1000的数字".tr);
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
@ -44,7 +44,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
|
||||
state.autoLockTime.value = autoTime;
|
||||
state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond = int.parse(state.autoLockTime.value);
|
||||
showToast("操作成功", something: (){
|
||||
showToast("操作成功".tr, something: (){
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
Get.back();
|
||||
@ -167,7 +167,6 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
autoTime = state.autoLockTime.value;
|
||||
}
|
||||
}
|
||||
// print("autoTimeautoTimeautoTime:${autoTime}");
|
||||
IoSenderManage.setSupportFunctionsWithParametersCommand(
|
||||
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
@ -205,7 +204,6 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
@ -214,7 +212,6 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
// _readSupportFunctionsWithParameters();
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/showBottomSheetTool.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'automaticBlocking_logic.dart';
|
||||
@ -44,7 +45,9 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
|
||||
// }
|
||||
|
||||
if(state.isOpen.value == false){
|
||||
showDeletAlertTipDialog(context);
|
||||
ShowTipView().showIosTipWithContentDialog('关闭后,智能锁将设置为全天常开模式,直到手动关闭'.tr, (){
|
||||
logic.sendAutoLock();
|
||||
});
|
||||
}else{
|
||||
logic.sendAutoLock();
|
||||
}
|
||||
@ -72,7 +75,7 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
|
||||
Builder(builder: (context) {
|
||||
return Obx(() => CommonItem(
|
||||
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,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -195,32 +198,32 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> with Rout
|
||||
);
|
||||
}
|
||||
|
||||
void showDeletAlertTipDialog(BuildContext context) {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
// title: const Text("提示"),
|
||||
content: const Text('关闭后,智能锁将设置为全天常开模式,直到手动关闭'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
logic.sendAutoLock();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
// void showDeletAlertTipDialog(BuildContext context) {
|
||||
// showCupertinoDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return CupertinoAlertDialog(
|
||||
// // title: const Text("提示"),
|
||||
// content: Text('关闭后,智能锁将设置为全天常开模式,直到手动关闭'.tr),
|
||||
// actions: [
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// logic.sendAutoLock();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:async';
|
||||
|
||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
@ -40,16 +41,13 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
Future<void> _replyChangeAdministratorPassword(Reply reply) async {
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyFactoryDataResetKeyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
@ -57,9 +55,8 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
addLockAdminPassword(true);
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
@ -104,12 +101,11 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
Get.log("status:$status");
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
@ -117,16 +113,14 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
reply.data.removeRange(0, 6);
|
||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||
var getList = splitList(reply.data, 13);
|
||||
print("getList:$getList");
|
||||
for(int i = 0; i<getList.length; i++){
|
||||
var indexList = getList[i];
|
||||
print("indexList:$indexList");
|
||||
var pwd = indexList.sublist(1, 11);
|
||||
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){
|
||||
showToast("管理员密码相同,无需修改");
|
||||
showToast("管理员密码相同,无需修改".tr);
|
||||
return;
|
||||
}
|
||||
state.adminPwd.value = pwdStr;
|
||||
@ -136,7 +130,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -159,19 +153,16 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -282,12 +273,12 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if(isChange == true){
|
||||
showToast("修改成功", something: (){
|
||||
showToast("修改成功".tr, something: (){
|
||||
state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
});
|
||||
}else{
|
||||
showToast("上传成功", something: (){
|
||||
showToast("上传成功".tr, something: (){
|
||||
state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
});
|
||||
@ -299,7 +290,6 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
@ -308,7 +298,6 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -14,8 +15,7 @@ class AdminOpenLockPasswordPage extends StatefulWidget {
|
||||
const AdminOpenLockPasswordPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AdminOpenLockPasswordPage> createState() =>
|
||||
_AdminOpenLockPasswordPageState();
|
||||
State<AdminOpenLockPasswordPage> createState() => _AdminOpenLockPasswordPageState();
|
||||
}
|
||||
|
||||
class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
|
||||
@ -38,7 +38,7 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
showCupertinoAlertDialog(context);
|
||||
showCupertinoAlertDialog();
|
||||
})),
|
||||
Container(
|
||||
margin: EdgeInsets.all(30.w),
|
||||
@ -81,15 +81,13 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
|
||||
));
|
||||
}
|
||||
|
||||
void showCupertinoAlertDialog(
|
||||
BuildContext context,
|
||||
) {
|
||||
void showCupertinoAlertDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: "修改密码",
|
||||
tipTitle: "请输入",
|
||||
title: "修改密码".tr,
|
||||
tipTitle: "请输入".tr,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
@ -98,12 +96,12 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> {
|
||||
controller: state.changePwdController,
|
||||
sureClick: () {
|
||||
if(state.changePwdController.text.length < 6){
|
||||
logic.showToast("请输入6位管理员密码");
|
||||
logic.showToast("请输入6位管理员密码".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.changePwdController.text == state.lockBasicInfo.value.adminPwd!){
|
||||
logic.showToast("请输入新的管理员密码");
|
||||
logic.showToast("请输入新的管理员密码".tr);
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
|
||||
@ -23,7 +23,6 @@ class BasicInformationLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
}
|
||||
|
||||
@ -31,7 +30,6 @@ class BasicInformationLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
Obx(() => Visibility(
|
||||
visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间",
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${DateTool().dateToHNString((state.lockBasicInfo.value.startDate ?? 0).toString())}-${DateTool().dateToHNString((state.lockBasicInfo.value.endDate ?? 0).toString())}",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true),
|
||||
@ -101,27 +101,24 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.editLockNamePage,
|
||||
arguments: {
|
||||
var data = await Get.toNamed(Routers.editLockNamePage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.lockBasicInfo.value = data["lockBasicInfo"];
|
||||
print("state.lockBasicInfo.value.lockAlias:${state.lockBasicInfo.value.lockAlias}");
|
||||
});
|
||||
}
|
||||
}))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.groupName ?? "",
|
||||
rightTitle: state.lockBasicInfo.value.groupName!.tr ?? "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
Get.toNamed(Routers.lockSelectGroupingPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
})!
|
||||
.then((val) {
|
||||
})!.then((val) {
|
||||
if (val != null) {
|
||||
// mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
@ -136,7 +133,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
||||
rightTitle:
|
||||
state.lockBasicInfo!.value.adminPwd,
|
||||
state.lockBasicInfo.value.adminPwd,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
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;
|
||||
// }
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ class BasicInformationState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
var lockBasicInfo = LockBasicInfo().obs;
|
||||
|
||||
var groupName = "未分组".obs;
|
||||
var groupName = "未分组".tr.obs;
|
||||
|
||||
BasicInformationState() {
|
||||
var map = Get.arguments;
|
||||
|
||||
@ -16,13 +16,11 @@ class EditLockNameLogic extends BaseGetXController {
|
||||
lockName: state.changeLockNameController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
|
||||
showToast("修改成功", something: () {
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(
|
||||
3, state.lockBasicInfo.value.lockAlias!));
|
||||
showToast("修改成功".tr, something: () {
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(3, state.lockBasicInfo.value.lockAlias!));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
Get.back(result: {"lockBasicInfo": state.lockBasicInfo.value});
|
||||
});
|
||||
|
||||
Get.back(result: {"lockBasicInfo": state.lockBasicInfo.value});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
|
||||
child: LoginInput(
|
||||
controller: state.changeLockNameController,
|
||||
leftWidget: const SizedBox(),
|
||||
hintText: "请输入名称",
|
||||
hintText: "请输入名称".tr,
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(50),
|
||||
]),
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import '../../../../../tools/baseGetXController.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
@ -12,8 +14,9 @@ class LockSelectGroupingLogic extends BaseGetXController {
|
||||
Future<void> addLockGroupRequest() async {
|
||||
MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("创建成功");
|
||||
mockNetworkDataRequest();
|
||||
showToast("创建成功".tr, something: () {
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,14 +25,15 @@ class LockSelectGroupingLogic extends BaseGetXController {
|
||||
MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
|
||||
state.lockSetInfoData.value.lockId.toString(), itemData.keyGroupId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("设置锁分组成功");
|
||||
state.lockBasicInfo.value.groupId = itemData.keyGroupId;
|
||||
state.lockBasicInfo.value.groupName = itemData.keyGroupName;
|
||||
mockNetworkDataRequest();
|
||||
state.lockSetInfoData.value.lockBasicInfo!.groupId = itemData.keyGroupId;
|
||||
state.lockSetInfoData.value.lockBasicInfo!.groupName = itemData.keyGroupName;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
showToast("设置锁分组成功".tr, something: () {
|
||||
state.lockBasicInfo.value.groupId = itemData.keyGroupId;
|
||||
state.lockBasicInfo.value.groupName = itemData.keyGroupName;
|
||||
mockNetworkDataRequest();
|
||||
state.lockSetInfoData.value.lockBasicInfo!.groupId = itemData.keyGroupId;
|
||||
state.lockSetInfoData.value.lockBasicInfo!.groupName = itemData.keyGroupName;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,8 +49,6 @@ class LockSelectGroupingLogic extends BaseGetXController {
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
mockNetworkDataRequest();
|
||||
}
|
||||
|
||||
@ -54,11 +56,8 @@ class LockSelectGroupingLogic extends BaseGetXController {
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("lockDetail_onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -91,9 +92,9 @@ class _LockSelectGroupingPageState extends State<LockSelectGroupingPage> {
|
||||
//发送编辑钥匙名称请求
|
||||
if (state.changeNameController.text.isNotEmpty) {
|
||||
logic.addLockGroupRequest();
|
||||
Navigator.pop(context);
|
||||
Get.back();
|
||||
} else {
|
||||
logic.showToast("请输入分组名称");
|
||||
logic.showToast("请输入分组名称".tr);
|
||||
}
|
||||
},
|
||||
cancelClick: () {
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.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 '../../../../../blue/blue_manage.dart';
|
||||
@ -25,7 +26,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
.uploadElectricQuantity(
|
||||
electricQuantity, state.lockSetInfoData.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("锁电量更新成功", something: () {
|
||||
showToast("锁电量更新成功".tr, something: () {
|
||||
eventBus
|
||||
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(
|
||||
@ -87,7 +88,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
@ -104,23 +105,19 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -129,7 +126,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("NearbyLockLogic onReady()");
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
@ -137,7 +133,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
print("NearbyLockLogic onInit()");
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -54,7 +55,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
||||
children: [
|
||||
Expanded(
|
||||
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),
|
||||
)),
|
||||
],
|
||||
@ -64,7 +65,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"电池2${TranslationLoader.lanKeys!.electricQuantity!.tr}:--%",
|
||||
"${"电池2".tr}:${TranslationLoader.lanKeys!.electricQuantity!.tr}:--%",
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
)),
|
||||
],
|
||||
@ -75,7 +76,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"电量更新时间:${DateTool().dateToYMDHNString(state.uploadElectricQuantityDate.value.toString())}",
|
||||
"${"电量更新时间".tr}:${DateTool().dateToYMDHNString(state.uploadElectricQuantityDate.value.toString())}",
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
)),
|
||||
],
|
||||
|
||||
@ -7,6 +7,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
@ -121,23 +122,22 @@ class LockSetLogic extends BaseGetXController {
|
||||
Future<void> _replyFactoryDataResetKey(Reply reply) async {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyFactoryDataResetKeyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[6];
|
||||
print("status:$status");
|
||||
Get.log("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
deletLockInfoData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -158,21 +158,21 @@ class LockSetLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
dismissEasyLoading();
|
||||
showToast("用户无权限");
|
||||
showToast("用户无权限".tr);
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} ");
|
||||
Get.log("${reply.commandType!.typeValue} ");
|
||||
dismissEasyLoading();
|
||||
showToast("权限校验错误");
|
||||
// showToast("权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
dismissEasyLoading();
|
||||
showToast("权限校验错误");
|
||||
// showToast("权限校验错误");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
// Toast.show(msg: "操作成功");featureEnable = state.isOpenStayWarn.value == 1 ? 0 : 1;
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
@ -240,26 +240,26 @@ class LockSetLogic extends BaseGetXController {
|
||||
state.lockSetInfoData.value.lockSettingInfo!.abnormalWarn =
|
||||
state.isOpenExceptionWarnings.value;
|
||||
}
|
||||
print("isOpenBlueBroadcast111:${state.isOpenBlueBroadcast.value}");
|
||||
Get.log("isOpenBlueBroadcast111:${state.isOpenBlueBroadcast.value}");
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
Get.log("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
@ -463,11 +463,10 @@ class LockSetLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isAttendance.value = (state.isAttendance.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.attendance = state.isAttendance.value;
|
||||
showToast("设置成功", something: (){
|
||||
showToast("设置成功".tr, something: (){
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
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) {
|
||||
state.isLockPickingReminder.value = (state.isLockPickingReminder.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.unlockReminderPush = state.isLockPickingReminder.value;
|
||||
showToast("设置成功", something: (){
|
||||
showToast("设置成功".tr, something: (){
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
}
|
||||
@ -496,7 +495,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
state.isOpenLockNeedOnline.value = (state.isOpenLockNeedOnline.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.appUnlockOnline = state.isOpenLockNeedOnline.value;
|
||||
|
||||
showToast("设置成功",something: (){
|
||||
showToast("设置成功".tr,something: (){
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(1, state.lockSettingInfo.value.appUnlockOnline!.toString()));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
// print("state.lockSettingInfo.value.appUnlockOnline:${state.lockSettingInfo.value.appUnlockOnline}");
|
||||
@ -529,79 +528,87 @@ class LockSetLogic extends BaseGetXController {
|
||||
// }
|
||||
|
||||
void showDeletAlertTipDialog({String? showContent = ""}) {
|
||||
// bool isContains = BlueManage().connectDeviceName!.contains("T9A");
|
||||
var content = showContent!.isEmpty ? "删除设备失败,请确保在设备附近,设备未被连接,设备已打开${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮" : ""}" : showContent;
|
||||
showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: Text(content),
|
||||
// content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'),
|
||||
actions: [
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// ),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
// if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// // 直接调用删除锁接口
|
||||
// deletLockInfoData();
|
||||
// } else {
|
||||
// // 直接调用删除要是接口
|
||||
// deletKeyData();
|
||||
// }
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
ShowTipView().showSureAlertDialog(content);
|
||||
|
||||
// showCupertinoDialog(context: Get.context!, builder: (context) {
|
||||
// return CupertinoAlertDialog(
|
||||
// title: const Text("提示"),
|
||||
// content: Text(content),
|
||||
// // content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'),
|
||||
// actions: [
|
||||
// // CupertinoDialogAction(
|
||||
// // child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// // onPressed: () {
|
||||
// // Navigator.pop(context);
|
||||
// // },
|
||||
// // ),
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// // if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// // // 直接调用删除锁接口
|
||||
// // deletLockInfoData();
|
||||
// // } else {
|
||||
// // // 直接调用删除要是接口
|
||||
// // deletKeyData();
|
||||
// // }
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
}
|
||||
|
||||
//确认弹窗
|
||||
void showCupertinoAlertDialog(widgetContext) {
|
||||
showCupertinoDialog(
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: const Text('创建公司后,考勤功能才能使用'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Get.toNamed(Routers.checkInCreatCompanyPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
// void showCupertinoAlertDialog(widgetContext) {
|
||||
// showCupertinoDialog(
|
||||
// context: widgetContext,
|
||||
// builder: (context) {
|
||||
// return CupertinoAlertDialog(
|
||||
// title: Text("提示".tr),
|
||||
// content: const Text('创建公司后,考勤功能才能使用'),
|
||||
// actions: [
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// Get.toNamed(Routers.checkInCreatCompanyPage, arguments: {
|
||||
// 'lockSetInfoData': state.lockSetInfoData.value
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
/// 以下为删除逻辑
|
||||
deleyLockLogicOfRoles(){
|
||||
if (state.lockBasicInfo.value.isLockOwner == 1) {
|
||||
// 超级管理员必须通过连接蓝牙删除
|
||||
showDeletAlertDialog();
|
||||
// showDeletAlertDialog();
|
||||
ShowTipView().showIosTipWithContentDialog("删除锁后,所有信息都会一起删除,确定删除锁吗?".tr, (){
|
||||
// 删除锁
|
||||
showDeletPasswordAlertDialog();
|
||||
});
|
||||
} else if (state.lockBasicInfo.value.keyRight == 1){
|
||||
// 授权管理员弹框提示
|
||||
showDeleteAdministratorIsHaveAllDataDialog();
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog("同时删除其发送的所有钥匙,钥匙删除后不能恢复".tr, (a){
|
||||
// 授权管理员删除
|
||||
state.deleteAdministratorIsHaveAllData.value = a;
|
||||
deletKeyData();
|
||||
});
|
||||
// showDeleteAdministratorIsHaveAllDataDialog();
|
||||
} else{
|
||||
// 普通用户直接删除
|
||||
deletKeyData();
|
||||
@ -609,54 +616,45 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//超级管理员 删除弹窗
|
||||
void showDeletAlertDialog() {
|
||||
showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: const Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
showDeletPasswordAlertDialog(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
// void showDeletAlertDialog() {
|
||||
// showCupertinoDialog(
|
||||
// context: Get.context!,
|
||||
// builder: (context) {
|
||||
// return CupertinoAlertDialog(
|
||||
// title: const Text("提示"),
|
||||
// content: const Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'),
|
||||
// actions: [
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// showDeletPasswordAlertDialog();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
void showDeletPasswordAlertDialog(BuildContext context) {
|
||||
// 点击删除 开始扫描
|
||||
// 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();
|
||||
// }
|
||||
// });
|
||||
void showDeletPasswordAlertDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: "请输入登录密码",
|
||||
title: "请输入登录密码".tr,
|
||||
tipTitle: "",
|
||||
controller: state.passwordTF,
|
||||
sureClick: () {
|
||||
//发送删除锁请求
|
||||
if (state.passwordTF.text.isEmpty) {
|
||||
showToast("请输入登录密码");
|
||||
showToast("请输入登录密码".tr);
|
||||
return;
|
||||
}
|
||||
checkLoginPassword();
|
||||
@ -672,51 +670,51 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 授权管理员调用删除数据
|
||||
void showDeleteAdministratorIsHaveAllDataDialog() {
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: Container(
|
||||
height: 100.h,
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
state.deleteAdministratorIsHaveAllData.value = !state.deleteAdministratorIsHaveAllData.value;
|
||||
},
|
||||
child: Obx(() => Image.asset(
|
||||
state.deleteAdministratorIsHaveAllData.value
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
))),
|
||||
SizedBox(width: 15.w,),
|
||||
Expanded(child: Text('同时删除其发送的所有钥匙,钥匙删除后不能恢复', maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.delete!.tr),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
deletKeyData();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
// void showDeleteAdministratorIsHaveAllDataDialog() {
|
||||
// showDialog(
|
||||
// context: Get.context!,
|
||||
// builder: (BuildContext context) {
|
||||
// return CupertinoAlertDialog(
|
||||
// title: const Text("提示"),
|
||||
// content: Container(
|
||||
// height: 100.h,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// state.deleteAdministratorIsHaveAllData.value = !state.deleteAdministratorIsHaveAllData.value;
|
||||
// },
|
||||
// child: Obx(() => Image.asset(
|
||||
// state.deleteAdministratorIsHaveAllData.value
|
||||
// ? 'images/icon_round_select.png'
|
||||
// : 'images/icon_round_unSelect.png',
|
||||
// width: 30.w,
|
||||
// height: 30.w,
|
||||
// ))),
|
||||
// SizedBox(width: 15.w,),
|
||||
// Expanded(child: Text('同时删除其发送的所有钥匙,钥匙删除后不能恢复', maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// actions: [
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.delete!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// deletKeyData();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
// 查询账户密码
|
||||
void checkLoginPassword() async {
|
||||
@ -725,77 +723,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Get.back();
|
||||
|
||||
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;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -423,7 +424,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
// Toast.show(msg: "功能暂未开放");
|
||||
Get.toNamed(Routers.openDoorDirectionPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
@ -437,7 +437,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
// Toast.show(msg: "功能暂未开放");
|
||||
Get.toNamed(Routers.motorPowerPage);
|
||||
})),
|
||||
// 蓝牙广播(关闭则不能使用蓝牙主动开锁)
|
||||
@ -636,7 +635,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
|
||||
// 开启考勤
|
||||
CupertinoSwitch _openCheckInSwitch() {
|
||||
// print("111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}");
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
@ -645,7 +643,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
onChanged: (value) {
|
||||
logic.openCheckingInData((checkingInInfoDataEntity) {
|
||||
if (checkingInInfoDataEntity.data!.companyId == 0) {
|
||||
logic.showCupertinoAlertDialog(context);
|
||||
// logic.showCupertinoAlertDialog(context);
|
||||
ShowTipView().showIosTipWithContentDialog("创建公司后,考勤功能才能使用".tr, (){
|
||||
// 删除锁
|
||||
Get.toNamed(Routers.checkInCreatCompanyPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
});
|
||||
} else {
|
||||
logic.setLockSetGeneralSetting();
|
||||
}
|
||||
|
||||
@ -44,28 +44,20 @@ class LockListLogic extends BaseGetXController{
|
||||
Future<void> _replyFactoryDataResetKey(Reply reply) async {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyFactoryDataResetKeyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[6];
|
||||
print("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
deletLockInfoData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${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!);
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -80,20 +72,20 @@ class LockListLogic extends BaseGetXController{
|
||||
token: getTokenList);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
dismissEasyLoading();
|
||||
showToast("用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} ");
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} ");
|
||||
dismissEasyLoading();
|
||||
showToast("权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
dismissEasyLoading();
|
||||
showToast("权限校验错误");
|
||||
break;
|
||||
@ -120,7 +112,7 @@ class LockListLogic extends BaseGetXController{
|
||||
if(keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop){
|
||||
// 当是正常使用跟待接收状态的时候
|
||||
if(keyInfo.keyStatus == XSConstantMacro.keyStatusNormalUse || keyInfo.keyStatus == XSConstantMacro.keyStatusWaitReceive) {
|
||||
return "余${DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!)}天";
|
||||
return "${"余".tr}${DateTool().compareTimeGetDaysFromNow(keyInfo.endDate!)}${"天".tr}";
|
||||
} else {
|
||||
return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!);
|
||||
}
|
||||
@ -148,8 +140,8 @@ class LockListLogic extends BaseGetXController{
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: const Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'),
|
||||
title: Text("提示".tr),
|
||||
content: Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
@ -176,13 +168,13 @@ class LockListLogic extends BaseGetXController{
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: "请输入登录密码",
|
||||
title: "请输入登录密码".tr,
|
||||
tipTitle: "",
|
||||
controller: state.passwordTF,
|
||||
sureClick: () {
|
||||
//发送删除锁请求
|
||||
if (state.passwordTF.text.isEmpty) {
|
||||
showToast("请输入登录密码");
|
||||
showToast("请输入登录密码".tr);
|
||||
return;
|
||||
}
|
||||
checkLoginPassword();
|
||||
@ -203,8 +195,8 @@ class LockListLogic extends BaseGetXController{
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: Container(
|
||||
title: Text("提示".tr),
|
||||
content: SizedBox(
|
||||
height: 100.h,
|
||||
child: Row(
|
||||
children: [
|
||||
@ -220,7 +212,7 @@ class LockListLogic extends BaseGetXController{
|
||||
height: 30.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 {
|
||||
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>();
|
||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||
@ -338,32 +321,18 @@ class LockListLogic extends BaseGetXController{
|
||||
|
||||
void showDeletAlertTipDialog({String? showContent = ""}) {
|
||||
// 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(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
title: Text("提示".tr),
|
||||
content: Text(content),
|
||||
// content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'),
|
||||
actions: [
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// ),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
// if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// // 直接调用删除锁接口
|
||||
// deletLockInfoData();
|
||||
// } else {
|
||||
// // 直接调用删除要是接口
|
||||
// deletKeyData();
|
||||
// }
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@ -82,7 +82,6 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
||||
|
||||
}
|
||||
setState(() {});
|
||||
print('选中了么0');
|
||||
},
|
||||
typeImgList: const [],
|
||||
groupItem: itemData,
|
||||
@ -113,22 +112,22 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
label: '删除'.tr,
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: lockInfoListItem(keyInfo, isLast, () {
|
||||
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)){
|
||||
logic.showToast("您的钥匙未生效");
|
||||
logic.showToast("您的钥匙未生效".tr);
|
||||
return;
|
||||
}
|
||||
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)){
|
||||
logic.showToast("您的钥匙已冻结");
|
||||
logic.showToast("您的钥匙已冻结".tr);
|
||||
return;
|
||||
}
|
||||
if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)){
|
||||
logic.showToast("您的钥匙已过期");
|
||||
logic.showToast("您的钥匙已过期".tr);
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.lockDetailMainPage, arguments: {
|
||||
@ -223,7 +222,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
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: [
|
||||
SizedBox(width: 30.w),
|
||||
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: [
|
||||
SizedBox(width: 30.w),
|
||||
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(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
import '../../../talk/udp/udp_help.dart';
|
||||
import '../../../tools/baseGetXController.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../entity/lockListInfo_entity.dart';
|
||||
import 'lockMain_state.dart';
|
||||
|
||||
@ -17,27 +20,35 @@ class LockMainLogic extends BaseGetXController {
|
||||
pageSize: 50,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data!.groupList!.isEmpty) {
|
||||
state.dataLength.value = 0;
|
||||
} 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;
|
||||
loadMainDataLogic(entity.data!);
|
||||
Storage.saveMainListData(entity.data!);
|
||||
// return entity.data!;
|
||||
} else {
|
||||
print("首页锁列表请求失败");
|
||||
state.dataLength.value = 0;
|
||||
Get.log("首页锁列表请求失败");
|
||||
// showToast("数据请求失败");
|
||||
// state.dataLength.value = 0;
|
||||
LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData();
|
||||
loadMainDataLogic(lockListInfoGroupEntity!);
|
||||
}
|
||||
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 {
|
||||
var connectResult = await (Connectivity().checkConnectivity());
|
||||
@ -45,16 +56,16 @@ class LockMainLogic extends BaseGetXController {
|
||||
if (connectResult == ConnectivityResult.mobile) {
|
||||
// _netType = "4G";
|
||||
state.networkConnectionStatus.value = 1;
|
||||
print("4G 4G 4G 4G 4G");
|
||||
Get.log("4G 4G 4G 4G 4G");
|
||||
} else if (connectResult == ConnectivityResult.wifi) {
|
||||
// _netType = "wifi";
|
||||
state.networkConnectionStatus.value = 1;
|
||||
print("wifi wifi wifi wifi wifi");
|
||||
Get.log("wifi wifi wifi wifi wifi");
|
||||
} else {
|
||||
// _netType = "未连接";
|
||||
state.networkConnectionStatus.value = 0;
|
||||
print("未连接 未连接 未连接 未连接 未连接");
|
||||
showToast("网络访问失败,请检查网络是否正常");
|
||||
Get.log("未连接 未连接 未连接 未连接 未连接");
|
||||
// showToast("网络访问失败,请检查网络是否正常");
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,9 +78,8 @@ class LockMainLogic extends BaseGetXController {
|
||||
/// 设置网络切换监听
|
||||
connectListener() async {
|
||||
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
|
||||
print("设置网络切换监听:$result");
|
||||
if (state.networkConnectionStatus.value == 0 &&
|
||||
result != ConnectivityResult.none) {
|
||||
Get.log("设置网络切换监听:$result");
|
||||
if (state.networkConnectionStatus.value == 0 && result != ConnectivityResult.none) {
|
||||
// 从无网络到有网络
|
||||
state.networkConnectionStatus.value = 1;
|
||||
getStarLockInfo();
|
||||
@ -81,7 +91,6 @@ class LockMainLogic extends BaseGetXController {
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
// 开启UDP
|
||||
UdpHelp().openUDP();
|
||||
@ -93,7 +102,6 @@ class LockMainLogic extends BaseGetXController {
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
// getLockInfo();
|
||||
// 设置网络变化监听
|
||||
|
||||
@ -140,17 +140,17 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
case 1:
|
||||
// 只有一条数据
|
||||
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(
|
||||
isOnlyOneData: true,
|
||||
lockListInfoItemEntity: state
|
||||
.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
|
||||
.lockListInfoGroupEntity.value.groupList![0].lockList![0]);
|
||||
break;
|
||||
case 2:
|
||||
// 有多条数据
|
||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||
returnWidget = LockListPage(
|
||||
lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
|
||||
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value);
|
||||
break;
|
||||
default:
|
||||
returnWidget = NoData();
|
||||
|
||||
@ -8,7 +8,7 @@ class LockMainState {
|
||||
|
||||
// 0是无数据 1是有一条数据 2是有很多条数据
|
||||
var dataLength = 100.obs;
|
||||
var lockListInfoEntity = LockListInfoEntity().obs;
|
||||
var lockListInfoGroupEntity = LockListInfoGroupEntity().obs;
|
||||
|
||||
// 网络连接状态 0没有网络 1有网络
|
||||
var networkConnectionStatus = 0.obs;
|
||||
|
||||
@ -127,31 +127,27 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 显示权限被永久拒绝的提示对话框
|
||||
void showPermissionDeniedDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('权限被拒绝'),
|
||||
content: const Text('请手动在系统设置中开启相册权限以继续使用应用。'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('去设置'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // 关闭对话框
|
||||
openAppSettings(); // 打开系统设置页面
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
// void showPermissionDeniedDialog() {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: const Text('权限被拒绝'),
|
||||
// content: const Text('请手动在系统设置中开启相册权限以继续使用应用。'),
|
||||
// actions: <Widget>[
|
||||
// TextButton(
|
||||
// child: const Text('去设置'),
|
||||
// onPressed: () {
|
||||
// Navigator.of(context).pop(); // 关闭对话框
|
||||
// openAppSettings(); // 打开系统设置页面
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
Future _openModalBottomSheet() async {
|
||||
showModalBottomSheet(
|
||||
|
||||
@ -42,7 +42,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
} else {
|
||||
httpClient.baseUrl = '${F.apiPrefix}/api';
|
||||
}
|
||||
print('请求body体======>$body');
|
||||
// print('请求body体======>$body');
|
||||
var res = await super.post(url, body,
|
||||
contentType: contentType,
|
||||
headers: headers,
|
||||
@ -51,7 +51,8 @@ class BaseProvider extends GetConnect with Api {
|
||||
uploadProgress: uploadProgress);
|
||||
// print('res.body======>${res.body}');
|
||||
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);
|
||||
if (res.statusCode == null) {
|
||||
EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||
@ -71,7 +72,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
statusText: res.statusText,
|
||||
);
|
||||
} else {}
|
||||
print('得到的数据======>${res.bodyString}');
|
||||
// print('得到的数据======>${res.bodyString}');
|
||||
getDataResult(res.body);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import 'package:get/get.dart';
|
||||
import 'package:get/get_connect/http/src/request/request.dart';
|
||||
|
||||
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);
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -170,20 +170,20 @@ class BaseGetXController extends GetxController {
|
||||
String useDateStr = '';
|
||||
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) {
|
||||
//永久
|
||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
|
||||
useDateStr = '永久';
|
||||
useDateStr = '永久'.tr;
|
||||
} else if (keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
|
||||
useDateStr = '单次';
|
||||
useDateStr = '单次'.tr;
|
||||
} 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;
|
||||
|
||||
@ -6,6 +6,7 @@ import 'dart:convert';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../login/login/entity/LoginData.dart';
|
||||
import '../main/lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
const saveBluePublicKey = "BluePublicKey";
|
||||
const saveBluePrivateKey = "BluePrivateKey";
|
||||
@ -23,6 +24,7 @@ const saveLockAlias = "saveLockAlias"; //锁别名
|
||||
const pushDeviceID = 'pushDeviceID'; //推送设备ID
|
||||
|
||||
const saveUserLoginData = "userLoginData";
|
||||
const saveLockMainListData = "lockMainListData";
|
||||
|
||||
class Storage {
|
||||
Storage._internal();
|
||||
@ -194,4 +196,18 @@ class Storage {
|
||||
static Future<void> saveLoginData(LoginData? data) async {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user