Merge branch 'master' of gitee.com:starlock-cn/app-starlock

This commit is contained in:
Daisy 2024-04-25 10:44:04 +08:00
commit 7fdc1e6e6d
15 changed files with 223 additions and 150 deletions

View File

@ -56,7 +56,6 @@ import 'login/forgetPassword/starLock_forgetPassword_page.dart';
import 'login/login/starLock_login_page.dart'; import 'login/login/starLock_login_page.dart';
import 'login/register/starLock_register_page.dart'; import 'login/register/starLock_register_page.dart';
import 'login/selectCountryRegion/selectCountryRegion_page.dart'; import 'login/selectCountryRegion/selectCountryRegion_page.dart';
import 'main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_page.dart';
import 'main/lockDetail/card/addCardType/addCardType_page.dart'; import 'main/lockDetail/card/addCardType/addCardType_page.dart';
import 'main/lockDetail/card/addICCard/addICCard_page.dart'; import 'main/lockDetail/card/addICCard/addICCard_page.dart';
import 'main/lockDetail/card/cardDetail/cardDetail_page.dart'; import 'main/lockDetail/card/cardDetail/cardDetail_page.dart';
@ -80,7 +79,7 @@ import 'main/lockDetail/face/addFace/addFace_page.dart';
import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart'; import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart';
import 'main/lockDetail/face/faceList/faceList_page.dart'; import 'main/lockDetail/face/faceList/faceList_page.dart';
import 'main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart'; import 'main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart';
import 'main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintManage/addFingerprintTypeManage_page.dart'; import 'main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart';
import 'main/lockDetail/fingerprint/addFingerprintTip/addFingerprintTip_page.dart'; import 'main/lockDetail/fingerprint/addFingerprintTip/addFingerprintTip_page.dart';
import 'main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart'; import 'main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart';
import 'main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart'; import 'main/lockDetail/fingerprint/fingerprintList/fingerprintList_page.dart';
@ -421,8 +420,7 @@ abstract class Routers {
static const addCardPage = '/AddCardPage'; // static const addCardPage = '/AddCardPage'; //
static const cardDetailPage = '/CardDetailPage'; // static const cardDetailPage = '/CardDetailPage'; //
static const fingerprintListPage = '/FingerprintListPage'; // static const fingerprintListPage = '/FingerprintListPage'; //
static const addFingerprintTypeManagePage = static const addFingerprintTypePage = '/AddFingerprintTypePage'; //
'/AddFingerprintTypeManagePage'; //
static const fingerprintDetailPage = '/FingerprintDetailPage'; // static const fingerprintDetailPage = '/FingerprintDetailPage'; //
static const faceListPage = '/FaceListPage'; // static const faceListPage = '/FaceListPage'; //
static const addFaceTypeManagePage = '/AddFaceTypeManagePage'; // static const addFaceTypeManagePage = '/AddFaceTypeManagePage'; //
@ -1022,8 +1020,8 @@ abstract class AppRouters {
name: Routers.fingerprintListPage, name: Routers.fingerprintListPage,
page: () => const FingerprintListPage()), page: () => const FingerprintListPage()),
GetPage( GetPage(
name: Routers.addFingerprintTypeManagePage, name: Routers.addFingerprintTypePage,
page: () => const AddFingerprintTypeManagePage()), page: () => const AddFingerprintTypePage()),
GetPage( GetPage(
name: Routers.fingerprintDetailPage, name: Routers.fingerprintDetailPage,
page: () => const FingerprintDetailPage()), page: () => const FingerprintDetailPage()),

View File

