Compare commits
1 Commits
develop_sk
...
develop_sk
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e53ecfbf5 |
BIN
images/icon_device_not_selected.png
Normal file
BIN
images/icon_device_not_selected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
BIN
images/icon_device_selected.png
Normal file
BIN
images/icon_device_selected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
BIN
images/icon_main_drlock_1024.png
Normal file
BIN
images/icon_main_drlock_1024.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 306 KiB |
@ -1185,5 +1185,6 @@
|
|||||||
"这是单次密码,只能使用一次": "这是单次密码,只能使用一次",
|
"这是单次密码,只能使用一次": "这是单次密码,只能使用一次",
|
||||||
"您好": "您好",
|
"您好": "您好",
|
||||||
"您的开门密码是": "您的开门密码是",
|
"您的开门密码是": "您的开门密码是",
|
||||||
"开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标": "开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标"
|
"开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标": "开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标",
|
||||||
|
"锁博士": "锁博士"
|
||||||
}
|
}
|
||||||
|
|||||||
74
lib/blue/io_protocol/io_readRegisterKey.dart
Normal file
74
lib/blue/io_protocol/io_readRegisterKey.dart
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import '../io_tool/io_tool.dart';
|
||||||
|
import '../sm4Encipher/sm4.dart';
|
||||||
|
import '../io_reply.dart';
|
||||||
|
import '../io_sender.dart';
|
||||||
|
import '../io_type.dart';
|
||||||
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
|
/// 读取注册密钥
|
||||||
|
class SenderReadRegisterKeyCommand extends SenderProtocol {
|
||||||
|
SenderReadRegisterKeyCommand({
|
||||||
|
this.lockID,
|
||||||
|
this.token,
|
||||||
|
this.needAuthor,
|
||||||
|
this.publicKey,
|
||||||
|
this.privateKey,
|
||||||
|
}) : super(CommandType.readRegisterKey);
|
||||||
|
|
||||||
|
String? lockID;
|
||||||
|
|
||||||
|
List<int>? token;
|
||||||
|
int? needAuthor;
|
||||||
|
List<int>? publicKey;
|
||||||
|
List<int>? privateKey;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SenderReadRegisterKeyCommand{ lockID: $lockID, token: $token, '
|
||||||
|
'needAuthor: $needAuthor, publicKey: $publicKey, '
|
||||||
|
'privateKey: $privateKey}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
|
||||||
|
if ((data.length % 16) != 0) {
|
||||||
|
final int add = 16 - data.length % 16;
|
||||||
|
for (int i = 0; i < add; i++) {
|
||||||
|
data.add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printLog(data);
|
||||||
|
|
||||||
|
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||||
|
return ebcData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SenderReadRegisterKeyCommandReply extends Reply {
|
||||||
|
SenderReadRegisterKeyCommandReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
|
: super.parseData(commandType, dataDetail) {
|
||||||
|
data = dataDetail;
|
||||||
|
|
||||||
|
final int status = data[6];
|
||||||
|
errorWithStstus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
106
lib/blue/io_protocol/io_sendAuthorizationCode.dart
Normal file
106
lib/blue/io_protocol/io_sendAuthorizationCode.dart
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import '../io_tool/io_tool.dart';
|
||||||
|
import '../sm4Encipher/sm4.dart';
|
||||||
|
import '../io_reply.dart';
|
||||||
|
import '../io_sender.dart';
|
||||||
|
import '../io_type.dart';
|
||||||
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
|
/// 发送授权码
|
||||||
|
class SenderAuthorizationCodeCommand extends SenderProtocol {
|
||||||
|
SenderAuthorizationCodeCommand({
|
||||||
|
this.lockID,
|
||||||
|
this.uuid,
|
||||||
|
this.key,
|
||||||
|
this.mac,
|
||||||
|
this.platform,
|
||||||
|
this.utcTimeStamp,
|
||||||
|
this.token,
|
||||||
|
this.needAuthor,
|
||||||
|
this.publicKey,
|
||||||
|
this.privateKey,
|
||||||
|
}) : super(CommandType.sendAuthorizationCode);
|
||||||
|
|
||||||
|
String? lockID;
|
||||||
|
String? uuid;
|
||||||
|
String? key;
|
||||||
|
String? mac;
|
||||||
|
int? platform; //0:锁通通;1:涂鸦智能
|
||||||
|
int? utcTimeStamp;
|
||||||
|
|
||||||
|
List<int>? token;
|
||||||
|
int? needAuthor;
|
||||||
|
List<int>? publicKey;
|
||||||
|
List<int>? privateKey;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SenderAuthorizationCodeCommand{ lockID: $lockID, token: $token, '
|
||||||
|
'needAuthor: $needAuthor, publicKey: $publicKey, '
|
||||||
|
'privateKey: $privateKey}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
|
||||||
|
// uuid 40
|
||||||
|
final int uuidLength = utf8.encode(uuid!).length;
|
||||||
|
data.addAll(utf8.encode(uuid!));
|
||||||
|
data = getFixedLengthList(data, 40 - uuidLength);
|
||||||
|
|
||||||
|
// key 40
|
||||||
|
final int keyLength = utf8.encode(key!).length;
|
||||||
|
data.addAll(utf8.encode(key!));
|
||||||
|
data = getFixedLengthList(data, 40 - keyLength);
|
||||||
|
|
||||||
|
// mac 40
|
||||||
|
final int macLength = utf8.encode(mac!).length;
|
||||||
|
data.addAll(utf8.encode(mac!));
|
||||||
|
data = getFixedLengthList(data, 40 - macLength);
|
||||||
|
|
||||||
|
data.add(platform!);
|
||||||
|
|
||||||
|
data.add((utcTimeStamp! & 0xff000000) >> 24);
|
||||||
|
data.add((utcTimeStamp! & 0xff0000) >> 16);
|
||||||
|
data.add((utcTimeStamp! & 0xff00) >> 8);
|
||||||
|
data.add(utcTimeStamp! & 0xff);
|
||||||
|
|
||||||
|
if ((data.length % 16) != 0) {
|
||||||
|
final int add = 16 - data.length % 16;
|
||||||
|
for (int i = 0; i < add; i++) {
|
||||||
|
data.add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printLog(data);
|
||||||
|
|
||||||
|
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||||
|
return ebcData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SenderAuthorizationCodeCommandReply extends Reply {
|
||||||
|
SenderAuthorizationCodeCommandReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
|
: super.parseData(commandType, dataDetail) {
|
||||||
|
data = dataDetail;
|
||||||
|
|
||||||
|
final int status = data[6];
|
||||||
|
errorWithStstus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,10 +9,10 @@ List<String> getDeviceType(DeviceType deviceType) {
|
|||||||
List<String> t = ['758824'];
|
List<String> t = ['758824'];
|
||||||
switch (deviceType) {
|
switch (deviceType) {
|
||||||
case DeviceType.blue:
|
case DeviceType.blue:
|
||||||
t = ['758824', '75', '768824', '76','24'];
|
t = ['758824', '75', '768824', '76', '24'];
|
||||||
break;
|
break;
|
||||||
case DeviceType.gateway:
|
case DeviceType.gateway:
|
||||||
t = ['758825','25'];
|
t = ['758825', '25'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
@ -53,6 +53,8 @@ enum CommandType {
|
|||||||
gatewayGetWifiList, //网关获取附近的wifi列表 0x30F6
|
gatewayGetWifiList, //网关获取附近的wifi列表 0x30F6
|
||||||
gatewayGetWifiListResult, //网关获取附近的wifi列表结果 0x30F7
|
gatewayGetWifiListResult, //网关获取附近的wifi列表结果 0x30F7
|
||||||
gatewayGetStatus, //获取网关状态 0x30F8
|
gatewayGetStatus, //获取网关状态 0x30F8
|
||||||
|
readRegisterKey, //读取注册密钥 0x30A7
|
||||||
|
sendAuthorizationCode, //发送授权码 0x30A6
|
||||||
|
|
||||||
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
||||||
gecChangeAdministratorPassword, // 通用扩展指令子命令-修改管理员密码 = 2
|
gecChangeAdministratorPassword, // 通用扩展指令子命令-修改管理员密码 = 2
|
||||||
@ -245,6 +247,16 @@ extension ExtensionCommandType on CommandType {
|
|||||||
type = CommandType.gatewayGetStatus;
|
type = CommandType.gatewayGetStatus;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 0x30A6:
|
||||||
|
{
|
||||||
|
type = CommandType.sendAuthorizationCode;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x30A7:
|
||||||
|
{
|
||||||
|
type = CommandType.readRegisterKey;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
type = CommandType.readStarLockStatusInfo;
|
type = CommandType.readStarLockStatusInfo;
|
||||||
@ -353,6 +365,12 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case CommandType.setLockCurrentVoicePacket:
|
case CommandType.setLockCurrentVoicePacket:
|
||||||
type = 0x30A5;
|
type = 0x30A5;
|
||||||
break;
|
break;
|
||||||
|
case CommandType.sendAuthorizationCode:
|
||||||
|
type = 0x30A6;
|
||||||
|
break;
|
||||||
|
case CommandType.readRegisterKey:
|
||||||
|
type = 0x30A7;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
type = 0x300A;
|
type = 0x300A;
|
||||||
break;
|
break;
|
||||||
@ -492,6 +510,12 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case 0x30A5:
|
case 0x30A5:
|
||||||
t = '设置锁当前语音包';
|
t = '设置锁当前语音包';
|
||||||
break;
|
break;
|
||||||
|
case 0x30A6:
|
||||||
|
t = '发送授权码';
|
||||||
|
break;
|
||||||
|
case 0x30A7:
|
||||||
|
t = '读取注册密钥';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
t = '读星锁状态信息';
|
t = '读星锁状态信息';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -16,10 +16,12 @@ import 'package:star_lock/blue/io_protocol/io_getDeviceModel.dart';
|
|||||||
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
|
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_readRegisterKey.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsNoParameters.dart';
|
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsNoParameters.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsWithParameters.dart';
|
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsWithParameters.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readVoicePackageFinalResult.dart';
|
import 'package:star_lock/blue/io_protocol/io_readVoicePackageFinalResult.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_referEventRecordTime.dart';
|
import 'package:star_lock/blue/io_protocol/io_referEventRecordTime.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_sendAuthorizationCode.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
|
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.dart';
|
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_setVoicePackageFinalResult.dart';
|
import 'package:star_lock/blue/io_protocol/io_setVoicePackageFinalResult.dart';
|
||||||
@ -331,6 +333,18 @@ class CommandReciverManager {
|
|||||||
SetVoicePackageFinalResultReply.parseData(commandType, data);
|
SetVoicePackageFinalResultReply.parseData(commandType, data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CommandType.readRegisterKey:
|
||||||
|
{
|
||||||
|
reply =
|
||||||
|
SenderReadRegisterKeyCommandReply.parseData(commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CommandType.sendAuthorizationCode:
|
||||||
|
{
|
||||||
|
reply =
|
||||||
|
SenderAuthorizationCodeCommandReply.parseData(commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CommandType.generalExtendedCommond:
|
case CommandType.generalExtendedCommond:
|
||||||
{
|
{
|
||||||
// 子命令类型
|
// 子命令类型
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
|||||||
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
|
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_readRegisterKey.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_sendAuthorizationCode.dart';
|
||||||
|
|
||||||
import 'io_gateway/io_gateway_configuringWifi.dart';
|
import 'io_gateway/io_gateway_configuringWifi.dart';
|
||||||
import 'io_gateway/io_gateway_getStatus.dart';
|
import 'io_gateway/io_gateway_getStatus.dart';
|
||||||
@ -1109,10 +1111,7 @@ class IoSenderManage {
|
|||||||
|
|
||||||
//ota 升级过程
|
//ota 升级过程
|
||||||
static void senderProcessOtaUpgradeCommand(
|
static void senderProcessOtaUpgradeCommand(
|
||||||
{required int? index,
|
{required int? index, required int? size, required List<int>? data, CommandSendCallBack? callBack}) {
|
||||||
required int? size,
|
|
||||||
required List<int>? data,
|
|
||||||
CommandSendCallBack? callBack}) {
|
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: ProcessOtaUpgradeCommand(
|
command: ProcessOtaUpgradeCommand(
|
||||||
index: index,
|
index: index,
|
||||||
@ -1321,8 +1320,7 @@ class IoSenderManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 网关获取wifi列表
|
// 网关获取wifi列表
|
||||||
static void gatewayGetWifiCommand(
|
static void gatewayGetWifiCommand({required String? userID, CommandSendCallBack? callBack}) {
|
||||||
{required String? userID, CommandSendCallBack? callBack}) {
|
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: GatewayGetWifiCommand(
|
command: GatewayGetWifiCommand(
|
||||||
userID: userID,
|
userID: userID,
|
||||||
@ -1339,21 +1337,51 @@ class IoSenderManage {
|
|||||||
CommandSendCallBack? callBack}) {
|
CommandSendCallBack? callBack}) {
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: GatewayConfiguringWifiCommand(
|
command: GatewayConfiguringWifiCommand(
|
||||||
ssid: ssid,
|
ssid: ssid, password: password, gatewayConfigurationStr: gatewayConfigurationStr),
|
||||||
password: password,
|
|
||||||
gatewayConfigurationStr: gatewayConfigurationStr),
|
|
||||||
isBeforeAddUser: true,
|
isBeforeAddUser: true,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取网关状态
|
// 获取网关状态
|
||||||
static void gatewayGetStatusCommand(
|
static void gatewayGetStatusCommand(
|
||||||
{required String? lockID,
|
{required String? lockID, required String? userID, CommandSendCallBack? callBack}) {
|
||||||
required String? userID,
|
|
||||||
CommandSendCallBack? callBack}) {
|
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: GatewayGetStatusCommand(lockID: lockID, userID: userID),
|
command: GatewayGetStatusCommand(lockID: lockID, userID: userID), isBeforeAddUser: true, callBack: callBack);
|
||||||
isBeforeAddUser: true,
|
}
|
||||||
callBack: callBack);
|
|
||||||
|
// 读取注册密钥
|
||||||
|
static void readRegisterKey({
|
||||||
|
required String? lockID,
|
||||||
|
CommandSendCallBack? callBack,
|
||||||
|
}) {
|
||||||
|
CommandSenderManager().managerSendData(
|
||||||
|
command: SenderReadRegisterKeyCommand(lockID: lockID),
|
||||||
|
isBeforeAddUser: true,
|
||||||
|
callBack: callBack,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送授权码
|
||||||
|
static void sendAuthorizationCode({
|
||||||
|
required String? lockID,
|
||||||
|
required String? uuid,
|
||||||
|
required String? key,
|
||||||
|
required String? mac,
|
||||||
|
required int? platform,
|
||||||
|
required int? utcTimeStamp,
|
||||||
|
CommandSendCallBack? callBack,
|
||||||
|
}) {
|
||||||
|
CommandSenderManager().managerSendData(
|
||||||
|
command: SenderAuthorizationCodeCommand(
|
||||||
|
lockID: lockID,
|
||||||
|
uuid: uuid,
|
||||||
|
key: key,
|
||||||
|
mac: mac,
|
||||||
|
platform: platform,
|
||||||
|
utcTimeStamp: utcTimeStamp,
|
||||||
|
),
|
||||||
|
isBeforeAddUser: true,
|
||||||
|
callBack: callBack,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,7 @@ class F {
|
|||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
case Flavor.sky_dev:
|
case Flavor.sky_dev:
|
||||||
case Flavor.sky_pre:
|
case Flavor.sky_pre:
|
||||||
return '锁通通'.tr;
|
return '锁博士'.tr;
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
case Flavor.xhj_bundle:
|
case Flavor.xhj_bundle:
|
||||||
case Flavor.xhj_dev:
|
case Flavor.xhj_dev:
|
||||||
@ -119,7 +119,7 @@ class F {
|
|||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
case Flavor.sky_dev:
|
case Flavor.sky_dev:
|
||||||
case Flavor.sky_pre:
|
case Flavor.sky_pre:
|
||||||
return '锁通通'.tr;
|
return '锁博士'.tr;
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
case Flavor.xhj_bundle:
|
case Flavor.xhj_bundle:
|
||||||
case Flavor.xhj_dev:
|
case Flavor.xhj_dev:
|
||||||
|
|||||||
@ -88,7 +88,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(10.w),
|
padding: EdgeInsets.all(10.w),
|
||||||
child: Center(child: Image.asset('images/icon_main_sky_1024.png', width: 110.w, height: 110.w))),
|
child: Center(child: Image.asset('images/icon_main_drlock_1024.png', width: 110.w, height: 110.w))),
|
||||||
SizedBox(height: 50.w),
|
SizedBox(height: 50.w),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '你所在的国家/地区'.tr,
|
leftTitel: '你所在的国家/地区'.tr,
|
||||||
|
|||||||
@ -69,6 +69,14 @@ FutureOr<void> main() async {
|
|||||||
String? token = await CallKitHandler.getVoipToken();
|
String? token = await CallKitHandler.getVoipToken();
|
||||||
print('获取到的VoIP Token: $token');
|
print('获取到的VoIP Token: $token');
|
||||||
}
|
}
|
||||||
|
// 在 runApp 之前设置
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
const SystemUiOverlayStyle(
|
||||||
|
statusBarColor: Colors.transparent, // 状态栏背景色(通常透明)
|
||||||
|
statusBarIconBrightness: Brightness.dark, // Android: 黑色图标
|
||||||
|
statusBarBrightness: Brightness.dark, // iOS: 状态栏内容为深色(影响时间等颜色)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
runApp(MyApp(isLogin: isLogin));
|
runApp(MyApp(isLogin: isLogin));
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,24 +1,109 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
class ActivateInfoResponse {
|
class ActivateInfoResponse {
|
||||||
ActivateInfoResponse({
|
ActivateInfoResponse({
|
||||||
this.description,
|
this.description,
|
||||||
this.errorCode,
|
this.errorCode,
|
||||||
this.data, // 现在是一个 List<ActivateInfo>
|
this.data, // 现在是一个 List<ActivateInfo>
|
||||||
this.errorMsg,
|
this.errorMsg,
|
||||||
});
|
});
|
||||||
|
|
||||||
ActivateInfoResponse.fromJson(dynamic json) {
|
ActivateInfoResponse.fromJson(dynamic json) {
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
errorCode = json['errorCode'];
|
errorCode = json['errorCode'];
|
||||||
// 修改这里:如果 json['data'] 是列表,则解析为 List<ActivateInfo>;否则为空列表
|
// 修改这里:直接解析为单个 ActivateInfo 对象
|
||||||
data = json['data'] != null
|
data = json['data'] != null ? ActivateInfo.fromJson(json['data']) : null;
|
||||||
? (json['data'] as List).map((item) => ActivateInfo.fromJson(item)).toList()
|
|
||||||
: [];
|
|
||||||
errorMsg = json['errorMsg'];
|
errorMsg = json['errorMsg'];
|
||||||
}
|
}
|
||||||
|
|
||||||
String? description;
|
String? description;
|
||||||
int? errorCode;
|
int? errorCode;
|
||||||
List<ActivateInfo>? data; // 改为 List<ActivateInfo>
|
ActivateInfo? data; // 改为 List<ActivateInfo>
|
||||||
|
String? errorMsg;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final map = <String, dynamic>{};
|
||||||
|
map['description'] = description;
|
||||||
|
map['errorCode'] = errorCode;
|
||||||
|
if (data != null) {
|
||||||
|
// 修改这里:将单个 ActivateInfo 对象转换为 JSON
|
||||||
|
map['data'] = data!.toJson();
|
||||||
|
}
|
||||||
|
map['errorMsg'] = errorMsg;
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ActivateInfoResponse{description: $description, errorCode: $errorCode, data: $data, errorMsg: $errorMsg}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ActivateInfo {
|
||||||
|
String? authCode;
|
||||||
|
String? activatedAt;
|
||||||
|
Map<String, dynamic>? extraParams; // 修改为 Map 类型
|
||||||
|
|
||||||
|
ActivateInfo({
|
||||||
|
this.authCode,
|
||||||
|
this.activatedAt,
|
||||||
|
this.extraParams,
|
||||||
|
});
|
||||||
|
|
||||||
|
ActivateInfo.fromJson(dynamic json) {
|
||||||
|
authCode = json['auth_code'] ?? '';
|
||||||
|
activatedAt = json['activated_at'] ?? '';
|
||||||
|
// 修改这里:将 extraParams 解析为 Map 对象
|
||||||
|
if (json['extra_params'] != null) {
|
||||||
|
if (json['extra_params'] is Map) {
|
||||||
|
extraParams = json['extra_params'];
|
||||||
|
} else if (json['extra_params'] is String) {
|
||||||
|
// 如果是字符串,尝试解析为 JSON 对象
|
||||||
|
try {
|
||||||
|
extraParams = jsonDecode(json['extra_params']);
|
||||||
|
} catch (e) {
|
||||||
|
// 解析失败则设为 null 或空 map
|
||||||
|
extraParams = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
extraParams = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final map = <String, dynamic>{};
|
||||||
|
map['authCode'] = authCode;
|
||||||
|
map['activatedAt'] = activatedAt;
|
||||||
|
map['extraParams'] = extraParams;
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ActivateInfo{authCode: $authCode, activatedAt: $activatedAt, extraParams: $extraParams}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TppSupportResponse {
|
||||||
|
TppSupportResponse({
|
||||||
|
this.description,
|
||||||
|
this.errorCode,
|
||||||
|
this.data, // 现在是一个 List<ActivateInfo>
|
||||||
|
this.errorMsg,
|
||||||
|
});
|
||||||
|
|
||||||
|
TppSupportResponse.fromJson(dynamic json) {
|
||||||
|
description = json['description'];
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
// 修改这里:如果 json['data'] 是列表,则解析为 List<ActivateInfo>;否则为空列表
|
||||||
|
data = json['data'] != null ? (json['data'] as List).map((item) => TppSupportInfo.fromJson(item)).toList() : [];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
}
|
||||||
|
|
||||||
|
String? description;
|
||||||
|
int? errorCode;
|
||||||
|
List<TppSupportInfo>? data; // 改为 List<ActivateInfo>
|
||||||
String? errorMsg;
|
String? errorMsg;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -35,33 +120,28 @@ class ActivateInfoResponse {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ActivateInfoResponse{description: $description, errorCode: $errorCode, data: $data, errorMsg: $errorMsg}';
|
return 'TppSupportResponse{description: $description, errorCode: $errorCode, data: $data, errorMsg: $errorMsg}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActivateInfo {
|
class TppSupportInfo {
|
||||||
String? platformName;
|
|
||||||
int? platform;
|
int? platform;
|
||||||
|
String? platformName;
|
||||||
|
|
||||||
ActivateInfo({
|
TppSupportInfo({
|
||||||
this.platformName,
|
|
||||||
this.platform,
|
this.platform,
|
||||||
|
this.platformName,
|
||||||
});
|
});
|
||||||
|
|
||||||
ActivateInfo.fromJson(dynamic json) {
|
TppSupportInfo.fromJson(dynamic json) {
|
||||||
platformName = json['platformName'] ?? '';
|
platform = json['platform'] as int? ?? -1;
|
||||||
platform = json['platform'] ?? '';
|
platformName = json['platform_name'] as String? ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final map = <String, dynamic>{};
|
final map = <String, dynamic>{};
|
||||||
map['platformName'] = platformName;
|
|
||||||
map['platform'] = platform;
|
map['platform'] = platform;
|
||||||
|
map['platform_name'] = platformName;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'ActivateInfo{platformName: $platformName, platform: $platform}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@ -35,27 +34,25 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
|||||||
skyCall: () => Scaffold(
|
skyCall: () => Scaffold(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: F.navTitle,
|
barTitle: F.navTitle,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: Colors.white,
|
||||||
body: LockDetailPage(
|
titleColor: Colors.black,
|
||||||
isOnlyOneData: isOnlyOneData,
|
iconColor: Colors.black,
|
||||||
lockListInfoItemEntity: keyInfos),
|
),
|
||||||
|
body: LockDetailPage(isOnlyOneData: isOnlyOneData, lockListInfoItemEntity: keyInfos),
|
||||||
// body: Container(),
|
// body: Container(),
|
||||||
),
|
),
|
||||||
xhjCall: () => Scaffold(
|
xhjCall: () => Scaffold(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: F.sw(
|
barTitle: F.sw(xhjCall: () => '星星锁'.tr, skyCall: () => keyInfos.lockAlias),
|
||||||
xhjCall: () => '星星锁'.tr, skyCall: () => keyInfos.lockAlias),
|
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
titleColor: AppColors.blackColor,
|
titleColor: AppColors.blackColor,
|
||||||
iconColor: AppColors.blackColor,
|
iconColor: AppColors.blackColor,
|
||||||
),
|
),
|
||||||
body: LockDetailPage(
|
body: LockDetailPage(isOnlyOneData: isOnlyOneData, lockListInfoItemEntity: keyInfos),
|
||||||
isOnlyOneData: isOnlyOneData,
|
|
||||||
lockListInfoItemEntity: keyInfos),
|
|
||||||
// body: Container(),
|
// body: Container(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -464,6 +464,44 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
Widget skWidget() {
|
Widget skWidget() {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Visibility(
|
||||||
|
visible: widget.isOnlyOneData,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Image.asset('images/icon_main_drlock_1024.png', width: 68.w, height: 68.w),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
F.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
//实现回调函数
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routers.selectLockTypePage,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add_circle_outline_rounded,
|
||||||
|
size: 48.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: (state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
visible: (state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||||
|
|||||||
@ -1,40 +1,298 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.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_getStarLockStatusInfo.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_readRegisterKey.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_sendAuthorizationCode.dart';
|
||||||
|
import 'package:star_lock/blue/io_reply.dart';
|
||||||
|
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||||
|
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
||||||
|
import 'package:star_lock/blue/sender_manage.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_state.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/network/start_company_api.dart';
|
import 'package:star_lock/network/start_company_api.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
class ThirdPartyPlatformLogic extends BaseGetXController {
|
class ThirdPartyPlatformLogic extends BaseGetXController {
|
||||||
ThirdPartyPlatformState state = ThirdPartyPlatformState();
|
ThirdPartyPlatformState state = ThirdPartyPlatformState();
|
||||||
|
|
||||||
void savePlatFormSetting() {
|
// 监听设备返回的数据
|
||||||
// showEasyLoading();
|
StreamSubscription<Reply>? _replySubscription;
|
||||||
showToast('功能待开放'.tr);
|
|
||||||
// dismissEasyLoading();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 查询TPP支持
|
|
||||||
void getActivateInfo() async {
|
|
||||||
final model = state.lockSetInfoData.value.lockBasicInfo?.model;
|
|
||||||
if (model != null && model != '') {
|
|
||||||
final response = await StartCompanyApi.to.getActivateInfo(model: model);
|
|
||||||
if (response.errorCode!.codeIsSuccessful) {
|
|
||||||
AppLog.log('${response.data}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() async {
|
void onReady() async {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
getActivateInfo();
|
await getActivateInfo();
|
||||||
|
_initReplySubscription();
|
||||||
|
getServerDatetime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
|
// 安全地取消订阅
|
||||||
|
_replySubscription?.cancel();
|
||||||
|
_replySubscription = null;
|
||||||
|
|
||||||
|
// 添加额外的日志来跟踪清理过程
|
||||||
|
AppLog.log('ThirdPartyPlatformLogic disposed, subscription cancelled');
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
super.onClose();
|
||||||
|
// 安全地取消订阅
|
||||||
|
_replySubscription?.cancel();
|
||||||
|
_replySubscription = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从服务器时间
|
||||||
|
Future<void> getServerDatetime() async {
|
||||||
|
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading: true);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int getUTCNetTime() {
|
||||||
|
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _initReplySubscription() {
|
||||||
|
// 更严格的检查,避免重复初始化
|
||||||
|
if (_replySubscription != null) {
|
||||||
|
AppLog.log('订阅已存在,避免重复初始化');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
|
AppLog.log('输出了listen:${_replySubscription.hashCode}');
|
||||||
|
if (reply is SenderReadRegisterKeyCommandReply) {
|
||||||
|
_handleReadRegisterKeyReply(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reply is GetStarLockStatuInfoReply) {
|
||||||
|
_replyGetStarLockStatusInfo(reply);
|
||||||
|
}
|
||||||
|
if (reply is SenderAuthorizationCodeCommandReply) {
|
||||||
|
_handleAuthorizationCodeReply(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AppLog.log('创建新订阅:${_replySubscription.hashCode}');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取星锁状态
|
||||||
|
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
//成功
|
||||||
|
// AppLog.log('获取锁状态成功');
|
||||||
|
// 厂商名称
|
||||||
|
int index = 3;
|
||||||
|
final List<int> vendor = reply.data.sublist(index, index + 20);
|
||||||
|
final String vendorStr = utf8String(vendor);
|
||||||
|
state.lockInfo['vendor'] = vendorStr;
|
||||||
|
// state.lockInfo["vendor"] = "XL";
|
||||||
|
index = index + 20;
|
||||||
|
// AppLog.log('厂商名称 vendorStr:$vendorStr');
|
||||||
|
|
||||||
|
// 锁设备类型
|
||||||
|
final int product = reply.data[index];
|
||||||
|
state.lockInfo['product'] = product;
|
||||||
|
index = index + 1;
|
||||||
|
// AppLog.log('锁设备类型 product:$product');
|
||||||
|
|
||||||
|
// 产品名称
|
||||||
|
final List<int> model = reply.data.sublist(index, index + 20);
|
||||||
|
final String modelStr = utf8String(model);
|
||||||
|
state.lockInfo['model'] = modelStr;
|
||||||
|
// state.lockInfo["model"] = "JL-BLE-01";
|
||||||
|
index = index + 20;
|
||||||
|
// AppLog.log('产品名称 mmodelStr:$modelStr');
|
||||||
|
|
||||||
|
// 软件版本
|
||||||
|
final List<int> fwVersion = reply.data.sublist(index, index + 20);
|
||||||
|
final String fwVersionStr = utf8String(fwVersion);
|
||||||
|
state.lockInfo['fwVersion'] = fwVersionStr;
|
||||||
|
index = index + 20;
|
||||||
|
// AppLog.log('软件版本 fwVersionStr:$fwVersionStr');
|
||||||
|
|
||||||
|
// 硬件版本
|
||||||
|
final List<int> hwVersion = reply.data.sublist(index, index + 20);
|
||||||
|
final String hwVersionStr = utf8String(hwVersion);
|
||||||
|
state.lockInfo['hwVersion'] = hwVersionStr;
|
||||||
|
index = index + 20;
|
||||||
|
// AppLog.log('硬件版本 hwVersionStr:$hwVersionStr');
|
||||||
|
|
||||||
|
// 厂商序列号
|
||||||
|
final List<int> serialNum0 = reply.data.sublist(index, index + 16);
|
||||||
|
final String serialNum0Str = utf8String(serialNum0);
|
||||||
|
state.lockInfo['serialNum0'] = serialNum0Str;
|
||||||
|
// state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
|
||||||
|
index = index + 16;
|
||||||
|
// AppLog.log('厂商序列号 serialNum0Str:$serialNum0Str');
|
||||||
|
final response = await StartCompanyApi.to.getAuthorizationCode(
|
||||||
|
registerKey: state.registerKey.value,
|
||||||
|
model: modelStr,
|
||||||
|
serialNum0: serialNum0Str,
|
||||||
|
platform: 1,
|
||||||
|
);
|
||||||
|
if (response.errorCode!.codeIsSuccessful) {
|
||||||
|
BlueManage().blueSendData(
|
||||||
|
BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState connectionState) async {
|
||||||
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
|
IoSenderManage.sendAuthorizationCode(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
uuid: response.data?.extraParams?['uuid'],
|
||||||
|
key: response.data?.authCode,
|
||||||
|
mac: response.data?.extraParams?['mac'],
|
||||||
|
platform: 1,
|
||||||
|
utcTimeStamp: getUTCNetTime(),
|
||||||
|
);
|
||||||
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isAddEquipment: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
utcTimeStamp: 0,
|
||||||
|
unixTimeStamp: 0,
|
||||||
|
isBeforeAddUser: false,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void savePlatFormSetting() {
|
||||||
|
if (state.selectPlatFormIndex.value == 1) {
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(
|
||||||
|
BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState connectionState) async {
|
||||||
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
|
IoSenderManage.readRegisterKey(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
);
|
||||||
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
showToast('目前只支持切换至涂鸦智能协议'.tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 查询TPP支持
|
||||||
|
Future<void> getActivateInfo() async {
|
||||||
|
final model = state.lockSetInfoData.value.lockBasicInfo?.model;
|
||||||
|
if (model != null && model != '') {
|
||||||
|
final response = await StartCompanyApi.to.getTppSupport(model: model);
|
||||||
|
if (response.errorCode!.codeIsSuccessful) {
|
||||||
|
response.data?.forEach((element) {
|
||||||
|
state.tppSupportList.add(element);
|
||||||
|
});
|
||||||
|
state.tppSupportList.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handleReadRegisterKeyReply(SenderReadRegisterKeyCommandReply reply) {
|
||||||
|
final int status = reply.data[6];
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
// 提取 RegisterKey (从第7个字节开始,长度为40)
|
||||||
|
final List<int> registerKeyBytes = reply.data.sublist(7, 47);
|
||||||
|
final String registerKey = String.fromCharCodes(registerKeyBytes);
|
||||||
|
|
||||||
|
print('Register Key: $registerKey');
|
||||||
|
state.registerKey.value = registerKey;
|
||||||
|
if (registerKey.isNotEmpty) {
|
||||||
|
_requestAuthorizationCode();
|
||||||
|
}
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _requestAuthorizationCode() async {
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
utcTimeStamp: 0,
|
||||||
|
unixTimeStamp: 0,
|
||||||
|
isBeforeAddUser: false,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
//失败
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handleAuthorizationCodeReply(SenderAuthorizationCodeCommandReply reply) {
|
||||||
|
final int status = reply.data[6];
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
showToast('操作成功,请在24小时内用涂鸦APP添加门锁,否则将过期'.tr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,107 +45,123 @@ class _ThirdPartyPlatformPageState extends State<ThirdPartyPlatformPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
return Stack(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Container(
|
||||||
// 1. 背景或空白区域(可选)
|
decoration: BoxDecoration(
|
||||||
Container(
|
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: EdgeInsets.all(16.w),
|
|
||||||
),
|
),
|
||||||
// 2. 顶部图标行:使用 Row 并排显示
|
constraints: BoxConstraints(
|
||||||
Positioned(
|
minHeight: MediaQuery.of(context).size.height - 100.h,
|
||||||
top: 80.h,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // 均匀分布
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'images/other/tuya.png',
|
|
||||||
height: 50.h,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
Image.asset(
|
|
||||||
'images/other/2.png', // 中间图标
|
|
||||||
height: 80.h,
|
|
||||||
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
Image.asset(
|
|
||||||
'images/other/matter.png',
|
|
||||||
width: 110.w,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Positioned(
|
child: Stack(
|
||||||
top: 220.h,
|
children: [
|
||||||
left: 20.w,
|
// 1. 背景或空白区域(可选)
|
||||||
right: 20.w,
|
Container(
|
||||||
child: Text(
|
color: Colors.white,
|
||||||
'第三方协议的支持依赖网络授权下载,打开功能开关时请保证手机数据网络的正常连接'.tr,
|
padding: EdgeInsets.all(16.w),
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20.sp,
|
|
||||||
color: Colors.grey,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
),
|
top: 30.h,
|
||||||
|
left: 50.w,
|
||||||
Positioned(
|
child: Image.asset(
|
||||||
left: 0,
|
'images/other/tuya.png',
|
||||||
right: 0,
|
height: 80.h,
|
||||||
top: 320.h,
|
fit: BoxFit.cover,
|
||||||
bottom: 0,
|
),
|
||||||
child: ListView.builder(
|
),
|
||||||
itemCount: state.platFormSet.length,
|
Positioned(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
top: 130.h,
|
||||||
// 判断是否是最后一个元素(索引等于 itemCount - 1)
|
left: 150.w,
|
||||||
final isLastItem = index == state.platFormSet.length - 1;
|
right: 150.w,
|
||||||
|
child: Image.asset(
|
||||||
// 获取当前平台数据(假设 platFormSet 是 RxList<Platform>)
|
'images/other/2.png',
|
||||||
final platform = state.platFormSet.value[index];
|
height: 220.h,
|
||||||
return CommonItem(
|
fit: BoxFit.contain,
|
||||||
leftTitel: state.platFormSet.value[index],
|
),
|
||||||
rightTitle: '',
|
),
|
||||||
isHaveLine: !isLastItem,
|
// 2. 顶部图标行:使用 Row 并排显示
|
||||||
// 最后一个元素不显示分割线(取反)
|
Positioned(
|
||||||
isHaveDirection: false,
|
top: 400.h,
|
||||||
isHaveRightWidget: true,
|
right: 50.w,
|
||||||
rightWidget: Radio<String>(
|
child: Column(
|
||||||
// Radio 的值:使用平台的唯一标识(如 id)
|
children: [
|
||||||
value: platform,
|
Image.asset(
|
||||||
// 当前选中的值:与 selectPlatFormIndex 关联的 id
|
'images/other/matter.png',
|
||||||
groupValue: state.platFormSet.value[state.selectPlatFormIndex.value],
|
width: 280.w,
|
||||||
// 选中颜色(可选,默认主题色)
|
fit: BoxFit.contain,
|
||||||
activeColor: AppColors.mainColor,
|
),
|
||||||
// 点击 Radio 时回调(更新选中索引)
|
],
|
||||||
onChanged: (value) {
|
),
|
||||||
if (value != null) {
|
),
|
||||||
setState(() {
|
Positioned(
|
||||||
// 找到当前选中平台的索引(根据 id 匹配)
|
top: 530.h,
|
||||||
final newIndex = state.platFormSet.value.indexWhere((p) => p == value);
|
left: 20.w,
|
||||||
if (newIndex != -1) {
|
right: 20.w,
|
||||||
state.selectPlatFormIndex.value = newIndex;
|
child: Text(
|
||||||
}
|
'第三方协议的支持依赖网络授权下载,打开功能开关时请保证手机数据网络的正常连接'.tr,
|
||||||
});
|
textAlign: TextAlign.center,
|
||||||
}
|
style: TextStyle(
|
||||||
},
|
fontSize: 20.sp,
|
||||||
|
color: Colors.grey,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
action: () {
|
),
|
||||||
setState(() {
|
),
|
||||||
state.selectPlatFormIndex.value = index;
|
|
||||||
});
|
Positioned(
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
top: 620.h,
|
||||||
|
bottom: 0,
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: state.platFormSet.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
// 判断是否是最后一个元素(索引等于 itemCount - 1)
|
||||||
|
final isLastItem = index == state.platFormSet.length - 1;
|
||||||
|
|
||||||
|
// 获取当前平台数据(假设 platFormSet 是 RxList<Platform>)
|
||||||
|
final platform = state.platFormSet.value[index];
|
||||||
|
return CommonItem(
|
||||||
|
leftTitel: state.platFormSet.value[index],
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: !isLastItem,
|
||||||
|
// 最后一个元素不显示分割线(取反)
|
||||||
|
isHaveDirection: false,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: Radio<String>(
|
||||||
|
// Radio 的值:使用平台的唯一标识(如 id)
|
||||||
|
value: platform,
|
||||||
|
// 当前选中的值:与 selectPlatFormIndex 关联的 id
|
||||||
|
groupValue: state.platFormSet.value[state.selectPlatFormIndex.value],
|
||||||
|
// 选中颜色(可选,默认主题色)
|
||||||
|
activeColor: AppColors.mainColor,
|
||||||
|
// 点击 Radio 时回调(更新选中索引)
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value != null) {
|
||||||
|
setState(() {
|
||||||
|
// 找到当前选中平台的索引(根据 id 匹配)
|
||||||
|
final newIndex = state.platFormSet.value.indexWhere((p) => p == value);
|
||||||
|
if (newIndex != -1) {
|
||||||
|
state.selectPlatFormIndex.value = newIndex;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
action: () {
|
||||||
|
setState(() {
|
||||||
|
state.selectPlatFormIndex.value = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
shrinkWrap: true,
|
||||||
},
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
),
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:get/get_rx/get_rx.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockDetail/ActivateInfoResponse.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
import 'package:star_lock/translations/app_dept.dart';
|
import 'package:star_lock/translations/app_dept.dart';
|
||||||
|
|
||||||
@ -11,15 +13,20 @@ class ThirdPartyPlatformState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
||||||
|
int differentialTime = 0;// 服务器时间即UTC+0时间
|
||||||
|
|
||||||
// 响应式字符串集合(自动触发 UI 更新)
|
// 响应式字符串集合(自动触发 UI 更新)
|
||||||
final RxList<String> platFormSet = List.of({
|
final RxList<String> platFormSet = List.of({
|
||||||
'锁通通'.tr,
|
'锁通通'.tr,
|
||||||
'涂鸦智能'.tr,
|
'涂鸦智能'.tr,
|
||||||
'Matter'.tr ,
|
'Matter'.tr,
|
||||||
}).obs;
|
}).obs;
|
||||||
|
|
||||||
RxInt selectPlatFormIndex = 0.obs;
|
// 响应式字符串集合(自动触发 UI 更新)
|
||||||
|
final RxList<TppSupportInfo> tppSupportList = RxList<TppSupportInfo>([]);
|
||||||
|
|
||||||
|
RxInt selectPlatFormIndex = 1.obs;
|
||||||
|
RxString registerKey = ''.obs;
|
||||||
|
|
||||||
|
Map lockInfo = {};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -300,7 +300,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
'\n' +
|
'\n' +
|
||||||
'有效期'.tr +
|
'有效期'.tr +
|
||||||
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
||||||
'这是单次密码,只能使用一次\n';
|
'${'这是单次密码,只能使用一次'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
@ -309,8 +309,8 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
':' +
|
':' +
|
||||||
'永久'.tr +
|
'永久'.tr +
|
||||||
'\n' +
|
'\n' +
|
||||||
'\n注:\n' +
|
'\n${'注:'.tr}\n' +
|
||||||
'必需在开始时间24小时内使用一次,否则将失效\n';
|
'${'必需在开始时间24小时内使用一次,否则将失效'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
@ -324,7 +324,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
||||||
'\n' +
|
'\n' +
|
||||||
'\n注:\n' +
|
'\n注:\n' +
|
||||||
'必需在开始时间24小时内使用一次,否则将失效\n';
|
'${'必需在开始时间24小时内使用一次,否则将失效'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
@ -453,9 +453,10 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
||||||
return '您好' +
|
return '您好'.tr +
|
||||||
',\n您的开门密码是' +
|
',\n${'您的开门密码是'.tr}' +
|
||||||
':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}\n\n开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标';
|
':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}\n'
|
||||||
|
'\n${'开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标'.tr}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -46,32 +46,24 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
} else if (state.widgetType.value == 1) {
|
} else if (state.widgetType.value == 1) {
|
||||||
//限时
|
//限时
|
||||||
// 鑫鸿佳不需要生效时间
|
// 鑫鸿佳不需要生效时间
|
||||||
if (CommonDataManage().currentKeyInfo.vendor ==
|
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XHJ &&
|
||||||
IoModelVendor.vendor_XHJ &&
|
(CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_SYD ||
|
||||||
(CommonDataManage().currentKeyInfo.model ==
|
CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_JL)) {
|
||||||
IoModelVendor.model_XHJ_SYD ||
|
if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
CommonDataManage().currentKeyInfo.model ==
|
|
||||||
IoModelVendor.model_XHJ_JL)) {
|
|
||||||
if (endDate <=
|
|
||||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
|
||||||
showToast('失效时间要大于当前时间'.tr);
|
showToast('失效时间要大于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//endDate 设置当天凌晨 0 点
|
//endDate 设置当天凌晨 0 点
|
||||||
final DateTime now = DateTime.now();
|
final DateTime now = DateTime.now();
|
||||||
startDate =
|
startDate = DateTime(now.year, now.month, now.day).millisecondsSinceEpoch;
|
||||||
DateTime(now.year, now.month, now.day).millisecondsSinceEpoch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 芯连需要生效时间
|
// 芯连需要生效时间
|
||||||
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
||||||
(CommonDataManage().currentKeyInfo.model ==
|
(CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE ||
|
||||||
IoModelVendor.model_XL_BLE ||
|
CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)) {
|
||||||
CommonDataManage().currentKeyInfo.model ==
|
|
||||||
IoModelVendor.model_XL_WIFI)) {
|
|
||||||
//限时
|
//限时
|
||||||
if (startDate <
|
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
|
||||||
showToast('生效时间不能小于当前时间'.tr);
|
showToast('生效时间不能小于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -91,12 +83,9 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
//循环
|
//循环
|
||||||
// 芯连需要结束时间
|
// 芯连需要结束时间
|
||||||
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
||||||
(CommonDataManage().currentKeyInfo.model ==
|
(CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE ||
|
||||||
IoModelVendor.model_XL_BLE ||
|
CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)) {
|
||||||
CommonDataManage().currentKeyInfo.model ==
|
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
IoModelVendor.model_XL_WIFI)) {
|
|
||||||
if (endDate <
|
|
||||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
|
||||||
showToast('结束时间不能小于当前时间'.tr);
|
showToast('结束时间不能小于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -166,10 +155,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
//是否为永久
|
//是否为永久
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
getKeyType = '3';
|
getKeyType = '3';
|
||||||
getEffectiveDateTime =
|
getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
||||||
DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
||||||
getFailureDateTime =
|
|
||||||
DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
|
||||||
}
|
}
|
||||||
final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey(
|
final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey(
|
||||||
lockId: lockId,
|
lockId: lockId,
|
||||||
@ -184,8 +171,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name': BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':
|
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'add_password_result': '成功',
|
'add_password_result': '成功',
|
||||||
});
|
});
|
||||||
@ -202,8 +188,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
} else {
|
} else {
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name': BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':
|
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'add_password_result': '${entity.errorMsg}',
|
'add_password_result': '${entity.errorMsg}',
|
||||||
});
|
});
|
||||||
@ -230,8 +215,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
showToast('请输入密码'.tr);
|
showToast('请输入密码'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final PasswordKeyEntity entity =
|
final PasswordKeyEntity entity = await ApiRepository.to.checkKeyboardpwdName(
|
||||||
await ApiRepository.to.checkKeyboardpwdName(
|
|
||||||
lockId: state.keyInfo.value.lockId.toString(),
|
lockId: state.keyInfo.value.lockId.toString(),
|
||||||
keyboardPwdName: state.nameController.text,
|
keyboardPwdName: state.nameController.text,
|
||||||
keyboardPwd: state.pwdController.text,
|
keyboardPwd: state.pwdController.text,
|
||||||
@ -246,16 +230,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription =
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
|
||||||
// 设置自定义密码
|
// 设置自定义密码
|
||||||
if ((reply is SenderCustomPasswordsReply) &&
|
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
(state.ifCurrentScreen.value == true)) {
|
|
||||||
BuglyTool.uploadException(
|
BuglyTool.uploadException(
|
||||||
message: '添加密码结果,解析数据',
|
message: '添加密码结果,解析数据', detail: '添加密码结果,解析数据:${reply.data}', eventStr: '添加密码事件结果', upload: true);
|
||||||
detail: '添加密码结果,解析数据:${reply.data}',
|
|
||||||
eventStr: '添加密码事件结果',
|
|
||||||
upload: true);
|
|
||||||
|
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -305,20 +284,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
final List<int> getPrivateKeyList =
|
|
||||||
changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? signKey =
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
await Storage.getStringList(saveBlueSignKey);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
final List<int> signKeyDataList =
|
|
||||||
changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
int startDate =
|
int startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
||||||
DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||||
int endDate =
|
|
||||||
DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
|
||||||
//非永久 须有时限
|
//非永久 须有时限
|
||||||
if (state.isPermanent.value == true) {
|
if (state.isPermanent.value == true) {
|
||||||
startDate = 0;
|
startDate = 0;
|
||||||
@ -367,8 +340,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||||
//非永久 须有时限
|
//非永久 须有时限
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
if (startDate <
|
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
|
||||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
|
|
||||||
showToast('生效时间需晚于当前时间'.tr);
|
showToast('生效时间需晚于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -382,8 +354,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
endDate = 0;
|
endDate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.pwdController.text.length < 6 ||
|
if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) {
|
||||||
state.pwdController.text.length > 9) {
|
|
||||||
showToast('请输入6-9位数字'.tr);
|
showToast('请输入6-9位数字'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -396,8 +367,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
@ -424,8 +394,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name': BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':
|
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'add_password_result': '添加自定义密码超时',
|
'add_password_result': '添加自定义密码超时',
|
||||||
});
|
});
|
||||||
@ -439,17 +408,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? signKey =
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
final List<int> getPrivateKeyList =
|
|
||||||
changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -469,13 +434,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState ==
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
BluetoothConnectionState.disconnected) {
|
|
||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name': BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':
|
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'add_password_result': '添加自定义密码断开',
|
'add_password_result': '添加自定义密码断开',
|
||||||
});
|
});
|
||||||
@ -517,17 +480,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
'\n' +
|
'\n' +
|
||||||
'有效期'.tr +
|
'有效期'.tr +
|
||||||
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
||||||
'这是单次密码,只能使用一次\n';
|
'${'这是单次密码,只能使用一次'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '永久'.tr + '\n' + '\n注:\n' + '${'必需在开始时间24小时内使用一次,否则将失效'.tr}\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'永久'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n注:\n' +
|
|
||||||
'必需在开始时间24小时内使用一次,否则将失效\n';
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
@ -540,15 +497,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
'有效期'.tr +
|
'有效期'.tr +
|
||||||
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
||||||
'\n' +
|
'\n' +
|
||||||
'\n注:\n' +
|
'\n${'注:'.tr}\n' +
|
||||||
'必需在开始时间24小时内使用一次,否则将失效\n';
|
'${'必需在开始时间24小时内使用一次,否则将失效'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//自定义
|
//自定义
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
useDateStr = '类型'.tr +
|
useDateStr =
|
||||||
':' +
|
'类型'.tr + ':' + '自定义-限时\n${'有效期'.tr}:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
||||||
'自定义-限时\n${'有效期'.tr}:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
|
||||||
} else {
|
} else {
|
||||||
useDateStr = '类型:自定义-永久'.tr;
|
useDateStr = '类型:自定义-永久'.tr;
|
||||||
}
|
}
|
||||||
@ -559,171 +515,51 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周末'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周末'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '每日'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'每日'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '工作日'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'工作日'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周一'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周一'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周二'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周二'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周三'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周三'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周四'.tr + ' $starHour:00 -$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周四'.tr +
|
|
||||||
' $starHour:00 -$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周五'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周五'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周六'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周六'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周日'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周日'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
|
||||||
return '您好' +
|
return '您好'.tr +
|
||||||
',\n您的开门密码是' +
|
',\n${'您的开门密码是'.tr}' +
|
||||||
':${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}\n\n开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标';
|
':${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}\n'
|
||||||
// switch (getPwdType) {
|
'\n${'开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标'.tr}';
|
||||||
// case 0:
|
|
||||||
// // 永久 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
|
||||||
// useDateStr = '类型'.tr + ':' + '永久';
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// //限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
|
||||||
// useDateStr = '类型'.tr +
|
|
||||||
// ':' +
|
|
||||||
// '限时\n${'有效期'.tr}:${state.beginTime.value} -- ${state.endTime.value}';
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// //单次 只能在开始时间后6小时内使用一次
|
|
||||||
// useDateStr = '类型'.tr +
|
|
||||||
// ':' +
|
|
||||||
// '单次\n${'有效期'.tr}:${state.beginTime.value} -- ${state.endTime.value}';
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// //自定义
|
|
||||||
// if (state.isPermanent.value == false) {
|
|
||||||
// useDateStr = '类型'.tr +
|
|
||||||
// ':' +
|
|
||||||
// '自定义-限时\n${'有效期'.tr}:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
|
||||||
// } else {
|
|
||||||
// useDateStr = '类型:自定义-永久'.tr;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case 4:
|
|
||||||
// //周未循环 在周未开始和结束时间指定时间段内有效
|
|
||||||
// useDateStr = '类型'.tr +
|
|
||||||
// ':' +
|
|
||||||
// '循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
|
|
||||||
// break;
|
|
||||||
// case 5:
|
|
||||||
// //删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
|
||||||
// useDateStr = '类型:清空';
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// default:
|
|
||||||
// }
|
|
||||||
// return '${'您好,您的密码是'.tr}:${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String addSpaces(String input) {
|
String addSpaces(String input) {
|
||||||
|
|||||||
@ -36,13 +36,13 @@ class _LockListGroupViewState extends State<LockListGroupView> {
|
|||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
// Container(
|
||||||
color: widget.backgroundColor ?? Colors.white,
|
// color: widget.backgroundColor ?? Colors.white,
|
||||||
height: 80.h,
|
// height: 80.h,
|
||||||
child: Row(
|
// child: Row(
|
||||||
children: _buildExpandRowList(),
|
// children: _buildExpandRowList(),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
ClipRect(
|
ClipRect(
|
||||||
child: AnimatedAlign(
|
child: AnimatedAlign(
|
||||||
heightFactor: _isExpanded ? 1.0 : 0.0,
|
heightFactor: _isExpanded ? 1.0 : 0.0,
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/main/lockMian/lockList/lockList_state.dart';
|
import 'package:star_lock/main/lockMian/lockList/lockList_state.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
@ -14,8 +16,7 @@ import 'lockListGroup_view.dart';
|
|||||||
import 'lockList_logic.dart';
|
import 'lockList_logic.dart';
|
||||||
|
|
||||||
class LockListPage extends StatefulWidget {
|
class LockListPage extends StatefulWidget {
|
||||||
const LockListPage({required this.lockListInfoGroupEntity, Key? key})
|
const LockListPage({required this.lockListInfoGroupEntity, Key? key}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
final LockListInfoGroupEntity lockListInfoGroupEntity;
|
final LockListInfoGroupEntity lockListInfoGroupEntity;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -30,41 +31,84 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
logic = Get.put(LockListLogic(widget.lockListInfoGroupEntity));
|
logic = Get.put(LockListLogic(widget.lockListInfoGroupEntity));
|
||||||
state = Get
|
state = Get.find<LockListLogic>().state;
|
||||||
.find<LockListLogic>()
|
|
||||||
.state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() => Scaffold(
|
return Obx(
|
||||||
body: ListView.separated(
|
() => Scaffold(
|
||||||
itemCount: logic.groupDataListFiltered.length,
|
body: SafeArea(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
child: Column(
|
||||||
final GroupList itemData = logic.groupDataListFiltered[index];
|
children: [
|
||||||
return _buildLockExpandedList(context, index, itemData, key: ValueKey(itemData.groupId));
|
Row(
|
||||||
},
|
children: [
|
||||||
shrinkWrap: true,
|
SizedBox(
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
width: 20.w,
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
),
|
||||||
return const Divider(
|
Image.asset('images/icon_main_drlock_1024.png', width: 68.w, height: 68.w),
|
||||||
height: 1,
|
SizedBox(
|
||||||
color: AppColors.greyLineColor,
|
width: 20.w,
|
||||||
);
|
),
|
||||||
}),
|
Text(
|
||||||
));
|
F.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
//实现回调函数
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routers.selectLockTypePage,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add_circle_outline_rounded,
|
||||||
|
size: 48.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
itemCount: logic.groupDataListFiltered.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
final GroupList itemData = logic.groupDataListFiltered[index];
|
||||||
|
return _buildLockExpandedList(context, index, itemData, key: ValueKey(itemData.groupId));
|
||||||
|
},
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备多层级列表
|
//设备多层级列表
|
||||||
Widget _buildLockExpandedList(BuildContext context, int index,
|
Widget _buildLockExpandedList(BuildContext context, int index, GroupList itemData, {Key? key}) {
|
||||||
GroupList itemData, {Key? key}) {
|
final List<LockListInfoItemEntity> lockItemList = itemData.lockList ?? <LockListInfoItemEntity>[];
|
||||||
final List<LockListInfoItemEntity> lockItemList =
|
|
||||||
itemData.lockList ?? <LockListInfoItemEntity>[];
|
|
||||||
return LockListGroupView(
|
return LockListGroupView(
|
||||||
key: key,
|
key: key,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
//是否选中组
|
//是否选中组
|
||||||
if (itemData.isChecked) {} else {}
|
if (itemData.isChecked) {
|
||||||
|
} else {}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
typeImgList: const <dynamic>[],
|
typeImgList: const <dynamic>[],
|
||||||
@ -103,39 +147,36 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
),
|
),
|
||||||
child: lockInfoListItem(keyInfo, isLast, () {
|
child: lockInfoListItem(keyInfo, isLast, () {
|
||||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
(keyInfo.keyStatus ==
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) {
|
||||||
XSConstantMacro.keyStatusWaitIneffective)) {
|
|
||||||
logic.showToast('您的钥匙未生效'.tr);
|
logic.showToast('您的钥匙未生效'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLong ||
|
keyInfo.keyType == XSConstantMacro.keyTypeLong ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
|
||||||
logic.showToast('您的钥匙已冻结'.tr);
|
logic.showToast('您的钥匙已冻结'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) {
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) {
|
||||||
logic.showToast('您的钥匙已过期'.tr);
|
logic.showToast('您的钥匙已过期'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Get.toNamed(Routers.lockDetailMainPage,
|
Get.toNamed(Routers.lockDetailMainPage, arguments: <String, Object>{
|
||||||
arguments: <String, Object>{
|
// "lockMainEntity": widget.lockMainEntity,
|
||||||
// "lockMainEntity": widget.lockMainEntity,
|
'keyInfo': keyInfo,
|
||||||
'keyInfo': keyInfo,
|
'isOnlyOneData': false,
|
||||||
'isOnlyOneData': false,
|
});
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget lockInfoListItem(LockListInfoItemEntity keyInfo, bool isLast,
|
Widget lockInfoListItem(LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
|
||||||
Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -144,16 +185,12 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w)
|
? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w)
|
||||||
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: (((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
color: (((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective ||
|
||||||
(keyInfo.keyStatus ==
|
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||||
XSConstantMacro.keyStatusWaitIneffective ||
|
keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) ||
|
||||||
keyInfo.keyStatus ==
|
(keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
||||||
XSConstantMacro.keyStatusFrozen ||
|
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen))
|
||||||
keyInfo.keyStatus ==
|
|
||||||
XSConstantMacro.keyStatusExpired)) ||
|
|
||||||
(keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
|
||||||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen))
|
|
||||||
? AppColors.greyBackgroundColor
|
? AppColors.greyBackgroundColor
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(20.w),
|
borderRadius: BorderRadius.circular(20.w),
|
||||||
@ -193,8 +230,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text(
|
Text(
|
||||||
'${keyInfo.electricQuantity!}%',
|
'${keyInfo.electricQuantity!}%',
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
],
|
],
|
||||||
@ -211,10 +247,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
borderRadius: BorderRadius.circular(5.w),
|
borderRadius: BorderRadius.circular(5.w),
|
||||||
color: AppColors.openPassageModeColor,
|
color: AppColors.openPassageModeColor,
|
||||||
),
|
),
|
||||||
child: Text('常开模式开启'.tr,
|
child: Text('常开模式开启'.tr, style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)),
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.sp,
|
|
||||||
color: AppColors.appBarIconColor)),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
@ -226,8 +259,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Text(
|
Text(
|
||||||
'远程开锁'.tr,
|
'远程开锁'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
@ -241,15 +273,13 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5.w),
|
borderRadius: BorderRadius.circular(5.w),
|
||||||
color:
|
color: DateTool().compareTimeIsOvertime(keyInfo.endDate!)
|
||||||
DateTool().compareTimeIsOvertime(keyInfo.endDate!)
|
|
||||||
? AppColors.listTimeYellowColor
|
? AppColors.listTimeYellowColor
|
||||||
: AppColors.mainColor,
|
: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
child: Text(logic.getKeyEffective(keyInfo),
|
child: Text(logic.getKeyEffective(keyInfo), style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||||
style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||||
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
@ -258,13 +288,8 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Text(
|
Text(
|
||||||
"${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate,
|
"${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)}/${keyInfo.isLockOwner == 1 ? '超级管理员'.tr : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr)}",
|
||||||
keyInfo.keyType)}/${keyInfo.isLockOwner == 1
|
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
? '超级管理员'.tr
|
|
||||||
: (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户"
|
|
||||||
.tr)}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -286,13 +311,10 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
Get.delete<LockListLogic>();
|
Get.delete<LockListLogic>();
|
||||||
|
|
||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super
|
super.dispose();
|
||||||
.
|
|
||||||
dispose
|
|
||||||
(
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 从上级界面进入 当前界面即将出现
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
|||||||
@ -34,8 +34,7 @@ import '../lockList/lockList_page.dart';
|
|||||||
import 'lockMain_logic.dart';
|
import 'lockMain_logic.dart';
|
||||||
|
|
||||||
class StarLockMainPage extends StatefulWidget {
|
class StarLockMainPage extends StatefulWidget {
|
||||||
StarLockMainPage({Key? key, this.showAppBar = true, this.showDrawer = true})
|
StarLockMainPage({Key? key, this.showAppBar = true, this.showDrawer = true}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
bool showAppBar;
|
bool showAppBar;
|
||||||
bool showDrawer;
|
bool showDrawer;
|
||||||
|
|
||||||
@ -48,16 +47,13 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
final LockMainLogic logic = Get.put(LockMainLogic());
|
final LockMainLogic logic = Get.put(LockMainLogic());
|
||||||
final LockMainState state = Get.find<LockMainLogic>().state;
|
final LockMainState state = Get.find<LockMainLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData(
|
Future<void> getHttpData({bool clearScanDevices = false, bool isUnShowLoading = false}) async {
|
||||||
{bool clearScanDevices = false, bool isUnShowLoading = false}) async {
|
LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData();
|
||||||
LockListInfoGroupEntity? lockListInfoGroupEntity =
|
|
||||||
await Storage.getLockMainListData();
|
|
||||||
if (lockListInfoGroupEntity != null) {
|
if (lockListInfoGroupEntity != null) {
|
||||||
await logic.loadMainDataLogic(lockListInfoGroupEntity);
|
await logic.loadMainDataLogic(lockListInfoGroupEntity);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
lockListInfoGroupEntity =
|
lockListInfoGroupEntity = (await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data;
|
||||||
(await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data;
|
|
||||||
if (lockListInfoGroupEntity != null) {
|
if (lockListInfoGroupEntity != null) {
|
||||||
await logic.loadMainDataLogic(lockListInfoGroupEntity);
|
await logic.loadMainDataLogic(lockListInfoGroupEntity);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -89,7 +85,8 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GetBuilder<LockMainLogic>(builder: (LockMainLogic logic) {
|
return GetBuilder<LockMainLogic>(builder: (LockMainLogic logic) {
|
||||||
Widget child = EasyRefreshTool(
|
Widget child = Obx(
|
||||||
|
() => EasyRefreshTool(
|
||||||
onRefresh: () {
|
onRefresh: () {
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
// 更新状态的代码
|
// 更新状态的代码
|
||||||
@ -98,37 +95,40 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// child: getDataReturnUI(state.dataLength.value));
|
// child: getDataReturnUI(state.dataLength.value));
|
||||||
child: getDataReturnUI(state.dataLength.value));
|
child: getDataReturnUI(state.dataLength.value),
|
||||||
|
),
|
||||||
|
);
|
||||||
if (widget.showAppBar || widget.showDrawer) {
|
if (widget.showAppBar || widget.showDrawer) {
|
||||||
child = Scaffold(
|
child = Scaffold(
|
||||||
backgroundColor: const Color(0xFFF5F5F5),
|
backgroundColor: Colors.white,
|
||||||
appBar: widget.showAppBar
|
|
||||||
? TitleAppBar(
|
|
||||||
barTitle: F.navTitle,
|
|
||||||
haveBack: false,
|
|
||||||
haveOtherLeftWidget: true,
|
|
||||||
leftWidget: Builder(
|
|
||||||
builder: (BuildContext context) => IconButton(
|
|
||||||
icon: Image.asset(
|
|
||||||
'images/main/mainLeft_menu_icon.png',
|
|
||||||
color: Colors.white,
|
|
||||||
width: 44.w,
|
|
||||||
height: 44.w,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Scaffold.of(context).openDrawer();
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
backgroundColor: AppColors.mainColor,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
drawer: widget.showDrawer
|
|
||||||
? Drawer(
|
|
||||||
width: 1.sw / 3 * 2,
|
|
||||||
child: const StarLockMinePage(),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
body: child,
|
body: child,
|
||||||
|
bottomNavigationBar: Obx(
|
||||||
|
() => BottomNavigationBar(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
items: <BottomNavigationBarItem>[
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: ImageIcon(
|
||||||
|
AssetImage(state.selectedIndex.value == 0
|
||||||
|
? 'images/icon_device_selected'
|
||||||
|
'.png'
|
||||||
|
: 'images/icon_device_not_selected.png'),
|
||||||
|
), // 使用本地图片
|
||||||
|
label: '设备',
|
||||||
|
),
|
||||||
|
const BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.person),
|
||||||
|
label: '我的',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onTap: (index) {
|
||||||
|
state.selectedIndex.value = index;
|
||||||
|
},
|
||||||
|
currentIndex: state.selectedIndex.value,
|
||||||
|
selectedItemColor: AppColors.mainColor,
|
||||||
|
unselectedItemColor: Colors.grey,
|
||||||
|
showUnselectedLabels: true, // 显示未选中项的标签
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
child = F.sw(
|
child = F.sw(
|
||||||
@ -149,34 +149,37 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
Widget getDataReturnUI(int type) {
|
Widget getDataReturnUI(int type) {
|
||||||
Widget returnWidget;
|
Widget returnWidget;
|
||||||
|
|
||||||
if (type == 1) {
|
if (state.selectedIndex.value == 0) {
|
||||||
type = F.sw(skyCall: () => 1, xhjCall: () => 2);
|
if (type == 1) {
|
||||||
}
|
type = F.sw(skyCall: () => 1, xhjCall: () => 2);
|
||||||
switch (type) {
|
}
|
||||||
case 0:
|
switch (type) {
|
||||||
// 显示无数据模式
|
case 0:
|
||||||
returnWidget = unHaveData();
|
// 显示无数据模式
|
||||||
break;
|
returnWidget = unHaveData();
|
||||||
case 1:
|
break;
|
||||||
// 只有一条数据
|
case 1:
|
||||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
// 只有一条数据
|
||||||
returnWidget = LockDetailPage(
|
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||||
isOnlyOneData: true,
|
returnWidget = LockDetailPage(
|
||||||
lockListInfoItemEntity:
|
isOnlyOneData: true,
|
||||||
state.lockListInfoGroupEntity.value.groupList![0].lockList![0]);
|
lockListInfoItemEntity: state.lockListInfoGroupEntity.value.groupList![0].lockList![0]);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 有多条数据
|
// 有多条数据
|
||||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||||
returnWidget = F.sw(
|
returnWidget = F.sw(
|
||||||
skyCall: () => LockListPage(
|
skyCall: () => LockListPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value),
|
||||||
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value),
|
xhjCall: () => LockListXHJPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value));
|
||||||
xhjCall: () => LockListXHJPage(
|
break;
|
||||||
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value));
|
default:
|
||||||
break;
|
returnWidget = NoData();
|
||||||
default:
|
break;
|
||||||
returnWidget = NoData();
|
}
|
||||||
break;
|
} else if (state.selectedIndex.value == 1) {
|
||||||
|
returnWidget = StarLockMinePage();
|
||||||
|
} else {
|
||||||
|
returnWidget = StarLockMinePage();
|
||||||
}
|
}
|
||||||
return returnWidget;
|
return returnWidget;
|
||||||
}
|
}
|
||||||
@ -192,6 +195,44 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Image.asset('images/icon_main_drlock_1024.png', width: 68.w, height: 68.w),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
F.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
//实现回调函数
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routers.selectLockTypePage,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add_circle_outline_rounded,
|
||||||
|
size: 48.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 160.h,
|
height: 160.h,
|
||||||
),
|
),
|
||||||
@ -288,13 +329,9 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
|
|
||||||
void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
_teamEvent = eventBus
|
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((RefreshLockListInfoDataEvent event) {
|
||||||
.on<RefreshLockListInfoDataEvent>()
|
|
||||||
.listen((RefreshLockListInfoDataEvent event) {
|
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData(
|
getHttpData(clearScanDevices: event.clearScanDevices, isUnShowLoading: event.isUnShowLoading);
|
||||||
clearScanDevices: event.clearScanDevices,
|
|
||||||
isUnShowLoading: event.isUnShowLoading);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,8 +341,7 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
ByteData byteData = await rootBundle.load(assetPath);
|
ByteData byteData = await rootBundle.load(assetPath);
|
||||||
|
|
||||||
// 将 ByteData 转换为 Uint8List
|
// 将 ByteData 转换为 Uint8List
|
||||||
Uint8List uint8List =
|
Uint8List uint8List = Uint8List.sublistView(byteData); //byteData.buffer.asUint8List();
|
||||||
Uint8List.sublistView(byteData); //byteData.buffer.asUint8List();
|
|
||||||
|
|
||||||
// 返回字节数组
|
// 返回字节数组
|
||||||
return uint8List.toList();
|
return uint8List.toList();
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import '../entity/lockListInfo_entity.dart';
|
import '../entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
class LockMainState {
|
class LockMainState {
|
||||||
|
|
||||||
// 0是无数据 1是有一条数据 2是有很多条数据
|
// 0是无数据 1是有一条数据 2是有很多条数据
|
||||||
RxInt dataLength = 100.obs;
|
RxInt dataLength = 100.obs;
|
||||||
Rx<LockListInfoGroupEntity> lockListInfoGroupEntity = LockListInfoGroupEntity().obs;
|
Rx<LockListInfoGroupEntity> lockListInfoGroupEntity = LockListInfoGroupEntity().obs;
|
||||||
@ -13,5 +11,6 @@ class LockMainState {
|
|||||||
// 网络连接状态 0没有网络 1有网络
|
// 网络连接状态 0没有网络 1有网络
|
||||||
RxInt networkConnectionStatus = 0.obs;
|
RxInt networkConnectionStatus = 0.obs;
|
||||||
|
|
||||||
// late Timer timer;
|
RxInt selectedIndex = 0.obs;
|
||||||
}
|
// late Timer timer;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.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/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
import 'package:star_lock/tools/wechat/customer_tool.dart';
|
import 'package:star_lock/tools/wechat/customer_tool.dart';
|
||||||
|
|
||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
@ -37,189 +40,205 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: const Color(0xFFFFFFFF),
|
body: SafeArea(
|
||||||
body: Column(
|
child: Container(
|
||||||
children: <Widget>[
|
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
||||||
topWidget(),
|
child: Column(
|
||||||
bottomListWidget(),
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 80.h,
|
height: 20.h,
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
WechatManageTool.getAppInfo(() {
|
|
||||||
WxPushWeChatMiniProgramTool.pushWeChatMiniProgram(
|
|
||||||
F.wechatAppInfo.wechatAppId, F.wechatAppInfo.universalLink);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
|
||||||
child: Image.asset(
|
|
||||||
'images/mine/icon_mine_wan_miniprogram.png',
|
|
||||||
// width: 400.w,
|
|
||||||
// height: 151.h,
|
|
||||||
fit: BoxFit.fill,
|
|
||||||
),
|
),
|
||||||
),
|
topWidget(),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10.r),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.h),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
Get.toNamed(Routers.minePersonInfoPage);
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons.person,
|
||||||
|
size: 32.sp,
|
||||||
|
),
|
||||||
|
SizedBox(width: 15.w),
|
||||||
|
Text(
|
||||||
|
'个人信息'.tr,
|
||||||
|
style: TextStyle(fontSize: 28.sp),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios_rounded,
|
||||||
|
color: Colors.grey[400],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
bottomListWidget(),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget topWidget() {
|
Widget topWidget() {
|
||||||
return Container(
|
return Row(
|
||||||
height: 380.h,
|
children: <Widget>[
|
||||||
width: 1.sw,
|
GestureDetector(
|
||||||
color: AppColors.mainColor,
|
onTap: () {
|
||||||
// color: Colors.red,
|
Get.back();
|
||||||
child: Stack(
|
Get.toNamed(Routers.minePersonInfoPage);
|
||||||
children: <Widget>[
|
},
|
||||||
Image.asset(
|
child: Obx(
|
||||||
'images/mine/icon_mine_topBg.png',
|
() => SizedBox(
|
||||||
width: 400.w,
|
width: 88.w,
|
||||||
height: 380.h,
|
height: 88.w,
|
||||||
fit: BoxFit.fill,
|
child: ClipRRect(
|
||||||
),
|
borderRadius: BorderRadius.circular(52.5.w),
|
||||||
Center(
|
child: CustomNetworkImage(
|
||||||
child: Column(
|
url: state.userHeadUrl.value,
|
||||||
children: <Widget>[
|
defaultUrl: 'images/controls_user.png',
|
||||||
SizedBox(
|
width: 88.w,
|
||||||
height: 120.h,
|
height: 88.h,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 20.w),
|
||||||
|
Obx(
|
||||||
|
() => GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
if (!state.isVip.value) {
|
||||||
|
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: <String, int>{
|
||||||
|
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
||||||
|
});
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
state.userNickName.value.isNotEmpty
|
||||||
|
? state.userNickName.value
|
||||||
|
: (state.userMobile.value.isNotEmpty ? state.userMobile.value : state.userEmail.value),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 5.w,
|
||||||
|
),
|
||||||
|
if (!state.isVip.value)
|
||||||
|
Image.asset(
|
||||||
|
'images/mine/icon_mine_noPlus.png',
|
||||||
|
width: 20.w,
|
||||||
|
height: 20.w,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Image.asset(
|
||||||
|
'images/mine/icon_mine_isPlus.png',
|
||||||
|
width: 20.w,
|
||||||
|
height: 20.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10.r),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if (F.isSKY && Get.locale!.languageCode == 'zh')
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
Get.toNamed(Routers.minePersonInfoPage);
|
WechatManageTool.getAppInfo(CustomerTool.openCustomerService);
|
||||||
},
|
},
|
||||||
child: Obx(() => SizedBox(
|
child: Image.asset(
|
||||||
width: 105.w,
|
'images/mine/icon_mine_main_supportStaff.png',
|
||||||
height: 105.w,
|
width: 34.w,
|
||||||
child: ClipRRect(
|
height: 34.w,
|
||||||
borderRadius: BorderRadius.circular(52.5.w),
|
),
|
||||||
child: CustomNetworkImage(
|
|
||||||
url: state.userHeadUrl.value,
|
|
||||||
defaultUrl: 'images/controls_user.png',
|
|
||||||
width: 105.w,
|
|
||||||
height: 105.h,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
width: 20.w,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
Get.toNamed(Routers.messageListPage);
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
'images/mine/icon_mine_main_message.png',
|
||||||
|
width: 36.w,
|
||||||
|
height: 36.w,
|
||||||
),
|
),
|
||||||
Obx(() => GestureDetector(
|
),
|
||||||
onTap: () {
|
],
|
||||||
if (!state.isVip.value) {
|
|
||||||
// if (CommonDataManage().currentKeyInfo.isLockOwner !=
|
|
||||||
// 1) {
|
|
||||||
// logic.showToast('请先添加锁');
|
|
||||||
// } else {
|
|
||||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
|
||||||
arguments: <String, int>{
|
|
||||||
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
|
||||||
});
|
|
||||||
// }
|
|
||||||
} else {
|
|
||||||
Get.toNamed(
|
|
||||||
Routers.valueAddedServicesHighFunctionPage);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
state.userNickName.value.isNotEmpty
|
|
||||||
? state.userNickName.value
|
|
||||||
: (state.userMobile.value.isNotEmpty
|
|
||||||
? state.userMobile.value
|
|
||||||
: state.userEmail.value),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 22.sp,
|
|
||||||
color: Colors.white,
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
width: 5.w,
|
|
||||||
),
|
|
||||||
if (!state.isVip.value)
|
|
||||||
Image.asset(
|
|
||||||
'images/mine/icon_mine_noPlus.png',
|
|
||||||
width: 20.w,
|
|
||||||
height: 20.w,
|
|
||||||
)
|
|
||||||
else
|
|
||||||
Image.asset(
|
|
||||||
'images/mine/icon_mine_isPlus.png',
|
|
||||||
width: 20.w,
|
|
||||||
height: 20.w,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bottomListWidget() {
|
Widget bottomListWidget() {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.only(
|
width: double.infinity,
|
||||||
left: 60.w,
|
decoration: BoxDecoration(
|
||||||
top: 50.h,
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10.w),
|
||||||
),
|
),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
mineItem('images/mine/icon_mine_main_addLock.png', '添加设备'.tr, () {
|
|
||||||
Get.back();
|
|
||||||
Get.toNamed(Routers.selectLockTypePage);
|
|
||||||
}),
|
|
||||||
// mineItem('images/mine/icon_mine_main_gateway.png',
|
|
||||||
// TranslationLoader.lanKeys!.gateway!.tr, () {
|
|
||||||
// Navigator.pushNamed(context, Routers.gatewayListPage);
|
|
||||||
// }),
|
|
||||||
mineItem('images/mine/icon_mine_main_message.png', '消息'.tr, () {
|
|
||||||
Get.back();
|
|
||||||
Get.toNamed(Routers.messageListPage);
|
|
||||||
// Toast.show(msg: "功能暂未开放");
|
|
||||||
}),
|
|
||||||
//删除“客服”行
|
|
||||||
// mineItem('images/mine/icon_mine_main_supportStaff.png',
|
|
||||||
// TranslationLoader.lanKeys!.supportStaff!.tr, () {
|
|
||||||
// Navigator.pushNamed(context, Routers.supportStaffPage);
|
|
||||||
// }),
|
|
||||||
mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () {
|
mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () {
|
||||||
Get.back();
|
Get.back();
|
||||||
Get.toNamed(Routers.mineSetPage);
|
Get.toNamed(Routers.mineSetPage);
|
||||||
}),
|
}),
|
||||||
//上架审核
|
SizedBox(height: 20.h),
|
||||||
// if (F.isLite)
|
mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () async {
|
||||||
// Container()
|
final bool? isVip = await Storage.getBool(saveIsVip);
|
||||||
// else
|
if (isVip == null || !isVip) {
|
||||||
mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () {
|
// vip状态是和账号绑定,这里判断用户打开的某个锁是不是LockOwner没意义
|
||||||
Get.back();
|
// if (CommonDataManage().currentKeyInfo.isLockOwner != 1) {
|
||||||
Get.toNamed(Routers.valueAddedServicesPage);
|
// logic.showToast('请先添加锁'.tr);
|
||||||
|
// } else {
|
||||||
|
//刷新购买状态
|
||||||
|
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: <String, int>{
|
||||||
|
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
||||||
|
})?.then((value) => logic.getUserInfoRequest());
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
// if (F.isLite)
|
SizedBox(height: 20.h),
|
||||||
// Container()
|
|
||||||
// else
|
|
||||||
mineItem('images/mine/icon_mine_main_shoppingcart.png', '配件商城'.tr,
|
|
||||||
() {
|
|
||||||
Get.back();
|
|
||||||
Get.toNamed(Routers.lockMallPage);
|
|
||||||
}),
|
|
||||||
if (F.isSKY && Get.locale!.languageCode == 'zh')
|
|
||||||
mineItem('images/mine/icon_mine_main_supportStaff.png', '客服'.tr,
|
|
||||||
() {
|
|
||||||
Get.back();
|
|
||||||
WechatManageTool.getAppInfo(CustomerTool.openCustomerService);
|
|
||||||
}),
|
|
||||||
mineItem('images/mine/icon_mine_main_about.png', '关于'.tr, () {
|
mineItem('images/mine/icon_mine_main_about.png', '关于'.tr, () {
|
||||||
Get.back();
|
Get.back();
|
||||||
Get.toNamed(Routers.aboutPage);
|
Get.toNamed(Routers.aboutPage);
|
||||||
@ -229,71 +248,25 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget keyBottomWidget() {
|
Widget mineItem(String lockTypeIcon, String lockTypeTitle, Function() action) {
|
||||||
// return Column(
|
|
||||||
// children: <Widget>[
|
|
||||||
// SubmitBtn(
|
|
||||||
// btnName: '退出'.tr,
|
|
||||||
// borderRadius: 20.w,
|
|
||||||
// fontSize: 32.sp,
|
|
||||||
// margin: EdgeInsets.only(left: 60.w, right: 60.w),
|
|
||||||
// padding: EdgeInsets.only(top: 15.w, bottom: 15.w),
|
|
||||||
// onClick: () {}),
|
|
||||||
// Container(
|
|
||||||
// padding: EdgeInsets.only(right: 30.w),
|
|
||||||
// // color: Colors.red,
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
// children: <Widget>[
|
|
||||||
// TextButton(
|
|
||||||
// child: Text(
|
|
||||||
// '删除账号'.tr,
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: AppColors.mainColor, fontWeight: FontWeight.w500),
|
|
||||||
// ),
|
|
||||||
// onPressed: () {},
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// height: 30.h,
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
Widget mineItem(
|
|
||||||
String lockTypeIcon, String lockTypeTitle, Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Center(
|
Image.asset(
|
||||||
child: Container(
|
lockTypeIcon,
|
||||||
// height: 80.h,
|
width: 28.w,
|
||||||
width: 330.w,
|
height: 28.w,
|
||||||
padding: EdgeInsets.all(20.h),
|
|
||||||
color: Colors.white,
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Image.asset(
|
|
||||||
lockTypeIcon,
|
|
||||||
width: 28.w,
|
|
||||||
height: 28.w,
|
|
||||||
),
|
|
||||||
SizedBox(width: 15.w),
|
|
||||||
Text(
|
|
||||||
lockTypeTitle,
|
|
||||||
style: TextStyle(fontSize: 22.sp),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Container(
|
SizedBox(width: 15.w),
|
||||||
height: 0.5.h,
|
Text(
|
||||||
color: Colors.grey,
|
lockTypeTitle,
|
||||||
|
style: TextStyle(fontSize: 28.sp),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios_rounded,
|
||||||
|
color: Colors.grey[400],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -305,6 +305,8 @@ abstract class Api {
|
|||||||
'/lockSetting/updateLockSetting'; // 设置语音包
|
'/lockSetting/updateLockSetting'; // 设置语音包
|
||||||
final String reportBuyRequestURL =
|
final String reportBuyRequestURL =
|
||||||
'/service/reportBuyRequest'; // 上报增值服务购买请求
|
'/service/reportBuyRequest'; // 上报增值服务购买请求
|
||||||
final String getActivateInfoURL =
|
final String getTppSupportURL =
|
||||||
'/api/authCode/getTppSupport'; // 查询ttp
|
'/api/authCode/getTppSupport'; // 查询ttp
|
||||||
|
final String getActivateInfoURL =
|
||||||
|
'/api/authCode/getActivateInfo'; // 查询ttp
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,28 +10,48 @@ import 'package:star_lock/talk/starChart/entity/star_chart_register_node_entity.
|
|||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
class StartCompanyApi extends BaseProvider {
|
class StartCompanyApi extends BaseProvider {
|
||||||
// 星图url
|
// 星启url
|
||||||
String _startChartHost = 'https://company.skychip.top';
|
String _startChartHost = 'https://company.skychip.top';
|
||||||
|
|
||||||
static StartCompanyApi get to => Get.put(StartCompanyApi());
|
static StartCompanyApi get to => Get.put(StartCompanyApi());
|
||||||
|
|
||||||
// 设置星图host
|
// 设置星启host
|
||||||
set startChartHost(String value) {
|
set startChartHost(String value) {
|
||||||
_startChartHost = value;
|
_startChartHost = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取星图host
|
// 获取星启host
|
||||||
String get startChartHost => _startChartHost;
|
String get startChartHost => _startChartHost;
|
||||||
|
|
||||||
// ttp查询
|
// ttp查询
|
||||||
Future<ActivateInfoResponse> getActivateInfo({
|
Future<TppSupportResponse> getTppSupport({
|
||||||
required String model,
|
required String model,
|
||||||
|
}) async {
|
||||||
|
final response = await post(
|
||||||
|
_startChartHost + getTppSupportURL.toUrl,
|
||||||
|
jsonEncode(<String, dynamic>{
|
||||||
|
'model': model,
|
||||||
|
}),
|
||||||
|
isUnShowLoading: true,
|
||||||
|
isUserBaseUrl: false,
|
||||||
|
);
|
||||||
|
return TppSupportResponse.fromJson(response.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取授权码
|
||||||
|
Future<ActivateInfoResponse> getAuthorizationCode({
|
||||||
|
required String registerKey,
|
||||||
|
required String model,
|
||||||
|
required String serialNum0,
|
||||||
|
required int platform,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await post(
|
final response = await post(
|
||||||
_startChartHost + getActivateInfoURL.toUrl,
|
_startChartHost + getActivateInfoURL.toUrl,
|
||||||
jsonEncode(<String, dynamic>{
|
jsonEncode(<String, dynamic>{
|
||||||
|
'register_key': registerKey,
|
||||||
|
'platform': platform,
|
||||||
'model': model,
|
'model': model,
|
||||||
|
'serial_num0': serialNum0,
|
||||||
}),
|
}),
|
||||||
isUnShowLoading: true,
|
isUnShowLoading: true,
|
||||||
isUserBaseUrl: false,
|
isUserBaseUrl: false,
|
||||||
|
|||||||
@ -261,7 +261,7 @@ dependencies:
|
|||||||
|
|
||||||
jverify: 3.0.0
|
jverify: 3.0.0
|
||||||
#<cn>
|
#<cn>
|
||||||
umeng_common_sdk: 1.2.8
|
# umeng_common_sdk: 1.2.8
|
||||||
#</cn>
|
#</cn>
|
||||||
#<com>
|
#<com>
|
||||||
firebase_analytics: 11.3.0
|
firebase_analytics: 11.3.0
|
||||||
@ -323,6 +323,7 @@ flutter:
|
|||||||
- images/
|
- images/
|
||||||
- images/tabbar/
|
- images/tabbar/
|
||||||
- images/guide/
|
- images/guide/
|
||||||
|
- images/other/
|
||||||
- images/main/
|
- images/main/
|
||||||
- images/main/addFingerprint/
|
- images/main/addFingerprint/
|
||||||
- images/mine/
|
- images/mine/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user