1、修复添加卡轻微左右滑动添加卡类型不同问题。2、添加根据鑫锁跟锁通通算法不同 APP区分生成离线密码

This commit is contained in:
魏少阳 2024-04-24 17:01:59 +08:00
parent 5561996f05
commit 02ad8cd2e8
12 changed files with 252 additions and 144 deletions

View File

@ -57,6 +57,7 @@ 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/addCardManage/addCardTypeManage_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';
import 'main/lockDetail/card/cardList/cardList_page.dart'; import 'main/lockDetail/card/cardList/cardList_page.dart';
@ -416,7 +417,8 @@ abstract class Routers {
'/AddRemoteControlManagePage'; // '/AddRemoteControlManagePage'; //
static const cardListPage = '/CardListPage'; // static const cardListPage = '/CardListPage'; //
static const addCardTypeManagePage = '/AddCardTypeManagePage'; // // static const addCardTypeManagePage = '/AddCardTypeManagePage'; //
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 addFingerprintTypeManagePage =
@ -1009,9 +1011,12 @@ abstract class AppRouters {
name: Routers.addRemoteControlManagePage, name: Routers.addRemoteControlManagePage,
page: () => const AddRemoteControlManagePage()), page: () => const AddRemoteControlManagePage()),
GetPage(name: Routers.cardListPage, page: () => const CardListPage()), GetPage(name: Routers.cardListPage, page: () => const CardListPage()),
// GetPage(
// name: Routers.addCardTypeManagePage,
// page: () => const AddCardTypeManagePage()),
GetPage( GetPage(
name: Routers.addCardTypeManagePage, name: Routers.addCardPage,
page: () => const AddCardTypeManagePage()), page: () => const AddCardPage()),
GetPage(name: Routers.cardDetailPage, page: () => const CardDetailPage()), GetPage(name: Routers.cardDetailPage, page: () => const CardDetailPage()),
GetPage( GetPage(
name: Routers.fingerprintListPage, name: Routers.fingerprintListPage,

View File

@ -0,0 +1,13 @@
// ignore_for_file: non_constant_identifier_names
class IoModelVendor {
static String vendor_XHJ = 'XHJ';
static String model_XHJ_SYD = 'SYD-BLE-01';
static String model_XHJ_JL = 'JL-BLE-01';
static String vendor_XL = 'XL';
static String model_XL_BLE = 'JL-BLE-01';
static String model_XL_WIFI = 'JL-WIFI-01';
}

View File

@ -50,6 +50,7 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
length: widget.fromType == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length, length: widget.fromType == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
initialIndex: widget.initialIndex); initialIndex: widget.initialIndex);
_tabController.addListener(() { _tabController.addListener(() {
print("_tabController.indexIsChanging:${_tabController.indexIsChanging} _tabController.index:${_tabController.index}");
if (_tabController.animation!.value == _tabController.index) { if (_tabController.animation!.value == _tabController.index) {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
} }
@ -107,8 +108,8 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
controller: _tabController, controller: _tabController,
children: children:
widget.fromType == 1 widget.fromType == 1
? _itemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList() ? _itemTabs.map((ItemView item) => AddCardPage()).toList()
: _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList(), : _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage()).toList(),
), ),
); );
} }

View File