@ -22,7 +22,7 @@ class OTAUpgradeCommand extends SenderProtocol {
int? fwSize; int? fwSize;
String? fwMD5; String? fwMD5;
int? needAuthor; int? needAuthor;
List<int>? publicKey; List<int>? signKey;
List<int>? privateKey; List<int>? privateKey;
List<int>? token; List<int>? token;
@ -37,7 +37,7 @@ class OTAUpgradeCommand extends SenderProtocol {
this.fwSize, this.fwSize,
this.fwMD5, this.fwMD5,
this.needAuthor, this.needAuthor,
this.publicKey, this.signKey,
this.privateKey, this.privateKey,
this.token}) this.token})
: super(CommandType.startOATUpgrade); : super(CommandType.startOATUpgrade);
@ -101,22 +101,24 @@ class OTAUpgradeCommand extends SenderProtocol {
// token 4 Token 0 token失效或者第一次发送的时候token为0 // token 4 Token 0 token失效或者第一次发送的时候token为0
data.addAll(token!); data.addAll(token!);
print('--->1'+data.toString());
if (needAuthor == 0) { if (needAuthor == 0) {
//AuthCodeLen 1 //AuthCodeLen 1
data.add(0); data.add(0);
} else { } else {
List<int> authCodeData = []; List<int> authCodeData = [];
//authUserID
authCodeData.addAll(utf8.encode(userID!));
//KeyID //KeyID
authCodeData.addAll(utf8.encode(keyID!)); authCodeData.addAll(utf8.encode(keyID!));
//UserID
authCodeData.addAll(utf8.encode(userID!));
//token 4 Token 0 //token 4 Token 0
authCodeData.addAll(token!); authCodeData.addAll(token!);
authCodeData.addAll(publicKey!); authCodeData.addAll(signKey!);
// KeyIDauthUserIDmd5加密之后就是authCode // KeyIDauthUserIDmd5加密之后就是authCode
var authCode = crypto.md5.convert(authCodeData); var authCode = crypto.md5.convert(authCodeData);
@ -140,10 +142,14 @@ class OTAUpgradeCommand extends SenderProtocol {
} }
class OTAUpgradeReply extends Reply { class OTAUpgradeReply extends Reply {
List<int> token = [];
OTAUpgradeReply.parseData(CommandType commandType, List<int> dataDetail) OTAUpgradeReply.parseData(CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) { : super.parseData(commandType, dataDetail) {
data = dataDetail; data = dataDetail;
int status = data[6]; token = data.sublist(2, 6);
status = data[6];
print('--->2'+data.toString());
errorWithStstus(status); errorWithStstus(status);
} }
} }

View File

@ -58,7 +58,7 @@ class ProcessOtaUpgradeReply extends Reply {
CommandType commandType, List<int> dataDetail) CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) { : super.parseData(commandType, dataDetail) {
data = dataDetail; data = dataDetail;
int status = data[2]; status = data[2];
errorWithStstus(status); errorWithStstus(status);
} }
} }
@ -68,7 +68,7 @@ class ConfirmationOTAUpgradeReply extends Reply {
CommandType commandType, List<int> dataDetail) CommandType commandType, List<int> dataDetail)
: super.parseData(commandType, dataDetail) { : super.parseData(commandType, dataDetail) {
data = dataDetail; data = dataDetail;
int status = data[2]; status = data[2];
errorWithStstus(status); errorWithStstus(status);
} }
} }

View File

@ -999,7 +999,7 @@ class IoSenderManage {
required String? fwMD5, required String? fwMD5,
required int? needAuthor, required int? needAuthor,
required List<int>? token, required List<int>? token,
required List<int>? publicKey, required List<int>? signKey,
required List<int>? privateKey, required List<int>? privateKey,
CommandSendCallBack? callBack}) { CommandSendCallBack? callBack}) {
CommandSenderManager().managerSendData( CommandSenderManager().managerSendData(
@ -1015,7 +1015,7 @@ class IoSenderManage {
fwMD5: fwMD5, fwMD5: fwMD5,
token: token, token: token,
needAuthor: needAuthor, needAuthor: needAuthor,
publicKey: publicKey, signKey: signKey,
privateKey: privateKey, privateKey: privateKey,
), ),
callBack: callBack); callBack: callBack);

View File

