添加转移锁功能,修复转移锁模块问题
This commit is contained in:
parent
c3d6f208d7
commit
3ff1d01d19
@ -885,5 +885,22 @@
|
|||||||
"请输入时间(秒)": "Please enter the time (seconds)",
|
"请输入时间(秒)": "Please enter the time (seconds)",
|
||||||
"加载数据失败": "Failed to load data",
|
"加载数据失败": "Failed to load data",
|
||||||
"重试": "Retry",
|
"重试": "Retry",
|
||||||
"升级中,是否退出": "During the upgrade, whether to exit"
|
"升级中,是否退出": "During the upgrade, whether to exit",
|
||||||
|
"下一步": "Next",
|
||||||
|
"公寓": "Apartment",
|
||||||
|
"个人用户": "Personal user",
|
||||||
|
"星寓": "Star apartment",
|
||||||
|
"账号": "Account",
|
||||||
|
|
||||||
|
"请输入手机号或email": "Please enter mobile phone number or email",
|
||||||
|
"请输入星寓管理员的账号": "Please enter the account of the star apartment administrator",
|
||||||
|
"选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权": "The selected smart lock will be transferred to the account you entered, and you will lose the management rights of the lock",
|
||||||
|
"暂不支持跨平台转移,敬请期待": "Cross-platform transfer is not supported for the time being, please look forward to it",
|
||||||
|
"移除坏锁": "Remove bad lock",
|
||||||
|
"转移确认": "Transfer confirmation",
|
||||||
|
"本次共转移": "This time a total of",
|
||||||
|
"把智能锁": "Smart lock",
|
||||||
|
"确认": "Confirm",
|
||||||
|
"移除成功": "Remove successfully",
|
||||||
|
"转移成功": "Transfer success"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -917,5 +917,22 @@
|
|||||||
"请输入时间(秒)": "请输入时间(秒)",
|
"请输入时间(秒)": "请输入时间(秒)",
|
||||||
"加载数据失败": "加载数据失败",
|
"加载数据失败": "加载数据失败",
|
||||||
"重试": "重试",
|
"重试": "重试",
|
||||||
"升级中,是否退出": "升级中,是否退出"
|
"升级中,是否退出": "升级中,是否退出",
|
||||||
|
"下一步": "下一步",
|
||||||
|
"公寓": "公寓",
|
||||||
|
"个人用户": "个人用户",
|
||||||
|
"星寓": "星寓",
|
||||||
|
"账号": "账号",
|
||||||
|
|
||||||
|
"请输入手机号或email": "请输入手机号或email",
|
||||||
|
"请输入星寓管理员的账号": "请输入星寓管理员的账号",
|
||||||
|
"选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权": "选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权",
|
||||||
|
"暂不支持跨平台转移,敬请期待": "暂不支持跨平台转移,敬请期待",
|
||||||
|
"移除坏锁": "移除坏锁",
|
||||||
|
"转移确认": "转移确认",
|
||||||
|
"本次共转移": "本次共转移",
|
||||||
|
"把智能锁": "把智能锁",
|
||||||
|
"确认": "确认",
|
||||||
|
"移除成功": "移除成功",
|
||||||
|
"转移成功": "转移成功"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -883,5 +883,22 @@
|
|||||||
"请输入时间(秒)": "请输入时间(秒)",
|
"请输入时间(秒)": "请输入时间(秒)",
|
||||||
"加载数据失败": "加载数据失败",
|
"加载数据失败": "加载数据失败",
|
||||||
"重试": "重试",
|
"重试": "重试",
|
||||||
"升级中,是否退出": "升级中,是否退出"
|
"升级中,是否退出": "升级中,是否退出",
|
||||||
|
"下一步": "下一步",
|
||||||
|
"公寓": "公寓",
|
||||||
|
"个人用户": "个人用户",
|
||||||
|
"星寓": "星寓",
|
||||||
|
"账号": "账号",
|
||||||
|
|
||||||
|
"请输入手机号或email": "请输入手机号或email",
|
||||||
|
"请输入星寓管理员的账号": "请输入星寓管理员的账号",
|
||||||
|
"选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权": "选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权",
|
||||||
|
"暂不支持跨平台转移,敬请期待": "暂不支持跨平台转移,敬请期待",
|
||||||
|
"移除坏锁": "移除坏锁",
|
||||||
|
"转移确认": "转移确认",
|
||||||
|
"本次共转移": "本次共转移",
|
||||||
|
"把智能锁": "把智能锁",
|
||||||
|
"确认": "确认",
|
||||||
|
"移除成功": "移除成功",
|
||||||
|
"转移成功": "转移成功"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
|
|
||||||
//TODO:添加用户
|
//TODO:恢复出厂设置
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import '../io_tool/io_tool.dart';
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
import '../sm4Encipher/sm4.dart';
|
|
||||||
import '../io_reply.dart';
|
import '../io_reply.dart';
|
||||||
import '../io_sender.dart';
|
import '../io_sender.dart';
|
||||||
|
import '../io_tool/io_tool.dart';
|
||||||
import '../io_type.dart';
|
import '../io_type.dart';
|
||||||
import 'package:crypto/crypto.dart' as crypto;
|
import '../sm4Encipher/sm4.dart';
|
||||||
|
|
||||||
class FactoryDataResetCommand extends SenderProtocol {
|
class FactoryDataResetCommand extends SenderProtocol {
|
||||||
|
|
||||||
|
|||||||
108
lib/blue/io_protocol/io_transferSmartLock.dart
Normal file
108
lib/blue/io_protocol/io_transferSmartLock.dart
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
|
||||||
|
//TODO:转移智能锁
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
|
import '../io_reply.dart';
|
||||||
|
import '../io_sender.dart';
|
||||||
|
import '../io_tool/io_tool.dart';
|
||||||
|
import '../io_type.dart';
|
||||||
|
import '../sm4Encipher/sm4.dart';
|
||||||
|
|
||||||
|
class TransferSmartLockCommand extends SenderProtocol {
|
||||||
|
|
||||||
|
String? lockID;
|
||||||
|
String? userID;
|
||||||
|
String? keyID;
|
||||||
|
List<int>? publicKey;
|
||||||
|
List<int>? privateKey;
|
||||||
|
List<int>? token;
|
||||||
|
int? needAuthor;
|
||||||
|
TransferSmartLockCommand({
|
||||||
|
this.lockID,
|
||||||
|
this.userID,
|
||||||
|
this.keyID,
|
||||||
|
this.token,
|
||||||
|
this.needAuthor,
|
||||||
|
this.publicKey,
|
||||||
|
this.privateKey,
|
||||||
|
}) : super(CommandType.transferSmartLock);
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'TransferSmartLockCommand{lockID: $lockID, userID: $userID, '
|
||||||
|
'keyID: $keyID, publicKey: $publicKey, privateKey: $privateKey, '
|
||||||
|
'token: $token, needAuthor: $needAuthor}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<int> messageDetail() {
|
||||||
|
List<int> data = <int>[];
|
||||||
|
List<int> ebcData = <int>[];
|
||||||
|
|
||||||
|
// 指令类型
|
||||||
|
final int type = commandType!.typeValue;
|
||||||
|
final double typeDouble = type / 256;
|
||||||
|
final int type1 = typeDouble.toInt();
|
||||||
|
final int type2 = type % 256;
|
||||||
|
data.add(type1);
|
||||||
|
data.add(type2);
|
||||||
|
|
||||||
|
// 锁id 40
|
||||||
|
final int lockIDLength = utf8.encode(lockID!).length;
|
||||||
|
data.addAll(utf8.encode(lockID!));
|
||||||
|
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||||
|
|
||||||
|
//userID 20
|
||||||
|
final int userIDLength = utf8.encode(userID!).length;
|
||||||
|
data.addAll(utf8.encode(userID!));
|
||||||
|
data = getFixedLengthList(data, 20 - userIDLength);
|
||||||
|
|
||||||
|
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||||
|
data.addAll(token!);
|
||||||
|
|
||||||
|
if(needAuthor == 0){
|
||||||
|
//AuthCodeLen 1
|
||||||
|
data.add(0);
|
||||||
|
} else {
|
||||||
|
final List<int> authCodeData = <int>[];
|
||||||
|
|
||||||
|
//userID
|
||||||
|
authCodeData.addAll(utf8.encode(lockID!));
|
||||||
|
|
||||||
|
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||||
|
authCodeData.addAll(token!);
|
||||||
|
|
||||||
|
authCodeData.addAll(publicKey!);
|
||||||
|
|
||||||
|
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||||
|
final crypto.Digest authCode = crypto.md5.convert(authCodeData);
|
||||||
|
|
||||||
|
data.add(authCode.bytes.length);
|
||||||
|
data.addAll(authCode.bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((data.length % 16) != 0) {
|
||||||
|
final int add = 16 - data.length % 16;
|
||||||
|
for (int i = 0; i < add; i++) {
|
||||||
|
data.add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printLog(data);
|
||||||
|
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||||
|
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||||
|
return ebcData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TransferSmartLockReply extends Reply {
|
||||||
|
TransferSmartLockReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
|
: super.parseData(commandType, dataDetail) {
|
||||||
|
data = dataDetail;
|
||||||
|
final int status = data[6];
|
||||||
|
errorWithStstus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
import '../io_reply.dart';
|
import '../io_reply.dart';
|
||||||
import '../io_sender.dart';
|
import '../io_sender.dart';
|
||||||
import '../io_tool/io_tool.dart';
|
import '../io_tool/io_tool.dart';
|
||||||
import '../io_type.dart';
|
import '../io_type.dart';
|
||||||
import 'package:crypto/crypto.dart' as crypto;
|
|
||||||
|
|
||||||
import '../sm4Encipher/sm4.dart';
|
import '../sm4Encipher/sm4.dart';
|
||||||
|
|
||||||
class UpdataLockCardListCommand extends SenderProtocol {
|
class UpdataLockCardListCommand extends SenderProtocol {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ enum CommandType {
|
|||||||
addUser, //增加用户 = 0x3001
|
addUser, //增加用户 = 0x3001
|
||||||
deletUser, //删除用户 = 0x3002
|
deletUser, //删除用户 = 0x3002
|
||||||
editUser, //修改用户 = 0x3003
|
editUser, //修改用户 = 0x3003
|
||||||
|
transferSmartLock, //转移智能锁 = 0x300D
|
||||||
factoryDataReset, //恢复出厂设置 = 0x3004
|
factoryDataReset, //恢复出厂设置 = 0x3004
|
||||||
openLock, //开门 = 0x3005
|
openLock, //开门 = 0x3005
|
||||||
readLockStatusInfo, //读取锁状态信息 = 0x300A
|
readLockStatusInfo, //读取锁状态信息 = 0x300A
|
||||||
@ -84,6 +85,11 @@ extension ExtensionCommandType on CommandType {
|
|||||||
type = CommandType.cleanUpUsers;
|
type = CommandType.cleanUpUsers;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 0x300D:
|
||||||
|
{
|
||||||
|
type = CommandType.transferSmartLock;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 0x300A:
|
case 0x300A:
|
||||||
{
|
{
|
||||||
type = CommandType.readLockStatusInfo;
|
type = CommandType.readLockStatusInfo;
|
||||||
@ -199,6 +205,9 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case CommandType.cleanUpUsers:
|
case CommandType.cleanUpUsers:
|
||||||
type = 0x300C;
|
type = 0x300C;
|
||||||
break;
|
break;
|
||||||
|
case CommandType.transferSmartLock:
|
||||||
|
type = 0x300D;
|
||||||
|
break;
|
||||||
case CommandType.readLockStatusInfo:
|
case CommandType.readLockStatusInfo:
|
||||||
type = 0x300A;
|
type = 0x300A;
|
||||||
break;
|
break;
|
||||||
@ -299,6 +308,9 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case 0x300C:
|
case 0x300C:
|
||||||
t = '清理用户';
|
t = '清理用户';
|
||||||
break;
|
break;
|
||||||
|
case 0x300D:
|
||||||
|
t = '转移智能锁';
|
||||||
|
break;
|
||||||
case 0x300A:
|
case 0x300A:
|
||||||
t = '读取锁状态信息';
|
t = '读取锁状态信息';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import 'package:star_lock/blue/io_protocol/io_timing.dart';
|
|||||||
import 'package:star_lock/blue/io_protocol/io_transferPermissions.dart';
|
import 'package:star_lock/blue/io_protocol/io_transferPermissions.dart';
|
||||||
|
|
||||||
import '../tools/storage.dart';
|
import '../tools/storage.dart';
|
||||||
|
|
||||||
import 'io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
import 'io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
||||||
import 'io_protocol/io_addICCardWithTimeCycleCoercion.dart';
|
import 'io_protocol/io_addICCardWithTimeCycleCoercion.dart';
|
||||||
import 'io_protocol/io_addStressPassword.dart';
|
import 'io_protocol/io_addStressPassword.dart';
|
||||||
@ -37,7 +36,9 @@ import 'io_protocol/io_getWifiList.dart';
|
|||||||
import 'io_protocol/io_openLock.dart';
|
import 'io_protocol/io_openLock.dart';
|
||||||
import 'io_protocol/io_queryingFingerprintStatus.dart';
|
import 'io_protocol/io_queryingFingerprintStatus.dart';
|
||||||
import 'io_protocol/io_referEventRecordNumber.dart';
|
import 'io_protocol/io_referEventRecordNumber.dart';
|
||||||
|
import 'io_protocol/io_senderCustomPasswords.dart';
|
||||||
import 'io_protocol/io_senderResetPasswords.dart';
|
import 'io_protocol/io_senderResetPasswords.dart';
|
||||||
|
import 'io_protocol/io_transferSmartLock.dart';
|
||||||
import 'io_protocol/io_updataLockCardList.dart';
|
import 'io_protocol/io_updataLockCardList.dart';
|
||||||
import 'io_protocol/io_updataLockFaceList.dart';
|
import 'io_protocol/io_updataLockFaceList.dart';
|
||||||
import 'io_protocol/io_updataLockFingerprintList.dart';
|
import 'io_protocol/io_updataLockFingerprintList.dart';
|
||||||
@ -45,11 +46,10 @@ import 'io_protocol/io_updataLockPalmVeinList.dart';
|
|||||||
import 'io_protocol/io_updataLockPasswordList.dart';
|
import 'io_protocol/io_updataLockPasswordList.dart';
|
||||||
import 'io_protocol/io_updataLockSet.dart';
|
import 'io_protocol/io_updataLockSet.dart';
|
||||||
import 'io_reply.dart';
|
import 'io_reply.dart';
|
||||||
import 'io_protocol/io_senderCustomPasswords.dart';
|
|
||||||
import 'io_type.dart';
|
|
||||||
import 'io_tool/io_manager.dart';
|
import 'io_tool/io_manager.dart';
|
||||||
import 'io_tool/io_tool.dart';
|
import 'io_tool/io_tool.dart';
|
||||||
import 'io_tool/manager_event_bus.dart';
|
import 'io_tool/manager_event_bus.dart';
|
||||||
|
import 'io_type.dart';
|
||||||
import 'sm4Encipher/sm4.dart';
|
import 'sm4Encipher/sm4.dart';
|
||||||
|
|
||||||
class CommandReciverManager {
|
class CommandReciverManager {
|
||||||
@ -172,6 +172,11 @@ class CommandReciverManager {
|
|||||||
reply = TransferPermissionsReply.parseData(commandType, data);
|
reply = TransferPermissionsReply.parseData(commandType, data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CommandType.transferSmartLock:
|
||||||
|
{
|
||||||
|
reply = TransferSmartLockReply.parseData(commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CommandType.factoryDataReset:
|
case CommandType.factoryDataReset:
|
||||||
{
|
{
|
||||||
reply = FactoryDataResetReply.parseData(commandType, data);
|
reply = FactoryDataResetReply.parseData(commandType, data);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
import 'package:star_lock/blue/entity/lock_user_no_list_entity.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
@ -14,15 +15,18 @@ import '../tools/commonDataManage.dart';
|
|||||||
import '../tools/storage.dart';
|
import '../tools/storage.dart';
|
||||||
import 'blue_manage.dart';
|
import 'blue_manage.dart';
|
||||||
import 'io_protocol/io_addUser.dart';
|
import 'io_protocol/io_addUser.dart';
|
||||||
|
import 'io_protocol/io_transferSmartLock.dart';
|
||||||
import 'io_reply.dart';
|
import 'io_reply.dart';
|
||||||
import 'io_tool/io_tool.dart';
|
import 'io_tool/io_tool.dart';
|
||||||
import 'io_tool/manager_event_bus.dart';
|
import 'io_tool/manager_event_bus.dart';
|
||||||
import 'sender_data.dart';
|
import 'sender_data.dart';
|
||||||
|
|
||||||
class SenderBeforeDataManage {
|
class SenderBeforeDataManage {
|
||||||
static SenderBeforeDataManage? _manager;
|
|
||||||
|
factory SenderBeforeDataManage() => shareManager()!;
|
||||||
|
|
||||||
SenderBeforeDataManage._init();
|
SenderBeforeDataManage._init();
|
||||||
|
static SenderBeforeDataManage? _manager;
|
||||||
|
|
||||||
static SenderBeforeDataManage? shareManager() {
|
static SenderBeforeDataManage? shareManager() {
|
||||||
_manager ??= SenderBeforeDataManage._init();
|
_manager ??= SenderBeforeDataManage._init();
|
||||||
@ -30,8 +34,6 @@ class SenderBeforeDataManage {
|
|||||||
return _manager;
|
return _manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory SenderBeforeDataManage() => shareManager()!;
|
|
||||||
|
|
||||||
SenderBeforeDataManage? get manager => shareManager();
|
SenderBeforeDataManage? get manager => shareManager();
|
||||||
|
|
||||||
void _init() {
|
void _init() {
|
||||||
@ -40,10 +42,12 @@ class SenderBeforeDataManage {
|
|||||||
|
|
||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
StreamSubscription<Reply>? _replySubscription;
|
StreamSubscription<Reply>? _replySubscription;
|
||||||
|
// 是否是添加用户之前的调用
|
||||||
bool isBeforeAddUser = true;
|
bool isBeforeAddUser = true;
|
||||||
|
|
||||||
// 启动订阅
|
// 启动订阅
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription ??= EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
_replySubscription ??= EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
// 添加用户
|
// 添加用户
|
||||||
if (reply is AddUserReply && isBeforeAddUser == false) {
|
if (reply is AddUserReply && isBeforeAddUser == false) {
|
||||||
_replyAddUserKey(reply);
|
_replyAddUserKey(reply);
|
||||||
@ -52,32 +56,36 @@ class SenderBeforeDataManage {
|
|||||||
if (reply is CleanUpUsersReply) {
|
if (reply is CleanUpUsersReply) {
|
||||||
_cleanUpUsersReply(reply);
|
_cleanUpUsersReply(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reply is TransferSmartLockReply) {
|
||||||
|
_transferSmartLockReply(reply);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析添加用户订阅
|
// 解析添加用户订阅
|
||||||
Future<void> _replyAddUserKey(Reply reply) async {
|
Future<void> _replyAddUserKey(Reply reply) async {
|
||||||
int status = reply.data[46];
|
final int status = reply.data[46];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
CommonDataManage().currentLockUserNo =
|
var userNoData = reply.data.sublist(47, 49);
|
||||||
listChangInt(reply.data.sublist(47, 49));
|
CommonDataManage().currentLockUserNo = listChangInt(userNoData);
|
||||||
CommonDataManage().currentKeyInfo.lockUserNo =
|
CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo;
|
||||||
CommonDataManage().currentLockUserNo;
|
|
||||||
_updateLockUserNo();
|
_updateLockUserNo(userNoData);
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var token = reply.data.sublist(42, 46);
|
final List<int> token = reply.data.sublist(42, 46);
|
||||||
List<String> strTokenList = changeIntListToStringList(token);
|
final List<String> strTokenList = changeIntListToStringList(token);
|
||||||
Storage.setStringList(saveBlueToken, strTokenList);
|
Storage.setStringList(saveBlueToken, strTokenList);
|
||||||
var addUserData = await getAddUserKeyData(tokenList: token);
|
final List<int> addUserData = await getAddUserKeyData(tokenList: token);
|
||||||
eventBus.fire(LockAddUserSucceedEvent(addUserData, 1));
|
eventBus.fire(LockAddUserSucceedEvent(addUserData, 1));
|
||||||
break;
|
break;
|
||||||
case 0x0c:
|
case 0x0c:
|
||||||
//锁设备用户超过 32个,需要同步锁用户列表刷新
|
//锁设备用户超过 32个,需要同步锁用户列表刷新
|
||||||
var addUserData = await getCleanUpUsers();
|
final List<int> addUserData = await getCleanUpUsers();
|
||||||
CommandSenderManager().sendNormalData(addUserData);
|
CommandSenderManager().sendNormalData(addUserData);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -88,20 +96,20 @@ class SenderBeforeDataManage {
|
|||||||
|
|
||||||
// 解析清理用户订阅
|
// 解析清理用户订阅
|
||||||
Future<void> _cleanUpUsersReply(Reply reply) async {
|
Future<void> _cleanUpUsersReply(Reply reply) async {
|
||||||
int status = reply.data[6];
|
final int status = reply.data[6];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
//添加用户
|
//添加用户
|
||||||
var addUserData = await getAddUserKeyData();
|
final List<int> addUserData = await getAddUserKeyData();
|
||||||
CommandSenderManager().sendNormalData(addUserData);
|
CommandSenderManager().sendNormalData(addUserData);
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var token = reply.data.sublist(2, 6);
|
final List<int> token = reply.data.sublist(2, 6);
|
||||||
List<String> strTokenList = changeIntListToStringList(token);
|
final List<String> strTokenList = changeIntListToStringList(token);
|
||||||
Storage.setStringList(saveBlueToken, strTokenList);
|
Storage.setStringList(saveBlueToken, strTokenList);
|
||||||
var addUserData = await getCleanUpUsers(tokenList: token);
|
final List<int> addUserData = await getCleanUpUsers(tokenList: token);
|
||||||
CommandSenderManager().sendNormalData(addUserData);
|
CommandSenderManager().sendNormalData(addUserData);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -110,26 +118,52 @@ class SenderBeforeDataManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 转移锁指令
|
||||||
|
Future<void> _transferSmartLockReply(Reply reply) async {
|
||||||
|
final int status = reply.data[6];
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
CommonDataManage().initUserNo = 0;
|
||||||
|
CommonDataManage().currentKeyInfo.initUserNo = 0;
|
||||||
|
|
||||||
|
_updateLockInitUserNo();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<int> token = reply.data.sublist(2, 6);
|
||||||
|
final List<String> strTokenList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, strTokenList);
|
||||||
|
|
||||||
|
final List<int> transferSmartLockData = await getTransferSmartLockData(tokenList: token);
|
||||||
|
CommandSenderManager().sendNormalData(transferSmartLockData);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//获取清除用户列表指令
|
//获取清除用户列表指令
|
||||||
Future<List<int>> getCleanUpUsers({List<int>? tokenList}) async {
|
Future<List<int>> getCleanUpUsers({List<int>? tokenList}) async {
|
||||||
var entity = await ApiRepository.to
|
final LockUserNoListEntity entity = await ApiRepository.to
|
||||||
.getLockUserNoList(lockId: CommonDataManage().currentKeyInfo.lockId!);
|
.getLockUserNoList(lockId: CommonDataManage().currentKeyInfo.lockId!);
|
||||||
if (!entity.errorCode!.codeIsSuccessful ||
|
if (!entity.errorCode!.codeIsSuccessful ||
|
||||||
(entity.data?.userNos ?? []).isEmpty) {
|
(entity.data?.userNos ?? <int>[]).isEmpty) {
|
||||||
throw Exception('ApiRepository.to.getLockUserNoList 访问失败');
|
throw Exception('ApiRepository.to.getLockUserNoList 访问失败');
|
||||||
}
|
}
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
if (tokenList == null) {
|
if (tokenList == null) {
|
||||||
var tokenKey = await Storage.getStringList(saveBlueToken);
|
final List<String>? tokenKey = await Storage.getStringList(saveBlueToken);
|
||||||
tokenList = changeStringListToIntList(tokenKey!);
|
tokenList = changeStringListToIntList(tokenKey!);
|
||||||
}
|
}
|
||||||
|
|
||||||
var cleanUpUsersData = CleanUpUsersCommand(
|
final CleanUpUsersCommand cleanUpUsersData = CleanUpUsersCommand(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
||||||
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||||
@ -145,24 +179,24 @@ class SenderBeforeDataManage {
|
|||||||
|
|
||||||
//获取添加用户指令
|
//获取添加用户指令
|
||||||
Future<List<int>> getAddUserKeyData({List<int>? tokenList}) async {
|
Future<List<int>> getAddUserKeyData({List<int>? tokenList}) async {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
if (tokenList == null) {
|
if (tokenList == null) {
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
tokenList = changeStringListToIntList(token!);
|
tokenList = changeStringListToIntList(token!);
|
||||||
}
|
}
|
||||||
|
|
||||||
LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo;
|
final LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo;
|
||||||
DateTime? startTime;
|
DateTime? startTime;
|
||||||
DateTime? endTime;
|
DateTime? endTime;
|
||||||
var startDateTime = 0;
|
int startDateTime = 0;
|
||||||
var endDateTime = 0;
|
int endDateTime = 0;
|
||||||
bool isRound = false;
|
bool isRound = false;
|
||||||
var useCountLimit = 0xffff;
|
int useCountLimit = 0xffff;
|
||||||
if(currentKeyInfo.keyType == XSConstantMacro.keyTypeTime){
|
if(currentKeyInfo.keyType == XSConstantMacro.keyTypeTime){
|
||||||
// 限时
|
// 限时
|
||||||
startDateTime = currentKeyInfo.startDate! ~/ 1000;
|
startDateTime = currentKeyInfo.startDate! ~/ 1000;
|
||||||
@ -181,7 +215,7 @@ class SenderBeforeDataManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AppLog.log("startTime.hour:${startTime!.hour} startTime.minute:${startTime!.minute} endTime.hour:${endTime!.hour} endTime.minute:${endTime!.minute}}");
|
// AppLog.log("startTime.hour:${startTime!.hour} startTime.minute:${startTime!.minute} endTime.hour:${endTime!.hour} endTime.minute:${endTime!.minute}}");
|
||||||
var addUserData = AddUserCommand(
|
final AddUserCommand addUserData = AddUserCommand(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
authUserID: currentKeyInfo.senderUserId!.toString(),
|
authUserID: currentKeyInfo.senderUserId!.toString(),
|
||||||
keyID: currentKeyInfo.keyId.toString(),
|
keyID: currentKeyInfo.keyId.toString(),
|
||||||
@ -201,7 +235,7 @@ class SenderBeforeDataManage {
|
|||||||
endHour: isRound ? endTime!.hour : 0,
|
endHour: isRound ? endTime!.hour : 0,
|
||||||
endMin: isRound ? endTime!.minute : 0,
|
endMin: isRound ? endTime!.minute : 0,
|
||||||
role: currentKeyInfo.keyRight == 1 ? 1 : 0,
|
role: currentKeyInfo.keyRight == 1 ? 1 : 0,
|
||||||
password: "123456",
|
password: '123456',
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
publicKey: publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
@ -209,13 +243,50 @@ class SenderBeforeDataManage {
|
|||||||
return addUserData.packageData();
|
return addUserData.packageData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取转移智能锁指令数据
|
||||||
|
Future<List<int>> getTransferSmartLockData({List<int>? tokenList}) async {
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
if (tokenList == null) {
|
||||||
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
|
tokenList = changeStringListToIntList(token!);
|
||||||
|
}
|
||||||
|
final LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo;
|
||||||
|
|
||||||
|
final TransferSmartLockCommand transferSmartLockData = TransferSmartLockCommand(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
keyID: currentKeyInfo.keyId.toString(),
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: publicKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: tokenList);
|
||||||
|
return transferSmartLockData.packageData();
|
||||||
|
}
|
||||||
|
|
||||||
// 普通用户接收电子钥匙之后 更新锁用户NO
|
// 普通用户接收电子钥匙之后 更新锁用户NO
|
||||||
void _updateLockUserNo() async {
|
Future<void> _updateLockUserNo(List<int> dataList) async {
|
||||||
LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(
|
final LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(
|
||||||
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
|
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||||
lockUserNo: CommonDataManage().currentKeyInfo.lockUserNo.toString());
|
lockUserNo: CommonDataManage().currentKeyInfo.lockUserNo.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
eventBus.fire(LockAddUserSucceedEvent([0], 0));
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
|
eventBus.fire(LockAddUserSucceedEvent(<int>[0], 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新锁用户InitUserNo
|
||||||
|
Future<void> _updateLockInitUserNo() async {
|
||||||
|
final LockNetTokenEntity entity = await ApiRepository.to.updateLockInitUserNo(
|
||||||
|
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
|
||||||
|
initUserNo: CommonDataManage().currentKeyInfo.initUserNo ?? 0);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
|
eventBus.fire(LockInitUserNoEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import '../app_settings/app_settings.dart';
|
import '../app_settings/app_settings.dart';
|
||||||
import '../tools/commonDataManage.dart';
|
import '../tools/commonDataManage.dart';
|
||||||
import '../tools/eventBusEventManage.dart';
|
import '../tools/eventBusEventManage.dart';
|
||||||
import 'io_sender.dart';
|
import 'io_sender.dart';
|
||||||
import 'io_type.dart';
|
|
||||||
import 'io_tool/io_model.dart';
|
import 'io_tool/io_model.dart';
|
||||||
import 'io_tool/manager_event_bus.dart';
|
import 'io_tool/manager_event_bus.dart';
|
||||||
import 'sender_beforeDataManage.dart';
|
import 'sender_beforeDataManage.dart';
|
||||||
@ -12,27 +12,26 @@ import 'sender_beforeDataManage.dart';
|
|||||||
typedef CommandSendCallBack = void Function(ErrorType errorType);
|
typedef CommandSendCallBack = void Function(ErrorType errorType);
|
||||||
|
|
||||||
class CommandSenderManager {
|
class CommandSenderManager {
|
||||||
static final CommandSenderManager _manager = CommandSenderManager._init();
|
|
||||||
|
|
||||||
factory CommandSenderManager() => _manager;
|
factory CommandSenderManager() => _manager;
|
||||||
|
|
||||||
static CommandSenderManager getInstance() => _manager;
|
|
||||||
|
|
||||||
CommandSenderManager._init() {
|
CommandSenderManager._init() {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
static final CommandSenderManager _manager = CommandSenderManager._init();
|
||||||
|
|
||||||
|
static CommandSenderManager getInstance() => _manager;
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
initLockAddUserSucceedEvent();
|
_initLockAddUserSucceedEvent();
|
||||||
|
_initTransferSmartLockSucceedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下级界面修改成功后传递数据
|
// 蓝牙添加用户成功 继续发送上次未发送的数据
|
||||||
StreamSubscription? _passCurrentLockInformationEvent;
|
StreamSubscription? _passCurrentLockInformationEvent;
|
||||||
List<int> dataBeforeAddTheUser = [];
|
List<int> dataBeforeAddTheUser = <int>[];
|
||||||
|
void _initLockAddUserSucceedEvent() {
|
||||||
void initLockAddUserSucceedEvent() {
|
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_passCurrentLockInformationEvent = eventBus.on<LockAddUserSucceedEvent>().listen((event) {
|
_passCurrentLockInformationEvent = eventBus.on<LockAddUserSucceedEvent>().listen((LockAddUserSucceedEvent event) {
|
||||||
if (event.type == 0) {
|
if (event.type == 0) {
|
||||||
sendNormalData(dataBeforeAddTheUser);
|
sendNormalData(dataBeforeAddTheUser);
|
||||||
} else {
|
} else {
|
||||||
@ -41,10 +40,18 @@ class CommandSenderManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StreamSubscription? _transferSmartLockEvent;
|
||||||
|
List<int> dataTransferSmartLock = <int>[];
|
||||||
|
void _initTransferSmartLockSucceedEvent() {
|
||||||
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
|
_transferSmartLockEvent = eventBus.on<LockInitUserNoEvent>().listen((LockInitUserNoEvent event) {
|
||||||
|
sendNormalData(dataTransferSmartLock);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// CommandType lastCommandType = CommandType.readLockStatusInfo;
|
// CommandType lastCommandType = CommandType.readLockStatusInfo;
|
||||||
bool canSendControlCommand = false;
|
bool canSendControlCommand = false;
|
||||||
|
|
||||||
//TODO:发送常规数据
|
|
||||||
Future<void> managerSendData(
|
Future<void> managerSendData(
|
||||||
{required SenderProtocol command,
|
{required SenderProtocol command,
|
||||||
bool isBeforeAddUser = false,
|
bool isBeforeAddUser = false,
|
||||||
@ -56,15 +63,22 @@ class CommandSenderManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SenderBeforeDataManage().isBeforeAddUser = isBeforeAddUser;
|
SenderBeforeDataManage().isBeforeAddUser = isBeforeAddUser;
|
||||||
List<int> value = command.packageData();
|
final List<int> value = command.packageData();
|
||||||
if (isBeforeAddUser == true) {
|
if (isBeforeAddUser == true) {
|
||||||
// 如果是添加用户之前调用协议 直接发送
|
// 如果是添加用户之前调用协议 直接发送
|
||||||
sendNormalData(value);
|
sendNormalData(value);
|
||||||
} else {
|
} else {
|
||||||
|
// 当前锁被转移了 需要更新锁的userid 调用转移锁协议
|
||||||
|
if(CommonDataManage().initUserNo == 1){
|
||||||
|
final List<int> entity = await SenderBeforeDataManage().getTransferSmartLockData();
|
||||||
|
sendNormalData(entity);
|
||||||
|
dataTransferSmartLock = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 添加用户之后调用协议就要判断是否添加用户
|
// 添加用户之后调用协议就要判断是否添加用户
|
||||||
if (CommonDataManage().currentLockUserNo == 0) {
|
if (CommonDataManage().currentLockUserNo == 0) {
|
||||||
// 如果LockUserNo为0,先添加用户
|
// 如果LockUserNo为0,先添加用户
|
||||||
var entity = await SenderBeforeDataManage().getAddUserKeyData();
|
final List<int> entity = await SenderBeforeDataManage().getAddUserKeyData();
|
||||||
sendNormalData(entity);
|
sendNormalData(entity);
|
||||||
dataBeforeAddTheUser = value;
|
dataBeforeAddTheUser = value;
|
||||||
} else {
|
} else {
|
||||||
@ -73,7 +87,7 @@ class CommandSenderManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendNormalData(List<int> data) async {
|
Future<void> sendNormalData(List<int> data) async {
|
||||||
if (data.isNotEmpty) {
|
if (data.isNotEmpty) {
|
||||||
EventBusManager().eventBusFir(
|
EventBusManager().eventBusFir(
|
||||||
EventSendModel(data: data, sendChannel: DataChannel.ble));
|
EventSendModel(data: data, sendChannel: DataChannel.ble));
|
||||||
@ -137,5 +151,6 @@ class CommandSenderManager {
|
|||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
_passCurrentLockInformationEvent?.cancel();
|
_passCurrentLockInformationEvent?.cancel();
|
||||||
|
_transferSmartLockEvent?.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -278,6 +278,28 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo:转移智能锁
|
||||||
|
static void sendTransferSmartLockCommand(
|
||||||
|
{required String? lockID,
|
||||||
|
required String? userID,
|
||||||
|
required String? keyID,
|
||||||
|
required List<int>? publicKey,
|
||||||
|
required List<int>? privateKey,
|
||||||
|
required List<int>? token,
|
||||||
|
required int? needAuthor,
|
||||||
|
CommandSendCallBack? callBack}) {
|
||||||
|
CommandSenderManager().managerSendData(
|
||||||
|
command: FactoryDataResetCommand(
|
||||||
|
lockID: lockID,
|
||||||
|
userID: userID,
|
||||||
|
keyID: keyID,
|
||||||
|
needAuthor: needAuthor,
|
||||||
|
publicKey: publicKey,
|
||||||
|
privateKey: privateKey,
|
||||||
|
token: token),
|
||||||
|
callBack: callBack);
|
||||||
|
}
|
||||||
|
|
||||||
//todo:恢复出厂设置
|
//todo:恢复出厂设置
|
||||||
static void senderFactoryDataReset(
|
static void senderFactoryDataReset(
|
||||||
{required String? lockID,
|
{required String? lockID,
|
||||||
|
|||||||
@ -100,7 +100,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
|||||||
state.starTime.value = data['starTime'];
|
state.starTime.value = data['starTime'];
|
||||||
state.endTime.value = data['endTime'];
|
state.endTime.value = data['endTime'];
|
||||||
state.weekDay.value = data['weekDay'];
|
state.weekDay.value = data['weekDay'];
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,6 +84,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Future<void> loadData() async {
|
Future<void> loadData() async {
|
||||||
state.keyInfos.value = widget.lockListInfoItemEntity;
|
state.keyInfos.value = widget.lockListInfoItemEntity;
|
||||||
CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!;
|
CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!;
|
||||||
|
CommonDataManage().initUserNo = state.keyInfos.value.initUserNo!;
|
||||||
CommonDataManage().currentKeyInfo = state.keyInfos.value;
|
CommonDataManage().currentKeyInfo = state.keyInfos.value;
|
||||||
|
|
||||||
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
||||||
|
|||||||
@ -5,32 +5,32 @@ import 'package:get/get.dart';
|
|||||||
import 'lockSetInfo_entity.dart';
|
import 'lockSetInfo_entity.dart';
|
||||||
|
|
||||||
class LockSetState {
|
class LockSetState {
|
||||||
final lockSetInfoData = LockSetInfoData().obs;
|
final Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
||||||
final lockFeature = LockFeature().obs;
|
final Rx<LockFeature> lockFeature = LockFeature().obs;
|
||||||
final lockSettingInfo = LockSettingInfo().obs;
|
final Rx<LockSettingInfo> lockSettingInfo = LockSettingInfo().obs;
|
||||||
final lockStatus = LockStatus().obs;
|
final Rx<LockStatus> lockStatus = LockStatus().obs;
|
||||||
final lockBasicInfo = LockBasicInfo().obs;
|
final Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
|
||||||
|
|
||||||
final lockId = 0.obs;
|
final RxInt lockId = 0.obs;
|
||||||
|
|
||||||
var isOnlyOneData = false.obs;
|
RxBool isOnlyOneData = false.obs;
|
||||||
var isAttendance = 0.obs; // 是否开启考勤
|
RxInt isAttendance = 0.obs; // 是否开启考勤
|
||||||
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
RxInt isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
||||||
|
|
||||||
var isUnlockReminder = 0.obs; // 是否开启开锁提醒
|
RxInt isUnlockReminder = 0.obs; // 是否开启开锁提醒
|
||||||
var isOpenBlueBroadcast = 0.obs; // 是否开启蓝牙广播
|
RxInt isOpenBlueBroadcast = 0.obs; // 是否开启蓝牙广播
|
||||||
var isOpenExceptionWarnings = 0.obs; // 是否开启异常警告
|
RxInt isOpenExceptionWarnings = 0.obs; // 是否开启异常警告
|
||||||
var isOpenStayWarn = 0.obs; // 是否开启逗留警告
|
RxInt isOpenStayWarn = 0.obs; // 是否开启逗留警告
|
||||||
|
|
||||||
var passwordTF = TextEditingController();
|
TextEditingController passwordTF = TextEditingController();
|
||||||
|
|
||||||
var settingUpSupportFeatures = 0;
|
int settingUpSupportFeatures = 0;
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
var deleteAdministratorIsHaveAllData = false.obs; // 删除管理员是否有所有数据
|
RxBool deleteAdministratorIsHaveAllData = false.obs; // 删除管理员是否有所有数据
|
||||||
|
|
||||||
LockSetState() {
|
LockSetState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
lockId.value = map["lockId"];
|
lockId.value = map['lockId'];
|
||||||
isOnlyOneData.value = map["isOnlyOneData"];
|
isOnlyOneData.value = map['isOnlyOneData'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,6 +143,7 @@ class LockListInfoItemEntity {
|
|||||||
int? hasGateway;
|
int? hasGateway;
|
||||||
int? appUnlockOnline;
|
int? appUnlockOnline;
|
||||||
String? mac;
|
String? mac;
|
||||||
|
int? initUserNo;
|
||||||
|
|
||||||
LockListInfoItemEntity({
|
LockListInfoItemEntity({
|
||||||
this.keyId,
|
this.keyId,
|
||||||
@ -180,6 +181,7 @@ class LockListInfoItemEntity {
|
|||||||
this.hasGateway,
|
this.hasGateway,
|
||||||
this.appUnlockOnline,
|
this.appUnlockOnline,
|
||||||
this.mac,
|
this.mac,
|
||||||
|
this.initUserNo,
|
||||||
});
|
});
|
||||||
|
|
||||||
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
|
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
|
||||||
@ -224,6 +226,7 @@ class LockListInfoItemEntity {
|
|||||||
hasGateway = json['hasGateway'];
|
hasGateway = json['hasGateway'];
|
||||||
appUnlockOnline = json['appUnlockOnline'];
|
appUnlockOnline = json['appUnlockOnline'];
|
||||||
mac = json['mac'];
|
mac = json['mac'];
|
||||||
|
initUserNo = json['initUserNo'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -269,6 +272,7 @@ class LockListInfoItemEntity {
|
|||||||
data['hasGateway'] = hasGateway;
|
data['hasGateway'] = hasGateway;
|
||||||
data['appUnlockOnline'] = appUnlockOnline;
|
data['appUnlockOnline'] = appUnlockOnline;
|
||||||
data['mac'] = mac;
|
data['mac'] = mac;
|
||||||
|
data['initUserNo'] = initUserNo;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import '../../../../main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -13,8 +14,8 @@ class RecipientInformationLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 转移智能锁确认
|
// 转移智能锁确认
|
||||||
Future<void> transferLockConfirmInfoData(void Function(RecipientInformationData recipientInformationData) action) async{
|
Future<void> transferLockConfirmInfoData(void Function(RecipientInformationData recipientInformationData) action) async{
|
||||||
var entity = await ApiRepository.to.transferLockConfirmInfoData(
|
final RecipientInformationEntity entity = await ApiRepository.to.transferLockConfirmInfoData(
|
||||||
receiverUserid: state.numberController.text,
|
receiverUsername: state.numberController.text,
|
||||||
type: state.type.value.toString(),
|
type: state.type.value.toString(),
|
||||||
countryCode: state.countryCode.value
|
countryCode: state.countryCode.value
|
||||||
);
|
);
|
||||||
@ -29,32 +30,51 @@ class RecipientInformationLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 转移智能锁
|
// 转移智能锁
|
||||||
Future<void> transferLockInfoData() async{
|
Future<void> transferLockInfoData() async{
|
||||||
var entity = await ApiRepository.to.transferLockInfoData(
|
final RecipientInformationEntity entity = await ApiRepository.to.transferLockInfoData(
|
||||||
receiverUserid: state.numberController.text,
|
receiverUsername: state.numberController.text,
|
||||||
lockIdList: state.idList.value,
|
lockIdList: state.idList.value,
|
||||||
countryCode: state.countryCode.value
|
countryCode: state.countryCode.value
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Get.back(result: "scuess");
|
showToast('转移成功'.tr, something: (){
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
Get.back(result: 'scuess');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移除坏锁
|
// 移除坏锁
|
||||||
Future<void> removeBrokenLockData() async{
|
Future<void> removeBrokenLockData() async{
|
||||||
var entity = await ApiRepository.to.removeBrokenLockData(
|
final RecipientInformationEntity entity = await ApiRepository.to.removeBrokenLockData(
|
||||||
lockIdList: state.idList.value,
|
lockIdList: state.idList.value,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
showToast('移除成功'.tr, something: (){
|
||||||
Get.back(result: "scuess");
|
Get.back(result: 'scuess');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询账户密码
|
||||||
|
Future<void> checkLoginPassword() async {
|
||||||
|
final LockListInfoEntity entity = await ApiRepository.to.checkLoginPassword(
|
||||||
|
password: state.passwordTF.text,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Get.back();
|
||||||
|
if (state.isFromType.value == 1) {
|
||||||
|
// 转移智能锁 transferGatewayInfoData
|
||||||
|
transferLockInfoData();
|
||||||
|
} else {
|
||||||
|
// 转移网关
|
||||||
|
transferGatewayInfoData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转移网关确认
|
// 转移网关确认
|
||||||
Future<void> transferGateWayConfirmInfoData(void Function(RecipientInformationData recipientInformationData) action) async{
|
Future<void> transferGateWayConfirmInfoData(void Function(RecipientInformationData recipientInformationData) action) async{
|
||||||
var entity = await ApiRepository.to.transferGatewayConfirmInfoData(
|
final RecipientInformationEntity entity = await ApiRepository.to.transferGatewayConfirmInfoData(
|
||||||
receiverUserid: state.numberController.text,
|
receiverUsername: state.numberController.text,
|
||||||
type: state.type.value.toString(),
|
type: state.type.value.toString(),
|
||||||
countryCode: state.countryCode.value
|
countryCode: state.countryCode.value
|
||||||
);
|
);
|
||||||
@ -65,13 +85,13 @@ class RecipientInformationLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 转移网关
|
// 转移网关
|
||||||
Future<void> transferGatewayInfoData() async{
|
Future<void> transferGatewayInfoData() async{
|
||||||
var entity = await ApiRepository.to.transferGatewayInfoData(
|
final RecipientInformationEntity entity = await ApiRepository.to.transferGatewayInfoData(
|
||||||
receiverUserid: state.numberController.text,
|
receiverUsername: state.numberController.text,
|
||||||
plugIdList: state.idList.value,
|
plugIdList: state.idList.value,
|
||||||
countryCode: state.countryCode.value
|
countryCode: state.countryCode.value
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Get.back(result: "scuess");
|
Get.back(result: 'scuess');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,16 +99,14 @@ class RecipientInformationLogic extends BaseGetXController{
|
|||||||
void showDeletAlertDialog() {
|
void showDeletAlertDialog() {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
title: const Text("提示"),
|
title: const Text('提示'),
|
||||||
content: const Text('确定要移除所选中的坏锁吗?'),
|
content: const Text('确定要移除所选中的坏锁吗?'),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
onPressed: () {
|
onPressed: Get.back,
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
@ -103,23 +121,4 @@ class RecipientInformationLogic extends BaseGetXController{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -11,6 +12,8 @@ import '../../../../../app_settings/app_colors.dart';
|
|||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/customNetworkImage.dart';
|
||||||
|
import '../../../../tools/showTipView.dart';
|
||||||
import 'recipientInformation_entity.dart';
|
import 'recipientInformation_entity.dart';
|
||||||
|
|
||||||
class RecipientInformationPage extends StatefulWidget {
|
class RecipientInformationPage extends StatefulWidget {
|
||||||
@ -61,7 +64,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
state.type.value == 1
|
state.type.value == 1
|
||||||
? 'images/select_circle.png'
|
? 'images/select_circle.png'
|
||||||
: 'images/normal_circle.png',
|
: 'images/normal_circle.png',
|
||||||
'个人用户', () {
|
'个人用户'.tr, () {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.type.value = 1;
|
state.type.value = 1;
|
||||||
});
|
});
|
||||||
@ -70,7 +73,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
state.type.value == 2
|
state.type.value == 2
|
||||||
? 'images/select_circle.png'
|
? 'images/select_circle.png'
|
||||||
: 'images/normal_circle.png',
|
: 'images/normal_circle.png',
|
||||||
'星寓', () {
|
'星寓'.tr, () {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.type.value = 2;
|
state.type.value = 2;
|
||||||
});
|
});
|
||||||
@ -90,9 +93,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(width: 20.w),
|
||||||
width: 40.w,
|
|
||||||
),
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
leftIcon,
|
leftIcon,
|
||||||
@ -100,9 +101,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
height: 20.w,
|
height: 20.w,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(width: 16.w),
|
||||||
width: 16.w,
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
leftTitle,
|
leftTitle,
|
||||||
style: TextStyle(fontSize: 24.sp),
|
style: TextStyle(fontSize: 24.sp),
|
||||||
@ -122,9 +121,9 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 40.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
Text('账号',
|
Text('账号'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -136,7 +135,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintText:
|
hintText:
|
||||||
state.type.value == 1 ? '请输入手机号或email' : '请输入星寓管理员的账号',
|
state.type.value == 1 ? '请输入手机号或email'.tr : '请输入星寓管理员的账号'.tr,
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
color: AppColors.placeholderTextColor,
|
color: AppColors.placeholderTextColor,
|
||||||
fontSize: ScreenUtil().setSp(22),
|
fontSize: ScreenUtil().setSp(22),
|
||||||
@ -205,7 +204,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(top: 20.h, bottom: 80.h),
|
padding: EdgeInsets.only(top: 20.h, bottom: 80.h),
|
||||||
child: Text(
|
child: Text(
|
||||||
'选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权',
|
'选中的智能锁将会转移到您输入的账号中,您将失去锁的管理权'.tr,
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor),
|
TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
@ -215,10 +214,10 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
|
|
||||||
Widget _buildNextBtn(BuildContext context) {
|
Widget _buildNextBtn(BuildContext context) {
|
||||||
return SubmitBtn(
|
return SubmitBtn(
|
||||||
btnName: '下一步',
|
btnName: '下一步'.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (state.numberController.text.isEmpty) {
|
if (state.numberController.text.isEmpty) {
|
||||||
logic.showToast('请输入手机号或email');
|
logic.showToast('请输入手机号或email'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.isFromType.value == 1) {
|
if (state.isFromType.value == 1) {
|
||||||
@ -228,7 +227,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
showCupertinoAlertDialog(context, v);
|
showCupertinoAlertDialog(context, v);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
logic.showToast('暂不支持跨平台转移,敬请期待');
|
logic.showToast('暂不支持跨平台转移,敬请期待'.tr);
|
||||||
// Get.toNamed(Routers.selectBranchPage, arguments: {
|
// Get.toNamed(Routers.selectBranchPage, arguments: {
|
||||||
// "idList": state.idList.value,
|
// "idList": state.idList.value,
|
||||||
// "countryCode": state.countryCode.value,
|
// "countryCode": state.countryCode.value,
|
||||||
@ -243,7 +242,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
showCupertinoAlertDialog(context, v);
|
showCupertinoAlertDialog(context, v);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
logic.showToast('暂不支持跨平台转移,敬请期待');
|
logic.showToast('暂不支持跨平台转移,敬请期待'.tr);
|
||||||
|
|
||||||
// Get.toNamed(Routers.selectBranchPage, arguments: {
|
// Get.toNamed(Routers.selectBranchPage, arguments: {
|
||||||
// "idList": state.idList.value,
|
// "idList": state.idList.value,
|
||||||
@ -263,7 +262,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
TextButton(
|
TextButton(
|
||||||
onPressed: logic.showDeletAlertDialog,
|
onPressed: logic.showDeletAlertDialog,
|
||||||
child: Text(
|
child: Text(
|
||||||
'移除坏锁',
|
'移除坏锁'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
@ -295,14 +294,25 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: 400.w,
|
width: 400.w,
|
||||||
height: 400.h,
|
height: 400.h,
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(20.w),
|
||||||
|
color: Colors.white
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Text('转移确认', style: TextStyle(fontSize: 24.sp)),
|
Text('转移确认'.tr, style: TextStyle(fontSize: 24.sp)),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Image.asset('images/icon_lockGroup_item.png',
|
ClipRRect(
|
||||||
width: 70.h, height: 70.h, fit: BoxFit.fill),
|
borderRadius: BorderRadius.circular(40.w),
|
||||||
|
child:CustomNetworkImage(
|
||||||
|
url: recipientInformationData.headUrl!,
|
||||||
|
defaultUrl: 'images/controls_user.png',
|
||||||
|
width: 80.w,
|
||||||
|
height: 80.w)
|
||||||
|
),
|
||||||
|
// Image.asset('images/icon_lockGroup_item.png',
|
||||||
|
// width: 70.h, height: 70.h, fit: BoxFit.fill),
|
||||||
SizedBox(height: 15.h),
|
SizedBox(height: 15.h),
|
||||||
Stack(
|
Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@ -310,25 +320,25 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(recipientInformationData.nickname!,
|
Text(recipientInformationData.nickname!,
|
||||||
style: TextStyle(fontSize: 22.sp)),
|
style: TextStyle(fontSize: 22.sp)),
|
||||||
Positioned(
|
// Positioned(
|
||||||
left: (recipientInformationData.nickname!.length * 19.w)
|
// left: (recipientInformationData.nickname!.length * 19.w)
|
||||||
.w,
|
// .w,
|
||||||
child: Container(
|
// child: Container(
|
||||||
width: 80.w,
|
// width: 80.w,
|
||||||
color: Colors.red,
|
// color: Colors.red,
|
||||||
child: Center(
|
// child: Center(
|
||||||
child: Text(state.type.value == 1 ? '个人用户' : '星寓',
|
// child: Text(state.type.value == 1 ? '个人用户'.tr : '星寓'.tr,
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
fontSize: 18.sp, color: Colors.white))),
|
// fontSize: 18.sp, color: Colors.white))),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8.h),
|
||||||
Text(recipientInformationData.userid!,
|
Text(recipientInformationData.userid!,
|
||||||
style: TextStyle(fontSize: 22.sp)),
|
style: TextStyle(fontSize: 22.sp)),
|
||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8.h),
|
||||||
Text('本次共转移${state.idList.value.length}把智能锁',
|
Text('本次共转移'.tr + '${state.idList.value.length}' + '把智能锁'.tr,
|
||||||
style: TextStyle(fontSize: 20.sp)),
|
style: TextStyle(fontSize: 20.sp)),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Row(
|
Row(
|
||||||
@ -349,13 +359,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
if (state.isFromType.value == 1) {
|
ShowTipView().showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, logic.checkLoginPassword);
|
||||||
// 转移智能锁 transferGatewayInfoData
|
|
||||||
logic.transferLockInfoData();
|
|
||||||
} else {
|
|
||||||
// 转移网关
|
|
||||||
logic.transferGatewayInfoData();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: AppColors.appBarIconColor, backgroundColor: AppColors.mainColor,
|
foregroundColor: AppColors.appBarIconColor, backgroundColor: AppColors.mainColor,
|
||||||
@ -365,7 +369,7 @@ class _RecipientInformationPageState extends State<RecipientInformationPage> {
|
|||||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text('确认', style: TextStyle(fontSize: 22.sp)),
|
child: Text('确认'.tr, style: TextStyle(fontSize: 22.sp)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@ -4,18 +4,20 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class RecipientInformationState{
|
class RecipientInformationState{
|
||||||
var type = 1.obs;// 1、个人用户 2、星寓用户
|
RecipientInformationState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
idList.value = map['idList'];
|
||||||
|
isFromType.value = map['isFromType'];
|
||||||
|
}
|
||||||
|
RxInt type = 1.obs;// 1、个人用户 2、星寓用户
|
||||||
final TextEditingController numberController = TextEditingController();
|
final TextEditingController numberController = TextEditingController();
|
||||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||||
late Contact contact;
|
late Contact contact;
|
||||||
|
|
||||||
final countryName = "中国".obs;
|
TextEditingController passwordTF = TextEditingController();
|
||||||
final countryCode = "86".obs;
|
|
||||||
final isFromType = 1.obs; // 1从转移智能锁过来 2 转移网关
|
final RxString countryName = '中国'.obs;
|
||||||
final idList = [].obs;
|
final RxString countryCode = '86'.obs;
|
||||||
RecipientInformationState() {
|
final RxInt isFromType = 1.obs; // 1从转移智能锁过来 2 转移网关
|
||||||
Map map = Get.arguments;
|
final RxList idList = [].obs;
|
||||||
idList.value = map["idList"];
|
|
||||||
isFromType.value = map["isFromType"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/transferSmartLock/selectBranch/selectBranch_state.dart';
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
@ -16,8 +18,8 @@ class SelectBranchPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SelectBranchPageState extends State<SelectBranchPage> {
|
class _SelectBranchPageState extends State<SelectBranchPage> {
|
||||||
final logic = Get.put(SelectBranchLogic());
|
final SelectBranchLogic logic = Get.put(SelectBranchLogic());
|
||||||
final state = Get.find<SelectBranchLogic>().state;
|
final SelectBranchState state = Get.find<SelectBranchLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -29,16 +31,12 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
_buildTopView(),
|
_buildTopView(),
|
||||||
SizedBox(
|
SizedBox(height: 20.h),
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
_buildNextBtn(),
|
_buildNextBtn(),
|
||||||
SizedBox(
|
SizedBox(height: 64.h)
|
||||||
height: 64.h,
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -51,17 +49,17 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(left: 40.w, top: 20.h, bottom: 16.h),
|
padding: EdgeInsets.only(left: 40.w, top: 20.h, bottom: 16.h),
|
||||||
child: Text(
|
child: Text(
|
||||||
'公寓',
|
'公寓'.tr,
|
||||||
style: TextStyle(fontSize: 28.sp),
|
style: TextStyle(fontSize: 28.sp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(() => Padding(
|
Obx(() => Padding(
|
||||||
padding: EdgeInsets.only(left: 40.w),
|
padding: EdgeInsets.only(left: 40.w),
|
||||||
child: Text('管理员:${state.receiverNumber.value}',
|
child: Text('管理员'.tr + ':${state.receiverNumber.value}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.darkGrayTextColor, fontSize: 24.sp)),
|
color: AppColors.darkGrayTextColor, fontSize: 24.sp)),
|
||||||
))
|
))
|
||||||
@ -73,7 +71,7 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
itemCount: 1,
|
itemCount: 1,
|
||||||
separatorBuilder: (context, index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return Divider(
|
return Divider(
|
||||||
height: 1,
|
height: 1,
|
||||||
indent: 20.w,
|
indent: 20.w,
|
||||||
@ -81,8 +79,8 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
color: AppColors.greyLineColor,
|
color: AppColors.greyLineColor,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
return _electronicKeyItem('images/normal_circle.png', "分组一", () {});
|
return _electronicKeyItem('images/normal_circle.png', '分组一', () {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +93,7 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 40.w,
|
width: 40.w,
|
||||||
),
|
),
|
||||||
@ -131,7 +129,7 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
// showCupertinoAlertDialog(context, RecipientInformationData());
|
// showCupertinoAlertDialog(context, RecipientInformationData());
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'下一步',
|
'下一步'.tr,
|
||||||
style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
@ -159,9 +157,9 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
height: 370.h,
|
height: 370.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Text("转移确认", style: TextStyle(fontSize: 24.sp)),
|
Text('转移确认', style: TextStyle(fontSize: 24.sp)),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Image.asset('images/icon_lockGroup_item.png', width: 70.h, height: 70.h, fit: BoxFit.fill),
|
Image.asset('images/icon_lockGroup_item.png', width: 70.h, height: 70.h, fit: BoxFit.fill),
|
||||||
SizedBox(height: 15.h),
|
SizedBox(height: 15.h),
|
||||||
@ -175,7 +173,7 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: 80.w,
|
width: 80.w,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
child: Center(child: Text(state.type.value == 1 ? "个人用户" : "星寓", style: TextStyle(fontSize: 18.sp, color: Colors.white))),
|
child: Center(child: Text(state.type.value == 1 ? '个人用户' : '星寓', style: TextStyle(fontSize: 18.sp, color: Colors.white))),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -183,11 +181,11 @@ class _SelectBranchPageState extends State<SelectBranchPage> {
|
|||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8.h),
|
||||||
Text(recipientInformationData.userid!, style: TextStyle(fontSize: 22.sp)),
|
Text(recipientInformationData.userid!, style: TextStyle(fontSize: 22.sp)),
|
||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8.h),
|
||||||
Text("本次共转移${state.idList.value.length}把智能锁", style: TextStyle(fontSize: 20.sp)),
|
Text('本次共转移${state.idList.value.length}把智能锁', style: TextStyle(fontSize: 20.sp)),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: <Widget>[
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: Get.back,
|
onPressed: Get.back,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import 'transferSmartLock_entity.dart';
|
import 'transferSmartLock_entity.dart';
|
||||||
@ -9,30 +11,11 @@ class TransferSmartLockLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 获取锁列表
|
// 获取锁列表
|
||||||
Future<TransferSmartLockEntity> getTransferLockListData() async{
|
Future<TransferSmartLockEntity> getTransferLockListData() async{
|
||||||
var entity = await ApiRepository.to.getTransferLockListData();
|
final TransferSmartLockEntity entity = await ApiRepository.to.getTransferLockListData(searchStr: state.searchController.text);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
state.transferSmartLockListData.value = entity.data!.list!;
|
state.transferSmartLockListData.value = entity.data!.list!;
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
|
||||||
// getTransferLockListData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,12 +1,16 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_state.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
import '../../../../tools/EasyRefreshTool.dart';
|
import '../../../../tools/EasyRefreshTool.dart';
|
||||||
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/keySearchWidget.dart';
|
import '../../../../tools/keySearchWidget.dart';
|
||||||
import '../../../../tools/noData.dart';
|
import '../../../../tools/noData.dart';
|
||||||
import 'transferSmartLock_entity.dart';
|
import 'transferSmartLock_entity.dart';
|
||||||
@ -19,9 +23,9 @@ class TransferSmartLockPage extends StatefulWidget {
|
|||||||
State<TransferSmartLockPage> createState() => _TransferSmartLockPageState();
|
State<TransferSmartLockPage> createState() => _TransferSmartLockPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
class _TransferSmartLockPageState extends State<TransferSmartLockPage> with RouteAware {
|
||||||
final logic = Get.put(TransferSmartLockLogic());
|
final TransferSmartLockLogic logic = Get.put(TransferSmartLockLogic());
|
||||||
final state = Get.find<TransferSmartLockLogic>().state;
|
final TransferSmartLockState state = Get.find<TransferSmartLockLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData() async {
|
||||||
logic.getTransferLockListData().then((TransferSmartLockEntity value){
|
logic.getTransferLockListData().then((TransferSmartLockEntity value){
|
||||||
@ -44,17 +48,17 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
|||||||
barTitle: TranslationLoader.lanKeys!.selectiveLock!.tr,
|
barTitle: TranslationLoader.lanKeys!.selectiveLock!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
if(state.isSelectAll == true){
|
if(state.isSelectAll == true){
|
||||||
for (var element in state.transferSmartLockListData.value) {
|
for (final TransferSmartLockItemData element in state.transferSmartLockListData.value) {
|
||||||
state.isSelectAll = false;
|
state.isSelectAll = false;
|
||||||
element.select = 0;
|
element.select = 0;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
for (var element in state.transferSmartLockListData.value) {
|
for (final TransferSmartLockItemData element in state.transferSmartLockListData.value) {
|
||||||
state.isSelectAll = true;
|
state.isSelectAll = true;
|
||||||
element.select = 1;
|
element.select = 1;
|
||||||
}
|
}
|
||||||
@ -68,29 +72,29 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
|||||||
onRefresh: (){
|
onRefresh: (){
|
||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
child: Obx(() => state.transferSmartLockListData.value.isNotEmpty ? Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
// KeySearchWidget(
|
KeySearchWidget(
|
||||||
// editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
// onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
// getHttpData();
|
getHttpData();
|
||||||
// },
|
},
|
||||||
// ),
|
),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
_buildNextBtn(),
|
_buildNextBtn(),
|
||||||
SizedBox(height: 64.h)
|
SizedBox(height: 64.h)
|
||||||
],
|
],
|
||||||
): NoData()),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return ListView.separated(
|
return Obx(() => state.transferSmartLockListData.value.isNotEmpty ? ListView.separated(
|
||||||
itemCount: state.transferSmartLockListData.value.length,
|
itemCount: state.transferSmartLockListData.value.length,
|
||||||
separatorBuilder: (context, index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return Divider(
|
return Divider(
|
||||||
height: 1,
|
height: 1,
|
||||||
indent: 20.w,
|
indent: 20.w,
|
||||||
@ -98,8 +102,8 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
|||||||
color: AppColors.greyLineColor,
|
color: AppColors.greyLineColor,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
TransferSmartLockItemData transferSmartLockItemData = state.transferSmartLockListData.value[index];
|
final TransferSmartLockItemData transferSmartLockItemData = state.transferSmartLockListData.value[index];
|
||||||
return _electronicKeyItem(transferSmartLockItemData, () {
|
return _electronicKeyItem(transferSmartLockItemData, () {
|
||||||
setState(() {
|
setState(() {
|
||||||
if(transferSmartLockItemData.select == 1){
|
if(transferSmartLockItemData.select == 1){
|
||||||
@ -109,7 +113,7 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}): NoData());
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(TransferSmartLockItemData transferSmartLockItemData, Function() action) {
|
Widget _electronicKeyItem(TransferSmartLockItemData transferSmartLockItemData, Function() action) {
|
||||||
@ -117,17 +121,20 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
|||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height: 90.h,
|
// height: 90.h,
|
||||||
|
padding: EdgeInsets.only(top: 10.h, bottom: 10.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Image.asset((transferSmartLockItemData.select == 1) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w),
|
Image.asset((transferSmartLockItemData.select == 1) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w),
|
||||||
SizedBox(width: 16.w),
|
SizedBox(width: 16.w),
|
||||||
Image.asset('images/icon_lockGroup_item.png', width: 50.h, height: 50.h, fit: BoxFit.fill),
|
Image.asset('images/icon_lockGroup_item.png', width: 50.h, height: 50.h, fit: BoxFit.fill),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
Text(transferSmartLockItemData.lockAlias!, style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor))
|
Flexible(
|
||||||
|
child: Text(transferSmartLockItemData.lockAlias!, style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor)),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -143,28 +150,72 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
|||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
bool isCanNext = false;
|
bool isCanNext = false;
|
||||||
var idList = [];
|
final List idList = [];
|
||||||
for (var element in state.transferSmartLockListData.value) {
|
for (final TransferSmartLockItemData element in state.transferSmartLockListData.value) {
|
||||||
if(element.select == 1){
|
if(element.select == 1){
|
||||||
isCanNext = true;
|
isCanNext = true;
|
||||||
idList.add(element.lockId);
|
idList.add(element.lockId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isCanNext == false){
|
if(isCanNext == false){
|
||||||
logic.showToast("请选择锁".tr);
|
logic.showToast('请选择锁'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var data = await Get.toNamed(Routers.recipientInformationPage, arguments: {
|
final data = await Get.toNamed(Routers.recipientInformationPage, arguments: <String, Object>{
|
||||||
"idList":idList,
|
'idList':idList,
|
||||||
"isFromType":1,
|
'isFromType':1,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
logic.getTransferLockListData();
|
await getHttpData();
|
||||||
|
// eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text('下一步', style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
child: Text('下一步'.tr, style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
/// 路由订阅
|
||||||
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPopNext() {
|
||||||
|
super.didPopNext();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 进入下级界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
super.didPushNext();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import 'package:get/get.dart';
|
|||||||
import 'transferSmartLock_entity.dart';
|
import 'transferSmartLock_entity.dart';
|
||||||
|
|
||||||
class TransferSmartLockState{
|
class TransferSmartLockState{
|
||||||
var transferSmartLockListData = <TransferSmartLockItemData>[].obs;
|
RxList<TransferSmartLockItemData> transferSmartLockListData = <TransferSmartLockItemData>[].obs;
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
bool isSelectAll = false;
|
bool isSelectAll = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -354,6 +354,15 @@ class ApiProvider extends BaseProvider {
|
|||||||
}),
|
}),
|
||||||
isUnShowLoading: true);
|
isUnShowLoading: true);
|
||||||
|
|
||||||
|
// 更新锁InitUserNo
|
||||||
|
Future<Response> updateLockInitUserNo(int lockId, int initUserNo) => post(
|
||||||
|
lockUpdateLockInfo.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'initUserNo': initUserNo,
|
||||||
|
}),
|
||||||
|
isUnShowLoading: true);
|
||||||
|
|
||||||
// 绑定蓝牙管理员
|
// 绑定蓝牙管理员
|
||||||
Future<Response> bindingBlueAdmin(
|
Future<Response> bindingBlueAdmin(
|
||||||
String lockAlias,
|
String lockAlias,
|
||||||
@ -1449,27 +1458,29 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({'lockId': lockId, 'cardName': cardName}));
|
jsonEncode({'lockId': lockId, 'cardName': cardName}));
|
||||||
|
|
||||||
// 获取转移锁锁列表
|
// 获取转移锁锁列表
|
||||||
Future<Response> getTransferLockListData() =>
|
Future<Response> getTransferLockListData(String searchStr) =>
|
||||||
post(transferLockListURL.toUrl, jsonEncode({}));
|
post(transferLockListURL.toUrl, jsonEncode({
|
||||||
|
"searchStr":searchStr
|
||||||
|
}));
|
||||||
|
|
||||||
// 转移智能锁确认
|
// 转移智能锁确认
|
||||||
Future<Response> transferLockConfirmInfoData(
|
Future<Response> transferLockConfirmInfoData(
|
||||||
String receiverUserid, String type, String countryCode) =>
|
String receiverUsername, String type, String countryCode) =>
|
||||||
post(
|
post(
|
||||||
transferLockConfirmURL.toUrl,
|
transferLockConfirmURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverUserid': receiverUserid,
|
'receiverUsername': receiverUsername,
|
||||||
'type': type,
|
'type': type,
|
||||||
'countryCode': countryCode
|
'countryCode': countryCode
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 转移智能锁
|
// 转移智能锁
|
||||||
Future<Response> transferLockInfoData(
|
Future<Response> transferLockInfoData(
|
||||||
String receiverUserid, List lockIdList, String countryCode) =>
|
String receiverUsername, List lockIdList, String countryCode) =>
|
||||||
post(
|
post(
|
||||||
transferLockURL.toUrl,
|
transferLockURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverUserid': receiverUserid,
|
'receiverUsername': receiverUsername,
|
||||||
'lockIdList': lockIdList,
|
'lockIdList': lockIdList,
|
||||||
'countryCode': countryCode
|
'countryCode': countryCode
|
||||||
}));
|
}));
|
||||||
@ -1481,22 +1492,22 @@ class ApiProvider extends BaseProvider {
|
|||||||
|
|
||||||
// 转移网关确认
|
// 转移网关确认
|
||||||
Future<Response> transferGatewayConfirmInfoData(
|
Future<Response> transferGatewayConfirmInfoData(
|
||||||
String receiverUserid, String type, String countryCode) =>
|
String receiverUsername, String type, String countryCode) =>
|
||||||
post(
|
post(
|
||||||
transferGatewayConfirmURL.toUrl,
|
transferGatewayConfirmURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverUserid': receiverUserid,
|
'receiverUsername': receiverUsername,
|
||||||
'type': type,
|
'type': type,
|
||||||
'countryCode': countryCode
|
'countryCode': countryCode
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 转移网关
|
// 转移网关
|
||||||
Future<Response> transferGatewayInfoData(
|
Future<Response> transferGatewayInfoData(
|
||||||
String receiverUserid, List plugIdList, String countryCode) =>
|
String receiverUsername, List plugIdList, String countryCode) =>
|
||||||
post(
|
post(
|
||||||
transferGatewayURL.toUrl,
|
transferGatewayURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverUserid': receiverUserid,
|
'receiverUsername': receiverUsername,
|
||||||
'plugIdList': plugIdList,
|
'plugIdList': plugIdList,
|
||||||
'countryCode': countryCode
|
'countryCode': countryCode
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -318,6 +318,13 @@ class ApiRepository {
|
|||||||
return LockNetTokenEntity.fromJson(res.body);
|
return LockNetTokenEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新锁用户 InitUserNo
|
||||||
|
Future<LockNetTokenEntity> updateLockInitUserNo(
|
||||||
|
{required int lockId, required int initUserNo}) async {
|
||||||
|
final res = await apiProvider.updateLockInitUserNo(lockId, initUserNo);
|
||||||
|
return LockNetTokenEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
// 绑定蓝牙管理员
|
// 绑定蓝牙管理员
|
||||||
Future<SaveLockEntity> bindingBlueAdmin(
|
Future<SaveLockEntity> bindingBlueAdmin(
|
||||||
{required String lockAlias,
|
{required String lockAlias,
|
||||||
@ -1639,28 +1646,28 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取转移锁锁列表
|
// 获取转移锁锁列表
|
||||||
Future<TransferSmartLockEntity> getTransferLockListData() async {
|
Future<TransferSmartLockEntity> getTransferLockListData({required String searchStr}) async {
|
||||||
final res = await apiProvider.getTransferLockListData();
|
final res = await apiProvider.getTransferLockListData(searchStr);
|
||||||
return TransferSmartLockEntity.fromJson(res.body);
|
return TransferSmartLockEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转移智能锁确认
|
// 转移智能锁确认
|
||||||
Future<RecipientInformationEntity> transferLockConfirmInfoData(
|
Future<RecipientInformationEntity> transferLockConfirmInfoData(
|
||||||
{required String receiverUserid,
|
{required String receiverUsername,
|
||||||
required String type,
|
required String type,
|
||||||
required String countryCode}) async {
|
required String countryCode}) async {
|
||||||
final res = await apiProvider.transferLockConfirmInfoData(
|
final res = await apiProvider.transferLockConfirmInfoData(
|
||||||
receiverUserid, type, countryCode);
|
receiverUsername, type, countryCode);
|
||||||
return RecipientInformationEntity.fromJson(res.body);
|
return RecipientInformationEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转移智能锁
|
// 转移智能锁
|
||||||
Future<RecipientInformationEntity> transferLockInfoData(
|
Future<RecipientInformationEntity> transferLockInfoData(
|
||||||
{required String receiverUserid,
|
{required String receiverUsername,
|
||||||
required List lockIdList,
|
required List lockIdList,
|
||||||
required String countryCode}) async {
|
required String countryCode}) async {
|
||||||
final res = await apiProvider.transferLockInfoData(
|
final res = await apiProvider.transferLockInfoData(
|
||||||
receiverUserid, lockIdList, countryCode);
|
receiverUsername, lockIdList, countryCode);
|
||||||
return RecipientInformationEntity.fromJson(res.body);
|
return RecipientInformationEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1673,21 +1680,21 @@ class ApiRepository {
|
|||||||
|
|
||||||
// 转移网关确认
|
// 转移网关确认
|
||||||
Future<RecipientInformationEntity> transferGatewayConfirmInfoData(
|
Future<RecipientInformationEntity> transferGatewayConfirmInfoData(
|
||||||
{required String receiverUserid,
|
{required String receiverUsername,
|
||||||
required String type,
|
required String type,
|
||||||
required String countryCode}) async {
|
required String countryCode}) async {
|
||||||
final res = await apiProvider.transferGatewayConfirmInfoData(
|
final res = await apiProvider.transferGatewayConfirmInfoData(
|
||||||
receiverUserid, type, countryCode);
|
receiverUsername, type, countryCode);
|
||||||
return RecipientInformationEntity.fromJson(res.body);
|
return RecipientInformationEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转移智能锁
|
// 转移智能锁
|
||||||
Future<RecipientInformationEntity> transferGatewayInfoData(
|
Future<RecipientInformationEntity> transferGatewayInfoData(
|
||||||
{required String receiverUserid,
|
{required String receiverUsername,
|
||||||
required List plugIdList,
|
required List plugIdList,
|
||||||
required String countryCode}) async {
|
required String countryCode}) async {
|
||||||
final res = await apiProvider.transferGatewayInfoData(
|
final res = await apiProvider.transferGatewayInfoData(
|
||||||
receiverUserid, plugIdList, countryCode);
|
receiverUsername, plugIdList, countryCode);
|
||||||
return RecipientInformationEntity.fromJson(res.body);
|
return RecipientInformationEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,9 @@ class CommonDataManage {
|
|||||||
// set setCurrentLockUserNo(int v) => _currentLockUserNo = v;
|
// set setCurrentLockUserNo(int v) => _currentLockUserNo = v;
|
||||||
// get getCurrentLockUserNo => _currentLockUserNo;
|
// get getCurrentLockUserNo => _currentLockUserNo;
|
||||||
|
|
||||||
|
// 当前锁是否被转移 1-转移 0-未转移
|
||||||
|
int initUserNo = 0;
|
||||||
|
|
||||||
LockSetInfoData currentLockSetInfoData = LockSetInfoData();
|
LockSetInfoData currentLockSetInfoData = LockSetInfoData();
|
||||||
|
|
||||||
int dayLatestTime = (86400-1)*1000;
|
int dayLatestTime = (86400-1)*1000;
|
||||||
|
|||||||
@ -23,6 +23,11 @@ class LockAddUserSucceedEvent {
|
|||||||
LockAddUserSucceedEvent(this.dataList, this.type);
|
LockAddUserSucceedEvent(this.dataList, this.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 蓝牙转移用户更新成功
|
||||||
|
class LockInitUserNoEvent {
|
||||||
|
LockInitUserNoEvent();
|
||||||
|
}
|
||||||
|
|
||||||
/// 刷新锁详情数据
|
/// 刷新锁详情数据
|
||||||
class RefreshLockDetailInfoDataEvent {
|
class RefreshLockDetailInfoDataEvent {
|
||||||
RefreshLockDetailInfoDataEvent();
|
RefreshLockDetailInfoDataEvent();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user