Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
# Conflicts: # star_lock/lib/blue/blue_manage.dart # star_lock/lib/blue/sender_beforeDataManage.dart
This commit is contained in:
commit
56efaa9947
@ -832,5 +832,6 @@
|
||||
"钥匙详情":"Key details",
|
||||
"姓名":"Name",
|
||||
"发送":"Send",
|
||||
"请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct"
|
||||
"请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct",
|
||||
"传输期间请勿离开当前页面":"Do not leave the current page during transfer"
|
||||
}
|
||||
|
||||
@ -860,5 +860,6 @@
|
||||
"钥匙详情":"钥匙详情",
|
||||
"姓名":"姓名",
|
||||
"发送":"发送",
|
||||
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确"
|
||||
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确",
|
||||
"传输期间请勿离开当前页面":"传输期间请勿离开当前页面"
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@
|
||||
"customMailTemplate":"自定义邮件模版",
|
||||
"record":"记录",
|
||||
|
||||
"buyRealNameTip":"给用户发送电子钥匙时,可以要求其开锁前先进行实名认证,以保证是他本人在操作。实名认证调用国家公安系统接口,为付费功能,请购买次数后再使用。",
|
||||
"buyRealNameTip":"给用户发送电子钥匙时,可以要求其开锁前先进行人脸识别,以保证是他本人在操作。人脸实名认证调用国家公安系统接口,为付费功能,请购买次数后再使用。",
|
||||
"buyRealNameSelectYouWantBuyTip":"请选择你希望的实名认证频数",
|
||||
"forTheFirstTime":"仅首次",
|
||||
"onceDay":"每日一次",
|
||||
@ -863,5 +863,7 @@
|
||||
"钥匙详情":"钥匙详情",
|
||||
"姓名":"姓名",
|
||||
"发送":"发送",
|
||||
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确"
|
||||
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确",
|
||||
"传输期间请勿离开当前页面":"传输期间请勿离开当前页面"
|
||||
|
||||
}
|
||||
|
||||
@ -183,7 +183,6 @@ class OTAUpgradeReply extends Reply {
|
||||
data = dataDetail;
|
||||
token = data.sublist(2, 6);
|
||||
status = data[6];
|
||||
// AppLog.log('--->2' + data.toString());
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,121 +12,124 @@ abstract class Reply{
|
||||
//command key flag
|
||||
int status = 0;
|
||||
List<int> data = [];
|
||||
static String logTag= '锁 -> App,指令订阅类型 :';
|
||||
Reply.parseData(this.commandType, List<int> dataDetail);
|
||||
|
||||
void errorWithStstus(int status){
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
// 成功
|
||||
AppLog.log("$logTag ${commandType?.typeName} 0x00 成功");
|
||||
break;
|
||||
case 0x01:
|
||||
// 包格式错误
|
||||
AppLog.log("${commandType!.typeName} 0x01 包格式错误");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x01 包格式错误");
|
||||
showErrorMessage("包格式错误");
|
||||
break;
|
||||
case 0x02:
|
||||
// 密码错误
|
||||
AppLog.log("${commandType!.typeName} 0x02 密码错误");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x02 密码错误");
|
||||
showErrorMessage("密码错误");
|
||||
break;
|
||||
case 0x03:
|
||||
// 网络中断
|
||||
AppLog.log("${commandType!.typeName} 0x03 网络中断");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x03 网络中断");
|
||||
showErrorMessage("网络中断");
|
||||
break;
|
||||
case 0x04:
|
||||
// 用户未登记
|
||||
AppLog.log("${commandType!.typeName} 0x04 用户未登记");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x04 用户未登记");
|
||||
showErrorMessage("用户未登记");
|
||||
break;
|
||||
case 0x05:
|
||||
// 参数错误
|
||||
AppLog.log("${commandType!.typeName} 0x05 参数错误");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x05 参数错误");
|
||||
showErrorMessage("参数错误");
|
||||
break;
|
||||
case 0x06:
|
||||
// 需要鉴权
|
||||
AppLog.log("${commandType!.typeName} 0x06 需要鉴权");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x06 需要鉴权");
|
||||
// showErrorMessage("需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
// 无权限
|
||||
AppLog.log("${commandType!.typeName} 0x07 无权限");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x07 无权限");
|
||||
// showErrorMessage("无权限");
|
||||
break;
|
||||
case 0x08:
|
||||
// 应答超时
|
||||
AppLog.log("${commandType!.typeName} 0x08 应答超时");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x08 应答超时");
|
||||
showErrorMessage("应答超时");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
AppLog.log("${commandType!.typeName} 0x09 权限校验错误");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x09 权限校验错误");
|
||||
showErrorMessage("权限校验错误");
|
||||
break;
|
||||
case 0x0a:
|
||||
// 钥匙不存在
|
||||
showErrorMessage("钥匙不存在");
|
||||
AppLog.log("${commandType!.typeName} 0x0a 钥匙不存在");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x0a 钥匙不存在");
|
||||
break;
|
||||
case 0x0b:
|
||||
// 钥匙过期
|
||||
showErrorMessage("钥匙过期");
|
||||
AppLog.log("${commandType!.typeName} 0x0b 钥匙过期");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x0b 钥匙过期");
|
||||
break;
|
||||
case 0x0c:
|
||||
// 钥匙数量已到上限
|
||||
showErrorMessage("钥匙数量已到上限");
|
||||
AppLog.log("${commandType!.typeName} 0x0c 钥匙数量已到上限");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限");
|
||||
break;
|
||||
case 0x0d:
|
||||
// 钥匙无效
|
||||
showErrorMessage("钥匙无效");
|
||||
AppLog.log("${commandType!.typeName} 0x0d 钥匙无效");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x0d 钥匙无效");
|
||||
break;
|
||||
case 0x0e:
|
||||
// 钥匙已存在
|
||||
showErrorMessage("钥匙已存在");
|
||||
AppLog.log("${commandType!.typeName} 0x0e 钥匙无效");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙无效");
|
||||
break;
|
||||
case 0x0f:
|
||||
// 用户已存在
|
||||
AppLog.log("${commandType!.typeName} 0x0f 用户已存在");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x0f 用户已存在");
|
||||
showErrorMessage("用户已存在");
|
||||
break;
|
||||
case 0x10:
|
||||
// 密码失效
|
||||
AppLog.log("${commandType!.typeName} 0x11 密码失效");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x11 密码失效");
|
||||
showErrorMessage("密码失效");
|
||||
break;
|
||||
case 0x11:
|
||||
// 无效指令
|
||||
AppLog.log("${commandType!.typeName} 0x11 无效指令");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x11 无效指令");
|
||||
showErrorMessage("无效指令");
|
||||
break;
|
||||
case 0x12:
|
||||
// 门锁时间异常
|
||||
AppLog.log("${commandType!.typeName} 0x12 门锁时间异常");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x12 门锁时间异常");
|
||||
showErrorMessage("门锁时间异常");
|
||||
break;
|
||||
case 0x15:
|
||||
// APP(手机)未联网
|
||||
AppLog.log("${commandType!.typeName} 0x15 APP(手机)未联网");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x15 APP(手机)未联网");
|
||||
showErrorMessage("APP(手机)未联网");
|
||||
break;
|
||||
case 0x16:
|
||||
// 正在开锁中...
|
||||
AppLog.log("${commandType!.typeName}正在开锁中...");
|
||||
AppLog.log("$logTag ${commandType!.typeName}正在开锁中...");
|
||||
// showErrorMessage("正在开锁中...");
|
||||
break;
|
||||
case 0xff:
|
||||
// 异常,未知错误
|
||||
AppLog.log("${commandType!.typeName} 0xff");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0xff");
|
||||
showErrorMessage("异常,未知错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
AppLog.log("蓝牙返回其他错误问题");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 蓝牙返回其他错误问题");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,9 +110,6 @@ class CommandReciverManager {
|
||||
}
|
||||
parseData(oriDataList).then((Reply? value) async {
|
||||
EasyLoading.dismiss();
|
||||
if (value != null) {
|
||||
AppLog.log("锁 -> App,指令订阅类型 :${value.commandType?.typeName} \n $value");
|
||||
}
|
||||
await EventBusManager().eventBusFir(value);
|
||||
}).catchError((error) {
|
||||
AppLog.log("APP解析数据时发生错误: $error");
|
||||
|
||||
@ -44,6 +44,7 @@ class SenderBeforeDataManage {
|
||||
// 监听设备返回的数据
|
||||
StreamSubscription<Reply>? _replySubscription;
|
||||
|
||||
// 启动订阅
|
||||
void _initReplySubscription() {
|
||||
_replySubscription ??=
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
@ -52,128 +53,36 @@ class SenderBeforeDataManage {
|
||||
_replyAddUserKey(reply);
|
||||
}
|
||||
|
||||
if(reply is CleanUpUsersReply){
|
||||
if (reply is CleanUpUsersReply) {
|
||||
_cleanUpUsersReply(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 添加用户
|
||||
// 解析添加用户订阅
|
||||
Future<void> _replyAddUserKey(Reply reply) async {
|
||||
int status = reply.data[46];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
CommonDataManage().currentLockUserNo = listChangInt(reply.data.sublist(47, 49));
|
||||
CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo;
|
||||
CommonDataManage().currentLockUserNo =
|
||||
listChangInt(reply.data.sublist(47, 49));
|
||||
CommonDataManage().currentKeyInfo.lockUserNo =
|
||||
CommonDataManage().currentLockUserNo;
|
||||
_updateLockUserNo();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var token = reply.data.sublist(42, 46);
|
||||
List<String> strTokenList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, strTokenList);
|
||||
|
||||
// IoSenderManage.senderAddUser(
|
||||
// lockID: BlueManage().connectDeviceName,
|
||||
// authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
||||
// keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
// userID: await Storage.getUid(),
|
||||
// openMode: 1,
|
||||
// keyType: 0,
|
||||
// startDate: CommonDataManage().currentKeyInfo.startDate!~/10000,
|
||||
// expireDate: CommonDataManage().currentKeyInfo.endDate!~/10000,
|
||||
// role: CommonDataManage().currentKeyInfo.keyRight == 1 ? 1 : 0,
|
||||
// password: "123456",
|
||||
// needAuthor: 1,
|
||||
// publicKey: publicKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: token);
|
||||
LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo;
|
||||
AppLog.log(
|
||||
"startDate111:${currentKeyInfo.startDate} endDate:${currentKeyInfo.endDate}");
|
||||
DateTime startTime = DateTime.fromMillisecondsSinceEpoch(
|
||||
currentKeyInfo.startDate! ~/ 1000);
|
||||
DateTime endTime = DateTime.fromMillisecondsSinceEpoch(
|
||||
currentKeyInfo.endDate! ~/ 1000);
|
||||
bool isRound = currentKeyInfo.keyType == 2;
|
||||
var addUserData = AddUserCommand(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID: currentKeyInfo.senderUserId!.toString(),
|
||||
keyID: currentKeyInfo.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
keyType: currentKeyInfo.keyType,
|
||||
startDate: currentKeyInfo.startDate! ~/ 1000,
|
||||
expireDate: currentKeyInfo.endDate! ~/ 1000,
|
||||
useCountLimit: 0xFFFF,
|
||||
// useCountLimit: 1,
|
||||
isRound: isRound ? 1 : 0,
|
||||
weekRound: isRound
|
||||
? DateTool().accordingTheCycleIntoTheCorrespondingNumber(
|
||||
currentKeyInfo.weekDays!)
|
||||
: 0,
|
||||
startHour: isRound ? startTime.hour : 0,
|
||||
startMin: isRound ? startTime.minute : 0,
|
||||
endHour: isRound ? endTime.hour : 0,
|
||||
endMin: isRound ? endTime.minute : 0,
|
||||
role: currentKeyInfo.keyRight == 1 ? 1 : 0,
|
||||
password: "123456",
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token);
|
||||
eventBus.fire(LockAddUserSucceedEvent(addUserData.packageData(), 1));
|
||||
var addUserData = await getAddUserKeyData(tokenList: token);
|
||||
eventBus.fire(LockAddUserSucceedEvent(addUserData, 1));
|
||||
break;
|
||||
case 0x0c:
|
||||
//锁设备用户超过 32个,需要同步锁用户列表刷新
|
||||
var entity = await ApiRepository.to.getLockUserNoList(
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!);
|
||||
if (!entity.errorCode!.codeIsSuccessful &&
|
||||
(entity.data?.userNos ?? []).isNotEmpty) {
|
||||
return;
|
||||
}
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var tokenKey = await Storage.getStringList(saveBlueToken);
|
||||
List<int> tokenList = changeStringListToIntList(tokenKey!);
|
||||
AppLog.log('---> ${entity.data?.userNos}');
|
||||
|
||||
var cleanUpUsersData = CleanUpUsersCommand(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
||||
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
userNoList: entity.data!.userNos!,
|
||||
token: tokenList,
|
||||
).packageData();
|
||||
CommandSenderManager().sendNormalData(cleanUpUsersData);
|
||||
|
||||
// IoSenderManage.senderCleanUpUsersCommand(
|
||||
// lockID: BlueManage().connectDeviceName,
|
||||
// authUserID:
|
||||
// CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
||||
// keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
// userID: await Storage.getUid(),
|
||||
// userNoList: entity.data!.userNos!,
|
||||
// needAuthor: 1,
|
||||
// publicKey: publicKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: tokenList);
|
||||
|
||||
var addUserData = await getCleanUpUsers();
|
||||
CommandSenderManager().sendNormalData(addUserData);
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
@ -181,47 +90,81 @@ class SenderBeforeDataManage {
|
||||
}
|
||||
}
|
||||
|
||||
// 清理用户
|
||||
// 解析清理用户订阅
|
||||
Future<void> _cleanUpUsersReply(Reply reply) async {
|
||||
int status = reply.data[6];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
|
||||
//添加用户
|
||||
var addUserData = await getAddUserKeyData();
|
||||
CommandSenderManager().sendNormalData(addUserData);
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var token = reply.data.sublist(42, 46);
|
||||
//无权限
|
||||
var token = reply.data.sublist(2, 6);
|
||||
List<String> strTokenList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, strTokenList);
|
||||
|
||||
|
||||
var addUserData = await getCleanUpUsers(tokenList: token);
|
||||
CommandSenderManager().sendNormalData(addUserData);
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
//失败
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<int>> getAddUserKeyData() async {
|
||||
//获取清除用户列表指令
|
||||
Future<List<int>> getCleanUpUsers({List<int>? tokenList}) async {
|
||||
var entity = await ApiRepository.to
|
||||
.getLockUserNoList(lockId: CommonDataManage().currentKeyInfo.lockId!);
|
||||
if (!entity.errorCode!.codeIsSuccessful ||
|
||||
(entity.data?.userNos ?? []).isEmpty) {
|
||||
throw Exception('ApiRepository.to.getLockUserNoList 访问失败');
|
||||
}
|
||||
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!);
|
||||
if (tokenList == null) {
|
||||
var tokenKey = await Storage.getStringList(saveBlueToken);
|
||||
tokenList = changeStringListToIntList(tokenKey!);
|
||||
}
|
||||
|
||||
var cleanUpUsersData = CleanUpUsersCommand(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
||||
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
userNoList: entity.data!.userNos!,
|
||||
token: tokenList,
|
||||
);
|
||||
return cleanUpUsersData.packageData();
|
||||
}
|
||||
|
||||
//获取添加用户指令
|
||||
Future<List<int>> getAddUserKeyData({List<int>? tokenList}) async {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
if (tokenList == null) {
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
tokenList = changeStringListToIntList(token!);
|
||||
}
|
||||
|
||||
LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo;
|
||||
DateTime startTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000);
|
||||
DateTime endTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000);
|
||||
DateTime startTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000);
|
||||
DateTime endTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000);
|
||||
bool isRound = currentKeyInfo.keyType == 2;
|
||||
|
||||
var addUserData = AddUserCommand(
|
||||
@ -234,7 +177,6 @@ class SenderBeforeDataManage {
|
||||
startDate: currentKeyInfo.startDate! ~/ 1000,
|
||||
expireDate: currentKeyInfo.endDate! ~/ 1000,
|
||||
useCountLimit: 0xFFFF,
|
||||
// useCountLimit: 1,
|
||||
isRound: isRound ? 1 : 0,
|
||||
weekRound: isRound
|
||||
? DateTool().accordingTheCycleIntoTheCorrespondingNumber(
|
||||
@ -249,7 +191,7 @@ class SenderBeforeDataManage {
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList);
|
||||
token: tokenList);
|
||||
return addUserData.packageData();
|
||||
}
|
||||
|
||||
|
||||
@ -9,11 +9,16 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
||||
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||
import 'package:star_lock/blue/sender_data.dart';
|
||||
import 'package:star_lock/blue/sender_manage.dart';
|
||||
import 'package:star_lock/debug/log.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
@ -85,6 +90,14 @@ class DebugConsoleController {
|
||||
.catchError(EasyLoading.dismiss);
|
||||
},
|
||||
child: const Text('给锁设备创建 32个用户')),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
EasyLoading.show();
|
||||
sendCleanUpUsers()
|
||||
.then((value) => EasyLoading.dismiss())
|
||||
.catchError(EasyLoading.dismiss);
|
||||
},
|
||||
child: const Text('清除用户,只保留超级管理员')),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -141,9 +154,11 @@ class DebugConsoleController {
|
||||
privateKey: getPrivateKeyList,
|
||||
token: tokenList);
|
||||
}
|
||||
|
||||
AppLog.log('--> 添加第$count 用户');
|
||||
});
|
||||
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
count++;
|
||||
await randomlyCreate32Users(count, max);
|
||||
}
|
||||
@ -155,4 +170,36 @@ class DebugConsoleController {
|
||||
return List.generate(length, (index) => chars[random.nextInt(chars.length)])
|
||||
.join();
|
||||
}
|
||||
|
||||
//获取清除用户列表指令
|
||||
Future<void> sendCleanUpUsers({List<int>? tokenList}) async {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
if (tokenList == null) {
|
||||
var tokenKey = await Storage.getStringList(saveBlueToken);
|
||||
tokenList = changeStringListToIntList(tokenKey!);
|
||||
}
|
||||
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
IoSenderManage.senderCleanUpUsersCommand(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID:
|
||||
CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
||||
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
userNoList: [1],
|
||||
token: tokenList,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_reply.dart';
|
||||
@ -136,6 +140,45 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//如果打开了实名认证,需要弹出输入身份证信息框
|
||||
if (state.isAuthentication.value == true) {
|
||||
if (state.realNameController.text.isEmpty) {
|
||||
showToast("请输入真实姓名".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.idCardController.text.isEmpty) {
|
||||
showToast("请输入身份证号".tr);
|
||||
return;
|
||||
}
|
||||
//弹出身份证信息确认框
|
||||
ShowCupertinoAlertView().realNameIDCardInfoComfirmAlert(
|
||||
getNameStr: state.realNameController.text,
|
||||
getIDCardStr: state.idCardController.text,
|
||||
onConfirm: () {
|
||||
goSendElectronicKey(
|
||||
endDate: endDate,
|
||||
getKeyType: getKeyType,
|
||||
startDate: startDate,
|
||||
startTime: startTime,
|
||||
endTime: endTime);
|
||||
});
|
||||
} else {
|
||||
goSendElectronicKey(
|
||||
endDate: endDate,
|
||||
getKeyType: getKeyType,
|
||||
startDate: startDate,
|
||||
startTime: startTime,
|
||||
endTime: endTime);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> goSendElectronicKey(
|
||||
{required String endDate,
|
||||
required String getKeyType,
|
||||
required String startDate,
|
||||
required String startTime,
|
||||
required String endTime}) async {
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
createUser: state.isCreateUser.value ? "1" : "0",
|
||||
countryCode: state.countryCode.value,
|
||||
@ -156,8 +199,12 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
startTime: int.parse(startTime),
|
||||
endTime: int.parse(endTime),
|
||||
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0,
|
||||
realName: '',
|
||||
idCardNumber: '');
|
||||
realName: state.isRequireAuth.value == true
|
||||
? state.realNameController.text
|
||||
: "",
|
||||
idCardNumber: state.isRequireAuth.value == true
|
||||
? state.idCardController.text
|
||||
: "");
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isCreateUser.value = false;
|
||||
state.isSendSuccess.value = true;
|
||||
@ -169,7 +216,6 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
state.isCreateUser.value = true;
|
||||
// _showDialog('${entity.errorMsg}');
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'${"是否发送授权管理员给未注册账号".tr}\n${state.emailOrPhoneController.text}',
|
||||
() {
|
||||
@ -179,6 +225,24 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//检测实名认证是否支持开启
|
||||
Future<void> keyCheckFace() async {
|
||||
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
|
||||
countryCode: int.parse(state.countryCode.value),
|
||||
account: state.emailOrPhoneController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
//打开实名认证,需要弹出输入身份证信息框
|
||||
state.isRequireAuth.value = true;
|
||||
} else {
|
||||
ShowTipView().showBuyTipWithContentAlert(
|
||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||
sureClick: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: {'isShop': false});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
||||
Future<void> updateRoomCheckIn() async {
|
||||
var entity = await ApiRepository.to.setRoomStatusData(
|
||||
@ -190,40 +254,25 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//用户未注册确认弹窗
|
||||
// void _showDialog(String errMsg) {
|
||||
// showCupertinoDialog(
|
||||
// context: Get.context!,
|
||||
// builder: (context) {
|
||||
// return CupertinoAlertDialog(
|
||||
// title: const Text('接收者号码未注册,请重新发送'),
|
||||
// actions: [
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
// onPressed: () async {
|
||||
// //选择国家代码
|
||||
// Get.back();
|
||||
//
|
||||
// // var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||
// // if (result != null) {
|
||||
// // result as Map<String, dynamic>;
|
||||
// // state.countryCode.value = result['code'];
|
||||
// // state.countryName.value = result['countryName'];
|
||||
// // }
|
||||
// sendElectronicKeyRequest();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
TextEditingController getCurrentController(int lineIndex) {
|
||||
TextEditingController currentController = TextEditingController();
|
||||
switch (lineIndex) {
|
||||
case 1:
|
||||
currentController = state.emailOrPhoneController;
|
||||
break;
|
||||
case 2:
|
||||
currentController = state.keyNameController;
|
||||
break;
|
||||
case 3:
|
||||
currentController = state.realNameController;
|
||||
break;
|
||||
case 4:
|
||||
currentController = state.idCardController;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return currentController;
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
|
||||
@ -36,7 +36,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
state.tabController =
|
||||
@ -82,7 +81,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyTimeWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyOnlyManageWidget(),
|
||||
keyBottomWidget(
|
||||
TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
@ -95,7 +94,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyOnlyManageWidget(),
|
||||
keyBottomWidget(
|
||||
TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
@ -189,7 +188,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
}
|
||||
|
||||
// 实名认证
|
||||
Widget keyRealNameWidget() {
|
||||
Widget keyOnlyManageWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
@ -205,17 +204,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
height: 50.h,
|
||||
child: _onlyManageYouCreatesUserSwitch())),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: true,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch()),
|
||||
action: () {}),
|
||||
keyRealNameWidget(),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
);
|
||||
@ -227,7 +216,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.w),
|
||||
child: Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
@ -255,7 +243,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 30.w),
|
||||
// color: Colors.red,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
@ -264,7 +251,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
Get.toNamed(Routers.volumeAuthorizationLockManagePage);
|
||||
// Navigator.pushNamed(context, Routers.volumeAuthorizationLockManagePage);
|
||||
} else {
|
||||
logic.showToast("演示模式");
|
||||
}
|
||||
@ -281,6 +267,43 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
);
|
||||
}
|
||||
|
||||
// 实名认证
|
||||
Widget keyRealNameWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: true,
|
||||
isHaveLine:
|
||||
logic.state.isRequireAuth.value == true ? true : false,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。".tr);
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _realNameAuthSwitch()),
|
||||
)),
|
||||
Obx(() => Visibility(
|
||||
visible: logic.state.isRequireAuth.value,
|
||||
child: CommonItem(
|
||||
leftTitel: '真实姓名'.tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
isHaveLine: true,
|
||||
rightWidget: getTFWidget(false, '请输入真实姓名'.tr, 3)))),
|
||||
Obx(() => Visibility(
|
||||
visible: logic.state.isRequireAuth.value,
|
||||
child: CommonItem(
|
||||
leftTitel: '身份证号'.tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: getTFWidget(false, '请输入身份证号'.tr, 4)))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 发送电子钥匙成功
|
||||
Widget sendElectronicKeySucceed() {
|
||||
return Column(
|
||||
@ -336,11 +359,9 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
if (state.emailOrPhoneController.text.contains("@")) {
|
||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||
} else {
|
||||
// _openModalBottomSheet();
|
||||
NativeInteractionTool()
|
||||
.loadNativeShare(shareText: state.pwdShareStr);
|
||||
}
|
||||
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@ -349,7 +370,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
OutLineBtn(
|
||||
btnName: '微信通知',
|
||||
onClick: () {
|
||||
// _openModalBottomSheet();
|
||||
NativeInteractionTool()
|
||||
.loadNativeShare(shareText: state.pwdShareStr);
|
||||
},
|
||||
@ -357,12 +377,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
// OutLineBtn(
|
||||
// btnName: '标记为:已入住',
|
||||
// onClick: () {
|
||||
// logic.updateRoomCheckIn();
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -384,9 +398,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
],
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
controller: lineIndex == 1
|
||||
? state.emailOrPhoneController
|
||||
: state.keyNameController,
|
||||
controller: logic.getCurrentController(lineIndex),
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
@ -408,15 +420,6 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||
),
|
||||
// decoration: InputDecoration(
|
||||
// //输入里面输入文字内边距设置
|
||||
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
// hintText: tfStr,
|
||||
// hintStyle: TextStyle(
|
||||
// color: AppColors.placeholderTextColor, fontSize: 22.sp),
|
||||
// //不需要输入框下划线
|
||||
// border: InputBorder.none,
|
||||
// ),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
@ -460,7 +463,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
}
|
||||
|
||||
//实名认证
|
||||
CupertinoSwitch _switch() {
|
||||
CupertinoSwitch _realNameAuthSwitch() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
@ -469,6 +472,11 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
state.isAuthentication.value = !state.isAuthentication.value;
|
||||
if (state.isAuthentication.value == true) {
|
||||
logic.keyCheckFace();
|
||||
} else {
|
||||
state.isRequireAuth.value = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
@ -631,11 +639,9 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(
|
||||
// text: item.title,
|
||||
child: Container(
|
||||
width: 1.sw / 4,
|
||||
margin: EdgeInsets.all(10.w),
|
||||
// color: Colors.red,
|
||||
child: Text(
|
||||
item.title,
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
@ -3,23 +3,27 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class AuthorizedAdminState {
|
||||
final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框
|
||||
final TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||
final TextEditingController emailOrPhoneController =
|
||||
TextEditingController(); //邮箱/手机号输入框
|
||||
final TextEditingController keyNameController =
|
||||
TextEditingController(); //钥匙名输入框
|
||||
late TabController tabController;
|
||||
TextEditingController realNameController = TextEditingController(); //真实姓名输入框
|
||||
TextEditingController idCardController = TextEditingController(); //身份证号输入框
|
||||
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
|
||||
// final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final lockMainEntity = LockMainEntity().obs;
|
||||
final isAuthentication = false.obs; //是否可以实名认证
|
||||
var isAuthentication = false.obs; //是否可以实名认证
|
||||
final onlyManageYouCreatesUser = false.obs; // 只能管理自己创建的用户
|
||||
|
||||
var beginDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs; //默认为当前时间 开始时间
|
||||
var endDate = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//默认为当前时间 结束时间
|
||||
var beginDate = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; //默认为当前时间 开始时间
|
||||
var endDate = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; //默认为当前时间 结束时间
|
||||
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.obs;
|
||||
@ -31,9 +35,5 @@ class AuthorizedAdminState {
|
||||
String pwdShareStr = '您好,您的授权管理员生成成功';
|
||||
|
||||
var addUserId = ''.obs;
|
||||
// AuthorizedAdminState() {
|
||||
// Map map = Get.arguments;
|
||||
// // lockMainEntity.value = map["lockMainEntity"];
|
||||
// keyInfo.value = map["keyInfo"];
|
||||
// }
|
||||
var isRequireAuth = false.obs; //是否需要实名认证的必填项
|
||||
}
|
||||
|
||||
@ -22,14 +22,14 @@ class AuthorizedAdminListLogic extends BaseGetXController {
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize.toString(),
|
||||
startDate: '0',
|
||||
searchStr:state.searchStr.value);
|
||||
searchStr: state.searchStr.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (pageNo == 1) {
|
||||
state.itemDataList.value = entity.data!.itemList!;
|
||||
state.itemDataList.value = entity.data!.itemList;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.itemList!.isNotEmpty) {
|
||||
state.itemDataList.value.addAll(entity.data!.itemList!);
|
||||
if (entity.data!.itemList.isNotEmpty) {
|
||||
state.itemDataList.addAll(entity.data!.itemList);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
@ -39,11 +39,8 @@ class AuthorizedAdminListLogic extends BaseGetXController {
|
||||
|
||||
//删除电子钥匙名称请求
|
||||
Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async {
|
||||
ElectronicKeyListEntity entity =
|
||||
await ApiRepository.to.deleteElectronicKey(
|
||||
keyId:keyId,
|
||||
includeUnderlings: includeUnderlings
|
||||
);
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
|
||||
keyId: keyId, includeUnderlings: includeUnderlings);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功");
|
||||
pageNo = 1;
|
||||
@ -55,7 +52,8 @@ class AuthorizedAdminListLogic extends BaseGetXController {
|
||||
StreamSubscription? _getAuthorizedAdminPageRefreshUIEvent;
|
||||
void _getAuthorizedAdminPageRefreshUIAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getAuthorizedAdminPageRefreshUIEvent = eventBus.on<AuthorizedAdminPageRefreshUI>().listen((event) {
|
||||
_getAuthorizedAdminPageRefreshUIEvent =
|
||||
eventBus.on<AuthorizedAdminPageRefreshUI>().listen((event) {
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
|
||||
@ -11,7 +11,6 @@ import 'package:star_lock/tools/storage.dart';
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
@ -40,7 +39,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value){
|
||||
logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
@ -56,24 +55,24 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
onRefresh: () {
|
||||
logic.pageNo = 1;
|
||||
mockRequest();
|
||||
},
|
||||
onLoad: (){
|
||||
onLoad: () {
|
||||
mockRequest();
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child:_buildMainUI()),
|
||||
Expanded(child: _buildMainUI()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminPage).then((val) {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminPage)
|
||||
.then((val) {
|
||||
if (val != null) {
|
||||
logic.pageNo = 1;
|
||||
mockRequest();
|
||||
@ -93,116 +92,80 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
return Obx(() => state.itemDataList.value.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - 90)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
|
||||
String useDateStr = ''; //使用期限
|
||||
String keyStatus = ''; //钥匙状态
|
||||
child: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
ElectronicKeyListItem indexEntity =
|
||||
state.itemDataList.value[index];
|
||||
String useDateStr = ''; //使用期限
|
||||
String keyStatus = ''; //钥匙状态
|
||||
|
||||
//使用期限
|
||||
useDateStr = getUseDateStr(indexEntity);
|
||||
//使用期限
|
||||
useDateStr = getUseDateStr(indexEntity);
|
||||
|
||||
//钥匙状态
|
||||
keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
|
||||
//钥匙状态
|
||||
keyStatus =
|
||||
XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
|
||||
|
||||
//是否为管理钥匙
|
||||
bool isAdminKey = false;
|
||||
if (indexEntity.keyRight == 1) {
|
||||
isAdminKey = true;
|
||||
} else {
|
||||
isAdminKey = false;
|
||||
}
|
||||
|
||||
return Slidable(
|
||||
key:ValueKey(indexEntity.keyId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||
logic.deleteKeyRequest(indexEntity.keyId.toString(), isAllData ? 1 : 0);
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage, arguments: {
|
||||
"itemData": indexEntity,
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
//是否为管理钥匙
|
||||
bool isAdminKey = false;
|
||||
if (indexEntity.keyRight == 1) {
|
||||
isAdminKey = true;
|
||||
} else {
|
||||
isAdminKey = false;
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
// if (index < state.itemDataList.value.length) {
|
||||
// return LeftSlideActions(
|
||||
// // key: Key(indexEntity.lockId!.toString()),
|
||||
// actionsWidth: 60,
|
||||
// actions: [
|
||||
// _buildDeleteBtn(indexEntity),
|
||||
// ],
|
||||
// decoration: const BoxDecoration(
|
||||
// borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
// ),
|
||||
// child: _electronicKeyItem(
|
||||
// 'images/controls_user.png',
|
||||
// indexEntity.keyName!,
|
||||
// useDateStr,
|
||||
// keyStatus,
|
||||
// isAdminKey, () {
|
||||
// Navigator.pushNamed(
|
||||
// context, Routers.electronicKeyDetailPage,
|
||||
// arguments: {'itemData': indexEntity}).then((val) {
|
||||
// if (val != null) {
|
||||
// logic.mockNetworkDataRequest();
|
||||
// setState(() {});
|
||||
// }
|
||||
// });
|
||||
// }),
|
||||
// );
|
||||
// }
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
height: 1.h,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
return Slidable(
|
||||
key: ValueKey(indexEntity.keyId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context) {
|
||||
ShowTipView()
|
||||
.showDeleteAdministratorIsHaveAllDataDialog(
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||
logic.deleteKeyRequest(indexEntity.keyId.toString(),
|
||||
isAllData ? 1 : 0);
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(
|
||||
'images/controls_user.png',
|
||||
indexEntity.keyName!,
|
||||
useDateStr,
|
||||
keyStatus,
|
||||
isAdminKey, () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyDetailPage,
|
||||
arguments: {
|
||||
"itemData": indexEntity,
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
height: 1.h,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
// void showIosTipViewDialog(
|
||||
// BuildContext context, String keyId) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return ShowIosTipView(
|
||||
// title: "提示",
|
||||
// tipTitle: "确定要删除吗?",
|
||||
// sureClick: () {
|
||||
// Get.back();
|
||||
// logic.deleteKeyRequest(keyId);
|
||||
// },
|
||||
// cancelClick: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
|
||||
//使用期限
|
||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
@ -216,48 +179,11 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||
useDateStr = "永久";
|
||||
}
|
||||
// else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
// //单次
|
||||
// // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
// // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
// useDateStr = "单次";
|
||||
// } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
// //循环
|
||||
// useDateStr = '循环';
|
||||
// }
|
||||
|
||||
return useDateStr;
|
||||
}
|
||||
|
||||
//钥匙状态
|
||||
// String getKeyStatus(int? keyStatusFlag) {
|
||||
// String keyStatus = '';
|
||||
//
|
||||
// if (keyStatusFlag == 110401) {
|
||||
// //正常使用
|
||||
// keyStatus = '';
|
||||
// } else if (keyStatusFlag == 110402) {
|
||||
// //待接收
|
||||
// keyStatus = '待接收';
|
||||
// } else if (keyStatusFlag == 110405) {
|
||||
// //已冻结
|
||||
// keyStatus = '已冻结';
|
||||
// } else if (keyStatusFlag == 110408) {
|
||||
// //已删除
|
||||
// keyStatus = '已删除';
|
||||
// } else if (keyStatusFlag == 110410) {
|
||||
// //已重置
|
||||
// keyStatus = '已重置';
|
||||
// }
|
||||
//
|
||||
// return keyStatus;
|
||||
// }
|
||||
|
||||
Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
||||
String useDate, String keyStatus, bool isAdminKey, Function() action) {
|
||||
return GestureDetector(
|
||||
@ -268,7 +194,11 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 30.w),
|
||||
Image.asset(avatarURL, width: 60.w, height: 60.w,),
|
||||
Image.asset(
|
||||
avatarURL,
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@ -281,14 +211,13 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
receiveUser,
|
||||
child: Text(receiveUser,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: AppColors.blackColor)),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -321,80 +250,4 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
||||
// String useDate, String keyStatus, bool isAdminKey, Function() action) {
|
||||
// return GestureDetector(
|
||||
// onTap: action,
|
||||
// child: Container(
|
||||
// height: 100.h,
|
||||
// // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
// // decoration: BoxDecoration(
|
||||
// // color: Colors.white,
|
||||
// // borderRadius: BorderRadius.circular(10.w),
|
||||
// // ),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// width: 30.w,
|
||||
// ),
|
||||
// Image.asset(
|
||||
// avatarURL,
|
||||
// width: 60.w,
|
||||
// height: 60.w,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 20.w,
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// receiveUser,
|
||||
// style: TextStyle(
|
||||
// fontSize: 24.sp, color: AppColors.blackColor),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 8.w,
|
||||
// ),
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(
|
||||
// left: 4.w, right: 4.w, top: 1.w, bottom: 1.w),
|
||||
// decoration: BoxDecoration(
|
||||
// color: AppColors.toBeReceiveBgColor,
|
||||
// borderRadius: BorderRadius.circular(5.0),
|
||||
// ),
|
||||
// child: Text(
|
||||
// keyStatus,
|
||||
// style: TextStyle(color: Colors.red, fontSize: 16.sp),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(height: 5.h),
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// useDate,
|
||||
// style: TextStyle(
|
||||
// fontSize: 18.sp,
|
||||
// color: AppColors.placeholderTextColor),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(width: 20.h),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(width: 20.h),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@ -270,8 +270,6 @@ class _VolumeAuthorizationLockPageState
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
hintText: tfStr,
|
||||
hintStyle: TextStyle(fontSize: 22.sp),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
@ -288,14 +286,6 @@ class _VolumeAuthorizationLockPageState
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||
),
|
||||
// decoration: InputDecoration(
|
||||
// //输入里面输入文字内边距设置
|
||||
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
// hintText: tfStr,
|
||||
// hintStyle: TextStyle(fontSize: 22.sp),
|
||||
// //不需要输入框下划线
|
||||
// border: InputBorder.none,
|
||||
// ),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
|
||||
@ -169,7 +169,6 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
showToast("修改成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,9 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
@ -326,6 +324,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
if (alertEnum == ShowAlertEnum.name) {
|
||||
logic.modifyKeyNameRequest();
|
||||
} else {
|
||||
Get.back();
|
||||
logic.updateRealNameInfoRequest(alertEnum);
|
||||
}
|
||||
},
|
||||
|
||||
@ -35,7 +35,9 @@ class ElectronicKeyDetailState {
|
||||
keyName.value = itemData.value.keyName!;
|
||||
if (itemData.value.userIdCard != null) {
|
||||
getRealName.value = itemData.value.userIdCard!.realName ?? "";
|
||||
changeRealNameController.text = getRealName.value;
|
||||
getIDCardNumber.value = itemData.value.userIdCard!.idCardNumber ?? "";
|
||||
changeIDCardController.text = getIDCardNumber.value;
|
||||
}
|
||||
|
||||
isRemoteUnlock.value = itemData.value.remoteEnable! == 1 ? true : false;
|
||||
|
||||
@ -142,7 +142,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
? '1'
|
||||
: '2',
|
||||
endDate: int.parse(endDate),
|
||||
faceAuthentication: state.isAuthentication == true ? '1' : '2',
|
||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||
isCameraEnable: '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock == true ? '1' : '2',
|
||||
keyNameForAdmin: state.keyNameController.text,
|
||||
|
||||
@ -43,18 +43,6 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
// JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||
// if (index == 0) {
|
||||
// logic.mockNetworkDataRequest();
|
||||
// } else if (index == 1) {
|
||||
// logic.clearOperationRecordRequest();
|
||||
// }
|
||||
// }, listData: [
|
||||
// {'text': '读取记录'},
|
||||
// {'text': '清空记录'},
|
||||
// {'text': '导出记录'},
|
||||
// ]);
|
||||
|
||||
_openModalBottomSheet();
|
||||
} else {
|
||||
// Get.toNamed(Routers.selectLockTypePage);
|
||||
@ -67,20 +55,22 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
(state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1) ?
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.h),
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
),
|
||||
_searchWidget(),
|
||||
],
|
||||
) : Container(),
|
||||
(state.keyInfos.value.isLockOwner == 1 ||
|
||||
state.keyInfos.value.keyRight == 1)
|
||||
? Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.h),
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
),
|
||||
_searchWidget(),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(height: 10.h),
|
||||
Expanded(child: _buildMainUI()),
|
||||
],
|
||||
@ -148,22 +138,6 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
: NoData());
|
||||
}
|
||||
|
||||
Widget _dateItem(String lockDate) {
|
||||
return Container(
|
||||
height: 60.h,
|
||||
// color: Colors.red,
|
||||
padding: EdgeInsets.only(left: 20.h, right: 20.h),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
lockDate,
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getTypeIcon(int type) {
|
||||
String title = 'images/controls_user.png';
|
||||
switch (type) {
|
||||
|
||||
@ -14,7 +14,7 @@ class CatEyeWorkModeLogic extends BaseGetXController {
|
||||
catEyeConfig: [
|
||||
{
|
||||
'catEyeMode':
|
||||
state.boolList.value.indexWhere((element) => element == true) + 1,
|
||||
state.boolList.indexWhere((element) => element == true) + 1,
|
||||
'catEyeModeConfig': {
|
||||
'recordMode': state.lockSetInfoData.value.lockSettingInfo!
|
||||
.catEyeConfig!.isNotEmpty
|
||||
@ -63,24 +63,17 @@ class CatEyeWorkModeLogic extends BaseGetXController {
|
||||
state.catEyeConfigData.value =
|
||||
entity.data!.lockSettingInfo!.catEyeConfig![0];
|
||||
|
||||
// state.selectCatEyeWorkMode.value =
|
||||
// state.catEyeConfigData.value.catEyeMode!;
|
||||
|
||||
if (state.catEyeConfigData.value.catEyeMode ==
|
||||
XSConstantMacro.catEyeWorkModePowerSaving) {
|
||||
// state.boolList.value[0] = true;
|
||||
state.boolList.value = [true, false, false, false];
|
||||
} else if (state.catEyeConfigData.value.catEyeMode ==
|
||||
XSConstantMacro.catEyeWorkModeStayCapture) {
|
||||
// state.boolList.value[1] = true;
|
||||
state.boolList.value = [false, true, false, false];
|
||||
} else if (state.catEyeConfigData.value.catEyeMode ==
|
||||
XSConstantMacro.catEyeWorkModeRealTimeMonitoring) {
|
||||
// state.boolList.value[2] = true;
|
||||
state.boolList.value = [false, false, true, false];
|
||||
} else if (state.catEyeConfigData.value.catEyeMode ==
|
||||
XSConstantMacro.catEyeWorkModeCustom) {
|
||||
// state.boolList.value[3] = true;
|
||||
state.boolList.value = [false, false, false, true];
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,24 +137,6 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
||||
for (int i = 0; i < state.boolList.value.length; i++) {
|
||||
if (clickIndex == i) {
|
||||
state.boolList.value[clickIndex] = true;
|
||||
// switch (clickIndex) {
|
||||
// case 0:
|
||||
// state.selectCatEyeWorkMode.value =
|
||||
// XSConstantMacro.catEyeWorkModePowerSaving;
|
||||
// break;
|
||||
// case 1:
|
||||
// state.selectCatEyeWorkMode.value =
|
||||
// XSConstantMacro.catEyeWorkModeStayCapture;
|
||||
// break;
|
||||
// case 2:
|
||||
// state.selectCatEyeWorkMode.value =
|
||||
// XSConstantMacro.catEyeWorkModeRealTimeMonitoring;
|
||||
// break;
|
||||
// case 3:
|
||||
// state.selectCatEyeWorkMode.value =
|
||||
// XSConstantMacro.catEyeWorkModeCustom;
|
||||
// break;
|
||||
// }
|
||||
logic.updateCatEyeModeConfig();
|
||||
} else {
|
||||
state.boolList.value[i] = false;
|
||||
|
||||
@ -479,7 +479,6 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
token: token,
|
||||
encrypt: false,
|
||||
).packageData());
|
||||
showTitleEasyLoading("连接设备中...");
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {}
|
||||
},isAddEquipment: true);
|
||||
|
||||
@ -279,20 +279,31 @@ class OTAProgressDialog extends StatelessWidget {
|
||||
title: Text(
|
||||
'固件升级中'.tr,
|
||||
),
|
||||
content: Row(
|
||||
content: Column(
|
||||
children: [
|
||||
Text(
|
||||
'传输中'.tr,
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.mainColor),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20.h, bottom: 10.h),
|
||||
child: Text(
|
||||
'传输期间请勿离开当前页面'.tr,
|
||||
style: TextStyle(fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 15.w,
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'传输中'.tr,
|
||||
style: TextStyle(fontSize: 18.sp, color: AppColors.mainColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 15.w,
|
||||
),
|
||||
Expanded(
|
||||
child: LinearProgressIndicator(
|
||||
value: logic.state.otaProgress.value,
|
||||
color: AppColors.mainColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: LinearProgressIndicator(
|
||||
value: logic.state.otaProgress.value,
|
||||
color: AppColors.mainColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
|
||||
@ -1,25 +1,116 @@
|
||||
class UseRecordListEntity {
|
||||
UseRecordListEntity({
|
||||
this.description,
|
||||
this.errorCode,
|
||||
this.errorMsg,
|
||||
});
|
||||
|
||||
UseRecordListEntity.fromJson(dynamic json) {
|
||||
description = json['description'];
|
||||
errorCode = json['errorCode'];
|
||||
errorMsg = json['errorMsg'];
|
||||
}
|
||||
|
||||
String? description;
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
UseRecordListEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
|
||||
UseRecordListEntity.fromJson(Map<String, dynamic> json) {
|
||||
errorCode = json['errorCode'];
|
||||
description = json['description'];
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['description'] = description;
|
||||
map['errorCode'] = errorCode;
|
||||
map['errorMsg'] = errorMsg;
|
||||
return map;
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['errorCode'] = errorCode;
|
||||
data['description'] = description;
|
||||
data['errorMsg'] = errorMsg;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
int? pageNo;
|
||||
int? pageSize;
|
||||
int? total;
|
||||
List<UseItemData>? useRecordList;
|
||||
|
||||
Data({this.pageNo, this.pageSize, this.total, this.useRecordList});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
pageNo = json['pageNo'];
|
||||
pageSize = json['pageSize'];
|
||||
total = json['total'];
|
||||
if (json['list'] != null) {
|
||||
useRecordList = <UseItemData>[];
|
||||
json['list'].forEach((v) {
|
||||
useRecordList!.add(UseItemData.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['pageNo'] = pageNo;
|
||||
data['pageSize'] = pageSize;
|
||||
data['total'] = total;
|
||||
if (useRecordList != null) {
|
||||
data['list'] = useRecordList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class UseItemData {
|
||||
int? id;
|
||||
int? userId;
|
||||
String? type;
|
||||
String? receiverAccount;
|
||||
String? realName;
|
||||
int? authStatus;
|
||||
int? lockId;
|
||||
String? lockName;
|
||||
int? consCount;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
|
||||
UseItemData(
|
||||
{this.id,
|
||||
this.userId,
|
||||
this.type,
|
||||
this.receiverAccount,
|
||||
this.realName,
|
||||
this.authStatus,
|
||||
this.lockId,
|
||||
this.lockName,
|
||||
this.consCount,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
|
||||
UseItemData.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
userId = json['user_id'];
|
||||
type = json['type'];
|
||||
receiverAccount = json['receiver_account'];
|
||||
realName = json['real_name'];
|
||||
authStatus = json['status'];
|
||||
lockId = json['lock_id'];
|
||||
lockName = json['lock_name'];
|
||||
consCount = json['cons_count'];
|
||||
createdAt = json['created_at'];
|
||||
updatedAt = json['updated_at'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['user_id'] = userId;
|
||||
data['type'] = type;
|
||||
data['receiver_account'] = receiverAccount;
|
||||
data['real_name'] = realName;
|
||||
data['status'] = authStatus;
|
||||
data['lock_id'] = lockId;
|
||||
data['lock_name'] = lockName;
|
||||
data['cons_count'] = consCount;
|
||||
data['created_at'] = createdAt;
|
||||
data['updated_at'] = updatedAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
@ -11,6 +12,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
|
||||
|
||||
final ValueAddedServicesRecordState state = ValueAddedServicesRecordState();
|
||||
int buyPageNo = 1;
|
||||
int usePageNo = 1;
|
||||
late String type;
|
||||
|
||||
@override
|
||||
@ -41,10 +43,26 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//请求使用记录列表
|
||||
Future<void> loadUseRecordList(bool load) async {
|
||||
if (!load) {
|
||||
usePageNo = 1;
|
||||
}
|
||||
UseRecordListEntity entity = await ApiRepository.to.getUseRecordList(
|
||||
type: type,
|
||||
pageNo: buyPageNo,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.useRecordList.value = entity.data!.useRecordList!;
|
||||
state.useRecordList.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
|
||||
loadBuyRecordList(true);
|
||||
loadUseRecordList(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -45,10 +46,10 @@ class _ValueAddedServicesRealNamePageState
|
||||
Obx(() => Expanded(
|
||||
child: TabBarView(children: [
|
||||
_PurchaseRecords(
|
||||
getRecordList: logic.state.buyRecordList.value,
|
||||
buyRecordList: logic.state.buyRecordList.value,
|
||||
),
|
||||
_PurchaseRecords(
|
||||
getRecordList: logic.state.useRecordList.value,
|
||||
_UseRecordsTable(
|
||||
useRecordList: logic.state.useRecordList.value,
|
||||
),
|
||||
]),
|
||||
)),
|
||||
@ -70,11 +71,11 @@ Widget tabTextItem(String tabText) {
|
||||
);
|
||||
}
|
||||
|
||||
//购买记录、使用记录
|
||||
//购买记录
|
||||
class _PurchaseRecords extends StatefulWidget {
|
||||
final List getRecordList;
|
||||
final List buyRecordList;
|
||||
|
||||
const _PurchaseRecords({required this.getRecordList});
|
||||
const _PurchaseRecords({required this.buyRecordList});
|
||||
|
||||
@override
|
||||
State<_PurchaseRecords> createState() => _PurchaseRecordsState();
|
||||
@ -88,11 +89,11 @@ class _PurchaseRecordsState extends State<_PurchaseRecords> {
|
||||
return EasyRefresh(
|
||||
onRefresh: () async {},
|
||||
onLoad: () async {},
|
||||
child: widget.getRecordList.isNotEmpty
|
||||
child: widget.buyRecordList.isNotEmpty
|
||||
? ListView.builder(
|
||||
itemCount: widget.getRecordList.length,
|
||||
itemCount: widget.buyRecordList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _recordKeyItem(widget.getRecordList[index]);
|
||||
return _recordKeyItem(widget.buyRecordList[index]);
|
||||
})
|
||||
: NoData(),
|
||||
);
|
||||
@ -143,3 +144,82 @@ class _PurchaseRecordsState extends State<_PurchaseRecords> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//使用记录
|
||||
class _UseRecordsTable extends StatefulWidget {
|
||||
final List useRecordList;
|
||||
|
||||
const _UseRecordsTable({required this.useRecordList});
|
||||
|
||||
@override
|
||||
State<_UseRecordsTable> createState() => _UseRecordsTableState();
|
||||
}
|
||||
|
||||
class _UseRecordsTableState extends State<_UseRecordsTable> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return EasyRefresh(
|
||||
onRefresh: () async {},
|
||||
onLoad: () async {},
|
||||
child: widget.useRecordList.isNotEmpty
|
||||
? ListView.builder(
|
||||
itemCount: widget.useRecordList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _recordKeyItem(widget.useRecordList[index]);
|
||||
})
|
||||
: NoData(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _recordKeyItem(UseItemData itemData) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
||||
padding:
|
||||
EdgeInsets.only(left: 20.w, right: 20.w, top: 16.h, bottom: 16.h),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'${itemData.lockName ?? ""} ${itemData.realName ?? ""}',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: AppColors.blackColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
itemData.authStatus == 0
|
||||
? Container(
|
||||
padding: EdgeInsets.only(
|
||||
right: 6.w, left: 6.w, top: 2.h, bottom: 2.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
color: AppColors.toBeReceiveBgColor,
|
||||
),
|
||||
child: Text('失败',
|
||||
style: TextStyle(fontSize: 16.sp, color: Colors.red)),
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
itemData.createdAt!.length > 10
|
||||
? itemData.createdAt!.substring(0, 10)
|
||||
: itemData.createdAt!,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor))
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1387,8 +1387,19 @@ class ApiRepository {
|
||||
required int startTime,
|
||||
required int endTime,
|
||||
required int faceRight}) async {
|
||||
final res = await apiProvider.addFaceData(lockId, faceName, faceNumber,
|
||||
faceType, startDate, endDate, featureData, addType, weekDay, startTime, endTime, faceRight);
|
||||
final res = await apiProvider.addFaceData(
|
||||
lockId,
|
||||
faceName,
|
||||
faceNumber,
|
||||
faceType,
|
||||
startDate,
|
||||
endDate,
|
||||
featureData,
|
||||
addType,
|
||||
weekDay,
|
||||
startTime,
|
||||
endTime,
|
||||
faceRight);
|
||||
return AddFaceEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1652,10 +1663,8 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//重置密码钥匙
|
||||
Future<PasswordKeyListEntity> keyboardPwdReset({
|
||||
required String lockId,
|
||||
required List passwordKey
|
||||
}) async {
|
||||
Future<PasswordKeyListEntity> keyboardPwdReset(
|
||||
{required String lockId, required List passwordKey}) async {
|
||||
final res = await apiProvider.keyboardPwdReset(lockId, passwordKey);
|
||||
return PasswordKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
@ -2031,7 +2040,7 @@ class ApiRepository {
|
||||
return FaceAuthenticationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 获取使用记录
|
||||
// 获取购买记录
|
||||
Future<AdvancedFunctionRecordEntity> getBuyRecordList({
|
||||
required String type,
|
||||
required int pageNo,
|
||||
@ -2043,7 +2052,7 @@ class ApiRepository {
|
||||
return AdvancedFunctionRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 获取购买记录
|
||||
// 获取使用记录
|
||||
Future<UseRecordListEntity> getUseRecordList({
|
||||
required String type,
|
||||
required int pageNo,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user