@ -105,7 +105,7 @@ class AddICCardLogic extends BaseGetXController{
Future<void> _replyAddICCardConfirmation(Reply reply) async { Future<void> _replyAddICCardConfirmation(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
Get.log("_replyAddFingerprintstatus:$status"); Get.log("_replyAddCardtatus:$status");
switch(status){ switch(status){
case 0x00: case 0x00:

View File

@ -169,7 +169,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
} }
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.addFingerprintTypeManagePage, Routers.addFingerprintTypePage,
arguments: { arguments: {
"lockId": state.getKeyInfosData.value.lockId, "lockId": state.getKeyInfosData.value.lockId,
"fromType": 2, // 1 2 "fromType": 2, // 1 2

View File

@ -101,8 +101,8 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
controller: _tabController, controller: _tabController,
children: children:
widget.fromType == 1 widget.fromType == 1
? _itemTabs.map((ItemView item) => AddFingerprintTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList() ? _itemTabs.map((ItemView item) => const AddFingerprintTypePage()).toList()
:_itemTabs.map((ItemView item) => AddFingerprintTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(), :_itemTabs.map((ItemView item) => const AddFingerprintTypePage()).toList(),
), ),
); );
} }

View File

@ -24,8 +24,8 @@ class AddFingerprintTypeLogic extends BaseGetXController{
endTime = "0"; endTime = "0";
} else if (state.selectType.value == "1") { } else if (state.selectType.value == "1") {
fingerprintType = 2; fingerprintType = 2;
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
startTime = "0"; startTime = "0";
endTime = "0"; endTime = "0";
@ -48,17 +48,16 @@ class AddFingerprintTypeLogic extends BaseGetXController{
return; return;
} }
} else if (state.selectType.value == "2") { } else if (state.selectType.value == "2") {
if (state.beginTime.value.isEmpty) { if (state.cycleBeginTime.value.isEmpty) {
showToast("请选择有效期".tr); showToast("请选择有效期".tr);
return; return;
} }
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); endDate = DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString(); startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString(); endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
fingerprintType = 4; fingerprintType = 4;
} }
// var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1: 2: // var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1: 2:
// Get.log("addOtherType startDate:$startDate endDate:$endDate isCoerced:$isCoerced"); // Get.log("addOtherType startDate:$startDate endDate:$endDate isCoerced:$isCoerced");

View File

