添加演示功能,调试蓝牙
This commit is contained in:
parent
83035edc44
commit
8547f10ef4
@ -75,6 +75,8 @@ import 'main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerp
|
|||||||
import 'main/lockDetail/otherTypeKey/addICCard/addICCard_page.dart';
|
import 'main/lockDetail/otherTypeKey/addICCard/addICCard_page.dart';
|
||||||
import 'main/lockDetail/otherTypeKey/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart';
|
import 'main/lockDetail/otherTypeKey/otherTypeKeyChangeDate/otherTypeKeyChangeDate_page.dart';
|
||||||
import 'main/lockDetail/otherTypeKey/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart';
|
import 'main/lockDetail/otherTypeKey/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart';
|
||||||
|
import 'main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart';
|
||||||
|
import 'main/lockMian/demoMode/demoModeLockSet/demoModeLockSet_page.dart';
|
||||||
import 'mine/about/about_page.dart';
|
import 'mine/about/about_page.dart';
|
||||||
import 'mine/addLock/addLock/addLock_page.dart';
|
import 'mine/addLock/addLock/addLock_page.dart';
|
||||||
import 'main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart';
|
import 'main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart';
|
||||||
@ -331,6 +333,8 @@ abstract class Routers {
|
|||||||
'/expireLockChangeDatePage'; //即将到期列表有效期修改
|
'/expireLockChangeDatePage'; //即将到期列表有效期修改
|
||||||
static const safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证
|
static const safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证
|
||||||
static const webviewShowPage = '/webviewShowPage'; //网页
|
static const webviewShowPage = '/webviewShowPage'; //网页
|
||||||
|
static const demoModeLockDetailPage = '/DemoModeLockDetailPage'; // 演示模式锁详情页
|
||||||
|
static const demoModeLockSetPage = '/DemoModeLockSetPage'; // 演示模式锁设置页
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AppRouters {
|
abstract class AppRouters {
|
||||||
@ -824,5 +828,7 @@ abstract class AppRouters {
|
|||||||
name: Routers.minePersonInfoViewSafetyProblemPage,
|
name: Routers.minePersonInfoViewSafetyProblemPage,
|
||||||
page: () => const MinePersonInfoViewSafetyProblemPage()),
|
page: () => const MinePersonInfoViewSafetyProblemPage()),
|
||||||
GetPage(name: Routers.webviewShowPage, page: () => const WebviewShowPage()),
|
GetPage(name: Routers.webviewShowPage, page: () => const WebviewShowPage()),
|
||||||
|
GetPage(name: Routers.demoModeLockSetPage, page: () => const DemoModeLockSetPage()),
|
||||||
|
GetPage(name: Routers.demoModeLockDetailPage, page: () => const DemoModeLockDetailPage()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,9 +126,9 @@ class BlueManage{
|
|||||||
deviceConnectionState = connectionStateUpdate.connectionState;
|
deviceConnectionState = connectionStateUpdate.connectionState;
|
||||||
print('ConnectionState for device $deviceMAC : ${connectionStateUpdate.connectionState}');
|
print('ConnectionState for device $deviceMAC : ${connectionStateUpdate.connectionState}');
|
||||||
|
|
||||||
if(connectionStateUpdate.connectionState != DeviceConnectionState.connected){
|
// if(connectionStateUpdate.connectionState != DeviceConnectionState.connected){
|
||||||
EasyLoading.dismiss();
|
// EasyLoading.dismiss();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(connectionStateUpdate.connectionState == DeviceConnectionState.connected){
|
if(connectionStateUpdate.connectionState == DeviceConnectionState.connected){
|
||||||
// 如果状态是连接的开始发现服务
|
// 如果状态是连接的开始发现服务
|
||||||
|
|||||||
@ -3,13 +3,6 @@ enum DataTransmissionMode {
|
|||||||
ble,
|
ble,
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveBluePublicKey = "BluePublicKey";
|
|
||||||
const saveBluePrivateKey = "BluePrivateKey";
|
|
||||||
const saveBlueSignKey = "BlueSignKey";
|
|
||||||
const saveBlueToken = "BlueGetToken";
|
|
||||||
const currentConnectionLockId = "CurrentConnectionLockId";
|
|
||||||
const currentConnectionMacAddress = "CurrentConnectionMacAddress";
|
|
||||||
|
|
||||||
class IoManager {
|
class IoManager {
|
||||||
|
|
||||||
static IoManager? _ioManager;
|
static IoManager? _ioManager;
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListDay_entity.dart';
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListDay_entity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
import 'checkingInList_state.dart';
|
import 'checkingInList_state.dart';
|
||||||
|
|
||||||
class CheckingInListLogic extends BaseGetXController{
|
class CheckingInListLogic extends BaseGetXController{
|
||||||
@ -101,12 +102,16 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
super.onReady();
|
super.onReady();
|
||||||
print("onReady()");
|
print("onReady()");
|
||||||
|
|
||||||
openCheckingInData();
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if(isDemoMode == false){
|
||||||
|
openCheckingInData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import '../../../../app_settings/app_colors.dart';
|
|||||||
import '../../../../tools/noData.dart';
|
import '../../../../tools/noData.dart';
|
||||||
import '../../../../tools/showBottomSheetTool.dart';
|
import '../../../../tools/showBottomSheetTool.dart';
|
||||||
import '../../../../tools/showCalendar.dart';
|
import '../../../../tools/showCalendar.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
import 'checkingInListDay_entity.dart';
|
import 'checkingInListDay_entity.dart';
|
||||||
@ -36,10 +37,15 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
Get.toNamed(Routers.checkingInSetPage, arguments: {
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
"getKeyInfosData": state.getKeyInfosData.value,
|
if(isDemoMode == false){
|
||||||
});
|
Get.toNamed(Routers.checkingInSetPage, arguments: {
|
||||||
|
"getKeyInfosData": state.getKeyInfosData.value,
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)),
|
child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)),
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
@ -76,8 +82,9 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(width: 20.w,),
|
SizedBox(width: 20.w,),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: (){
|
onTap: () async {
|
||||||
setState(() {
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if(isDemoMode == false){
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isDay.value = true;
|
state.isDay.value = true;
|
||||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
||||||
@ -85,7 +92,9 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
state.checkListDate.value = beginDate;
|
state.checkListDate.value = beginDate;
|
||||||
logic.loadDataByType();
|
logic.loadDataByType();
|
||||||
});
|
});
|
||||||
});
|
}else{
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 90.w,
|
width: 90.w,
|
||||||
@ -109,14 +118,19 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
),
|
),
|
||||||
// SizedBox(width: 20.w,),
|
// SizedBox(width: 20.w,),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: (){
|
onTap: () async {
|
||||||
setState(() {
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
state.isDay.value = false;
|
if(isDemoMode == false){
|
||||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
setState(() {
|
||||||
String beginDate = formatDate(dateTime, [mm]);
|
state.isDay.value = false;
|
||||||
state.checkListDate.value = beginDate;
|
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
||||||
logic.loadDataByType();
|
String beginDate = formatDate(dateTime, [mm]);
|
||||||
});
|
state.checkListDate.value = beginDate;
|
||||||
|
logic.loadDataByType();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 90.w,
|
width: 90.w,
|
||||||
@ -137,21 +151,26 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await showDialog(
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
context: context,
|
if(isDemoMode == false){
|
||||||
builder: (context) {
|
await showDialog(
|
||||||
return ShowCalendar(
|
context: context,
|
||||||
datePickerMode: DatePickerMode.day,
|
builder: (context) {
|
||||||
seletAction: (dateTime) {
|
return ShowCalendar(
|
||||||
setState(() {
|
datePickerMode: DatePickerMode.day,
|
||||||
state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch;
|
seletAction: (dateTime) {
|
||||||
String beginDate = formatDate(dateTime, state.isDay.value ? [mm,'-',dd] : [mm]);
|
setState(() {
|
||||||
state.checkListDate.value = beginDate;
|
state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch;
|
||||||
logic.loadDataByType();
|
String beginDate = formatDate(dateTime, state.isDay.value ? [mm,'-',dd] : [mm]);
|
||||||
Get.back();
|
state.checkListDate.value = beginDate;
|
||||||
|
logic.loadDataByType();
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}else{
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -305,8 +324,13 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
|
|
||||||
Widget titleWidget() {
|
Widget titleWidget() {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
showListType();
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if(isDemoMode == false){
|
||||||
|
showListType();
|
||||||
|
}else{
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Obx(() => Container(
|
child: Obx(() => Container(
|
||||||
width: 200.w,
|
width: 200.w,
|
||||||
|
|||||||
@ -3,11 +3,12 @@ import 'dart:async';
|
|||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||||
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_factoryDataReset.dart';
|
||||||
import '../../../../blue/io_reply.dart';
|
import '../../../../blue/io_reply.dart';
|
||||||
import '../../../../blue/io_tool/io_manager.dart';
|
|
||||||
import '../../../../blue/io_tool/io_tool.dart';
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../../blue/sender_manage.dart';
|
import '../../../../blue/sender_manage.dart';
|
||||||
@ -26,6 +27,188 @@ typedef BlockSetCheckInCallback = void Function(
|
|||||||
class LockSetLogic extends BaseGetXController {
|
class LockSetLogic extends BaseGetXController {
|
||||||
final LockSetState state = LockSetState();
|
final LockSetState state = LockSetState();
|
||||||
|
|
||||||
|
// 监听蓝牙协议返回结果
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
|
// 删除用户
|
||||||
|
if (reply is DeletUserReply) {
|
||||||
|
_replyDeletUserKey(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 恢复出厂设置
|
||||||
|
if(reply is FactoryDataResetReply){
|
||||||
|
_replyFactoryDataResetKey(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除用户
|
||||||
|
Future<void> _replyDeletUserKey(Reply reply) async {
|
||||||
|
var tokenData = reply.data.sublist(2, 6);
|
||||||
|
var saveStrList = changeIntListToStringList(tokenData);
|
||||||
|
print("openDoorToken:$tokenData");
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
int status = reply.data[6];
|
||||||
|
print("status:$status");
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType}解析成功");
|
||||||
|
deletLockInfoData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}需要鉴权");
|
||||||
|
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
IoSenderManage.deletUser(
|
||||||
|
lockID:
|
||||||
|
state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
||||||
|
authUserID: await Storage.getUid(),
|
||||||
|
keyID: "1",
|
||||||
|
delUserID: await Storage.getUid(),
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: publicKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: tokenData);
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType}用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType}权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType}失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 恢复出厂设置数据解析
|
||||||
|
Future<void> _replyFactoryDataResetKey(Reply reply) async {
|
||||||
|
var token = reply.data.sublist(2, 6);
|
||||||
|
var saveStrList = changeIntListToStringList(token);
|
||||||
|
print("_replyFactoryDataResetKeyToken:$token");
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
int status = reply.data[6];
|
||||||
|
print("status:$status");
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderFactoryDataReset(
|
||||||
|
lockID:BlueManage().connectDeviceName,
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
keyID:"1",
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType!.typeValue} 用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType!.typeValue} 失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除用户蓝牙协议
|
||||||
|
Future<void> deletUserAction() async {
|
||||||
|
BlueManage().judgeReconnect(
|
||||||
|
BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
|
||||||
|
(DeviceConnectionState connectionState) async {
|
||||||
|
if (connectionState == DeviceConnectionState.connected) {
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.deletUser(
|
||||||
|
lockID: state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
||||||
|
authUserID: "100001",
|
||||||
|
keyID: "1",
|
||||||
|
delUserID: "100001",
|
||||||
|
needAuthor: 1,
|
||||||
|
publicKey: publicKeyDataList,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
token: getTokenList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 恢复出厂设置
|
||||||
|
Future<void> factoryDataResetAction() async {
|
||||||
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||||||
|
if (state == DeviceConnectionState.connected){
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderFactoryDataReset(
|
||||||
|
lockID:BlueManage().connectDeviceName,
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
keyID:"1",
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 删除锁调用后台接口
|
// 删除锁调用后台接口
|
||||||
void deletLockInfoData() async {
|
void deletLockInfoData() async {
|
||||||
var entity = await ApiRepository.to.deletLockData(
|
var entity = await ApiRepository.to.deletLockData(
|
||||||
@ -36,6 +219,16 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询账户密码
|
||||||
|
void checkLoginPassword() async {
|
||||||
|
var entity = await ApiRepository.to.checkLoginPassword(
|
||||||
|
password: state.passwordTF.text,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 开启考勤获取是否有公司
|
// 开启考勤获取是否有公司
|
||||||
void openCheckingInData(
|
void openCheckingInData(
|
||||||
BlockSetCheckInCallback blockSetCheckInCallback) async {
|
BlockSetCheckInCallback blockSetCheckInCallback) async {
|
||||||
@ -95,97 +288,6 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听蓝牙协议返回结果
|
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
|
||||||
void _initReplySubscription() {
|
|
||||||
_replySubscription =
|
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
|
||||||
if (reply is DeletUserReply) {
|
|
||||||
var tokenData = reply.data.sublist(2, 6);
|
|
||||||
var saveStrList = changeIntListToStringList(tokenData);
|
|
||||||
print("openDoorToken:$tokenData");
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
int status = reply.data[6];
|
|
||||||
print("status:$status");
|
|
||||||
switch (status) {
|
|
||||||
case 0x00:
|
|
||||||
//成功
|
|
||||||
print("${reply.commandType}解析成功");
|
|
||||||
deletLockInfoData();
|
|
||||||
break;
|
|
||||||
case 0x06:
|
|
||||||
//无权限
|
|
||||||
print("${reply.commandType}需要鉴权");
|
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
List<int> getPrivateKeyList =
|
|
||||||
changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
|
||||||
|
|
||||||
IoSenderManage.deletUser(
|
|
||||||
lockID:
|
|
||||||
state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
|
||||||
authUserID: await Storage.getUid(),
|
|
||||||
keyID: "1",
|
|
||||||
delUserID: await Storage.getUid(),
|
|
||||||
needAuthor: 1,
|
|
||||||
publicKey: publicKeyDataList,
|
|
||||||
privateKey: getPrivateKeyList,
|
|
||||||
token: tokenData);
|
|
||||||
break;
|
|
||||||
case 0x07:
|
|
||||||
//无权限
|
|
||||||
print("${reply.commandType}用户无权限");
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 0x09:
|
|
||||||
// 权限校验错误
|
|
||||||
print("${reply.commandType}权限校验错误");
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//失败
|
|
||||||
print("${reply.commandType}失败");
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除用户蓝牙协议
|
|
||||||
Future<void> deletUserAction() async {
|
|
||||||
BlueManage().judgeReconnect(
|
|
||||||
BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
|
|
||||||
(DeviceConnectionState connectionState) async {
|
|
||||||
if (connectionState == DeviceConnectionState.connected) {
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
|
||||||
print("openDoorTokenPubToken:$getTokenList");
|
|
||||||
print(
|
|
||||||
"state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName:${state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName}");
|
|
||||||
IoSenderManage.deletUser(
|
|
||||||
lockID: state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
|
||||||
authUserID: "100001",
|
|
||||||
keyID: "1",
|
|
||||||
delUserID: "100001",
|
|
||||||
needAuthor: 1,
|
|
||||||
publicKey: publicKeyDataList,
|
|
||||||
privateKey: getPrivateKeyList,
|
|
||||||
token: getTokenList);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import '../../../../tools/appRouteObserver.dart';
|
|||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
import '../../../../tools/showIosTipView.dart';
|
||||||
|
import '../../../../tools/showTFView.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../tools/toast.dart';
|
import '../../../../tools/toast.dart';
|
||||||
@ -424,7 +425,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
isDelete: true,
|
isDelete: true,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
// logic.deletUserAction();
|
// logic.deletUserAction();
|
||||||
logic.deletLockInfoData();
|
|
||||||
|
// logic.deletLockInfoData();
|
||||||
|
showDeletPasswordAlertDialog(context);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -512,6 +515,30 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showDeletPasswordAlertDialog(
|
||||||
|
BuildContext context,
|
||||||
|
) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ShowTFView(
|
||||||
|
title: "请输入登录密码",
|
||||||
|
tipTitle: "",
|
||||||
|
controller: state.passwordTF,
|
||||||
|
sureClick: () {
|
||||||
|
//发送编辑钥匙名称请求
|
||||||
|
if (state.passwordTF.text.isNotEmpty) {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
// TODO: implement didChangeDependencies
|
// TODO: implement didChangeDependencies
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
|
|
||||||
@ -8,6 +9,7 @@ class LockSetState {
|
|||||||
|
|
||||||
var isAttendance = 1.obs;// 是否开启考勤
|
var isAttendance = 1.obs;// 是否开启考勤
|
||||||
var isLockPickingReminder = 1.obs;// 是否开启开锁提醒
|
var isLockPickingReminder = 1.obs;// 是否开启开锁提醒
|
||||||
|
var passwordTF = TextEditingController();
|
||||||
|
|
||||||
LockSetState() {
|
LockSetState() {
|
||||||
getKeyInfosData.value = Get.arguments as KeyInfos;
|
getKeyInfosData.value = Get.arguments as KeyInfos;
|
||||||
|
|||||||
@ -48,11 +48,6 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
_replyEditUserKey(reply);
|
_replyEditUserKey(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 恢复出厂设置
|
|
||||||
if(reply is FactoryDataResetReply){
|
|
||||||
_replyFactoryDataResetKey(reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取星锁状态信息
|
// 获取星锁状态信息
|
||||||
if(reply is GetStarLockStatuInfoReply){
|
if(reply is GetStarLockStatuInfoReply){
|
||||||
_replyGetStarLockStatusInfo(reply);
|
_replyGetStarLockStatusInfo(reply);
|
||||||
@ -253,62 +248,6 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 恢复出厂设置数据解析
|
|
||||||
Future<void> _replyFactoryDataResetKey(Reply reply) async {
|
|
||||||
var token = reply.data.sublist(2, 6);
|
|
||||||
var saveStrList = changeIntListToStringList(token);
|
|
||||||
print("_replyFactoryDataResetKeyToken:$token");
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
int status = reply.data[6];
|
|
||||||
print("status:$status");
|
|
||||||
|
|
||||||
switch(status){
|
|
||||||
case 0x00:
|
|
||||||
//成功
|
|
||||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 0x06:
|
|
||||||
//无权限
|
|
||||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
|
||||||
|
|
||||||
IoSenderManage.senderFactoryDataReset(
|
|
||||||
lockID:BlueManage().connectDeviceName,
|
|
||||||
userID:await Storage.getUid(),
|
|
||||||
keyID:"1",
|
|
||||||
needAuthor:1,
|
|
||||||
publicKey:publicKeyDataList,
|
|
||||||
privateKey:getPrivateKeyList,
|
|
||||||
token: getTokenList
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 0x07:
|
|
||||||
//无权限
|
|
||||||
print("${reply.commandType!.typeValue} 用户无权限");
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 0x09:
|
|
||||||
// 权限校验错误
|
|
||||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//失败
|
|
||||||
print("${reply.commandType!.typeValue} 失败");
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
|
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
switch(status){
|
switch(status){
|
||||||
@ -465,31 +404,6 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 恢复出厂设置
|
|
||||||
Future<void> factoryDataResetAction() async {
|
|
||||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
|
||||||
if (state == DeviceConnectionState.connected){
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
|
||||||
|
|
||||||
IoSenderManage.senderFactoryDataReset(
|
|
||||||
lockID:BlueManage().connectDeviceName,
|
|
||||||
userID:await Storage.getUid(),
|
|
||||||
keyID:"1",
|
|
||||||
needAuthor:1,
|
|
||||||
publicKey:publicKeyDataList,
|
|
||||||
privateKey:getPrivateKeyList,
|
|
||||||
token: getTokenList
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 备用逻辑,进入管理钥匙界面获取锁状态
|
// 备用逻辑,进入管理钥匙界面获取锁状态
|
||||||
Future<void> connectBlue(String bluetoothDeviceId, String bluetoothDeviceName) async {
|
Future<void> connectBlue(String bluetoothDeviceId, String bluetoothDeviceName) async {
|
||||||
|
|||||||
@ -239,32 +239,45 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
super.onReady();
|
super.onReady();
|
||||||
print("onReady()");
|
print("onReady()");
|
||||||
|
|
||||||
_initReplySubscription();
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if(isDemoMode == false){
|
||||||
|
_initReplySubscription();
|
||||||
|
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
Future<void> onInit() async {
|
||||||
// TODO: implement onInit
|
// TODO: implement onInit
|
||||||
super.onInit();
|
super.onInit();
|
||||||
print("onInit()");
|
print("onInit()");
|
||||||
|
|
||||||
getLockRecordLastUploadDataTime();
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
// senderReferEventRecordTime();
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
// senderReferEventRecordNumber();
|
if(isDemoMode == false){
|
||||||
|
getLockRecordLastUploadDataTime();
|
||||||
|
// senderReferEventRecordTime();
|
||||||
|
// senderReferEventRecordNumber();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
Future<void> onClose() async {
|
||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
super.onClose();
|
super.onClose();
|
||||||
_replySubscription.cancel();
|
|
||||||
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if(isDemoMode == false){
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3,9 +3,11 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
|
|
||||||
|
import '../../../appRouters.dart';
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/jh_pop_menus.dart';
|
import '../../../tools/jh_pop_menus.dart';
|
||||||
import '../../../tools/noData.dart';
|
import '../../../tools/noData.dart';
|
||||||
|
import '../../../tools/storage.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
import 'lockOperatingRecord_logic.dart';
|
import 'lockOperatingRecord_logic.dart';
|
||||||
@ -22,18 +24,8 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
final logic = Get.put(LockOperatingRecordLogic());
|
final logic = Get.put(LockOperatingRecordLogic());
|
||||||
final state = Get.find<LockOperatingRecordLogic>().state;
|
final state = Get.find<LockOperatingRecordLogic>().state;
|
||||||
|
|
||||||
// late KeyInfos keyInfo;
|
|
||||||
// late LockMainEntity lockMainEntity;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
||||||
// if (obj != null && (obj["lockMainEntity"] != null)) {
|
|
||||||
// lockMainEntity = obj["lockMainEntity"];
|
|
||||||
// }
|
|
||||||
// if (obj != null && (obj["keyInfo"] != null)) {
|
|
||||||
// keyInfo = obj["keyInfo"];
|
|
||||||
// }
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
@ -48,20 +40,25 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
height: 30.h,
|
height: 30.h,
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
print('选中index: $index');
|
if(isDemoMode == false){
|
||||||
print('选中text: $selText');
|
JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||||
if (index == 0) {
|
print('选中index: $index');
|
||||||
logic.mockNetworkDataRequest();
|
print('选中text: $selText');
|
||||||
} else if (index == 1) {
|
if (index == 0) {
|
||||||
logic.clearOperationRecordRequest();
|
logic.mockNetworkDataRequest();
|
||||||
}
|
} else if (index == 1) {
|
||||||
}, listData: [
|
logic.clearOperationRecordRequest();
|
||||||
{'text': '读取记录'},
|
}
|
||||||
{'text': '清空记录'},
|
}, listData: [
|
||||||
{'text': '导出记录'},
|
{'text': '读取记录'},
|
||||||
]);
|
{'text': '清空记录'},
|
||||||
|
{'text': '导出记录'},
|
||||||
|
]);
|
||||||
|
}else{
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -128,14 +125,14 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
|||||||
KeyRecordDataItem dataItem = state.lockOperatingRecordListData[index];
|
KeyRecordDataItem dataItem = state.lockOperatingRecordListData[index];
|
||||||
int? operateDate = dataItem.operateDate;
|
int? operateDate = dataItem.operateDate;
|
||||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
||||||
String operateDateStr =
|
String operateDateStr = '${dateStr.toLocal().toString().substring(0, 16)} ';
|
||||||
'${dateStr.toLocal().toString().substring(0, 16)} ';
|
|
||||||
|
|
||||||
return _operatingRecordItem(
|
// return _operatingRecordItem('images/controls_user.png', dataItem.username ?? "未知", '$operateDateStr用${dataItem.recordTypeName}', () {
|
||||||
'images/controls_user.png',
|
//
|
||||||
dataItem.username ?? "未知",
|
// });
|
||||||
'$operateDateStr用${dataItem.recordTypeName}',
|
return _operatingRecordItem('images/controls_user.png', dataItem.recordTypeName!, operateDateStr, () {
|
||||||
() {});
|
|
||||||
|
});
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
return const Divider(
|
return const Divider(
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../tools/storage.dart';
|
||||||
import '../../lockMian/entity/lockInfoEntity.dart';
|
import '../../lockMian/entity/lockInfoEntity.dart';
|
||||||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
|
|
||||||
class LockOperatingRecordState{
|
class LockOperatingRecordState{
|
||||||
final keyInfos = KeyInfos().obs;
|
final keyInfos = KeyInfos().obs;
|
||||||
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
||||||
|
|
||||||
LockOperatingRecordState() {
|
LockOperatingRecordState() {
|
||||||
keyInfos.value = Get.arguments["keyInfo"];
|
keyInfos.value = Get.arguments["keyInfo"];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
// print("添加指纹确认成功,调用添加指纹接口");
|
// print("添加指纹确认成功,调用添加指纹接口");
|
||||||
if(state.isCoerced.value == "2"){
|
if(state.isCoerced.value == "2"){
|
||||||
// 非胁迫指纹
|
// 非胁迫指纹
|
||||||
addFingerprintsData();
|
addFingerprintsData(reply.data[6].toString());
|
||||||
}else{
|
}else{
|
||||||
// 如果是胁迫指纹在 添加完之后以后再调用添加胁迫指纹的
|
// 如果是胁迫指纹在 添加完之后以后再调用添加胁迫指纹的
|
||||||
senderAddStressFingerprint();
|
senderAddStressFingerprint();
|
||||||
@ -212,7 +212,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
//成功
|
//成功
|
||||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
// print("添加指纹确认成功,调用添加指纹接口");
|
// print("添加指纹确认成功,调用添加指纹接口");
|
||||||
addFingerprintsData();
|
addFingerprintsData(reply.data[6].toString());
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//需要权限
|
//需要权限
|
||||||
@ -254,7 +254,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
fingerNo:1,
|
fingerNo:1,
|
||||||
useCountLimit:1,
|
useCountLimit:0xff,
|
||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
// startTime:int.parse(state.startDate.value)~/1000,
|
// startTime:int.parse(state.startDate.value)~/1000,
|
||||||
@ -301,7 +301,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 添加指纹
|
// 添加指纹
|
||||||
void addFingerprintsData() async{
|
void addFingerprintsData(String fingerprintUserNo) async{
|
||||||
var entity = await ApiRepository.to.addFingerprintsData(
|
var entity = await ApiRepository.to.addFingerprintsData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
endDate: state.endDate.value,
|
endDate: state.endDate.value,
|
||||||
@ -315,16 +315,16 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Toast.show(msg: "添加成功");
|
Toast.show(msg: "添加成功");
|
||||||
updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString());
|
updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString(), fingerprintUserNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新指纹用户账号
|
// 更新指纹用户账号
|
||||||
void updateFingerprintUserNoLoadData(String fingerprintId) async{
|
void updateFingerprintUserNoLoadData(String fingerprintId, String fingerprintUserNo) async{
|
||||||
var entity = await ApiRepository.to.updateFingerprintUserNoLoadData(
|
var entity = await ApiRepository.to.updateFingerprintUserNoLoadData(
|
||||||
fingerprintId: fingerprintId,
|
fingerprintId: fingerprintId,
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
fingerprintUserNo: "0",
|
fingerprintUserNo: fingerprintUserNo,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Toast.show(msg: "添加成功");
|
Toast.show(msg: "添加成功");
|
||||||
|
|||||||
@ -101,7 +101,7 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
"根据提示,抬起手指后再进行下一次指纹采集,共3次",
|
"根据提示,抬起手指后再进行下一次指纹采集,共4次",
|
||||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
maxLines:null,
|
maxLines:null,
|
||||||
|
|||||||
@ -102,9 +102,9 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
|
|
||||||
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
||||||
var token = reply.data.sublist(2, 6);
|
var token = reply.data.sublist(2, 6);
|
||||||
var saveStrList = changeIntListToStringList(token);
|
// var saveStrList = changeIntListToStringList(token);
|
||||||
print("_replyAddICCardConfirmationReplyToken:$token");
|
// print("_replyAddICCardConfirmationReplyToken:$token");
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
print("_replyAddFingerprintstatus:$status");
|
print("_replyAddFingerprintstatus:$status");
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import 'package:star_lock/appRouters.dart';
|
|||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/toast.dart';
|
import '../../../../tools/toast.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -163,12 +164,20 @@ class _OtherTypeAddKeyPageState extends State<OtherTypeAddKeyPage> {
|
|||||||
rightWidget: SizedBox(
|
rightWidget: SizedBox(
|
||||||
width: 60.w, height: 50.h, child: _isStressFingerprint())),
|
width: 60.w, height: 50.h, child: _isStressFingerprint())),
|
||||||
SizedBox(height: 30.h),
|
SizedBox(height: 30.h),
|
||||||
SubmitBtn(btnName: TranslationLoader.lanKeys!.next!.tr, onClick: () {
|
SubmitBtn(btnName: TranslationLoader.lanKeys!.next!.tr, onClick: () async {
|
||||||
if(state.nameController.text.isEmpty){
|
|
||||||
Toast.show(msg: "请输入姓名");
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
return;
|
if(isDemoMode == false){
|
||||||
|
if(state.nameController.text.isEmpty){
|
||||||
|
Toast.show(msg: "请输入姓名");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
logic.addFingerprintsData();
|
||||||
|
}else{
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
}
|
}
|
||||||
logic.addFingerprintsData();
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,15 +1,98 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addFingerprint.dart';
|
||||||
|
import '../../../../blue/io_reply.dart';
|
||||||
|
import '../../../../blue/io_tool/io_manager.dart';
|
||||||
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
|
import '../../../../blue/sender_manage.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/toast.dart';
|
import '../../../../tools/toast.dart';
|
||||||
import 'otherTypeKeyDetail_state.dart';
|
import 'otherTypeKeyDetail_state.dart';
|
||||||
|
|
||||||
class OtherTypeKeyDetailLogic extends BaseGetXController{
|
class OtherTypeKeyDetailLogic extends BaseGetXController{
|
||||||
OtherTypeKeyDetailState state = OtherTypeKeyDetailState();
|
OtherTypeKeyDetailState state = OtherTypeKeyDetailState();
|
||||||
|
|
||||||
|
// 监听设备返回的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
|
// 添加指纹开始(删除单个指纹)
|
||||||
|
if(reply is SenderAddFingerprintReply) {
|
||||||
|
_replyAddFingerprintBegin(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||||
|
// var token = reply.data.sublist(2, 6);
|
||||||
|
// var saveStrList = changeIntListToStringList(token);
|
||||||
|
// print("_replyAddFingerprintReplyToken:$token");
|
||||||
|
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
int status = reply.data[2];
|
||||||
|
print("status:$status");
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
|
keyID:"1",
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:1,
|
||||||
|
useCountLimit:0,
|
||||||
|
startTime:0x11223344,
|
||||||
|
endTime:0x11223344,
|
||||||
|
// startTime:int.parse(state.startDate.value)~/1000,
|
||||||
|
// endTime:int.parse(state.endDate.value)~/1000,
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType!.typeValue} 用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType!.typeValue} 失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑指纹
|
// 编辑指纹
|
||||||
void editFingerprintsData() async{
|
void editFingerprintsData() async{
|
||||||
var entity = await ApiRepository.to.editFingerprintsData(
|
var entity = await ApiRepository.to.editFingerprintsData(
|
||||||
@ -27,6 +110,37 @@ class OtherTypeKeyDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除指纹
|
||||||
|
Future<void> senderAddFingerprint() async {
|
||||||
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == DeviceConnectionState.connected){
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
|
keyID:"1",
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:1,
|
||||||
|
useCountLimit:0,
|
||||||
|
startTime:0x11223344,
|
||||||
|
endTime:0x11223344,
|
||||||
|
// startTime:int.parse(state.startDate.value)~/1000,
|
||||||
|
// endTime:int.parse(state.endDate.value)~/1000,
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 删除指纹
|
// 删除指纹
|
||||||
void deletFingerprintsData() async{
|
void deletFingerprintsData() async{
|
||||||
var entity = await ApiRepository.to.deletFingerprintsData(
|
var entity = await ApiRepository.to.deletFingerprintsData(
|
||||||
@ -71,4 +185,29 @@ class OtherTypeKeyDetailLogic extends BaseGetXController{
|
|||||||
Get.back(result: "addScuess");
|
Get.back(result: "addScuess");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
_initReplySubscription();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
|
senderAddFingerprint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2,8 +2,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addFingerprint.dart';
|
||||||
import '../../../../blue/io_protocol/io_checkingCardStatus.dart';
|
import '../../../../blue/io_protocol/io_checkingCardStatus.dart';
|
||||||
import '../../../../blue/io_protocol/io_checkingUserInfoCount.dart';
|
import '../../../../blue/io_protocol/io_checkingUserInfoCount.dart';
|
||||||
import '../../../../blue/io_protocol/io_queryingFingerprintStatus.dart';
|
import '../../../../blue/io_protocol/io_queryingFingerprintStatus.dart';
|
||||||
@ -26,6 +28,11 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
|||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
|
// 添加指纹开始(重置锁里面所有指纹)
|
||||||
|
if(reply is SenderAddFingerprintReply) {
|
||||||
|
_replyAddFingerprintBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
if(reply is SenderQueryingFingerprintStatusReply) {
|
if(reply is SenderQueryingFingerprintStatusReply) {
|
||||||
// 获取指纹状态
|
// 获取指纹状态
|
||||||
_replyQueryingFingerprintStatus(reply);
|
_replyQueryingFingerprintStatus(reply);
|
||||||
@ -41,6 +48,67 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置锁里面所有指纹
|
||||||
|
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||||
|
// var token = reply.data.sublist(2, 6);
|
||||||
|
// var saveStrList = changeIntListToStringList(token);
|
||||||
|
// print("_replyAddFingerprintReplyToken:$token");
|
||||||
|
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
int status = reply.data[2];
|
||||||
|
print("status:$status");
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
deletAllFingerprintsData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
|
keyID:"1",
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:1,
|
||||||
|
useCountLimit:0,
|
||||||
|
startTime:0x11223344,
|
||||||
|
endTime:0x11223344,
|
||||||
|
// startTime:int.parse(state.startDate.value)~/1000,
|
||||||
|
// endTime:int.parse(state.endDate.value)~/1000,
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("${reply.commandType!.typeValue} 用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("${reply.commandType!.typeValue} 失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 获取指纹状态
|
// 获取指纹状态
|
||||||
Future<void> _replyQueryingFingerprintStatus(Reply reply) async {
|
Future<void> _replyQueryingFingerprintStatus(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
@ -263,6 +331,37 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
|||||||
}, isShowLoading: false);
|
}, isShowLoading: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置所有指纹
|
||||||
|
Future<void> senderAddFingerprint() async {
|
||||||
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == DeviceConnectionState.connected){
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
|
keyID:"1",
|
||||||
|
userID:"Delete All !@#",
|
||||||
|
fingerNo:255,
|
||||||
|
useCountLimit:0,
|
||||||
|
startTime:0x11223344,
|
||||||
|
endTime:0x11223344,
|
||||||
|
// startTime:int.parse(state.startDate.value)~/1000,
|
||||||
|
// endTime:int.parse(state.endDate.value)~/1000,
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 获取指纹列表
|
// 获取指纹列表
|
||||||
void getFingerprintsListData() async{
|
void getFingerprintsListData() async{
|
||||||
var entity = await ApiRepository.to.getFingerprintsListData(
|
var entity = await ApiRepository.to.getFingerprintsListData(
|
||||||
@ -341,49 +440,59 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
super.onReady();
|
super.onReady();
|
||||||
print("onReady()");
|
print("onReady()");
|
||||||
|
|
||||||
_initReplySubscription();
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if(isDemoMode == false){
|
||||||
|
_initReplySubscription();
|
||||||
|
|
||||||
_initRefreshAction();
|
_initRefreshAction();
|
||||||
|
|
||||||
switch (state.fromType.value) {
|
switch (state.fromType.value) {
|
||||||
case 0:
|
case 0:
|
||||||
// 卡
|
// 卡
|
||||||
getICCardListData();
|
getICCardListData();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// 指纹
|
// 指纹
|
||||||
getFingerprintsListData();
|
getFingerprintsListData();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 遥控
|
// 遥控
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
Future<void> onInit() async {
|
||||||
// TODO: implement onInit
|
// TODO: implement onInit
|
||||||
super.onInit();
|
super.onInit();
|
||||||
print("onInit()");
|
print("onInit()");
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
// senderQueryingFingerprintStatus();
|
if(isDemoMode == false) {
|
||||||
// senderCheckingCardStatus();
|
// senderQueryingFingerprintStatus();
|
||||||
senderCheckingUserInfoCount();
|
// senderCheckingCardStatus();
|
||||||
|
senderCheckingUserInfoCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
Future<void> onClose() async {
|
||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
super.onClose();
|
super.onClose();
|
||||||
_replySubscription.cancel();
|
|
||||||
_teamEvent.cancel();
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if(isDemoMode == false) {
|
||||||
|
_replySubscription.cancel();
|
||||||
|
_teamEvent.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,6 +6,7 @@ import '../../../../appRouters.dart';
|
|||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/noData.dart';
|
import '../../../../tools/noData.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -37,22 +38,28 @@ class _OtherTypeKeyListPageState extends State<OtherTypeKeyListPage> {
|
|||||||
TranslationLoader.lanKeys!.reset!.tr,
|
TranslationLoader.lanKeys!.reset!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
switch (state.fromType.value) {
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
case 0:
|
if(isDemoMode == false){
|
||||||
// 卡
|
switch (state.fromType.value) {
|
||||||
logic.deletICCardData();
|
case 0:
|
||||||
break;
|
// 卡
|
||||||
case 1:
|
logic.deletICCardData();
|
||||||
// 指纹
|
break;
|
||||||
logic.deletAllFingerprintsData();
|
case 1:
|
||||||
break;
|
// 指纹
|
||||||
case 2:
|
// logic.deletAllFingerprintsData();
|
||||||
// 遥控
|
logic.senderAddFingerprint();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// 遥控
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@ -611,7 +611,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
contentPadding: EdgeInsets.only(top: 24.h, bottom: 16.h),
|
||||||
hintText: tfStr,
|
hintText: tfStr,
|
||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
//不需要输入框下划线
|
//不需要输入框下划线
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import '../../../../tools/baseGetXController.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
|
import 'demoModeLockDetail_state.dart';
|
||||||
|
|
||||||
|
class DemoModeLockDetailLogic extends BaseGetXController {
|
||||||
|
DemoModeLockDetailState state = DemoModeLockDetailState();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
print("onReady()");
|
||||||
|
|
||||||
|
Storage.setBool(ifIsDemoModeOrNot, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
print("onInit()");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,372 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
import '../../entity/lockInfoEntity.dart';
|
||||||
|
import 'demoModeLockDetail_logic.dart';
|
||||||
|
|
||||||
|
class DemoModeLockDetailPage extends StatefulWidget {
|
||||||
|
const DemoModeLockDetailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DemoModeLockDetailPage> createState() => _DemoModeLockDetailPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||||
|
final logic = Get.put(DemoModeLockDetailLogic());
|
||||||
|
final state = Get.find<DemoModeLockDetailLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: "演示模式",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
width: 1.sw,
|
||||||
|
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
topTip(),
|
||||||
|
topWidget(),
|
||||||
|
Expanded(child: bottomWidget())
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget topTip(){
|
||||||
|
return Container(
|
||||||
|
// height: 120.h,
|
||||||
|
width: 1.sw,
|
||||||
|
margin: EdgeInsets.all(15.w),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(child: Text("提示:当前界面为展示界面,请添加设备后继续使用", style: TextStyle(fontSize: 24.sp, color: AppColors.mainColor))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget topWidget() {
|
||||||
|
// KeyInfos keyInfo = widget.lockMainEntity.data!.keyInfos![0];
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 30.h),
|
||||||
|
Stack(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
"TMH_78f16712781a",
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),
|
||||||
|
)),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"100%",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
),
|
||||||
|
SizedBox(width: 2.w),
|
||||||
|
Image.asset(
|
||||||
|
'images/main/icon_main_cell.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 24.w,
|
||||||
|
),
|
||||||
|
SizedBox(width: 30.w),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 30.h),
|
||||||
|
Container(
|
||||||
|
// width: 1.sw,
|
||||||
|
color: Colors.white,
|
||||||
|
height: 280.w,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
gotoLogin();
|
||||||
|
},
|
||||||
|
child: Image.asset('images/main/icon_main_openLockBtn.png',
|
||||||
|
width: 268.w, height: 268.w),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.h,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'门已上锁',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.sp,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 6.h,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp,
|
||||||
|
color: AppColors.btnDisableColor,
|
||||||
|
fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.h,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_electronicKey_admin.png',
|
||||||
|
width: 24.w,
|
||||||
|
height: 20.w,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 6.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'超级管理员',
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 80.w,
|
||||||
|
),
|
||||||
|
Image.asset('images/main/icon_main_remoteUnlocking_grey.png',
|
||||||
|
// state.keyInfos.value.remoteEnable == 1
|
||||||
|
// ? 'images/main/icon_main_remoteUnlocking.png'
|
||||||
|
// : 'images/main/icon_main_remoteUnlocking_grey.png',
|
||||||
|
width: 24.w,
|
||||||
|
height: 20.w,
|
||||||
|
// color: state.keyInfos.value.remoteEnable == 1
|
||||||
|
// ? AppColors.btnDisableColor
|
||||||
|
// : AppColors.mainColor,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 6.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'网关设备',
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
indent: 20.w,
|
||||||
|
endIndent: 20.w,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget bottomWidget() {
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h),
|
||||||
|
// color: Colors.blue,
|
||||||
|
child: SizedBox(
|
||||||
|
child: GridView.count(
|
||||||
|
crossAxisCount: 4,
|
||||||
|
// childAspectRatio: 3,
|
||||||
|
crossAxisSpacing: 20.w,
|
||||||
|
mainAxisSpacing: 0.h,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
children: getShowWidget()),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> getShowWidget() {
|
||||||
|
var showWidgetArr = <Widget>[];
|
||||||
|
|
||||||
|
// 考勤
|
||||||
|
// if (state.keyInfos.value.isAttendance == 1) {
|
||||||
|
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
|
||||||
|
TranslationLoader.lanKeys!.checkingIn!.tr, () {
|
||||||
|
// gotoLogin();
|
||||||
|
Get.toNamed(Routers.checkingInListPage, arguments: KeyInfos());
|
||||||
|
}));
|
||||||
|
// }
|
||||||
|
|
||||||
|
var defaultWidgetArr = [
|
||||||
|
// 电子钥匙
|
||||||
|
bottomItem('images/main/icon_main_electronicKey.png',
|
||||||
|
TranslationLoader.lanKeys!.electronicKey!.tr, () {
|
||||||
|
gotoLogin();
|
||||||
|
|
||||||
|
// Get.toNamed(Routers.electronicKeyListPage, arguments: {
|
||||||
|
// "lockMainEntity": widget.lockMainEntity,
|
||||||
|
// "keyInfo": widget.keyInfo
|
||||||
|
// });
|
||||||
|
}),
|
||||||
|
|
||||||
|
// 密码
|
||||||
|
bottomItem('images/main/icon_main_password.png',
|
||||||
|
TranslationLoader.lanKeys!.password!.tr, () {
|
||||||
|
gotoLogin();
|
||||||
|
|
||||||
|
// Get.toNamed(Routers.passwordKeyListPage, arguments: {
|
||||||
|
// "lockMainEntity": widget.lockMainEntity,
|
||||||
|
// "keyInfo": widget.keyInfo
|
||||||
|
// });
|
||||||
|
}),
|
||||||
|
|
||||||
|
// ic卡
|
||||||
|
bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () {
|
||||||
|
// gotoLogin();
|
||||||
|
|
||||||
|
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
|
||||||
|
"lockId": 0,
|
||||||
|
"fromType": 0
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
|
||||||
|
// 指纹
|
||||||
|
bottomItem('images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, () {
|
||||||
|
// gotoLogin();
|
||||||
|
|
||||||
|
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
|
||||||
|
"lockId": 1,
|
||||||
|
"fromType": 1
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
|
||||||
|
// 遥控
|
||||||
|
bottomItem('images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, () {
|
||||||
|
gotoLogin();
|
||||||
|
|
||||||
|
// Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
|
||||||
|
// "lockId": "2",
|
||||||
|
// "fromType": 2
|
||||||
|
// });
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
showWidgetArr.addAll(defaultWidgetArr);
|
||||||
|
|
||||||
|
//可视对讲门锁新增->人脸
|
||||||
|
showWidgetArr.add(
|
||||||
|
bottomItem('images/main/icon_face.png', '人脸', () {
|
||||||
|
gotoLogin();
|
||||||
|
|
||||||
|
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
|
||||||
|
// arguments: 1);
|
||||||
|
// Toast.show(msg: "功能暂未开放");
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
//可视对讲门锁新增->监控
|
||||||
|
showWidgetArr.add(
|
||||||
|
bottomItem('images/main/icon_catEyes.png', '监控', () {
|
||||||
|
gotoLogin();
|
||||||
|
|
||||||
|
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
|
||||||
|
// arguments: 1);
|
||||||
|
// Toast.show(msg: "功能暂未开放");
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
var endWiddget = [
|
||||||
|
// 授权管理员
|
||||||
|
bottomItem('images/main/icon_main_authorizedAdmin.png',
|
||||||
|
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
|
||||||
|
gotoLogin();
|
||||||
|
|
||||||
|
// Get.toNamed(Routers.authorizedAdminListPage, arguments: {
|
||||||
|
// "keyInfo": KeyInfos()
|
||||||
|
// });
|
||||||
|
}),
|
||||||
|
// 操作记录
|
||||||
|
bottomItem('images/main/icon_main_operatingRecord.png',
|
||||||
|
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
|
||||||
|
// gotoLogin();
|
||||||
|
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
|
||||||
|
"keyInfo": KeyInfos()
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
// 设置
|
||||||
|
bottomItem(
|
||||||
|
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
|
||||||
|
Get.toNamed(Routers.demoModeLockSetPage);
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
showWidgetArr.addAll(endWiddget);
|
||||||
|
return showWidgetArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget bottomItem(String iconUrl, String name, Function() onClick) {
|
||||||
|
var width = 42.w;
|
||||||
|
var height = 42.h;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: onClick,
|
||||||
|
child: Container(
|
||||||
|
// height: 300.h,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
child: Image.asset(iconUrl,
|
||||||
|
width: width, height: height, fit: BoxFit.fitWidth),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10.w),
|
||||||
|
Expanded(
|
||||||
|
child: Text(name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.sp, color: AppColors.blackColor),
|
||||||
|
textAlign: TextAlign.center))
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gotoLogin(){
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
|
class DemoModeLockDetailState {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,353 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/commonItem.dart';
|
||||||
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class DemoModeLockSetPage extends StatefulWidget {
|
||||||
|
const DemoModeLockSetPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DemoModeLockSetPage> createState() => _DemoModeLockSetPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.set!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
// 基本信息
|
||||||
|
CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
TranslationLoader.lanKeys!.basicInformation!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.basicInformationPage, arguments: {
|
||||||
|
// 'keyInfo': state.getKeyInfosData.value
|
||||||
|
// });
|
||||||
|
}),
|
||||||
|
SizedBox(height: 10.h,),
|
||||||
|
// 门磁
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.doorMagneticPage);
|
||||||
|
// Toast.show(msg: "功能暂未开放");
|
||||||
|
}),
|
||||||
|
// 无线键盘
|
||||||
|
CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.wirelessKeyboardPage);
|
||||||
|
// Toast.show(msg: "功能暂未开放");
|
||||||
|
}),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
// 自动闭锁
|
||||||
|
CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
||||||
|
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.automaticBlockingPage,
|
||||||
|
// arguments: state.getKeyInfosData.value);
|
||||||
|
}),
|
||||||
|
// 锁声音
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.lockSound!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.lockSoundSetPage, arguments: state.getKeyInfosData.value);
|
||||||
|
}),
|
||||||
|
// 防撬报警
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
|
||||||
|
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.burglarAlarmPage,
|
||||||
|
// arguments: state.getKeyInfosData.value);
|
||||||
|
}),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
// 常开模式
|
||||||
|
CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
||||||
|
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.normallyOpenModePage, arguments: state.getKeyInfosData.value);
|
||||||
|
}),
|
||||||
|
// 远程开锁
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
|
||||||
|
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.remoteUnlockingPage,
|
||||||
|
// arguments: state.getKeyInfosData.value);
|
||||||
|
}),
|
||||||
|
// 重置键
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
|
||||||
|
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
// Get.toNamed(Routers.resetButtonPage,
|
||||||
|
// arguments: state.getKeyInfosData.value);
|
||||||
|
}),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
//---田总新增展示
|
||||||
|
// Obx(() =>
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '面容开锁',
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget:
|
||||||
|
SizedBox(width: 60.w, child: _otherUnHaveDoneSwitch())),
|
||||||
|
// ),
|
||||||
|
// Obx(() =>
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '感应距离',
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
// ),
|
||||||
|
// Obx(() =>
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '自动亮屏',
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget:
|
||||||
|
SizedBox(width: 60.w, child: _otherUnHaveDoneSwitch())),
|
||||||
|
// ),
|
||||||
|
// Obx(() =>
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '逗留警告',
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget:
|
||||||
|
SizedBox(width: 60.w, child: _otherUnHaveDoneSwitch())),
|
||||||
|
// ),
|
||||||
|
// Obx(() =>
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '异常警告',
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget:
|
||||||
|
SizedBox(width: 60.w, child: _otherUnHaveDoneSwitch())),
|
||||||
|
// ),
|
||||||
|
// Obx(() =>
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '开门方向设置',
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
// ),
|
||||||
|
// Obx(() =>
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '电机功率设置',
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
// ),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
//-----新增至此
|
||||||
|
CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
TranslationLoader.lanKeys!.markedHouseState!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget:
|
||||||
|
SizedBox(width: 60.w, child: _openCheckInSwitch())
|
||||||
|
),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget:
|
||||||
|
SizedBox(width: 60.w, child: _lockRemindSwitch())),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader
|
||||||
|
.lanKeys!.wifiDistributionNetwork!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.lockTime!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.diagnose!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.uploadData!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel:
|
||||||
|
TranslationLoader.lanKeys!.importOtherLockData!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.lockEscalation!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
gotoAddLock();
|
||||||
|
}),
|
||||||
|
SizedBox(height: 30.h),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 30.h),
|
||||||
|
child: SubmitBtn(
|
||||||
|
btnName: "退出演示模式",
|
||||||
|
isDelete: true,
|
||||||
|
onClick: () {
|
||||||
|
Get.close(2);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
CupertinoSwitch _openCheckInSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: false,
|
||||||
|
onChanged: (value) {
|
||||||
|
gotoAddLock();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CupertinoSwitch _lockRemindSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: false,
|
||||||
|
onChanged: (value) {
|
||||||
|
gotoAddLock();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CupertinoSwitch _otherUnHaveDoneSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: false,
|
||||||
|
onChanged: (value) {
|
||||||
|
gotoAddLock();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gotoAddLock(){
|
||||||
|
Get.toNamed(Routers.seletLockTypePage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,15 +1,13 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../baseWidget.dart';
|
import '../../../baseWidget.dart';
|
||||||
import '../../../mine/mine/starLockMine_page.dart';
|
import '../../../mine/mine/starLockMine_page.dart';
|
||||||
import '../../../tools/refreshHeadFoot.dart';
|
import '../../../tools/storage.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
import '../../lockDetail/lockDetail/lockDetail_page.dart';
|
import '../../lockDetail/lockDetail/lockDetail_page.dart';
|
||||||
|
|||||||
@ -412,6 +412,9 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
String str = "";
|
String str = "";
|
||||||
for(int i = 0; i<6; i++){
|
for(int i = 0; i<6; i++){
|
||||||
var a = Random().nextInt(99);
|
var a = Random().nextInt(99);
|
||||||
|
if(a<10){
|
||||||
|
a = a*10;
|
||||||
|
}
|
||||||
str = "$str$a:";
|
str = "$str$a:";
|
||||||
}
|
}
|
||||||
String result = str.substring(0, str.length - 1);
|
String result = str.substring(0, str.length - 1);
|
||||||
|
|||||||
@ -35,6 +35,7 @@ abstract class Api {
|
|||||||
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //删除密码
|
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //删除密码
|
||||||
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
||||||
final String deletLockURL = '/lock/delete'; // 删除锁
|
final String deletLockURL = '/lock/delete'; // 删除锁
|
||||||
|
final String checkPasswordURL = '/user/checkPassword'; // 检查账户密码
|
||||||
|
|
||||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||||
final String passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
final String passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
||||||
|
|||||||
@ -311,6 +311,13 @@ class ApiProvider extends BaseProvider {
|
|||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// 检查账户密码
|
||||||
|
Future<Response> checkLoginPassword(String password) => post(
|
||||||
|
checkPasswordURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'password': password,
|
||||||
|
}));
|
||||||
|
|
||||||
// 获取Wifi锁服务器
|
// 获取Wifi锁服务器
|
||||||
Future<Response> getWifiLockServiceIpAndPort() =>
|
Future<Response> getWifiLockServiceIpAndPort() =>
|
||||||
post(getWifiServiceIpURL.toUrl, jsonEncode({}));
|
post(getWifiServiceIpURL.toUrl, jsonEncode({}));
|
||||||
@ -953,7 +960,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
|
|
||||||
// 更新ICCard序号
|
// 更新ICCard序号
|
||||||
Future<Response> updateIdCardUserNoLoadData(
|
Future<Response> updateIdCardUserNoLoadData(
|
||||||
String cardId, String lockId, String cardUserNo) =>
|
String lockId, String cardId, String cardUserNo) =>
|
||||||
post(
|
post(
|
||||||
updateICCardUserNoURL.toUrl,
|
updateICCardUserNoURL.toUrl,
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
|
|||||||
@ -332,6 +332,12 @@ class ApiRepository {
|
|||||||
return LockMainEntity.fromJson(res.body);
|
return LockMainEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查账户密码
|
||||||
|
Future<LockMainEntity> checkLoginPassword({required String password}) async {
|
||||||
|
final res = await apiProvider.checkLoginPassword(password);
|
||||||
|
return LockMainEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//获取密码
|
//获取密码
|
||||||
Future<PasswordKeyEntity> getPasswordKey(
|
Future<PasswordKeyEntity> getPasswordKey(
|
||||||
String endDate,
|
String endDate,
|
||||||
|
|||||||
@ -8,6 +8,14 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
import '../login/login/entity/LoginData.dart';
|
import '../login/login/entity/LoginData.dart';
|
||||||
import '../login/login/entity/LoginEntity.dart';
|
import '../login/login/entity/LoginEntity.dart';
|
||||||
|
|
||||||
|
const saveBluePublicKey = "BluePublicKey";
|
||||||
|
const saveBluePrivateKey = "BluePrivateKey";
|
||||||
|
const saveBlueSignKey = "BlueSignKey";
|
||||||
|
const saveBlueToken = "BlueGetToken";
|
||||||
|
const currentConnectionLockId = "CurrentConnectionLockId";
|
||||||
|
const currentConnectionMacAddress = "CurrentConnectionMacAddress";
|
||||||
|
const ifIsDemoModeOrNot = "IfIsDemoModeOrNot";
|
||||||
|
|
||||||
class Storage {
|
class Storage {
|
||||||
Storage._internal();
|
Storage._internal();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user