@ -12,21 +12,23 @@ class AddCardTypeLogic extends BaseGetXController{
// //
void addCardData() async { void addCardData() async {
var fingerprintType = 0; // :1;23:4 var carType = 0; // :1;23:4
var startDate = ""; var startDate = "";
var endDate = ""; var endDate = "";
var startTime = ""; var startTime = "";
var endTime = ""; var endTime = "";
if (state.selectType.value == "0") { if (state.selectType.value == "0") {
fingerprintType = 1; print("永久卡永久卡永久卡");
carType = 1;
startDate = "0"; startDate = "0";
endDate = "0"; endDate = "0";
startTime = "0"; startTime = "0";
endTime = "0"; endTime = "0";
} else if (state.selectType.value == "1") { } else if (state.selectType.value == "1") {
fingerprintType = 2; print("限时卡限时卡限时卡");
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); carType = 2;
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"; startTime = "0";
endTime = "0"; endTime = "0";
@ -49,15 +51,16 @@ class AddCardTypeLogic extends BaseGetXController{
return; return;
} }
} else if (state.selectType.value == "2") { } else if (state.selectType.value == "2") {
if (state.beginTime.value.isEmpty) { print("循环卡循环卡循环卡");
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; carType = 4;
} }
// var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1: 2: // var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1: 2:
@ -67,7 +70,7 @@ class AddCardTypeLogic extends BaseGetXController{
"addType": "1", "addType": "1",
"cardName": state.nameController.text, "cardName": state.nameController.text,
"cardNumber": "123456", "cardNumber": "123456",
"cardType": fingerprintType.toString(), "cardType": carType.toString(),
"isCoerced": state.isStressFingerprint.value == false ? "1" : "2", "isCoerced": state.isStressFingerprint.value == false ? "1" : "2",
"startDate": startDate, "startDate": startDate,
"weekDay": state.weekdaysList.value, "weekDay": state.weekdaysList.value,

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -8,110 +9,113 @@ 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 'addCardType_logic.dart'; import 'addCardType_logic.dart';
class AddCardPage extends StatefulWidget { class AddCardPage extends StatefulWidget {
final String selectType; // const AddCardPage({Key? key}) : super(key: key);
final int lockId;
final int fromType; // // 1 2
final String fromTypeTwoStaffName; //
const AddCardPage(
{Key? key,
required this.selectType,
required this.lockId,
required this.fromType,
required this.fromTypeTwoStaffName})
: super(key: key);
@override @override
State<AddCardPage> createState() => _AddCardPageState(); State<AddCardPage> createState() => _AddCardPageState();
} }
class _AddCardPageState extends State<AddCardPage> { class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStateMixin {
final logic = Get.put(AddCardTypeLogic()); final logic = Get.put(AddCardTypeLogic());
final state = Get.find<AddCardTypeLogic>().state; final state = Get.find<AddCardTypeLogic>().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 SingleChildScrollView(
child: indexChangeWidget()
);
}
@override @override
void initState() { void initState() {
// 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( length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
DateTime.now().millisecondsSinceEpoch.toString()); // initialIndex: 0);
state.endTime.value = DateTool().dateToYMDHNString( state.tabController.addListener(() {
DateTime.now().millisecondsSinceEpoch.toString()); // WidgetsBinding.instance.addPostFrameCallback((_) {
} else { state.selectType.value = state.tabController.index.toString();
state.beginTime.value = ""; // });
state.endTime.value = ""; //
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!.card!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
_tabBar(),
_pageWidget(),
],
),
);
}
Widget indexChangeWidget() { Widget indexChangeWidget() {
switch (int.parse(widget.selectType)) { switch (int.parse(state.selectType.value)) {
case 0: case 0:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyBottomWidget() state.nameController),
], keyBottomWidget()
],
),
); );
} }
case 1: case 1:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyTimeLimitWidget(), state.nameController),
// SizedBox(height: 10.h), keyTimeLimitWidget(),
keyBottomWidget() // SizedBox(height: 10.h),
], keyBottomWidget()
],
),
); );
} }
case 2: case 2:
{ {
// //
return Column( return SingleChildScrollView(
children: [ child: Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, perpetualKeyWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr, TranslationLoader.lanKeys!.name!.tr,
state.nameController), TranslationLoader.lanKeys!.pleaseEnter!.tr,
keyCyclicDate(), state.nameController),
SizedBox(height: 10.h), keyCyclicDate(),
keyBottomWidget() SizedBox(height: 10.h),
], keyBottomWidget()
],
),
); );
} }
default: default:
@ -140,23 +144,23 @@ class _AddCardPageState extends State<AddCardPage> {
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, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1); 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, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 1); state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
}); });
})), })),
Container(height: 10.h), Container(height: 10.h),
@ -170,21 +174,21 @@ class _AddCardPageState extends State<AddCardPage> {
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, arguments: { var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
'validityValue': state.weekdaysList.value, 'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value, 'starDate': state.cycleBeginTime.value,
'endDate': state.endTime.value, 'endDate': state.cycleEndTime.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'];
} }
@ -197,18 +201,17 @@ class _AddCardPageState extends State<AddCardPage> {
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'];
} }
@ -217,25 +220,22 @@ class _AddCardPageState extends State<AddCardPage> {
visible: state.effectiveDateTime.value.isNotEmpty, visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem( child: CommonItem(
leftTitel: "有效时间".tr, leftTitel: "有效时间".tr,
rightTitle: rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
"${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);
} }
}))), }))),
], ],
@ -368,4 +368,70 @@ class _AddCardPageState extends State<AddCardPage> {
}, },
); );
} }
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 AddCardTypeState{ class AddCardTypeState{
final lockId = 0.obs; final lockId = 0.obs;
@ -10,16 +12,24 @@ class AddCardTypeState{
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;
AddCardTypeState() { AddCardTypeState() {
// 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

@ -104,7 +104,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
AddBottomWhiteBtn( AddBottomWhiteBtn(
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}', btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}',
onClick: () async { onClick: () async {
var data = await Get.toNamed(Routers.addCardTypeManagePage, arguments: { var data = await Get.toNamed(Routers.addCardPage, arguments: {
"lockId": state.lockId.value, "lockId": state.lockId.value,
"fromType": 1 // 1 2 "fromType": 1 // 1 2
}); });

View File

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

View File

@ -496,7 +496,7 @@ class LockDetailLogic extends BaseGetXController {
void getLockNetToken() async { void getLockNetToken() async {
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString()); LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.lockNetToken = entity.data!.token!; state.lockNetToken = entity.data!.token!.toString();
Get.log("state.lockNetToken:${state.lockNetToken}"); Get.log("state.lockNetToken:${state.lockNetToken}");
openDoorAction(); openDoorAction();
}else{ }else{

View File

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

View File

@ -10,6 +10,7 @@ import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/eventBusEventManage.dart'; import 'package:star_lock/tools/eventBusEventManage.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_modelVendor.dart';
import '../../../../blue/io_reply.dart'; import '../../../../blue/io_reply.dart';
import '../../../../blue/io_protocol/io_senderCustomPasswords.dart'; import '../../../../blue/io_protocol/io_senderCustomPasswords.dart';
import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/io_tool.dart';
@ -57,8 +58,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
getKeyType = '2'; getKeyType = '2';
} else if (state.widgetType.value == 1) { } else if (state.widgetType.value == 1) {
// //
if(CommonDataManage().currentKeyInfo.vendor == "XL"){ // 鸿
// 鸿 if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XHJ && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_SYD || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_JL)){
if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("失效时间要大于当前时间".tr);
return;
}
}
//
if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){
// //
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("生效时间不能小于当前时间".tr); showToast("生效时间不能小于当前时间".tr);
@ -69,12 +78,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
showToast("失效时间要大于生效时间".tr); showToast("失效时间要大于生效时间".tr);
return; return;
} }
}else{
if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("生效时间要大于当前时间".tr);
return;
}
// startDate = 0;
} }
getKeyType = '3'; getKeyType = '3';
} else if (state.widgetType.value == 2) { } else if (state.widgetType.value == 2) {
@ -84,13 +87,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
// //
} else if (state.widgetType.value == 4) { } else if (state.widgetType.value == 4) {
// //
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { //
showToast("生效时间不能小于当前时间".tr); if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){
return; if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast("结束时间不能小于当前时间".tr);
return;
}
} }
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { if (state.loopStartHours.value >= state.loopEndHours.value) {
showToast("结束时间不能小于当前时间".tr); showToast("失效时间要大于生效时间".tr);
return; return;
} }

View File

@ -15,6 +15,7 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_modelVendor.dart';
import '../../../../tools/NativeInteractionTool.dart'; import '../../../../tools/NativeInteractionTool.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
@ -290,16 +291,19 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
]; ];
showPickerView(context, pickerDataList); showPickerView(context, pickerDataList);
}), }),
CommonItem( Visibility(
leftTitel: '结束日期', visible: (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)) ? true : false,
rightTitle: state.endTime.value, child: CommonItem(
isHaveLine: true, leftTitel: '结束日期',
isHaveDirection: true, rightTitle: state.endTime.value,
action: () { isHaveLine: true,
Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) { isHaveDirection: true,
state.endTime.value = DateTool().getYMDHNDateString(p, 4); action: () {
}); Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) {
}), state.endTime.value = DateTool().getYMDHNDateString(p, 4);
});
}),
),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.loopEffectiveDate.value, rightTitle: state.loopEffectiveDate.value,