@ -8,32 +8,23 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/dateTool.dart'; import '../../../../tools/dateTool.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'addFingerprintType_logic.dart'; import 'addFingerprintType_logic.dart';
class AddFingerprintTypePage extends StatefulWidget { class AddFingerprintTypePage extends StatefulWidget {
final String selectType; // const AddFingerprintTypePage({Key? key}) : super(key: key);
final int lockId;
final int fromType; // // 1 2
final String fromTypeTwoStaffName; //
const AddFingerprintTypePage(
{Key? key,
required this.selectType,
required this.lockId,
required this.fromType,
required this.fromTypeTwoStaffName})
: super(key: key);
@override @override
State<AddFingerprintTypePage> createState() => _AddFingerprintTypePageState(); State<AddFingerprintTypePage> createState() => _AddFingerprintTypePageState();
} }
class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> { class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with SingleTickerProviderStateMixin{
final logic = Get.put(AddFingerprintTypeLogic()); final logic = Get.put(AddFingerprintTypeLogic());
final state = Get.find<AddFingerprintTypeLogic>().state; final state = Get.find<AddFingerprintTypeLogic>().state;
@ -42,33 +33,41 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
// TODO: implement initState // TODO: implement initState
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { state.tabController = TabController(
if(state.selectType.value == "1"){ vsync: this,
state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); // length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());// initialIndex: 0);
}else{ state.tabController.addListener(() {
state.beginTime.value = ""; // WidgetsBinding.instance.addPostFrameCallback((_) {
state.endTime.value = "";// state.selectType.value = state.tabController.index.toString();
});
if (state.tabController.animation!.value == state.tabController.index) {
FocusScope.of(context).requestFocus(FocusNode());
} }
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
state.selectType.value = widget.selectType; return Scaffold(
state.lockId.value = widget.lockId; backgroundColor: AppColors.mainBackgroundColor,
if(widget.fromTypeTwoStaffName.isNotEmpty){ appBar: TitleAppBar(
state.nameController.text = widget.fromTypeTwoStaffName; barTitle:
} "${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
state.fromType.value = widget.fromType; haveBack: true,
backgroundColor: AppColors.mainColor),
return SingleChildScrollView( body: Column(
child: indexChangeWidget() children: [
_tabBar(),
_pageWidget(),
],
),
); );
} }
Widget indexChangeWidget() { Widget indexChangeWidget() {
switch (int.parse(widget.selectType)) { switch (int.parse(state.selectType.value)) {
case 0: case 0:
{ {
// //
@ -139,22 +138,24 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.beginTime.value, rightTitle: state.timeLimitBeginTime.value,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) { Pickers.showDatePicker(context, mode: DateMode.YMDHM,
state.beginTime.value = DateTool().getYMDHNDateString(p, 1); onConfirm: (p) {
}); state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
});
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.endTime.value, rightTitle: state.timeLimitEndTime.value,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) { Pickers.showDatePicker(context, mode: DateMode.YMDHM,
state.endTime.value = DateTool().getYMDHNDateString(p, 1); onConfirm: (p) {
}); state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
});
})), })),
Container(height: 10.h), Container(height: 10.h),
], ],
@ -162,30 +163,28 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
} }
// //
Widget keyCyclicDate(){ Widget keyCyclicDate() {
return Column( return Column(
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle: "${state.beginTime.value}\n${state.endTime.value}", rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () async { action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
arguments: { 'validityValue': state.weekdaysList.value,
'validityValue': state.weekdaysList.value, 'starDate': state.cycleBeginTime.value,
'starDate': state.beginTime.value, 'endDate': state.cycleEndTime.value,
'endDate': state.endTime.value, 'starTime': state.effectiveDateTime.value,
'starTime': state.effectiveDateTime.value, 'endTime': state.failureDateTime.value
'endTime': state.failureDateTime.value });
}); if (result != null && result.isNotEmpty) {
if(result != null && result.isNotEmpty){
state.weekdaysList.value = result['validityValue']; state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate']; state.cycleBeginTime.value = result['starDate'];
state.endTime.value = result['endDate']; state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime']; state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime']; state.failureDateTime.value = result['endTime'];
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
} }
})), })),
Obx(() => Visibility( Obx(() => Visibility(
@ -196,23 +195,21 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () async { action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
arguments: { 'validityValue': state.weekdaysList.value,
'validityValue': state.weekdaysList.value, 'starDate': state.cycleBeginTime.value,
'starDate': state.beginTime.value, 'endDate': state.cycleEndTime.value,
'endDate': state.endTime.value, 'starTime': state.effectiveDateTime.value,
'starTime': state.effectiveDateTime.value, 'endTime': state.failureDateTime.value
'endTime': state.failureDateTime.value });
}); if (result != null && result.isNotEmpty) {
if(result != null && result.isNotEmpty){
state.weekdaysList.value = result['validityValue']; state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate']; state.cycleBeginTime.value = result['starDate'];
state.endTime.value = result['endDate']; state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime']; state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime']; state.failureDateTime.value = result['endTime'];
} }
}) }))),
)),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.effectiveDateTime.value.isNotEmpty, visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem( child: CommonItem(
@ -220,24 +217,21 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}", rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
arguments: { 'validityValue': state.weekdaysList.value,
'validityValue': state.weekdaysList.value, 'starDate': state.cycleBeginTime.value,
'starDate': state.beginTime.value, 'endDate': state.cycleEndTime.value,
'endDate': state.endTime.value, 'starTime': state.effectiveDateTime.value,
'starTime': state.effectiveDateTime.value, 'endTime': state.failureDateTime.value
'endTime': state.failureDateTime.value });
}); if (result != null && result.isNotEmpty) {
if(result != null && result.isNotEmpty){
state.weekdaysList.value = result['validityValue']; state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate']; state.cycleBeginTime.value = result['starDate'];
state.endTime.value = result['endDate']; state.cycleEndTime.value = result['endDate'];
state.effectiveDateTime.value = result['starTime']; state.effectiveDateTime.value = result['starTime'];
state.failureDateTime.value = result['endTime']; state.failureDateTime.value = result['endTime'];
Get.back(result: result);
} }
}) }))),
)),
], ],
); );
} }
@ -435,4 +429,68 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
); );
} }
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;
} }

View File

