Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
This commit is contained in:
commit
a0c8e0832b
@ -75,6 +75,8 @@ import 'main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerp
|
||||
import 'main/lockDetail/otherTypeKey/addICCard/addICCard_page.dart';
|
||||
import 'main/lockDetail/otherTypeKey/otherTypeKeyChangeDate/otherTypeKeyChangeDate_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/addLock/addLock/addLock_page.dart';
|
||||
import 'main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart';
|
||||
@ -331,6 +333,8 @@ abstract class Routers {
|
||||
'/expireLockChangeDatePage'; //即将到期列表有效期修改
|
||||
static const safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证
|
||||
static const webviewShowPage = '/webviewShowPage'; //网页
|
||||
static const demoModeLockDetailPage = '/DemoModeLockDetailPage'; // 演示模式锁详情页
|
||||
static const demoModeLockSetPage = '/DemoModeLockSetPage'; // 演示模式锁设置页
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -824,5 +828,7 @@ abstract class AppRouters {
|
||||
name: Routers.minePersonInfoViewSafetyProblemPage,
|
||||
page: () => const MinePersonInfoViewSafetyProblemPage()),
|
||||
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;
|
||||
print('ConnectionState for device $deviceMAC : ${connectionStateUpdate.connectionState}');
|
||||
|
||||
if(connectionStateUpdate.connectionState != DeviceConnectionState.connected){
|
||||
EasyLoading.dismiss();
|
||||
}
|
||||
// if(connectionStateUpdate.connectionState != DeviceConnectionState.connected){
|
||||
// EasyLoading.dismiss();
|
||||
// }
|
||||
|
||||
if(connectionStateUpdate.connectionState == DeviceConnectionState.connected){
|
||||
// 如果状态是连接的开始发现服务
|
||||
|
||||
@ -3,13 +3,6 @@ enum DataTransmissionMode {
|
||||
ble,
|
||||
}
|
||||
|
||||
const saveBluePublicKey = "BluePublicKey";
|
||||
const saveBluePrivateKey = "BluePrivateKey";
|
||||
const saveBlueSignKey = "BlueSignKey";
|
||||
const saveBlueToken = "BlueGetToken";
|
||||
const currentConnectionLockId = "CurrentConnectionLockId";
|
||||
const currentConnectionMacAddress = "CurrentConnectionMacAddress";
|
||||
|
||||
class IoManager {
|
||||
|
||||
static IoManager? _ioManager;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListDay_entity.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import 'checkingInList_state.dart';
|
||||
|
||||
class CheckingInListLogic extends BaseGetXController{
|
||||
@ -101,12 +102,16 @@ class CheckingInListLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
openCheckingInData();
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
openCheckingInData();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -9,6 +9,7 @@ import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/noData.dart';
|
||||
import '../../../../tools/showBottomSheetTool.dart';
|
||||
import '../../../../tools/showCalendar.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'checkingInListDay_entity.dart';
|
||||
@ -36,10 +37,15 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.checkingInSetPage, arguments: {
|
||||
"getKeyInfosData": state.getKeyInfosData.value,
|
||||
});
|
||||
onTap: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
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,)),
|
||||
SizedBox(width: 30.w),
|
||||
@ -76,8 +82,9 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
children: [
|
||||
SizedBox(width: 20.w,),
|
||||
GestureDetector(
|
||||
onTap: (){
|
||||
setState(() {
|
||||
onTap: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
setState(() {
|
||||
state.isDay.value = true;
|
||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
||||
@ -85,7 +92,9 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
state.checkListDate.value = beginDate;
|
||||
logic.loadDataByType();
|
||||
});
|
||||
});
|
||||
}else{
|
||||
Get.toNamed(Routers.seletLockTypePage);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 90.w,
|
||||
@ -109,14 +118,19 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
),
|
||||
// SizedBox(width: 20.w,),
|
||||
GestureDetector(
|
||||
onTap: (){
|
||||
setState(() {
|
||||
state.isDay.value = false;
|
||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
||||
String beginDate = formatDate(dateTime, [mm]);
|
||||
state.checkListDate.value = beginDate;
|
||||
logic.loadDataByType();
|
||||
});
|
||||
onTap: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
setState(() {
|
||||
state.isDay.value = false;
|
||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
|
||||
String beginDate = formatDate(dateTime, [mm]);
|
||||
state.checkListDate.value = beginDate;
|
||||
logic.loadDataByType();
|
||||
});
|
||||
}else{
|
||||
Get.toNamed(Routers.seletLockTypePage);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 90.w,
|
||||
@ -137,21 +151,26 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return ShowCalendar(
|
||||
datePickerMode: DatePickerMode.day,
|
||||
seletAction: (dateTime) {
|
||||
setState(() {
|
||||
state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch;
|
||||
String beginDate = formatDate(dateTime, state.isDay.value ? [mm,'-',dd] : [mm]);
|
||||
state.checkListDate.value = beginDate;
|
||||
logic.loadDataByType();
|
||||
Get.back();
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return ShowCalendar(
|
||||
datePickerMode: DatePickerMode.day,
|
||||
seletAction: (dateTime) {
|
||||
setState(() {
|
||||
state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch;
|
||||
String beginDate = formatDate(dateTime, state.isDay.value ? [mm,'-',dd] : [mm]);
|
||||
state.checkListDate.value = beginDate;
|
||||
logic.loadDataByType();
|
||||
Get.back();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}else{
|
||||
Get.toNamed(Routers.seletLockTypePage);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -305,8 +324,13 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
|
||||
Widget titleWidget() {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
showListType();
|
||||
onTap: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
showListType();
|
||||
}else{
|
||||
Get.toNamed(Routers.seletLockTypePage);
|
||||
}
|
||||
},
|
||||
child: Obx(() => Container(
|
||||
width: 200.w,
|
||||
|
||||
@ -3,11 +3,12 @@ import 'dart:async';
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_factoryDataReset.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';
|
||||
@ -26,6 +27,188 @@ typedef BlockSetCheckInCallback = void Function(
|
||||
class LockSetLogic extends BaseGetXController {
|
||||
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 {
|
||||
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(
|
||||
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
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -12,6 +12,7 @@ import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/showTFView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
@ -446,7 +447,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
isDelete: true,
|
||||
onClick: () {
|
||||
// logic.deletUserAction();
|
||||
|
||||
logic.deletLockInfoData();
|
||||
// showDeletPasswordAlertDialog(context);
|
||||
}),
|
||||
),
|
||||
],
|
||||
@ -534,6 +537,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
|
||||
void didChangeDependencies() {
|
||||
// TODO: implement didChangeDependencies
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
|
||||
@ -8,6 +9,7 @@ class LockSetState {
|
||||
|
||||
var isAttendance = 1.obs;// 是否开启考勤
|
||||
var isLockPickingReminder = 1.obs;// 是否开启开锁提醒
|
||||
var passwordTF = TextEditingController();
|
||||
|
||||
LockSetState() {
|
||||
getKeyInfosData.value = Get.arguments as KeyInfos;
|
||||
|
||||
@ -48,11 +48,6 @@ class LockDetailLogic extends BaseGetXController{
|
||||
_replyEditUserKey(reply);
|
||||
}
|
||||
|
||||
// 恢复出厂设置
|
||||
if(reply is FactoryDataResetReply){
|
||||
_replyFactoryDataResetKey(reply);
|
||||
}
|
||||
|
||||
// 获取星锁状态信息
|
||||
if(reply is GetStarLockStatuInfoReply){
|
||||
_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 {
|
||||
int status = reply.data[2];
|
||||
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 {
|
||||
|
||||
@ -239,32 +239,45 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
_initReplySubscription();
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
_initReplySubscription();
|
||||
|
||||
mockNetworkDataRequest();
|
||||
mockNetworkDataRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
Future<void> onInit() async {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
getLockRecordLastUploadDataTime();
|
||||
// senderReferEventRecordTime();
|
||||
// senderReferEventRecordNumber();
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
getLockRecordLastUploadDataTime();
|
||||
// senderReferEventRecordTime();
|
||||
// senderReferEventRecordNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
Future<void> onClose() async {
|
||||
// TODO: implement 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:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/jh_pop_menus.dart';
|
||||
import '../../../tools/noData.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import 'lockOperatingRecord_logic.dart';
|
||||
@ -22,18 +24,8 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
final logic = Get.put(LockOperatingRecordLogic());
|
||||
final state = Get.find<LockOperatingRecordLogic>().state;
|
||||
|
||||
// late KeyInfos keyInfo;
|
||||
// late LockMainEntity lockMainEntity;
|
||||
|
||||
@override
|
||||
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(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
@ -48,20 +40,25 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
height: 30.h,
|
||||
width: 10.w,
|
||||
),
|
||||
onPressed: () {
|
||||
JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||
print('选中index: $index');
|
||||
print('选中text: $selText');
|
||||
if (index == 0) {
|
||||
logic.mockNetworkDataRequest();
|
||||
} else if (index == 1) {
|
||||
logic.clearOperationRecordRequest();
|
||||
}
|
||||
}, listData: [
|
||||
{'text': '读取记录'},
|
||||
{'text': '清空记录'},
|
||||
{'text': '导出记录'},
|
||||
]);
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||
print('选中index: $index');
|
||||
print('选中text: $selText');
|
||||
if (index == 0) {
|
||||
logic.mockNetworkDataRequest();
|
||||
} else if (index == 1) {
|
||||
logic.clearOperationRecordRequest();
|
||||
}
|
||||
}, listData: [
|
||||
{'text': '读取记录'},
|
||||
{'text': '清空记录'},
|
||||
{'text': '导出记录'},
|
||||
]);
|
||||
}else{
|
||||
Get.toNamed(Routers.seletLockTypePage);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -128,14 +125,14 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
|
||||
KeyRecordDataItem dataItem = state.lockOperatingRecordListData[index];
|
||||
int? operateDate = dataItem.operateDate;
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
||||
String operateDateStr =
|
||||
'${dateStr.toLocal().toString().substring(0, 16)} ';
|
||||
String operateDateStr = '${dateStr.toLocal().toString().substring(0, 16)} ';
|
||||
|
||||
return _operatingRecordItem(
|
||||
'images/controls_user.png',
|
||||
dataItem.username ?? "未知",
|
||||
'$operateDateStr用${dataItem.recordTypeName}',
|
||||
() {});
|
||||
// return _operatingRecordItem('images/controls_user.png', dataItem.username ?? "未知", '$operateDateStr用${dataItem.recordTypeName}', () {
|
||||
//
|
||||
// });
|
||||
return _operatingRecordItem('images/controls_user.png', dataItem.recordTypeName!, operateDateStr, () {
|
||||
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../lockMian/entity/lockInfoEntity.dart';
|
||||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||
|
||||
class LockOperatingRecordState{
|
||||
final keyInfos = KeyInfos().obs;
|
||||
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
||||
|
||||
LockOperatingRecordState() {
|
||||
keyInfos.value = Get.arguments["keyInfo"];
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
// print("添加指纹确认成功,调用添加指纹接口");
|
||||
if(state.isCoerced.value == "2"){
|
||||
// 非胁迫指纹
|
||||
addFingerprintsData();
|
||||
addFingerprintsData(reply.data[6].toString());
|
||||
}else{
|
||||
// 如果是胁迫指纹在 添加完之后以后再调用添加胁迫指纹的
|
||||
senderAddStressFingerprint();
|
||||
@ -212,7 +212,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// print("添加指纹确认成功,调用添加指纹接口");
|
||||
addFingerprintsData();
|
||||
addFingerprintsData(reply.data[6].toString());
|
||||
break;
|
||||
case 0x06:
|
||||
//需要权限
|
||||
@ -254,7 +254,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:1,
|
||||
useCountLimit:1,
|
||||
useCountLimit:0xff,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
// 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(
|
||||
lockId: state.lockId.value.toString(),
|
||||
endDate: state.endDate.value,
|
||||
@ -315,16 +315,16 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
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(
|
||||
fingerprintId: fingerprintId,
|
||||
lockId: state.lockId.value.toString(),
|
||||
fingerprintUserNo: "0",
|
||||
fingerprintUserNo: fingerprintUserNo,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Toast.show(msg: "添加成功");
|
||||
|
||||
@ -101,7 +101,7 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"根据提示,抬起手指后再进行下一次指纹采集,共3次",
|
||||
"根据提示,抬起手指后再进行下一次指纹采集,共4次",
|
||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines:null,
|
||||
|
||||
@ -102,9 +102,9 @@ class AddICCardLogic extends BaseGetXController{
|
||||
|
||||
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyAddICCardConfirmationReplyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
// var saveStrList = changeIntListToStringList(token);
|
||||
// print("_replyAddICCardConfirmationReplyToken:$token");
|
||||
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFingerprintstatus:$status");
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:star_lock/appRouters.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -163,12 +164,20 @@ class _OtherTypeAddKeyPageState extends State<OtherTypeAddKeyPage> {
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isStressFingerprint())),
|
||||
SizedBox(height: 30.h),
|
||||
SubmitBtn(btnName: TranslationLoader.lanKeys!.next!.tr, onClick: () {
|
||||
if(state.nameController.text.isEmpty){
|
||||
Toast.show(msg: "请输入姓名");
|
||||
return;
|
||||
SubmitBtn(btnName: TranslationLoader.lanKeys!.next!.tr, onClick: () async {
|
||||
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
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:star_lock/blue/io_type.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 '../../../../tools/storage.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
import 'otherTypeKeyDetail_state.dart';
|
||||
|
||||
class OtherTypeKeyDetailLogic extends BaseGetXController{
|
||||
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{
|
||||
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{
|
||||
var entity = await ApiRepository.to.deletFingerprintsData(
|
||||
@ -71,4 +185,29 @@ class OtherTypeKeyDetailLogic extends BaseGetXController{
|
||||
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 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:star_lock/blue/io_type.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_checkingUserInfoCount.dart';
|
||||
import '../../../../blue/io_protocol/io_queryingFingerprintStatus.dart';
|
||||
@ -26,6 +28,11 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
// 添加指纹开始(重置锁里面所有指纹)
|
||||
if(reply is SenderAddFingerprintReply) {
|
||||
_replyAddFingerprintBegin(reply);
|
||||
}
|
||||
|
||||
if(reply is SenderQueryingFingerprintStatusReply) {
|
||||
// 获取指纹状态
|
||||
_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 {
|
||||
int status = reply.data[2];
|
||||
@ -263,6 +331,37 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
}, 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{
|
||||
var entity = await ApiRepository.to.getFingerprintsListData(
|
||||
@ -341,49 +440,59 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
_initReplySubscription();
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
_initReplySubscription();
|
||||
|
||||
_initRefreshAction();
|
||||
_initRefreshAction();
|
||||
|
||||
switch (state.fromType.value) {
|
||||
case 0:
|
||||
switch (state.fromType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
getICCardListData();
|
||||
break;
|
||||
case 1:
|
||||
getICCardListData();
|
||||
break;
|
||||
case 1:
|
||||
// 指纹
|
||||
getFingerprintsListData();
|
||||
break;
|
||||
case 2:
|
||||
getFingerprintsListData();
|
||||
break;
|
||||
case 2:
|
||||
// 遥控
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
Future<void> onInit() async {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
// senderQueryingFingerprintStatus();
|
||||
// senderCheckingCardStatus();
|
||||
senderCheckingUserInfoCount();
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false) {
|
||||
// senderQueryingFingerprintStatus();
|
||||
// senderCheckingCardStatus();
|
||||
senderCheckingUserInfoCount();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
Future<void> onClose() async {
|
||||
// TODO: implement 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 '../../../../tools/dateTool.dart';
|
||||
import '../../../../tools/noData.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -37,22 +38,28 @@ class _OtherTypeKeyListPageState extends State<OtherTypeKeyListPage> {
|
||||
TranslationLoader.lanKeys!.reset!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
switch (state.fromType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
logic.deletICCardData();
|
||||
break;
|
||||
case 1:
|
||||
// 指纹
|
||||
logic.deletAllFingerprintsData();
|
||||
break;
|
||||
case 2:
|
||||
// 遥控
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
switch (state.fromType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
logic.deletICCardData();
|
||||
break;
|
||||
case 1:
|
||||
// 指纹
|
||||
// logic.deletAllFingerprintsData();
|
||||
logic.senderAddFingerprint();
|
||||
break;
|
||||
case 2:
|
||||
// 遥控
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
Get.toNamed(Routers.seletLockTypePage);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@ -614,7 +614,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
contentPadding: EdgeInsets.only(top: 24.h, bottom: 16.h),
|
||||
hintText: tfStr,
|
||||
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,16 +1,14 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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/tools/submitBtn.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../baseWidget.dart';
|
||||
import '../../../mine/mine/starLockMine_page.dart';
|
||||
import '../../../tools/refreshHeadFoot.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import '../../lockDetail/lockDetail/lockDetail_page.dart';
|
||||
@ -82,12 +80,14 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
returnWidget = unHaveData();
|
||||
break;
|
||||
case 1:
|
||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||
returnWidget = LockDetailPage(
|
||||
lockMainEntity: logic.state.lockMainEntity.value,
|
||||
isFrist: true,
|
||||
keyInfo: logic.state.lockMainEntity.value.data!.keyInfos![0]);
|
||||
break;
|
||||
case 2:
|
||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||
returnWidget =
|
||||
LockListPage(lockMainEntity: logic.state.lockMainEntity.value);
|
||||
break;
|
||||
@ -148,7 +148,9 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
SizedBox(
|
||||
height: 200.h,
|
||||
),
|
||||
SubmitBtn(btnName: '演示模式')
|
||||
SubmitBtn(btnName: '演示模式', onClick: (){
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -412,6 +412,9 @@ class SaveLockLogic extends BaseGetXController {
|
||||
String str = "";
|
||||
for(int i = 0; i<6; i++){
|
||||
var a = Random().nextInt(99);
|
||||
if(a<10){
|
||||
a = a*10;
|
||||
}
|
||||
str = "$str$a:";
|
||||
}
|
||||
String result = str.substring(0, str.length - 1);
|
||||
|
||||
@ -36,6 +36,7 @@ abstract class Api {
|
||||
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //删除密码
|
||||
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
||||
final String deletLockURL = '/lock/delete'; // 删除锁
|
||||
final String checkPasswordURL = '/user/checkPassword'; // 检查账户密码
|
||||
|
||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||
final String passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
||||
|
||||
@ -311,6 +311,13 @@ class ApiProvider extends BaseProvider {
|
||||
'lockId': lockId,
|
||||
}));
|
||||
|
||||
// 检查账户密码
|
||||
Future<Response> checkLoginPassword(String password) => post(
|
||||
checkPasswordURL.toUrl,
|
||||
jsonEncode({
|
||||
'password': password,
|
||||
}));
|
||||
|
||||
// 获取Wifi锁服务器
|
||||
Future<Response> getWifiLockServiceIpAndPort() =>
|
||||
post(getWifiServiceIpURL.toUrl, jsonEncode({}));
|
||||
@ -953,7 +960,7 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 更新ICCard序号
|
||||
Future<Response> updateIdCardUserNoLoadData(
|
||||
String cardId, String lockId, String cardUserNo) =>
|
||||
String lockId, String cardId, String cardUserNo) =>
|
||||
post(
|
||||
updateICCardUserNoURL.toUrl,
|
||||
jsonEncode(
|
||||
|
||||
@ -332,6 +332,12 @@ class ApiRepository {
|
||||
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(
|
||||
String endDate,
|
||||
|
||||
@ -8,6 +8,14 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../login/login/entity/LoginData.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 {
|
||||
Storage._internal();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user