Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
65403b64c5
@ -107,7 +107,7 @@ android {
|
||||
dimension "flavor-type"
|
||||
applicationId "com.xhjcn.lock"
|
||||
signingConfig signingConfigs.xhj
|
||||
resValue "string", "app_name", "星星锁"
|
||||
resValue "string", "app_name", "鑫锁"
|
||||
manifestPlaceholders.JPUSH_PKGNAME = "com.xhjcn.lock"
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ flavors:
|
||||
bundleId: "com.skychip.lock"
|
||||
xhj:
|
||||
app:
|
||||
name: "星星锁"
|
||||
name: "鑫锁"
|
||||
icon: "assets/icon/xhj.png"
|
||||
android:
|
||||
applicationId: "com.xhjcn.lock"
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
|
||||
FLUTTER_TARGET=lib/main_xhj_full.dart
|
||||
ASSET_PREFIX=xhj
|
||||
BUNDLE_NAME=星星锁
|
||||
BUNDLE_DISPLAY_NAME=星星锁
|
||||
BUNDLE_NAME=鑫锁
|
||||
BUNDLE_DISPLAY_NAME=鑫锁
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
|
||||
FLUTTER_TARGET=lib/main_xhj_full.dart
|
||||
ASSET_PREFIX=xhj
|
||||
BUNDLE_NAME=星星锁
|
||||
BUNDLE_DISPLAY_NAME=星星锁
|
||||
BUNDLE_NAME=鑫锁
|
||||
BUNDLE_DISPLAY_NAME=鑫锁
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
|
||||
FLUTTER_TARGET=lib/main_xhj_lite.dart
|
||||
ASSET_PREFIX=xhj
|
||||
BUNDLE_NAME=星星锁
|
||||
BUNDLE_DISPLAY_NAME=星星锁
|
||||
BUNDLE_NAME=鑫锁
|
||||
BUNDLE_DISPLAY_NAME=鑫锁
|
||||
|
||||
@ -76,7 +76,7 @@ import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkin
|
||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart';
|
||||
import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart';
|
||||
import 'main/lockDetail/face/addFace/addFace_page.dart';
|
||||
import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart';
|
||||
import 'main/lockDetail/face/addFaceType/addFaceType_page.dart';
|
||||
import 'main/lockDetail/face/faceList/faceList_page.dart';
|
||||
import 'main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart';
|
||||
import 'main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart';
|
||||
@ -115,9 +115,9 @@ import 'main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWi
|
||||
import 'main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
|
||||
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
||||
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart';
|
||||
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart';
|
||||
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart';
|
||||
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
|
||||
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControlManage/addRemoteControlManage_page.dart';
|
||||
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart';
|
||||
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
|
||||
import 'main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart';
|
||||
import 'main/lockDetail/videoLog/videoLog/videoLog_page.dart';
|
||||
@ -214,7 +214,7 @@ abstract class Routers {
|
||||
'/ElectronicKeyPeriodValidityPage'; // 电子钥匙有效期
|
||||
static const sendEmailNotificationPage = '/SendEmailNotificationPage'; // 邮件通知
|
||||
static const passwordKeyListPage = '/PasswordKeyListPage'; // 密码钥匙列表
|
||||
static const passwordKeyManagePage = '/PasswordKeyManagePage'; // 密码钥匙
|
||||
static const passwordKeyPerpetualPage = '/PasswordKeyPerpetualPage'; // 密码钥匙
|
||||
static const passwordKeyDetailPage = '/PasswordKeyDetailPage'; // 密码钥匙详情
|
||||
// static const otherTypeKeyListPage = '/OtherTypeKeyListPage'; // 卡、指纹、遥控钥匙列表
|
||||
// static const otherTypeKeyDetailPage = '/OtherTypeKeyDetailPage'; // 卡、指纹、遥控钥匙详情
|
||||
@ -412,8 +412,7 @@ abstract class Routers {
|
||||
static const videoLogDownLoadPage = '/VideoLogDownLoadPage'; // 视频下载列表
|
||||
|
||||
static const remoteControlListPage = '/RemoteControlListPage'; // 遥控列表
|
||||
static const addRemoteControlManagePage =
|
||||
'/AddRemoteControlManagePage'; // 添加遥控
|
||||
static const addRemoteControlPage = '/AddRemoteControlPage'; // 添加遥控
|
||||
|
||||
static const cardListPage = '/CardListPage'; // 卡列表
|
||||
// static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡
|
||||
@ -423,7 +422,7 @@ abstract class Routers {
|
||||
static const addFingerprintTypePage = '/AddFingerprintTypePage'; // 添加指纹
|
||||
static const fingerprintDetailPage = '/FingerprintDetailPage'; // 指纹详情
|
||||
static const faceListPage = '/FaceListPage'; // 人脸列表
|
||||
static const addFaceTypeManagePage = '/AddFaceTypeManagePage'; // 添加人脸
|
||||
static const addFaceTypePage = '/AddFaceTypePage'; // 添加人脸
|
||||
static const faceDetailPage = '/faceDetailPage'; // 人脸详情
|
||||
|
||||
static const irisListPage = '/IrisListPage'; // 虹膜列表
|
||||
@ -520,8 +519,8 @@ abstract class AppRouters {
|
||||
page: () => const PasswordKeyListPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.passwordKeyManagePage,
|
||||
page: () => const PasswordKeyManagePage(),
|
||||
name: Routers.passwordKeyPerpetualPage,
|
||||
page: () => const PasswordKeyPerpetualPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.passwordKeyDetailPage,
|
||||
@ -1006,8 +1005,8 @@ abstract class AppRouters {
|
||||
name: Routers.remoteControlListPage,
|
||||
page: () => const RemoteControlListPage()),
|
||||
GetPage(
|
||||
name: Routers.addRemoteControlManagePage,
|
||||
page: () => const AddRemoteControlManagePage()),
|
||||
name: Routers.addRemoteControlPage,
|
||||
page: () => const AddRemoteControlPage()),
|
||||
GetPage(name: Routers.cardListPage, page: () => const CardListPage()),
|
||||
// GetPage(
|
||||
// name: Routers.addCardTypeManagePage,
|
||||
@ -1027,8 +1026,8 @@ abstract class AppRouters {
|
||||
page: () => const FingerprintDetailPage()),
|
||||
GetPage(name: Routers.faceListPage, page: () => const FaceListPage()),
|
||||
GetPage(
|
||||
name: Routers.addFaceTypeManagePage,
|
||||
page: () => const AddFaceTypeManagePage()),
|
||||
name: Routers.addFaceTypePage,
|
||||
page: () => const AddFaceTypePage()),
|
||||
GetPage(
|
||||
name: Routers.passwordKeyDetailChangeDatePage,
|
||||
page: () => const PasswordKeyDetailChangeDatePage()),
|
||||
|
||||
@ -55,53 +55,78 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
print('---> 指令 : $type1 $type2' );
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
print('---> 锁id :' + utf8.encode(lockID!).toString());
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
print('---> userID :' + utf8.encode(userID!).toString());
|
||||
|
||||
//platform 2
|
||||
int platform0 = (platform! & 0xFF00) >> 8;
|
||||
int platform1 = platform! & 0xFF;
|
||||
data.add(platform0);
|
||||
data.add(platform1);
|
||||
|
||||
print('---> platform : $platform0 $platform1');
|
||||
|
||||
//product 2
|
||||
int product0 = (product! & 0xFF00) >> 8;
|
||||
int product1 = product! & 0xFF;
|
||||
data.add(product0);
|
||||
data.add(product1);
|
||||
// int product0 = (product! & 0xFF00) >> 8;
|
||||
// int product1 = product! & 0xFF;
|
||||
// data.add(product0);
|
||||
// data.add(product1);
|
||||
data.addAll([0,1]);//先默认是 01
|
||||
|
||||
print('---> platform : ${[0,1]}');
|
||||
|
||||
//HwVersion 20
|
||||
int hwVersionLength = utf8.encode(hwVersion!).length;
|
||||
data.addAll(utf8.encode(hwVersion!));
|
||||
data = getFixedLengthList(data, 20 - hwVersionLength);
|
||||
|
||||
print('---> hwVersion : ${utf8.encode(hwVersion!)}');
|
||||
|
||||
//FwVersion 20
|
||||
int fwVersionLength = utf8.encode(fwVersion!).length;
|
||||
data.addAll(utf8.encode(fwVersion!));
|
||||
data = getFixedLengthList(data, 20 - fwVersionLength);
|
||||
|
||||
print('---> FwVersion : ${utf8.encode(fwVersion!)}');
|
||||
|
||||
//fwSize 4
|
||||
ByteData bytes = ByteData(4); // 创建一个长度为4的字节数据
|
||||
bytes.setInt32(0, fwSize!);
|
||||
List<int> byteList = bytes.buffer.asUint8List();
|
||||
data.addAll(byteList);
|
||||
|
||||
//fwMD5 16
|
||||
int fwMD5Length = utf8.encode(fwMD5!).length;
|
||||
data.addAll(utf8.encode(fwMD5!));
|
||||
data = getFixedLengthList(data, 16 - fwMD5Length);
|
||||
print('---> fwSize : ${byteList}');
|
||||
|
||||
// 创建一个16字节的字节数组
|
||||
Uint8List result = Uint8List(16);
|
||||
// 将每个十六进制字符转换为4位二进制数据,并将其存储到结果字节数组中
|
||||
for (int i = 0; i < fwMD5!.length; i += 2) {
|
||||
String hex = fwMD5!.substring(i, i + 2);
|
||||
int byteValue = int.parse(hex, radix: 16);
|
||||
result[i ~/ 2] = byteValue;
|
||||
}
|
||||
data.addAll(result);
|
||||
print('---> fwMD5 : ${result}');
|
||||
|
||||
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||
data.addAll(token!);
|
||||
|
||||
print('--->1'+data.toString());
|
||||
print('---> token : ${token}');
|
||||
|
||||
print('--->1' + data.toString());
|
||||
|
||||
if (needAuthor == 0) {
|
||||
//AuthCodeLen 1
|
||||
@ -120,6 +145,8 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print('---> ${utf8.encode(keyID!)} ${utf8.encode(userID!)} $token $signKey');
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
@ -149,7 +176,7 @@ class OTAUpgradeReply extends Reply {
|
||||
data = dataDetail;
|
||||
token = data.sublist(2, 6);
|
||||
status = data[6];
|
||||
print('--->2'+data.toString());
|
||||
print('--->2' + data.toString());
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,8 +13,8 @@ enum CommandType {
|
||||
calibrationTime, // 校时 = 0x30f0
|
||||
readStarLockStatusInfo, //读星锁状态信息 0x3040
|
||||
startOATUpgrade, //OTA升级开始 0x30E0
|
||||
confirmationOTAUpgrade, //OTA升级开始 0x30E1
|
||||
processOTAUpgrade, //OTA升级过程 0x30E2
|
||||
confirmationOTAUpgrade, //OTA升级开始 0x30E2
|
||||
processOTAUpgrade, //OTA升级过程 0x30E1
|
||||
|
||||
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
||||
gecChangeAdministratorPassword, // 通用扩展指令子命令-修改管理员密码 = 2
|
||||
|
||||
@ -114,7 +114,7 @@ class CommandReciverManager {
|
||||
oriDataList = SM4.decrypt(getDataList,
|
||||
key: getPrivateKeyList, mode: SM4CryptoMode.ECB);
|
||||
oriDataList = oriDataList.sublist(0, oriLen);
|
||||
// print("SM4 oriDataList:$oriDataList");
|
||||
print("SM4 oriDataList:$oriDataList");
|
||||
break;
|
||||
}
|
||||
parseData(oriDataList).then((value) async {
|
||||
|
||||
@ -86,6 +86,7 @@ class IoSenderManage {
|
||||
List<int>? publicKey,
|
||||
List<int>? privateKey,
|
||||
List<int>? token,
|
||||
bool? isBeforeAddUser,
|
||||
CommandSendCallBack? callBack}) {
|
||||
CommandSenderManager().managerSendData(
|
||||
command: AddUserCommand(
|
||||
@ -103,7 +104,7 @@ class IoSenderManage {
|
||||
publicKey: publicKey,
|
||||
privateKey: privateKey,
|
||||
token: token),
|
||||
isBeforeAddUser: true,
|
||||
isBeforeAddUser: isBeforeAddUser!,
|
||||
callBack: callBack);
|
||||
}
|
||||
|
||||
@ -214,6 +215,7 @@ class IoSenderManage {
|
||||
{String? lockID,
|
||||
String? userID,
|
||||
List<int>? privateKey,
|
||||
bool? isBeforeAddUser,
|
||||
CommandSendCallBack? callBack}) {
|
||||
CommandSenderManager().managerSendData(
|
||||
command: GetStarLockStatuInfoCommand(
|
||||
@ -221,6 +223,7 @@ class IoSenderManage {
|
||||
userID: userID,
|
||||
privateKey: privateKey,
|
||||
),
|
||||
isBeforeAddUser: isBeforeAddUser!,
|
||||
callBack: callBack);
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ class F {
|
||||
case Flavor.sky:
|
||||
return '锁通通';
|
||||
case Flavor.xhj:
|
||||
return '星星锁';
|
||||
return '鑫锁';
|
||||
default:
|
||||
throw Exception('flavor[$name] title not found');
|
||||
}
|
||||
@ -91,7 +91,7 @@ class F {
|
||||
case Flavor.sky:
|
||||
return '锁通通';
|
||||
case Flavor.xhj:
|
||||
return '星星锁';
|
||||
return '鑫锁';
|
||||
default:
|
||||
throw Exception('flavor[$name] title not found');
|
||||
}
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'addCardTypeManage_tabbar.dart';
|
||||
|
||||
class AddCardTypeManagePage extends StatefulWidget {
|
||||
const AddCardTypeManagePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddCardTypeManagePage> createState() => _AddCardTypeManagePageState();
|
||||
}
|
||||
|
||||
class _AddCardTypeManagePageState extends State<AddCardTypeManagePage> {
|
||||
var index = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Map map = Get.arguments;
|
||||
var lockId = map["lockId"];
|
||||
var fromType = map["fromType"]??1; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "";
|
||||
if(fromType == 2){
|
||||
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
AddCardManageTabbar(initialIndex: index, lockId: lockId, fromType: fromType, fromTypeTwoStaffName:fromTypeTwoStaffName),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,123 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../addCardType_page.dart';
|
||||
|
||||
class AddCardManageTabbar extends StatefulWidget {
|
||||
var initialIndex = 1;
|
||||
var lockId = 0;
|
||||
var fromType = 0; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = ""; // 从添加员工进入 传入员工名字
|
||||
|
||||
AddCardManageTabbar(
|
||||
{Key? key,
|
||||
required this.initialIndex,
|
||||
required this.lockId,
|
||||
required this.fromType,
|
||||
required this.fromTypeTwoStaffName})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<AddCardManageTabbar> createState() => _AddCardManageTabbarState();
|
||||
}
|
||||
|
||||
class _AddCardManageTabbarState extends State<AddCardManageTabbar>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||
];
|
||||
|
||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
_tabController = TabController(
|
||||
vsync: this,
|
||||
length: widget.fromType == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
_tabController.addListener(() {
|
||||
print("_tabController.indexIsChanging:${_tabController.indexIsChanging} _tabController.index:${_tabController.index}");
|
||||
if (_tabController.animation!.value == _tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: _tabController,
|
||||
onTap: (index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
automaticIndicatorColorAdjustment: true,
|
||||
labelColor: AppColors.mainColor,
|
||||
labelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
indicator: CustomUnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||
strokeCap: StrokeCap.round,
|
||||
width: 30.w),
|
||||
);
|
||||
}
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(
|
||||
child: SizedBox(
|
||||
width: 1.sw / 5,
|
||||
child: Text(item.title, textAlign: TextAlign.center)));
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children:
|
||||
widget.fromType == 1
|
||||
? _itemTabs.map((ItemView item) => AddCardPage()).toList()
|
||||
: _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage()).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.selectType});
|
||||
|
||||
final String title;
|
||||
final String selectType;
|
||||
}
|
||||
@ -81,7 +81,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
cardNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||
useCountLimit:0xff,
|
||||
isForce:state.isCoerced.value == "1" ? 0 : 1, // 是否是胁迫
|
||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||
@ -229,7 +229,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
cardNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||
useCountLimit:0xff,
|
||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||
|
||||
@ -180,7 +180,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
||||
Get.toNamed(Routers.addFaceTypePage, arguments: {
|
||||
"lockId": state.getKeyInfosData.value.lockId,
|
||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
"fromTypeTwoStaffName": state.staffNameController.text
|
||||
|
||||
@ -83,7 +83,7 @@ class AddFaceLogic extends BaseGetXController {
|
||||
IoSenderManage.senderAddFaceCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
faceNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
faceNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||
useCountLimit:0xff,
|
||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||
@ -232,7 +232,7 @@ class AddFaceLogic extends BaseGetXController {
|
||||
IoSenderManage.senderAddFaceCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
faceNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
faceNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||
useCountLimit:0xff,
|
||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'addFaceTypeManage_tabbar.dart';
|
||||
|
||||
class AddFaceTypeManagePage extends StatefulWidget {
|
||||
const AddFaceTypeManagePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddFaceTypeManagePage> createState() => _AddFaceTypeManagePageState();
|
||||
}
|
||||
|
||||
class _AddFaceTypeManagePageState extends State<AddFaceTypeManagePage> {
|
||||
var index = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Map map = Get.arguments;
|
||||
var lockId = map["lockId"];
|
||||
var fromType = map["fromType"]; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "";
|
||||
if(fromType == 2){
|
||||
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
AddFaceTypeManageTabbar(lockId: lockId, fromType: fromType, fromTypeTwoStaffName: fromTypeTwoStaffName, initialIndex: index),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../addFaceType_page.dart';
|
||||
|
||||
class AddFaceTypeManageTabbar extends StatefulWidget {
|
||||
var initialIndex = 1;
|
||||
var lockId = 0;
|
||||
var fromType = 1; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "";// 从添加员工进入 传入员工名字
|
||||
AddFaceTypeManageTabbar({Key? key, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName, required this.initialIndex}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddFaceTypeManageTabbar> createState() => _AddFaceTypeManageTabbarState();
|
||||
}
|
||||
|
||||
class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||
];
|
||||
|
||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
_tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
|
||||
_tabController.addListener(() {
|
||||
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
|
||||
if (_tabController.animation!.value == _tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: _tabController,
|
||||
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
automaticIndicatorColorAdjustment: true,
|
||||
labelColor: AppColors.mainColor,
|
||||
labelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
indicator: CustomUnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||
strokeCap: StrokeCap.round,
|
||||
width: 30.w),
|
||||
);
|
||||
}
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(
|
||||
child: SizedBox(
|
||||
width: 1.sw / 5,
|
||||
child: Text(item.title, textAlign: TextAlign.center)));
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children:
|
||||
widget.fromType == 1
|
||||
? _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList()
|
||||
:_itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
|
||||
|
||||
// _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.selectType});
|
||||
|
||||
final String title;
|
||||
final String selectType;
|
||||
}
|
||||
@ -16,16 +16,17 @@ class AddFaceTypeLogic extends BaseGetXController {
|
||||
var startTime = "";
|
||||
var endTime = "";
|
||||
if (state.selectType.value == "0") {
|
||||
print("永久卡永久卡永久卡");
|
||||
faceType = 1;
|
||||
startDate = "0";
|
||||
endDate = "0";
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
} else if (state.selectType.value == "1") {
|
||||
print("限时卡限时卡限时卡");
|
||||
faceType = 2;
|
||||
startDate =
|
||||
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
|
||||
@ -48,16 +49,18 @@ class AddFaceTypeLogic extends BaseGetXController {
|
||||
return;
|
||||
}
|
||||
} else if (state.selectType.value == "2") {
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
print("循环卡循环卡循环卡");
|
||||
if (state.cycleBeginTime.value.isEmpty) {
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
}
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
|
||||
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||
faceType = 4;
|
||||
}
|
||||
|
||||
// 人脸
|
||||
Get.toNamed(Routers.addFacePage, arguments: {
|
||||
"lockId": state.lockId.value,
|
||||
|
||||
@ -9,106 +9,111 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'addFaceType_logic.dart';
|
||||
|
||||
class AddFaceTypePage extends StatefulWidget {
|
||||
final String selectType; // 永久限时循环下标
|
||||
final int lockId;
|
||||
final int fromType; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
final String fromTypeTwoStaffName; // 从添加员工进入 传入员工名字
|
||||
|
||||
const AddFaceTypePage(
|
||||
{Key? key,
|
||||
required this.selectType,
|
||||
required this.lockId,
|
||||
required this.fromType,
|
||||
required this.fromTypeTwoStaffName})
|
||||
: super(key: key);
|
||||
const AddFaceTypePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddFaceTypePage> createState() => _AddFaceTypePageState();
|
||||
}
|
||||
|
||||
class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
||||
class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProviderStateMixin {
|
||||
final logic = Get.put(AddFaceTypeLogic());
|
||||
final state = Get.find<AddFaceTypeLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.selectType.value = widget.selectType;
|
||||
state.lockId.value = widget.lockId;
|
||||
if (widget.fromTypeTwoStaffName.isNotEmpty) {
|
||||
state.nameController.text = widget.fromTypeTwoStaffName;
|
||||
}
|
||||
state.fromType.value = widget.fromType;
|
||||
|
||||
return indexChangeWidget();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (state.selectType.value == "1") {
|
||||
state.beginTime.value = DateTool().dateToYMDHNString(
|
||||
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||
state.endTime.value = DateTool().dateToYMDHNString(
|
||||
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
||||
} else {
|
||||
state.beginTime.value = ""; //默认为当前时间
|
||||
state.endTime.value = ""; //默认为当前时间
|
||||
state.tabController = TabController(
|
||||
vsync: this,
|
||||
length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
|
||||
initialIndex: 0);
|
||||
state.tabController.addListener(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
state.selectType.value = state.tabController.index.toString();
|
||||
});
|
||||
|
||||
if (state.tabController.animation!.value == state.tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
switch (int.parse(widget.selectType)) {
|
||||
switch (int.parse(state.selectType.value)) {
|
||||
case 0:
|
||||
{
|
||||
// 永久
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyTimeLimitWidget(),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyTimeLimitWidget(),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// 循环
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
default:
|
||||
@ -138,24 +143,24 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.beginTime.value,
|
||||
rightTitle: state.timeLimitBeginTime.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: state.endTime.value,
|
||||
rightTitle: state.timeLimitEndTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
@ -168,47 +173,44 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
||||
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.beginTime.value,
|
||||
'endDate': state.endTime.value,
|
||||
'starDate': state.cycleBeginTime.value,
|
||||
'endDate': state.cycleEndTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
state.endTime.value = result['endDate'];
|
||||
state.cycleBeginTime.value = result['starDate'];
|
||||
state.cycleEndTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
Get.log(
|
||||
'得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效日",
|
||||
leftTitel: "有效日".tr,
|
||||
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.beginTime.value,
|
||||
'endDate': state.endTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.cycleBeginTime.value,
|
||||
'endDate': state.cycleEndTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
state.endTime.value = result['endDate'];
|
||||
state.cycleBeginTime.value = result['starDate'];
|
||||
state.cycleEndTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
}
|
||||
@ -217,25 +219,22 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle:
|
||||
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.beginTime.value,
|
||||
'endDate': state.endTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.cycleBeginTime.value,
|
||||
'endDate': state.cycleEndTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
state.endTime.value = result['endDate'];
|
||||
state.cycleBeginTime.value = result['starDate'];
|
||||
state.cycleEndTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
Get.back(result: result);
|
||||
}
|
||||
}))),
|
||||
],
|
||||
@ -338,4 +337,69 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||
];
|
||||
|
||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
];
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: state.tabController,
|
||||
onTap: (index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
automaticIndicatorColorAdjustment: true,
|
||||
labelColor: AppColors.mainColor,
|
||||
labelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
indicator: CustomUnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||
strokeCap: StrokeCap.round,
|
||||
width: 30.w),
|
||||
);
|
||||
}
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(
|
||||
child: SizedBox(
|
||||
width: 1.sw / 5,
|
||||
child: Text(item.title, textAlign: TextAlign.center)));
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: state.tabController,
|
||||
children:
|
||||
state.fromType.value == 1
|
||||
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
|
||||
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.selectType});
|
||||
|
||||
final String title;
|
||||
final String selectType;
|
||||
}
|
||||
|
||||
@ -1,30 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../tools/dateTool.dart';
|
||||
|
||||
class AddFaceTypeState {
|
||||
final lockId = 0.obs;
|
||||
final selectType = "0".obs; // 0永久 1显示 2循环
|
||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字
|
||||
final isStressFingerprint = false.obs;
|
||||
final isAdministrator = false.obs; // 是否是管理员
|
||||
|
||||
var beginTime = "".obs; // 开始时间
|
||||
var endTime = "".obs; // 结束时间
|
||||
var effectiveDateTime = "".obs; // 生效时间
|
||||
var failureDateTime = "".obs; // 失效时间
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||
var cycleBeginTime = "".obs;// 循环开始时间
|
||||
var cycleEndTime = "".obs;// 循环结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字
|
||||
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
late TabController tabController;
|
||||
AddFaceTypeState() {
|
||||
// Map map = Get.arguments;
|
||||
// lockId.value = map["lockId"];
|
||||
// fromType.value = map["fromType"];
|
||||
// if(fromType.value == 2){
|
||||
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
// // nameController.text = fromTypeTwoStaffName.value;
|
||||
// }
|
||||
|
||||
// print("lockId:${lockId.value} fromType:${fromType.value}");
|
||||
Map map = Get.arguments;
|
||||
lockId.value = map["lockId"];
|
||||
fromType.value = map["fromType"];
|
||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
if(fromType.value == 2){
|
||||
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ class _FaceListPageState extends State<FaceListPage> {
|
||||
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}',
|
||||
onClick: () async {
|
||||
var data =
|
||||
await Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
||||
await Get.toNamed(Routers.addFaceTypePage, arguments: {
|
||||
"lockId": state.lockId.value,
|
||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
});
|
||||
|
||||
@ -93,7 +93,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||
useCountLimit:0xff,
|
||||
isForce:state.isCoerced.value == "1" ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||
@ -283,7 +283,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||
useCountLimit:0xff,
|
||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'addFingerprintTypeManage_tabbar.dart';
|
||||
|
||||
class AddFingerprintTypeManagePage extends StatefulWidget {
|
||||
const AddFingerprintTypeManagePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddFingerprintTypeManagePage> createState() => _AddFingerprintTypeManagePageState();
|
||||
}
|
||||
|
||||
class _AddFingerprintTypeManagePageState extends State<AddFingerprintTypeManagePage> {
|
||||
var index = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Map map = Get.arguments;
|
||||
var lockId = map["lockId"];
|
||||
var fromType = map["fromType"]; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "";
|
||||
if(fromType == 2){
|
||||
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
AddFingerprintTypeManageTabbar(initialIndex: index, lockId: lockId, fromType: fromType, fromTypeTwoStaffName:fromTypeTwoStaffName),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,117 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../addFingerprintType_page.dart';
|
||||
|
||||
class AddFingerprintTypeManageTabbar extends StatefulWidget {
|
||||
var initialIndex = 1;
|
||||
var lockId = 0;
|
||||
var fromType = 0; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "";// 从添加员工进入 传入员工名字
|
||||
|
||||
AddFingerprintTypeManageTabbar(
|
||||
{Key? key, required this.initialIndex, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddFingerprintTypeManageTabbar> createState() => _AddFingerprintTypeManageTabbarState();
|
||||
}
|
||||
|
||||
class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManageTabbar> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||
];
|
||||
|
||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
_tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
_tabController.addListener(() {
|
||||
if (_tabController.animation!.value==_tabController.index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: _tabController,
|
||||
onTap: (index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
automaticIndicatorColorAdjustment: true,
|
||||
labelColor: AppColors.mainColor,
|
||||
labelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
indicator: CustomUnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||
strokeCap: StrokeCap.round,
|
||||
width: 30.w),
|
||||
);
|
||||
}
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(child: SizedBox(
|
||||
width: 1.sw / 5,
|
||||
child: Text(item.title, textAlign: TextAlign.center)));
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children:
|
||||
widget.fromType == 1
|
||||
? _itemTabs.map((ItemView item) => const AddFingerprintTypePage()).toList()
|
||||
:_itemTabs.map((ItemView item) => const AddFingerprintTypePage()).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.selectType});
|
||||
|
||||
final String title;
|
||||
final String selectType;
|
||||
}
|
||||
@ -72,44 +72,50 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
|
||||
{
|
||||
// 永久
|
||||
// return sendElectronicKeySucceed();
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyTimeLimitWidget(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyTimeLimitWidget(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// 循环
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
default:
|
||||
|
||||
@ -14,6 +14,8 @@ import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.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/lockSet/lockSet_logic.dart';
|
||||
import 'package:star_lock/permission/permission_dialog.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
@ -64,7 +66,7 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
}
|
||||
String md5Str = md5.convert(otaBin!).toString();
|
||||
headJson!['fwMd5'] = md5Str;
|
||||
blueOTAUpgrade(headJson!, [0,0,0,0]);
|
||||
blueOTAUpgrade(headJson!, [0, 0, 0, 0]);
|
||||
}
|
||||
|
||||
//蓝牙操作 ota 升级
|
||||
@ -76,18 +78,11 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
String lockID = CommonDataManage.shareManager()
|
||||
?.currentLockSetInfoData
|
||||
.lockId
|
||||
?.toString() ??
|
||||
'';
|
||||
String keyID =
|
||||
CommonDataManage.shareManager()?.currentKeyInfo.keyId?.toString() ??
|
||||
'';
|
||||
String uid = await Storage.getUid() ?? '';
|
||||
BlueManage().writeCharacteristicWithResponse(OTAUpgradeCommand(
|
||||
lockID: lockID,
|
||||
userID: await Storage.getUid(),
|
||||
keyID: keyID,
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: uid,
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
platform: int.tryParse(data['platform']) ?? 0,
|
||||
product: int.tryParse(data['product']) ?? 0,
|
||||
hwVersion: data['hwVersion'],
|
||||
@ -96,7 +91,7 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
fwMD5: data['fwMd5'],
|
||||
needAuthor: 1,
|
||||
token: token,
|
||||
signKey: signKeyDataList,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList)
|
||||
.packageData());
|
||||
} else if (deviceConnectionState ==
|
||||
@ -119,10 +114,11 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
}
|
||||
if (otaCount <= otaIndex) {
|
||||
int now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
String msg = '传输完成 时间:${now - startSecond}秒';
|
||||
String msg =
|
||||
'传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ';
|
||||
closeOTADAta();
|
||||
print(msg);
|
||||
showToast(msg);
|
||||
// showToast(msg);
|
||||
return;
|
||||
}
|
||||
int star = otaIndex * 240;
|
||||
@ -130,10 +126,11 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
if (end > length) {
|
||||
end = length;
|
||||
}
|
||||
int size = end - star;
|
||||
List<int> data = otaBin!.sublist(star, end);
|
||||
state.otaProgress.value = otaIndex / otaCount;
|
||||
await BlueManage().writeCharacteristicWithResponse(
|
||||
ProcessOtaUpgradeCommand(index: otaIndex, size: length, data: data)
|
||||
ProcessOtaUpgradeCommand(index: otaIndex, size: size, data: data)
|
||||
.packageData());
|
||||
}
|
||||
|
||||
@ -173,7 +170,7 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
Uint8List metaLenList = data.sublist(12, 16);
|
||||
int metaLen = ByteData.sublistView(metaLenList).getUint32(0);
|
||||
if (metaLen < 2 || metaLen > 10240) {
|
||||
showToast('元数据长度错误');
|
||||
showToast('文件校验失败 0x01');
|
||||
return null;
|
||||
}
|
||||
// 读取和解析元数据
|
||||
@ -190,13 +187,14 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
// 获取固件数据部分
|
||||
Uint8List bin = data.sublist(binOffset.toInt(), data.length);
|
||||
//md5 校验有问题,暂时不解析
|
||||
// String md5Str = md5.convert(bin).toString();
|
||||
// if (md5Str != meta['fwMd5']) {
|
||||
// showToast('固件MD5校验失败');
|
||||
// return false;
|
||||
// }
|
||||
String md5Str = md5.convert(bin).toString().toUpperCase();
|
||||
print('---> $md5Str ${meta['fwMd5']}');
|
||||
if (md5Str != meta['fwMd5']) {
|
||||
showToast('文件校验失败 0x02');
|
||||
return null;
|
||||
}
|
||||
if (bin.length != meta['fwSize']) {
|
||||
showToast('固件校验失败');
|
||||
showToast('文件校验失败 0x03');
|
||||
return null;
|
||||
}
|
||||
return bin;
|
||||
@ -216,6 +214,7 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
if (reply is OTAUpgradeReply) {
|
||||
if (reply.status == 0x00) {
|
||||
//验证通过,开始发送数据包
|
||||
startOTAData();
|
||||
processOtaUpgrade();
|
||||
} else if (reply.status == 0x06) {
|
||||
blueOTAUpgrade(headJson!, reply.token);
|
||||
|
||||
@ -107,7 +107,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyManagePage,
|
||||
Navigator.pushNamed(context, Routers.passwordKeyPerpetualPage,
|
||||
arguments: {"keyInfo": state.keyInfo.value}).then((val) {
|
||||
if (val != null) {
|
||||
logic.pageNo = 1;
|
||||
|
||||
@ -115,11 +115,7 @@ class _PasswordKeyManageTabbarPageState extends State<PasswordKeyManageTabbarPag
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage(
|
||||
type: item.type,
|
||||
getKeyInfo: widget.keyInfo,
|
||||
))
|
||||
.toList(),
|
||||
children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage()).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -16,157 +16,178 @@ import 'package:star_lock/tools/storage.dart';
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_modelVendor.dart';
|
||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../tools/NativeInteractionTool.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
class PasswordKeyPerpetualPage extends StatefulWidget {
|
||||
final String type;
|
||||
final LockListInfoItemEntity getKeyInfo;
|
||||
|
||||
const PasswordKeyPerpetualPage(
|
||||
{Key? key, required this.type, required this.getKeyInfo})
|
||||
: super(key: key);
|
||||
{Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<PasswordKeyPerpetualPage> createState() =>
|
||||
_PasswordKeyPerpetualPageState();
|
||||
}
|
||||
|
||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> with RouteAware{
|
||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> with RouteAware, SingleTickerProviderStateMixin{
|
||||
final logic = Get.put(PasswordKeyPerpetualLogic());
|
||||
final state = Get.find<PasswordKeyPerpetualLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
initData();
|
||||
// state.isSendSuccess.value = false;
|
||||
}
|
||||
state.tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: 0);
|
||||
state.tabController.addListener(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
state.widgetType.value = state.tabController.index;
|
||||
});
|
||||
|
||||
void initData() {
|
||||
// if (!state.isInitialized.value) {
|
||||
// state.isInitialized.value = true;
|
||||
// state.keyInfo.value = widget.getKeyInfo;
|
||||
// }
|
||||
if (state.tabController.animation!.value == state.tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.keyInfo.value = widget.getKeyInfo;
|
||||
state.widgetType.value = int.parse(widget.type);
|
||||
print("state.widgetType.value:${state.widgetType.value}");
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Obx(() => indexChangeWidget()),
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
if (state.isSendSuccess.value == true && state.sendSucceedType.value.toString() == widget.type) {
|
||||
if (state.isSendSuccess.value == true && state.sendSucceedType.value == state.widgetType.value) {
|
||||
return sendElectronicKeySucceed();
|
||||
} else {
|
||||
switch (int.parse(widget.type)) {
|
||||
switch (state.widgetType.value) {
|
||||
case 0:
|
||||
{
|
||||
// 永久
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: [
|
||||
keyTimeLimitWidget(),
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyTimeLimitWidget(),
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// 单次
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
// 自定义
|
||||
return Column(
|
||||
children: [
|
||||
keyIfPerpetualWidget(),
|
||||
state.isPermanent.value == false
|
||||
? keyTimeLimitWidget()
|
||||
: Container(),
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.password!.tr,
|
||||
"请输入6-9位数字", state.pwdController
|
||||
),
|
||||
keyIfAdministratorWidget(),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyIfPerpetualWidget(),
|
||||
state.isPermanent.value == false
|
||||
? keyTimeLimitWidget()
|
||||
: Container(),
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.password!.tr,
|
||||
"请输入6-9位数字", state.pwdController
|
||||
),
|
||||
keyIfAdministratorWidget(),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
// 循环
|
||||
return Column(
|
||||
children: [
|
||||
keyCirculationWidget(),
|
||||
perpetualKeyWidget(
|
||||
true,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyCirculationWidget(),
|
||||
perpetualKeyWidget(
|
||||
true,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
// 清空
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
default:
|
||||
@ -365,7 +386,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: widget.type == "3" ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
btnName: state.widgetType.value == 3 ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
onClick: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
@ -568,6 +589,66 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
});
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: state.tabController,
|
||||
onTap: (index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
automaticIndicatorColorAdjustment: true,
|
||||
labelColor: AppColors.mainColor,
|
||||
labelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
indicator: CustomUnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||
strokeCap: StrokeCap.round,
|
||||
width: 30.w),
|
||||
);
|
||||
}
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(
|
||||
// text: item.title,
|
||||
child: Container(
|
||||
// width: item.title.length > 2 ? 1.sw / 8 : 1.sw / 12,
|
||||
// margin: EdgeInsets.all(10.w),
|
||||
// color: Colors.red,
|
||||
child: Text(
|
||||
item.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: state.tabController,
|
||||
children: _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.custom!.tr, type: "3"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "4"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.clearAll!.tr, type: "5"),
|
||||
];
|
||||
|
||||
List<Widget> initBottomSheetList() {
|
||||
List<Widget> widgetList = [];
|
||||
|
||||
@ -684,3 +765,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.type});
|
||||
|
||||
final String title;
|
||||
final String type;
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||
@ -32,4 +33,13 @@ class PasswordKeyPerpetualState {
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
|
||||
var pwdNumber = 0.obs;// 密码编号
|
||||
late TabController tabController;
|
||||
|
||||
PasswordKeyPerpetualState() {
|
||||
Map map = Get.arguments;
|
||||
if(map["keyInfo"] != null){
|
||||
keyInfo.value = map["keyInfo"];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'addRemoteControlManage_tabbar.dart';
|
||||
|
||||
class AddRemoteControlManagePage extends StatefulWidget {
|
||||
const AddRemoteControlManagePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddRemoteControlManagePage> createState() => _AddRemoteControlManagePageState();
|
||||
}
|
||||
|
||||
class _AddRemoteControlManagePageState extends State<AddRemoteControlManagePage> {
|
||||
var index = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.remoteControl!.tr}",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
AddRemoteControlManageTabbar(initialIndex: index),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../addRemoteControl_page.dart';
|
||||
|
||||
class AddRemoteControlManageTabbar extends StatefulWidget {
|
||||
var initialIndex = 1;
|
||||
|
||||
AddRemoteControlManageTabbar({Key? key, required this.initialIndex}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddRemoteControlManageTabbar> createState() => _AddRemoteControlManageTabbarState();
|
||||
}
|
||||
|
||||
class _AddRemoteControlManageTabbarState extends State<AddRemoteControlManageTabbar> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
_tabController = TabController(
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: _tabController,
|
||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
automaticIndicatorColorAdjustment: true,
|
||||
labelColor: AppColors.mainColor,
|
||||
labelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
indicator: CustomUnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||
strokeCap: StrokeCap.round,
|
||||
width: 30.w),
|
||||
);
|
||||
}
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(
|
||||
child: SizedBox(
|
||||
width: 1.sw / 5,
|
||||
child: Text(item.title, textAlign: TextAlign.center)));
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => AddRemoteControlPage(selectType: item.selectType,))
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.selectType});
|
||||
|
||||
final String title;
|
||||
final String selectType;
|
||||
}
|
||||
|
||||
@ -8,34 +8,67 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'addRemoteControl_logic.dart';
|
||||
|
||||
class AddRemoteControlPage extends StatefulWidget {
|
||||
final String selectType;
|
||||
|
||||
const AddRemoteControlPage({Key? key, required this.selectType})
|
||||
const AddRemoteControlPage({Key? key})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<AddRemoteControlPage> createState() => _AddRemoteControlPageState();
|
||||
}
|
||||
|
||||
class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
class _AddRemoteControlPageState extends State<AddRemoteControlPage> with SingleTickerProviderStateMixin {
|
||||
final logic = Get.put(AddRemoteControlLoigc());
|
||||
final state = Get.find<AddRemoteControlLoigc>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
state.tabController = TabController(
|
||||
vsync: this,
|
||||
length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
|
||||
initialIndex: 0);
|
||||
state.tabController.addListener(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
state.selectType.value = state.tabController.index.toString();
|
||||
});
|
||||
|
||||
if (state.tabController.animation!.value == state.tabController.index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return indexChangeWidget();
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
_tabBar(),
|
||||
_pageWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
switch (int.parse(widget.selectType)) {
|
||||
switch (int.parse(state.selectType.value)) {
|
||||
case 0:
|
||||
{
|
||||
// 永久
|
||||
@ -68,37 +101,18 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
case 2:
|
||||
{
|
||||
// 循环
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: "",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.beginTime.value,
|
||||
'endDate': state.endTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
if(result != null && result.isNotEmpty){
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.beginTime.value = result['starDate'];
|
||||
state.endTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
}
|
||||
}),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
state.nameController),
|
||||
keyCyclicDate(),
|
||||
SizedBox(height: 10.h),
|
||||
keyBottomWidget()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
default:
|
||||
@ -127,29 +141,104 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: state.beginTime.value,
|
||||
rightTitle: state.timeLimitBeginTime.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: state.endTime.value,
|
||||
rightTitle: state.timeLimitEndTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 循环顶部选择日期
|
||||
Widget keyCyclicDate() {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.cycleBeginTime.value,
|
||||
'endDate': state.cycleEndTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.cycleBeginTime.value = result['starDate'];
|
||||
state.cycleEndTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效日".tr,
|
||||
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.cycleBeginTime.value,
|
||||
'endDate': state.cycleEndTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.cycleBeginTime.value = result['starDate'];
|
||||
state.cycleEndTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
}
|
||||
}))),
|
||||
Obx(() => Visibility(
|
||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': state.weekdaysList.value,
|
||||
'starDate': state.cycleBeginTime.value,
|
||||
'endDate': state.cycleEndTime.value,
|
||||
'starTime': state.effectiveDateTime.value,
|
||||
'endTime': state.failureDateTime.value
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.cycleBeginTime.value = result['starDate'];
|
||||
state.cycleEndTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
}
|
||||
}))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
@ -310,4 +399,69 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
final List<ItemView> _itemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||
];
|
||||
|
||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||
];
|
||||
|
||||
TabBar _tabBar() {
|
||||
return TabBar(
|
||||
controller: state.tabController,
|
||||
onTap: (index) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
),
|
||||
automaticIndicatorColorAdjustment: true,
|
||||
labelColor: AppColors.mainColor,
|
||||
labelStyle: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
indicator: CustomUnderlineTabIndicator(
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||
strokeCap: StrokeCap.round,
|
||||
width: 30.w),
|
||||
);
|
||||
}
|
||||
|
||||
Tab _tab(ItemView item) {
|
||||
return Tab(
|
||||
child: SizedBox(
|
||||
width: 1.sw / 5,
|
||||
child: Text(item.title, textAlign: TextAlign.center)));
|
||||
}
|
||||
|
||||
Widget _pageWidget() {
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: state.tabController,
|
||||
children:
|
||||
state.fromType.value == 1
|
||||
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
|
||||
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ItemView {
|
||||
const ItemView({required this.title, required this.selectType});
|
||||
|
||||
final String title;
|
||||
final String selectType;
|
||||
}
|
||||
|
||||
@ -2,13 +2,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class AddRemoteControlState{
|
||||
import '../../../../tools/dateTool.dart';
|
||||
|
||||
var beginTime = "".obs;// 开始时间
|
||||
var endTime = "".obs;// 结束时间
|
||||
class AddRemoteControlState{
|
||||
final lockId = 0.obs;
|
||||
final selectType = "0".obs;// 0永久 1显示 2循环
|
||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
final isStressFingerprint = false.obs;
|
||||
final isAdministrator = false.obs;// 是否是管理员
|
||||
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||
var cycleBeginTime = "".obs;// 循环开始时间
|
||||
var cycleEndTime = "".obs;// 循环结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字
|
||||
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
late TabController tabController;
|
||||
AddRemoteControlState() {
|
||||
Map map = Get.arguments;
|
||||
if(map["lockId"]!=null){
|
||||
lockId.value = map["lockId"];
|
||||
}
|
||||
|
||||
if(map["fromType"]!=null){
|
||||
fromType.value = map["fromType"];
|
||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
if(fromType.value == 2){
|
||||
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/commonDataManage.dart';
|
||||
import '../../../../tools/keySearchWidget.dart';
|
||||
import '../../../../tools/noData.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
@ -69,7 +70,10 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
|
||||
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.remoteControl!.tr}',
|
||||
onClick: () async {
|
||||
var data =
|
||||
await Get.toNamed(Routers.addRemoteControlManagePage);
|
||||
await Get.toNamed(Routers.addRemoteControlPage, arguments: {
|
||||
"lockId": CommonDataManage().currentLockSetInfoData.lockId,
|
||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
});
|
||||
if (data != null) {
|
||||
// 遥控添加
|
||||
|
||||
|
||||
@ -298,6 +298,7 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
isBeforeAddUser: true,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
|
||||
@ -343,6 +344,7 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
isBeforeAddUser: true,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
} else if (state == BluetoothConnectionState.disconnected) {
|
||||
|
||||
@ -38,10 +38,9 @@ class SaveLockLogic extends BaseGetXController {
|
||||
_replySenderCustomPasswords(reply);
|
||||
}
|
||||
|
||||
if (reply is ChangeAdministratorPasswordReply) {
|
||||
_replyChangeAdministratorPassword(reply);
|
||||
}
|
||||
|
||||
// if (reply is ChangeAdministratorPasswordReply) {
|
||||
// _replyChangeAdministratorPassword(reply);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
@ -86,7 +85,8 @@ class SaveLockLogic extends BaseGetXController {
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token);
|
||||
token: token,
|
||||
isBeforeAddUser: true);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
@ -151,51 +151,51 @@ class SaveLockLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 修改管理员密码
|
||||
Future<void> _replyChangeAdministratorPassword(Reply reply) async {
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
Get.log("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
cancelBlueConnetctToastTimer();
|
||||
addLockAdminPassword(false);
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
IoSenderManage.changeAdministratorPasswordCommand(
|
||||
keyID: "1",
|
||||
userID: await Storage.getUid(),
|
||||
pwdNo: 254,
|
||||
pwd:state.adminPasswordTF.text,
|
||||
useCountLimit: 0xff,
|
||||
startTime: 0x11223344,
|
||||
endTime: 0x11223344,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: true,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: token);
|
||||
break;
|
||||
default:
|
||||
// 失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Future<void> _replyChangeAdministratorPassword(Reply reply) async {
|
||||
// var token = reply.data.sublist(5, 9);
|
||||
// var saveStrList = changeIntListToStringList(token);
|
||||
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||
//
|
||||
// int status = reply.data[2];
|
||||
// Get.log("status:$status");
|
||||
//
|
||||
// switch (status) {
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// cancelBlueConnetctToastTimer();
|
||||
// addLockAdminPassword(false);
|
||||
// break;
|
||||
// case 0x06:
|
||||
// //无权限
|
||||
// Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
//
|
||||
// var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
// List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
//
|
||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
//
|
||||
// IoSenderManage.changeAdministratorPasswordCommand(
|
||||
// keyID: "1",
|
||||
// userID: await Storage.getUid(),
|
||||
// pwdNo: 254,
|
||||
// pwd:state.adminPasswordTF.text,
|
||||
// useCountLimit: 0xff,
|
||||
// startTime: 0x11223344,
|
||||
// endTime: 0x11223344,
|
||||
// needAuthor: 1,
|
||||
// isBeforeAddUser: true,
|
||||
// signKey: signKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: token);
|
||||
// break;
|
||||
// default:
|
||||
// // 失败
|
||||
// Get.log("${reply.commandType!.typeValue} 失败");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 添加用户
|
||||
Future<void> addUserConnectBlue() async {
|
||||
@ -234,7 +234,8 @@ class SaveLockLogic extends BaseGetXController {
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList
|
||||
token: getTokenList,
|
||||
isBeforeAddUser: true
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
@ -282,45 +283,45 @@ class SaveLockLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 修改管理员密码(同添加自定义开锁密码,指纹/密码/卡片前5个是管理员)
|
||||
Future<void> changeAdministratorPasswordCommand() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
dismissEasyLoading();
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.changeAdministratorPasswordCommand(
|
||||
keyID: "1",
|
||||
userID: await Storage.getUid(),
|
||||
pwdNo: 254,
|
||||
pwd:state.adminPasswordTF.text,
|
||||
useCountLimit: 0xff,
|
||||
startTime: 0x11223344,
|
||||
endTime: 0x11223344,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: true,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.saveBtnIsUsable.value = true;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
}, isAddEquipment: true);
|
||||
}
|
||||
// Future<void> changeAdministratorPasswordCommand() async {
|
||||
// showEasyLoading();
|
||||
// showBlueConnetctToastTimer(action: (){
|
||||
// dismissEasyLoading();
|
||||
// });
|
||||
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
// if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
// var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
// List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
//
|
||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
//
|
||||
// var token = await Storage.getStringList(saveBlueToken);
|
||||
// List<int> getTokenList = changeStringListToIntList(token!);
|
||||
//
|
||||
// IoSenderManage.changeAdministratorPasswordCommand(
|
||||
// keyID: "1",
|
||||
// userID: await Storage.getUid(),
|
||||
// pwdNo: 254,
|
||||
// pwd:state.adminPasswordTF.text,
|
||||
// useCountLimit: 0xff,
|
||||
// startTime: 0x11223344,
|
||||
// endTime: 0x11223344,
|
||||
// needAuthor: 1,
|
||||
// isBeforeAddUser: true,
|
||||
// signKey: signKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: getTokenList);
|
||||
// } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
// dismissEasyLoading();
|
||||
// cancelBlueConnetctToastTimer();
|
||||
// state.saveBtnIsUsable.value = true;
|
||||
// if(state.ifCurrentScreen.value == true){
|
||||
// showBlueConnetctToast();
|
||||
// }
|
||||
// }
|
||||
// }, isAddEquipment: true);
|
||||
// }
|
||||
|
||||
void bindBlueAdmin() async{
|
||||
|
||||
@ -379,52 +380,52 @@ class SaveLockLogic extends BaseGetXController {
|
||||
adminPwd: state.adminPasswordTF.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if(isAddLockAdminPassword == true){
|
||||
showDeletPasswordAlertDialog();
|
||||
}else{
|
||||
// if(isAddLockAdminPassword == true){
|
||||
// showDeletPasswordAlertDialog();
|
||||
// }else{
|
||||
backAction();
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
void showDeletPasswordAlertDialog() {
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: "管理员密码",
|
||||
tipTitle: "如需修改,请输入新的管理员密码(6位),点击确定即可修改",
|
||||
leftBtnTitle: "确定".tr,
|
||||
rightBtnTitle: "修改",
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
LengthLimitingTextInputFormatter(6),
|
||||
],
|
||||
controller: state.adminPasswordTF,
|
||||
sureClick: () {
|
||||
if(state.adminPasswordTF.text.length < 6){
|
||||
showToast("请输入6位管理员密码".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.adminPasswordTF.text == state.adminPassword){
|
||||
showToast("请输入新的管理员密码".tr);
|
||||
return;
|
||||
}
|
||||
changeAdministratorPasswordCommand();
|
||||
},
|
||||
cancelClick: () {
|
||||
backAction();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
// void showDeletPasswordAlertDialog() {
|
||||
// showDialog(
|
||||
// context: Get.context!,
|
||||
// builder: (BuildContext context) {
|
||||
// return ShowTFView(
|
||||
// title: "管理员密码",
|
||||
// tipTitle: "如需修改,请输入新的管理员密码(6位),点击确定即可修改",
|
||||
// leftBtnTitle: "确定".tr,
|
||||
// rightBtnTitle: "修改",
|
||||
// keyboardType: TextInputType.number,
|
||||
// inputFormatters: [
|
||||
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
// LengthLimitingTextInputFormatter(6),
|
||||
// ],
|
||||
// controller: state.adminPasswordTF,
|
||||
// sureClick: () {
|
||||
// if(state.adminPasswordTF.text.length < 6){
|
||||
// showToast("请输入6位管理员密码".tr);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if(state.adminPasswordTF.text == state.adminPassword){
|
||||
// showToast("请输入新的管理员密码".tr);
|
||||
// return;
|
||||
// }
|
||||
// changeAdministratorPasswordCommand();
|
||||
// },
|
||||
// cancelClick: () {
|
||||
// backAction();
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
void backAction(){
|
||||
BlueManage().disconnect();
|
||||
Get.close(state.isFromMap == 1 ? 6 : 7);
|
||||
Get.close(state.isFromMap == 1 ? 5 : 6);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/appRouteObserver.dart';
|
||||
@ -134,6 +135,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
/// 取消路由订阅
|
||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
super.dispose();
|
||||
BlueManage().stopScan();
|
||||
}
|
||||
|
||||
/// 从上级界面进入 当前界面即将出现
|
||||
@ -141,6 +143,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -149,6 +152,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
void didPop() {
|
||||
super.didPop();
|
||||
|
||||
BlueManage().stopScan();
|
||||
state.ifCurrentScreen.value = false;
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
}
|
||||
|
||||
@ -32,9 +32,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# 1.0.27+2024041101:打包提审
|
||||
# 1.0.27+2024041102:打包预发布环境给田总测试
|
||||
# 1.0.28+2024041702:打包给欧阳回归测试
|
||||
# 1.0.27+2024041702 打包星星锁提审华为
|
||||
# 1.0.27+2024041703 打包星星锁提审ios
|
||||
# 1.0.27+2024042204 打包星星锁提审ios与 android
|
||||
# 1.0.27+2024041702 打包鑫锁提审华为
|
||||
# 1.0.27+2024041703 打包鑫锁提审ios
|
||||
# 1.0.27+2024042204 打包鑫锁提审ios与 android
|
||||
|
||||
version: 1.0.27+2024042204
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user