@ -2,6 +2,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../tools/dateTool.dart';
class AddFingerprintState{ class AddFingerprintState{
final lockId = 0.obs; final lockId = 0.obs;
final selectType = "0".obs;// 0 1 2 final selectType = "0".obs;// 0 1 2
@ -9,16 +11,24 @@ class AddFingerprintState{
final isStressFingerprint = false.obs; final isStressFingerprint = false.obs;
final isAdministrator = false.obs;// final isAdministrator = false.obs;//
var beginTime = "".obs;// var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
var endTime = "".obs;// var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;//
var cycleBeginTime = "".obs;//
var cycleEndTime = "".obs;//
var effectiveDateTime = "".obs;// var effectiveDateTime = "".obs;//
var failureDateTime = "".obs;// var failureDateTime = "".obs;//
var weekdaysList = [].obs; var weekdaysList = [].obs;
var fromTypeTwoStaffName = "".obs; //
final TextEditingController nameController = TextEditingController(); final TextEditingController nameController = TextEditingController();
late TabController tabController;
AddFingerprintState() { AddFingerprintState() {
// Map map = Get.arguments; Map map = Get.arguments;
// lockId.value = map["lockId"]; lockId.value = map["lockId"];
// fromType.value = map["fromType"]; fromType.value = map["fromType"];
// 1 2
if(fromType.value == 2){
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; //
}
} }
} }

View File

@ -108,7 +108,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}', btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}',
onClick: () async { onClick: () async {
var data = var data =
await Get.toNamed(Routers.addFingerprintTypeManagePage, arguments: { await Get.toNamed(Routers.addFingerprintTypePage, arguments: {
"lockId": state.lockId.value, "lockId": state.lockId.value,
"fromType": 1 // 1 2 "fromType": 1 // 1 2
}); });

View File

@ -50,8 +50,9 @@ class _LockDetailPageState extends State<LockDetailPage>
// TODO: implement initState // TODO: implement initState
super.initState(); super.initState();
print("openDoor${DateTool().accordingTheCycleIntoTheCorrespondingNumber([5])}"); // print("openDoor${DateTool().accordingTheCycleIntoTheCorrespondingNumber([5])}");
print("onLine${DateTool().accordingTheCycleIntoTheCorrespondingNumber([1])}"); // print("onLine${DateTool().accordingTheCycleIntoTheCorrespondingNumber([1])}");
// print("onLine openDoor${DateTool().accordingTheCycleIntoTheCorrespondingNumber([5, 1])}");
// logic.startScanAction(); // logic.startScanAction();
listeningAnimations(); listeningAnimations();
@ -1227,20 +1228,15 @@ class _LockDetailPageState extends State<LockDetailPage>
state.openLockBtnState.value = 1; state.openLockBtnState.value = 1;
// state.animationController!.forward(); // state.animationController!.forward();
// if (state.lockUserNo == 0) { if (state.isOpenLockNeedOnline.value == 0) {
// // lockUserNo为0 //
// logic.addUserConnectBlue(); state.openDoorModel = 0;
// } else { logic.openDoorAction();
// print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}"); } else {
if (state.isOpenLockNeedOnline.value == 0) { //
// state.openDoorModel = 2;
logic.openDoorAction(); logic.getLockNetToken();
} else { }
//
logic.getLockNetToken();
}
// }
// });
} }
startUnLock() { startUnLock() {
@ -1251,15 +1247,16 @@ class _LockDetailPageState extends State<LockDetailPage>
state.iSClosedUnlockSuccessfulPopup.value = false; state.iSClosedUnlockSuccessfulPopup.value = false;
state.openLockBtnState.value = 1; state.openLockBtnState.value = 1;
state.animationController!.forward(); state.animationController!.forward();
state.openDoorModel = 32;
// if (state.lockUserNo == 0) { if (state.isOpenLockNeedOnline.value == 0) {
// // lockUserNo为0 //
// logic.addUserConnectBlue();
// } else {
state.openDoorModel = 32; state.openDoorModel = 32;
logic.openDoorAction(); logic.openDoorAction();
// } } else {
//
state.openDoorModel = 34;
logic.getLockNetToken();
}
} }
@override @override

View File

