This commit is contained in:
魏少阳 2023-08-31 15:56:06 +08:00
commit c84a03dad5
15 changed files with 193 additions and 44 deletions

View File

@ -335,7 +335,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
// isOn:: 1 2
Future<void> updateRoomCheckIn() async {
var entity = await ApiRepository.to.updateSetting('0', '1', '13');
var entity = await ApiRepository.to
.updateSetting(keyInfo.lockId.toString(), '1', '13');
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
Toast.show(msg: "标记成功");

View File

@ -133,8 +133,8 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
}
return _electronicKeyItem('images/controls_user.png',
indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
// Navigator.pushNamed(context, Routers.authorizedAdminDetailPage);
Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
arguments: {'itemData': indexEntity});
});
});
}

View File

@ -96,7 +96,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
const SizedBox(height: 1),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
rightTitle: itemData.date.toString(),
rightTitle: getSenderDate(itemData),
action: () {}),
Container(height: 10.h),
CommonItem(
@ -115,7 +115,10 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.keyOperationRecordPage,
arguments: {});
arguments: {
'lockId': itemData.lockId.toString(),
'keyId': itemData.keyId.toString()
});
}),
Container(height: 40.h),
SubmitBtn(
@ -160,6 +163,14 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
return useDateStr;
}
//
String getSenderDate(ElectronicKeyListItem indexEntity) {
String senderDate = '';
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
senderDate = dateStr.toLocal().toString().substring(0, 16);
return senderDate;
}
Widget commonItem(String leftTitle, String rightTitle,
{bool isHaveDirection = false,
bool isHaveLine = false,

View File

@ -17,8 +17,31 @@ class KeyOperationRecordPage extends StatefulWidget {
}
class _KeyOperationRecordPageState extends State<KeyOperationRecordPage> {
String _keyId = '';
String _lockId = '';
String _keyboardPwdId = ''; //ID
String _cardId = ''; //ID
String _fingerprintId = ''; //ID
@override
Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["keyId"] != null)) {
_keyId = obj["keyId"];
}
if (obj != null && (obj["lockId"] != null)) {
_lockId = obj["lockId"];
}
if (obj != null && (obj["keyboardPwdId"] != null)) {
_keyboardPwdId = obj["keyboardPwdId"];
}
if (obj != null && (obj["cardId"] != null)) {
_cardId = obj["cardId"];
}
if (obj != null && (obj["fingerprintId"] != null)) {
_fingerprintId = obj["fingerprintId"];
}
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
@ -55,8 +78,21 @@ class _KeyOperationRecordPageState extends State<KeyOperationRecordPage> {
//
Future<List<KeyRecordDataItem>> mockNetworkDataRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to
.lockRecordList('0', '63', '0', '28', '1', '1', '20', '0', '', '', '');
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
'0',
_keyId,
'0',
_lockId,
'1',
'1',
'20',
'0',
'',
'',
'',
_keyboardPwdId,
_cardId,
_fingerprintId);
if (entity.errorCode!.codeIsSuccessful) {
print("操作记录列表成功:${entity.data?.itemList}");
}

View File

@ -196,8 +196,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
//
Future<void> resetElectronicKeyListRequest() async {
ElectronicKeyListEntity entity =
await ApiRepository.to.resetElectronicKey('28', '0');
ElectronicKeyListEntity entity = await ApiRepository.to
.resetElectronicKey(keyInfo.lockId.toString(), '0');
if (entity.errorCode!.codeIsSuccessful) {
print("重置电子钥匙成功啦啦啦啦啦");
Toast.show(msg: "重置成功");

View File

@ -445,7 +445,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
// isOn:: 1 2
Future<void> updateRoomCheckIn() async {
var entity = await ApiRepository.to.updateSetting('0', '1', '13');
var entity = await ApiRepository.to
.updateSetting(keyInfo.lockId.toString(), '1', '13');
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
Toast.show(msg: "标记成功");

View File

@ -17,7 +17,11 @@ class LockDetailPage extends StatefulWidget {
final KeyInfos keyInfo;
final LockMainEntity lockMainEntity;
const LockDetailPage({Key? key, required this.lockMainEntity, required this.isFrist, required this.keyInfo})
const LockDetailPage(
{Key? key,
required this.lockMainEntity,
required this.isFrist,
required this.keyInfo})
: super(key: key);
@override
@ -34,15 +38,19 @@ class _LockDetailPageState extends State<LockDetailPage> {
super.initState();
state.keyInfos.value = widget.keyInfo;
BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
BlueManage().connectDeviceMacAddress = state.keyInfos.value.bluetooth!.bluetoothDeviceId!;
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
BlueManage().connectDeviceMacAddress =
state.keyInfos.value.bluetooth!.bluetoothDeviceId!;
List<int> publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
var saveStrList = changeIntListToStringList(publicKeyData);
Storage.setStringList(saveBluePublicKey, saveStrList);
//
List<int> privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
List<int> privateKeyData =
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
@ -57,16 +65,12 @@ class _LockDetailPageState extends State<LockDetailPage> {
@override
Widget build(BuildContext context) {
return Container(
width: 1.sw,
height: 1.sh - ScreenUtil().statusBarHeight*2,
height: 1.sh - ScreenUtil().statusBarHeight * 2,
color: Colors.white,
child: Column(
children: [
topWidget(),
Expanded(child: bottomWidget())
],
children: [topWidget(), Expanded(child: bottomWidget())],
),
);
}
@ -187,7 +191,11 @@ class _LockDetailPageState extends State<LockDetailPage> {
}),
bottomItem('images/main/icon_main_password.png',
TranslationLoader.lanKeys!.password!.tr, () {
Navigator.pushNamed(context, Routers.passwordKeyListPage);
Navigator.pushNamed(context, Routers.passwordKeyListPage,
arguments: {
"lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo
});
}),
bottomItem('images/main/icon_main_icCard.png',
TranslationLoader.lanKeys!.card!.tr, () {
@ -223,7 +231,11 @@ class _LockDetailPageState extends State<LockDetailPage> {
}),
bottomItem('images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Navigator.pushNamed(context, Routers.lockOperatingRecordPage);
Navigator.pushNamed(context, Routers.lockOperatingRecordPage,
arguments: {
"lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo
});
}),
bottomItem('images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr, () {

View File

@ -4,6 +4,7 @@ import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/jh_pop_menus.dart';
@ -19,8 +20,19 @@ class LockOperatingRecordPage extends StatefulWidget {
}
class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
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,
appBar: TitleAppBar(
@ -93,8 +105,21 @@ class _LockOperatingRecordPageState extends State<LockOperatingRecordPage> {
//
Future<List<KeyRecordDataItem>> mockNetworkDataRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to
.lockRecordList('0', '63', '0', '28', '1', '1', '20', '0', '', '', '');
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
'0',
keyInfo.keyId.toString(),
'0',
keyInfo.lockId.toString(),
'1',
'1',
'20',
'0',
'',
'',
'',
'',
'',
'');
if (entity.errorCode!.codeIsSuccessful) {
print("操作记录列表成功:${entity.data?.itemList}");
}

View File

@ -99,7 +99,11 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
rightTitle: "",
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.keyOperationRecordPage);
Navigator.pushNamed(context, Routers.keyOperationRecordPage,
arguments: {
'lockId': itemData.lockId.toString(),
'keyId': itemData.keyboardPwdId.toString()
});
}),
Container(height: 40.h),
SizedBox(

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
@ -20,8 +21,18 @@ class PasswordKeyListPage extends StatefulWidget {
}
class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
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,
appBar: TitleAppBar(
@ -67,7 +78,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
onClick: () {
Navigator.pushNamed(
context, Routers.passwordKeyManagePage);
context, Routers.passwordKeyManagePage, arguments: {
"lockMainEntity": lockMainEntity,
"keyInfo": keyInfo
});
},
),
SizedBox(
@ -86,8 +100,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
//
Future<List<PasswordKeyListItem>> mockNetworkDataRequest() async {
PasswordKeyListEntity entity =
await ApiRepository.to.passwordKeyList('0', '28', '0', '1', '20');
PasswordKeyListEntity entity = await ApiRepository.to
.passwordKeyList('0', keyInfo.lockId.toString(), '0', '1', '20');
if (entity.errorCode!.codeIsSuccessful) {
print("密码钥匙列表成功:${entity.data?.itemList}");
}
@ -102,7 +116,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
//
Future<void> resetPasswordKeyListRequest() async {
PasswordKeyListEntity entity =
await ApiRepository.to.resetPasswordKey('28', '0');
await ApiRepository.to.resetPasswordKey(keyInfo.lockId.toString(), '0');
if (entity.errorCode!.codeIsSuccessful) {
print("重置电子钥匙成功啦啦啦啦啦");
Toast.show(msg: "重置成功");

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
@ -15,16 +15,33 @@ class PasswordKeyManagePage extends StatefulWidget {
}
class _PasswordKeyManagePageState extends State<PasswordKeyManagePage> {
var index=0;
var index = 0;
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,
appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.getPassword!.tr, haveBack:true, backgroundColor: AppColors.mainColor),
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.getPassword!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
PasswordKeyManageTabbarPage(initialIndex: index,),
PasswordKeyManageTabbarPage(
initialIndex: index,
keyInfo: keyInfo,
lockMainEntity: lockMainEntity,
),
],
),
);

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart';
@ -9,8 +10,14 @@ import '../passwordKey_Perpetual/passwordKey_perpetual_page.dart';
class PasswordKeyManageTabbarPage extends StatefulWidget {
var initialIndex = 1;
final KeyInfos keyInfo;
final LockMainEntity lockMainEntity;
PasswordKeyManageTabbarPage({Key? key, required this.initialIndex})
PasswordKeyManageTabbarPage(
{Key? key,
required this.initialIndex,
required this.keyInfo,
required this.lockMainEntity})
: super(key: key);
@override
State<PasswordKeyManageTabbarPage> createState() =>
@ -98,6 +105,8 @@ class _PasswordKeyManageTabbarPageState
children: _itemTabs
.map((ItemView item) => PasswordKeyPerpetualPage(
type: item.type,
getKeyInfo: widget.keyInfo,
lockMainEntity: widget.lockMainEntity,
))
.toList(),
),

View File

@ -6,6 +6,7 @@ import 'package:flutter_pickers/style/default_style.dart';
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
@ -17,8 +18,14 @@ import '../../../../translations/trans_lib.dart';
class PasswordKeyPerpetualPage extends StatefulWidget {
final String type;
final KeyInfos getKeyInfo;
final LockMainEntity lockMainEntity;
const PasswordKeyPerpetualPage({Key? key, required this.type})
const PasswordKeyPerpetualPage(
{Key? key,
required this.type,
required this.getKeyInfo,
required this.lockMainEntity})
: super(key: key);
@override
State<PasswordKeyPerpetualPage> createState() =>
@ -27,14 +34,14 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
final TextEditingController _controller = TextEditingController();
late bool _isSendSuccess;
late bool _isPermanent;
late bool _isSendSuccess; //
late bool _isPermanent; //
late String _getPwdStr;
String _selectEffectiveDate = ''; //
String _selectFailureDate = ''; //
late DateTime _effectiveDateTime;
late DateTime _failureDateTime;
late String cyclicModeStr;
late String cyclicModeStr; //
late String effectiveHourStr;
late String failureHourStr;
@ -365,7 +372,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
Future<void> getKeyboardPwdRequest() async {
String getFailureDateTime = '0';
String getEffectiveDateTime = '0';
String lockId = '28';
String lockId = widget.getKeyInfo.lockId.toString();
int passwordType = int.parse(widget.type);
String getKeyType = passwordType.toString();
if (passwordType == 0) {

View File

@ -209,7 +209,10 @@ class ApiProvider extends BaseProvider {
String startDate,
String recordType,
String searchStr,
String timezoneRawOffSet) =>
String timezoneRawOffSet,
String keyboardPwdId,
String cardId,
String fingerprintId) =>
post(
keyOperationRecordURL.toUrl,
jsonEncode({
@ -223,7 +226,10 @@ class ApiProvider extends BaseProvider {
'startDate': startDate,
'recordType': recordType,
'searchStr': searchStr,
'timezoneRawOffSet': timezoneRawOffSet
'timezoneRawOffSet': timezoneRawOffSet,
'keyboardPwdId': keyboardPwdId,
'cardId': cardId,
'fingerprintId': fingerprintId
}));
//

View File

@ -160,7 +160,10 @@ class ApiRepository {
String startDate,
String recordType,
String searchStr,
String timezoneRawOffSet) async {
String timezoneRawOffSet,
String keyboardPwdId,
String cardId,
String fingerprintId) async {
final res = await apiProvider.lockRecordList(
endDate,
keyId,
@ -172,7 +175,10 @@ class ApiRepository {
startDate,
recordType,
searchStr,
timezoneRawOffSet);
timezoneRawOffSet,
keyboardPwdId,
cardId,
fingerprintId);
return KeyOperationRecordEntity.fromJson(res.body);
}