@ -34,7 +34,7 @@ class LockDetailState {
var bottomBtnisEable = true.obs; // var bottomBtnisEable = true.obs; //
var openDoorBtnisUneable = true.obs; // 使使, var openDoorBtnisUneable = true.obs; // 使使,
var openDoorModel = 0; var openDoorModel = 0;// 线0, 线2 线32 线34
// //
AnimationController? animationController; AnimationController? animationController;

View File

@ -27,7 +27,7 @@ class LockNetTokenEntity {
} }
class Data { class Data {
int? token; String? token;
Data({this.token}); Data({this.token});

View File

@ -29,6 +29,7 @@ class LockEscalationLogic extends BaseGetXController {
int otaIndex = 0; int otaIndex = 0;
Uint8List? otaBin; Uint8List? otaBin;
int startSecond = 0; int startSecond = 0;
Map? headJson = null;
// //
Future<void> setLockSetGeneralSetting() async { Future<void> setLockSetGeneralSetting() async {
@ -53,29 +54,28 @@ class LockEscalationLogic extends BaseGetXController {
} }
File file = File(result.files.single.path!); File file = File(result.files.single.path!);
Uint8List data = await file.readAsBytes(); Uint8List data = await file.readAsBytes();
Map? headJson = await getHeadFile(data); headJson = await getHeadFile(data);
if (headJson is! Map) { if (headJson is! Map) {
return; return;
} }
otaBin = await checkFile(data, headJson); otaBin = await checkFile(data, headJson!);
if (otaBin == null) { if (otaBin == null) {
return; return;
} }
startOTAData(); String md5Str = md5.convert(otaBin!).toString();
blueOTAUpgrade(headJson); headJson!['fwMd5'] = md5Str;
blueOTAUpgrade(headJson!, [0,0,0,0]);
} }
// ota // ota
void blueOTAUpgrade(Map data) { void blueOTAUpgrade(Map data, List<int> token) {
BlueManage().bludSendData(BlueManage().connectDeviceName, BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async { (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> getTokenList = changeStringListToIntList(token!); List<int> signKeyDataList = changeStringListToIntList(signKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
String lockID = CommonDataManage.shareManager() String lockID = CommonDataManage.shareManager()
?.currentLockSetInfoData ?.currentLockSetInfoData
.lockId .lockId
@ -95,8 +95,8 @@ class LockEscalationLogic extends BaseGetXController {
fwSize: data['fwSize'], fwSize: data['fwSize'],
fwMD5: data['fwMd5'], fwMD5: data['fwMd5'],
needAuthor: 1, needAuthor: 1,
token: getTokenList, token: token,
publicKey: getPublicKeyList, signKey: signKeyDataList,
privateKey: getPrivateKeyList) privateKey: getPrivateKeyList)
.packageData()); .packageData());
} else if (deviceConnectionState == } else if (deviceConnectionState ==
@ -115,6 +115,7 @@ class LockEscalationLogic extends BaseGetXController {
int difference = length % 240; int difference = length % 240;
otaCount = length ~/ 240 + (difference > 0 ? 1 : 0); otaCount = length ~/ 240 + (difference > 0 ? 1 : 0);
startSecond = DateTime.now().millisecondsSinceEpoch ~/ 1000; startSecond = DateTime.now().millisecondsSinceEpoch ~/ 1000;
startOTAData();
} }
if (otaCount <= otaIndex) { if (otaCount <= otaIndex) {
int now = DateTime.now().millisecondsSinceEpoch ~/ 1000; int now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
@ -212,9 +213,13 @@ class LockEscalationLogic extends BaseGetXController {
super.onInit(); super.onInit();
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) { EventBusManager().eventBus!.on<Reply>().listen((reply) {
if (reply is OTAUpgradeReply && reply.status == 0x00) { if (reply is OTAUpgradeReply) {
// if (reply.status == 0x00) {
processOtaUpgrade(); //
processOtaUpgrade();
} else if (reply.status == 0x06) {
blueOTAUpgrade(headJson!, reply.token);
}
} else if (reply is ProcessOtaUpgradeReply && reply.status == 0x00) { } else if (reply is ProcessOtaUpgradeReply && reply.status == 0x00) {
otaIndex++; otaIndex++;
processOtaUpgrade(); processOtaUpgrade();