Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
This commit is contained in:
commit
88f4c5f9ab
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
@ -21,9 +20,10 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
// 开门
|
// 开门
|
||||||
if(reply is TransferPermissionsReply) {
|
if (reply is TransferPermissionsReply) {
|
||||||
var token = reply.data.sublist(2, 6);
|
var token = reply.data.sublist(2, 6);
|
||||||
var saveStrList = changeIntListToStringList(token);
|
var saveStrList = changeIntListToStringList(token);
|
||||||
print("_replyFactoryDataResetKeyToken:$token");
|
print("_replyFactoryDataResetKeyToken:$token");
|
||||||
@ -32,17 +32,18 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
int status = reply.data[6];
|
int status = reply.data[6];
|
||||||
print("status:$status");
|
print("status:$status");
|
||||||
|
|
||||||
switch(status){
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
@ -51,27 +52,26 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderFactoryDataReset(
|
IoSenderManage.senderFactoryDataReset(
|
||||||
lockID:BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID:await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
keyID:"1",
|
keyID: "1",
|
||||||
needAuthor:1,
|
needAuthor: 1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList
|
token: getTokenList);
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType!.typeValue} 用户无权限");
|
print("${reply.commandType!.typeValue} 用户无权限");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
// 权限校验错误
|
// 权限校验错误
|
||||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
print("${reply.commandType!.typeValue} 失败");
|
print("${reply.commandType!.typeValue} 失败");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -82,8 +82,10 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 转移权限
|
// 转移权限
|
||||||
Future<void> transferPermissionsAction() async {
|
Future<void> transferPermissionsAction() async {
|
||||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
BlueManage().judgeReconnect(
|
||||||
if (state == DeviceConnectionState.connected){
|
BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
|
||||||
|
(DeviceConnectionState state) async {
|
||||||
|
if (state == DeviceConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
@ -95,16 +97,15 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
print("openDoorTokenPubToken:$getTokenList");
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
|
||||||
IoSenderManage.senderTransferPermissions(
|
IoSenderManage.senderTransferPermissions(
|
||||||
lockID:BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
authUserID:await Storage.getUid(),
|
authUserID: await Storage.getUid(),
|
||||||
keyID:"1",
|
keyID: "1",
|
||||||
oldUserID:await Storage.getUid(),
|
oldUserID: await Storage.getUid(),
|
||||||
newUserID:"100002",
|
newUserID: "100002",
|
||||||
needAuthor:1,
|
needAuthor: 1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList
|
token: getTokenList);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -121,7 +122,6 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
// TODO: implement onInit
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -129,5 +129,4 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -302,7 +302,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
btnName: '完成',
|
btnName: '完成',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
_isSendSuccess = false;
|
_isSendSuccess = false;
|
||||||
setState(() {});
|
Navigator.pop(context, true);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
|
|||||||
@ -69,7 +69,12 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
arguments: {
|
arguments: {
|
||||||
"lockMainEntity": lockMainEntity,
|
"lockMainEntity": lockMainEntity,
|
||||||
"keyInfo": keyInfo
|
"keyInfo": keyInfo
|
||||||
});
|
}).then((val) {
|
||||||
|
if (val != null) {
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
@ -81,7 +81,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.electronicKeyDetailChangeDate);
|
context, Routers.electronicKeyDetailChangeDate,
|
||||||
|
arguments: {"itemData": itemData});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -252,7 +253,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
Future<void> modifyKeyNameRequest() async {
|
Future<void> modifyKeyNameRequest() async {
|
||||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.modifyKeyNameForAdmin(
|
.modifyKeyNameForAdmin(
|
||||||
itemData.keyId.toString(), _changeNameController.text, '0');
|
itemData.keyId.toString(), _changeNameController.text, '');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("修改要是名称成功啦啦啦啦啦");
|
print("修改要是名称成功啦啦啦啦啦");
|
||||||
Toast.show(msg: "修改成功");
|
Toast.show(msg: "修改成功");
|
||||||
@ -265,7 +266,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
//删除电子钥匙名称请求
|
//删除电子钥匙名称请求
|
||||||
Future<void> deleteKeyRequest() async {
|
Future<void> deleteKeyRequest() async {
|
||||||
ElectronicKeyListEntity entity =
|
ElectronicKeyListEntity entity =
|
||||||
await ApiRepository.to.deleteElectronicKey('0');
|
await ApiRepository.to.deleteElectronicKey(itemData.keyId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("删除电子钥匙成功");
|
print("删除电子钥匙成功");
|
||||||
Toast.show(msg: "删除成功");
|
Toast.show(msg: "删除成功");
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_cupertino_datetime_picker/flutter_cupertino_datetime_picker.dart';
|
import 'package:flutter_pickers/pickers.dart';
|
||||||
|
import 'package:flutter_pickers/time_picker/model/date_mode.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:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
import '../../../../../tools/showSeletDateTime.dart';
|
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -19,8 +24,23 @@ class ElectronicKeyDetailChangeDate extends StatefulWidget {
|
|||||||
|
|
||||||
class _ElectronicKeyDetailChangeDateState
|
class _ElectronicKeyDetailChangeDateState
|
||||||
extends State<ElectronicKeyDetailChangeDate> {
|
extends State<ElectronicKeyDetailChangeDate> {
|
||||||
|
ElectronicKeyListItem itemData = ElectronicKeyListItem();
|
||||||
|
|
||||||
|
String _selectEffectiveDate = ''; //生效时间
|
||||||
|
String _selectFailureDate = ''; //失效时间
|
||||||
|
late DateTime _effectiveDateTime;
|
||||||
|
late DateTime _failureDateTime;
|
||||||
|
late String endDay = '';
|
||||||
|
late String startDay = '';
|
||||||
|
late List weekDays = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["itemData"] != null)) {
|
||||||
|
itemData = obj["itemData"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -34,7 +54,9 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
TranslationLoader.lanKeys!.sure!.tr,
|
TranslationLoader.lanKeys!.sure!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
updateKeyDateRequest();
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -47,50 +69,58 @@ class _ElectronicKeyDetailChangeDateState
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: "2020.06.20 11:49",
|
rightTitle: _selectEffectiveDate,
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
ShowSeletDateTime().showDatePicker(
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
context,
|
onConfirm: (p) {
|
||||||
'2100-01-01 00:00',
|
setState(() {
|
||||||
'1900-01-01 00:00',
|
_selectEffectiveDate =
|
||||||
getNowDate(),
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
'yyyy-MMMM-dd HH:mm',
|
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
||||||
(dateTime, List<int> index) {});
|
});
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: "2020.06.20 11:49",
|
rightTitle: _selectFailureDate,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
ShowSeletDateTime().showDatePicker(context, '00:00', '00:00',
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
getNowDate(), 'HH:mm', (dateTime, List<int> index) {});
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
_selectFailureDate =
|
||||||
|
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||||
|
_failureDateTime = DateTime.parse(_selectFailureDate);
|
||||||
|
});
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getNowDate() {
|
//修改钥匙名称请求
|
||||||
// 获取当前时间对象
|
Future<void> updateKeyDateRequest() async {
|
||||||
DateTime today = DateTime.now();
|
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||||
String dateSlug =
|
itemData.keyId.toString(),
|
||||||
"${today.hour.toString().padLeft(2, '0')}:${today.minute.toString().padLeft(2, '0')}";
|
itemData.lockId.toString(),
|
||||||
|
_failureDateTime.millisecondsSinceEpoch.toString(),
|
||||||
|
endDay,
|
||||||
|
'',
|
||||||
|
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||||
|
startDay,
|
||||||
|
weekDays);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("修改要是名称成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "修改成功");
|
||||||
|
setState(() {
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// //获取当前时间的年
|
String intToStr(int v) {
|
||||||
// int year = now.year;
|
return (v < 10) ? "0$v" : "$v";
|
||||||
// //获取当前时间的月
|
|
||||||
// int month = now.month;
|
|
||||||
// //获取当前时间的日
|
|
||||||
// int day = now.day;
|
|
||||||
// //获取当前时间的时
|
|
||||||
// int hour = now.hour;
|
|
||||||
// //获取当前时间的分
|
|
||||||
// int minute = now.minute;
|
|
||||||
// //获取当前时间的秒
|
|
||||||
// int millisecond = now.millisecond;
|
|
||||||
|
|
||||||
// print("组合 $year-$month-$day $hour:$minute:$millisecond");
|
|
||||||
return dateSlug;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,12 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
arguments: {
|
arguments: {
|
||||||
"lockMainEntity": lockMainEntity,
|
"lockMainEntity": lockMainEntity,
|
||||||
"keyInfo": keyInfo
|
"keyInfo": keyInfo
|
||||||
});
|
}).then((val) {
|
||||||
|
if (val != null) {
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
@ -0,0 +1,163 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/utils.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/tools/ExpandedListView.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MassSendLockGroupListPage extends StatefulWidget {
|
||||||
|
const MassSendLockGroupListPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _MassSendLockGroupListPageState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: AppColors.mainColor,
|
||||||
|
title: Text(
|
||||||
|
TranslationLoader.lanKeys!.authorityManagement!.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'请选择要发送的锁',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
|
||||||
|
),
|
||||||
|
_keyGroupList()
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
//设备列表
|
||||||
|
Widget _keyGroupList() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (index == 0) {
|
||||||
|
return _buildLockExpandedList(context, index, "大门锁");
|
||||||
|
} else if (index == 1) {
|
||||||
|
return _buildLockExpandedList(context, index, "办公室锁");
|
||||||
|
} else if (index == 2) {
|
||||||
|
return _buildLockExpandedList(context, index, "会议室锁");
|
||||||
|
} else {
|
||||||
|
return _buildLockExpandedList(context, index, "宴会厅锁");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: 5)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设备多层级列表
|
||||||
|
Widget _buildLockExpandedList(context, index, deviceName) {
|
||||||
|
return ExpandedListTile(
|
||||||
|
onTap: () => print("onTap."),
|
||||||
|
title: deviceName,
|
||||||
|
imgName: 'images/icon_lock.png',
|
||||||
|
typeImgList: const [],
|
||||||
|
child: ListView.separated(
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: 10,
|
||||||
|
itemBuilder: (_, index) {
|
||||||
|
if (index == 0) {
|
||||||
|
return _buildNameWidget(
|
||||||
|
context, index, 'images/icon_password.png', '张三');
|
||||||
|
} else if (index == 1) {
|
||||||
|
return _buildNameWidget(
|
||||||
|
context, index, 'images/icon_card.png', '李四');
|
||||||
|
} else if (index == 2) {
|
||||||
|
return _buildNameWidget(
|
||||||
|
context, index, 'images/icon_fingerprint.png', '王二');
|
||||||
|
} else if (index == 3) {
|
||||||
|
return _buildNameWidget(
|
||||||
|
context, index, 'images/icon_card.png', '麻子');
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//单个姓名行
|
||||||
|
Widget _buildNameWidget(context, index, imageName, getName) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
height: 60.h,
|
||||||
|
color: Colors.white,
|
||||||
|
width: ScreenUtil().screenWidth,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 30.w,
|
||||||
|
),
|
||||||
|
Image.asset(
|
||||||
|
'images/controls_user.png',
|
||||||
|
width: 36.w,
|
||||||
|
height: 36.w,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
getName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 30.w,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
// selectNameIndex = index;
|
||||||
|
// setState(() {
|
||||||
|
// if (selectNameIndex == index) {
|
||||||
|
// isNameSelect = !isNameSelect;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -80,67 +80,63 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
switch (int.parse(widget.type)) {
|
if (_isSendSuccess) {
|
||||||
case 0:
|
return sendElectronicKeySucceed();
|
||||||
{
|
} else {
|
||||||
// 限时
|
switch (int.parse(widget.type)) {
|
||||||
return _isSendSuccess
|
case 0:
|
||||||
? sendElectronicKeySucceed()
|
{
|
||||||
: Column(
|
// 限时
|
||||||
children: [
|
return Column(
|
||||||
keyInfoWidget(),
|
children: [
|
||||||
keyTimeWidget(),
|
keyInfoWidget(),
|
||||||
remoteUnlockingWidget(),
|
keyTimeWidget(),
|
||||||
keyRealNameWidget(),
|
remoteUnlockingWidget(),
|
||||||
keyBottomWidget()
|
keyRealNameWidget(),
|
||||||
],
|
keyBottomWidget()
|
||||||
);
|
],
|
||||||
}
|
);
|
||||||
case 1:
|
}
|
||||||
{
|
case 1:
|
||||||
// 永久
|
{
|
||||||
return _isSendSuccess
|
// 永久
|
||||||
? sendElectronicKeySucceed()
|
return Column(
|
||||||
: Column(
|
children: [
|
||||||
children: [
|
keyInfoWidget(),
|
||||||
keyInfoWidget(),
|
remoteUnlockingWidget(),
|
||||||
remoteUnlockingWidget(),
|
keyRealNameWidget(),
|
||||||
keyRealNameWidget(),
|
keyBottomWidget()
|
||||||
keyBottomWidget()
|
],
|
||||||
],
|
);
|
||||||
);
|
}
|
||||||
}
|
case 2:
|
||||||
case 2:
|
{
|
||||||
{
|
// 单次
|
||||||
// 单次
|
return Column(
|
||||||
return _isSendSuccess
|
children: [
|
||||||
? sendElectronicKeySucceed()
|
keyInfoWidget(),
|
||||||
: Column(
|
remoteUnlockingWidget(),
|
||||||
children: [
|
keyRealNameWidget(),
|
||||||
keyInfoWidget(),
|
keyBottomWidget()
|
||||||
remoteUnlockingWidget(),
|
],
|
||||||
keyRealNameWidget(),
|
);
|
||||||
keyBottomWidget()
|
}
|
||||||
],
|
case 3:
|
||||||
);
|
{
|
||||||
}
|
// 循环
|
||||||
case 3:
|
return Column(
|
||||||
{
|
children: [
|
||||||
// 循环
|
keyInfoWidget(),
|
||||||
return _isSendSuccess
|
keyPeriodValidityWidget(),
|
||||||
? sendElectronicKeySucceed()
|
remoteUnlockingWidget(),
|
||||||
: Column(
|
keyRealNameWidget(),
|
||||||
children: [
|
keyBottomWidget()
|
||||||
keyInfoWidget(),
|
],
|
||||||
keyPeriodValidityWidget(),
|
);
|
||||||
remoteUnlockingWidget(),
|
}
|
||||||
keyRealNameWidget(),
|
default:
|
||||||
keyBottomWidget()
|
return Container();
|
||||||
],
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return Container();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +408,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
btnName: '完成',
|
btnName: '完成',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
_isSendSuccess = false;
|
_isSendSuccess = false;
|
||||||
setState(() {});
|
Navigator.pop(context, true);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
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:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -104,4 +106,37 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void getLockInfo() async {
|
||||||
|
var entity = await ApiRepository.to.getLockInfo(
|
||||||
|
lastUpdateDate: DateTime.now().millisecondsSinceEpoch.toString(),
|
||||||
|
pageNo: '1',
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// if (page == 0) {
|
||||||
|
// refreshController.refreshCompleted();
|
||||||
|
// } else {
|
||||||
|
// if (entity.data!.keyInfos!.isEmpty) {
|
||||||
|
// refreshController.loadNoData();
|
||||||
|
// } else {
|
||||||
|
// refreshController.loadComplete();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// page++;
|
||||||
|
|
||||||
|
if (entity.data!.keyInfos!.isEmpty) {
|
||||||
|
state.dataLength.value = 0;
|
||||||
|
} else if (entity.data!.keyInfos!.length == 1) {
|
||||||
|
state.dataLength.value = 1;
|
||||||
|
} else {
|
||||||
|
state.dataLength.value = 2;
|
||||||
|
}
|
||||||
|
state.lockMainEntity.value = entity;
|
||||||
|
} else {
|
||||||
|
// refreshController.loadFailed();
|
||||||
|
}
|
||||||
|
// refreshController.refreshCompleted();
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
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:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
@ -33,149 +34,166 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.passwordDetail!.tr,
|
barTitle: TranslationLoader.lanKeys!.passwordDetail!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'images/icon_bar_share.png',
|
'images/icon_bar_share.png',
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
],
|
||||||
|
// actionsList: [
|
||||||
|
// TextButton(
|
||||||
|
// child: Text(
|
||||||
|
// "分享",
|
||||||
|
// style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
|
// ),
|
||||||
|
// onPressed: () {},
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||||
|
rightTitle: itemData.keyboardPwd,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
showCupertinoAlertDialog(context);
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
|
rightTitle: itemData.keyboardPwdName,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
showCupertinoAlertDialog(context);
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
|
rightTitle: "永久",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.electronicKeyDetailChangeDate);
|
||||||
|
}),
|
||||||
|
Container(height: 10.h),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||||
|
rightTitle: itemData.senderUsername,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
||||||
|
rightTitle: getSenderDate(itemData),
|
||||||
|
action: () {}),
|
||||||
|
Container(height: 10.h),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(context, Routers.keyOperationRecordPage,
|
||||||
|
arguments: {
|
||||||
|
'lockId': itemData.lockId.toString(),
|
||||||
|
'keyId': itemData.keyboardPwdId.toString()
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
Container(height: 40.h),
|
||||||
|
SizedBox(
|
||||||
|
width: ScreenUtil().screenWidth - 40.w,
|
||||||
|
height: 60.h,
|
||||||
|
child: OutlinedButton(
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
// backgroundColor: Colors.white,
|
||||||
|
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.otherTypeKeyManagePage,
|
||||||
|
arguments: 0);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'设置卡',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor, fontSize: 24.sp),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: ScreenUtil().screenWidth - 40.w,
|
||||||
|
height: 60.h,
|
||||||
|
child: OutlinedButton(
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
// backgroundColor: Colors.white,
|
||||||
|
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.otherTypeKeyManagePage,
|
||||||
|
arguments: 1);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'设置指纹',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor, fontSize: 24.sp),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: ScreenUtil().screenWidth - 40.w,
|
||||||
|
height: 60.h,
|
||||||
|
child: OutlinedButton(
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
// backgroundColor: Colors.white,
|
||||||
|
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.otherTypeKeyManagePage,
|
||||||
|
arguments: 2);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'设置遥控',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor, fontSize: 24.sp),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.h,
|
||||||
|
),
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
||||||
|
isDelete: true,
|
||||||
|
borderRadius: 20.w,
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||||
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
|
onClick: () {
|
||||||
|
deletePwdRequest();
|
||||||
|
}),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
));
|
||||||
// actionsList: [
|
}
|
||||||
// TextButton(
|
|
||||||
// child: Text(
|
//发送时间
|
||||||
// "分享",
|
String getSenderDate(PasswordKeyListItem indexEntity) {
|
||||||
// style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
String senderDate = '';
|
||||||
// ),
|
DateTime dateStr =
|
||||||
// onPressed: () {},
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
// ),
|
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||||
// ],
|
return senderDate;
|
||||||
),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
|
||||||
rightTitle: itemData.keyboardPwd,
|
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveLine: true,
|
|
||||||
action: () {
|
|
||||||
showCupertinoAlertDialog(context);
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
|
||||||
rightTitle: itemData.keyboardPwdName,
|
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveLine: true,
|
|
||||||
action: () {
|
|
||||||
showCupertinoAlertDialog(context);
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
|
||||||
rightTitle: "永久",
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.electronicKeyDetailChangeDate);
|
|
||||||
}),
|
|
||||||
Container(height: 10.h),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
|
||||||
rightTitle: itemData.senderUsername,
|
|
||||||
action: () {}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
|
||||||
rightTitle: itemData.sendDate.toString(),
|
|
||||||
action: () {}),
|
|
||||||
Container(height: 10.h),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Navigator.pushNamed(context, Routers.keyOperationRecordPage,
|
|
||||||
arguments: {
|
|
||||||
'lockId': itemData.lockId.toString(),
|
|
||||||
'keyId': itemData.keyboardPwdId.toString()
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
Container(height: 40.h),
|
|
||||||
SizedBox(
|
|
||||||
width: ScreenUtil().screenWidth - 40.w,
|
|
||||||
height: 60.h,
|
|
||||||
child: OutlinedButton(
|
|
||||||
style: OutlinedButton.styleFrom(
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
|
||||||
arguments: 0);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
'设置卡',
|
|
||||||
style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: ScreenUtil().screenWidth - 40.w,
|
|
||||||
height: 60.h,
|
|
||||||
child: OutlinedButton(
|
|
||||||
style: OutlinedButton.styleFrom(
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
|
||||||
arguments: 1);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
'设置指纹',
|
|
||||||
style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: ScreenUtil().screenWidth - 40.w,
|
|
||||||
height: 60.h,
|
|
||||||
child: OutlinedButton(
|
|
||||||
style: OutlinedButton.styleFrom(
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
side: BorderSide(width: 1, color: AppColors.mainColor)),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
|
||||||
arguments: 2);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
'设置遥控',
|
|
||||||
style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 30.h,
|
|
||||||
),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
|
||||||
isDelete: true,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
margin: EdgeInsets.only(
|
|
||||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {
|
|
||||||
deletePwdRequest();
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget commonItem(String leftTitle, String rightTitle,
|
Widget commonItem(String leftTitle, String rightTitle,
|
||||||
@ -241,10 +259,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除密码请求
|
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||||
Future<void> deletePwdRequest() async {
|
Future<void> deletePwdRequest() async {
|
||||||
PasswordKeyEntity entity =
|
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||||
await ApiRepository.to.deleteKeyboardPwd('0', '1', '1');
|
itemData.lockId.toString(), itemData.keyboardPwdId.toString(), '1');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("删除密码成功");
|
print("删除密码成功");
|
||||||
Toast.show(msg: "删除成功");
|
Toast.show(msg: "删除成功");
|
||||||
|
|||||||
@ -75,15 +75,20 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.passwordKeyManagePage, arguments: {
|
context, Routers.passwordKeyManagePage,
|
||||||
"lockMainEntity": lockMainEntity,
|
arguments: {
|
||||||
"keyInfo": keyInfo
|
"lockMainEntity": lockMainEntity,
|
||||||
});
|
"keyInfo": keyInfo
|
||||||
},
|
}).then((val) {
|
||||||
),
|
if (val != null) {
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 42.h,
|
height: 42.h,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -14,13 +14,14 @@ import '../../../../tools/baseGetXController.dart';
|
|||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
|
|
||||||
class PasswordKeyPerpetualLogic extends BaseGetXController {
|
class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||||
|
late DateTime getStartDateTime;
|
||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
// 设置自定义密码
|
// 设置自定义密码
|
||||||
if(reply is SenderCustomPasswordsReply) {
|
if (reply is SenderCustomPasswordsReply) {
|
||||||
var token = reply.data.sublist(2, 6);
|
var token = reply.data.sublist(2, 6);
|
||||||
var saveStrList = changeIntListToStringList(token);
|
var saveStrList = changeIntListToStringList(token);
|
||||||
print("_replyFactoryDataResetKeyToken:$token");
|
print("_replyFactoryDataResetKeyToken:$token");
|
||||||
@ -29,47 +30,49 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
int status = reply.data[6];
|
int status = reply.data[6];
|
||||||
print("status:$status");
|
print("status:$status");
|
||||||
|
|
||||||
switch(status){
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
print('得到的开始时间时间戳$getStartDate');
|
||||||
|
|
||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID:"1",
|
keyID: "1",
|
||||||
userID:await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
pwdNo:1,
|
pwdNo: 1,
|
||||||
pwd: "123456",
|
pwd: "123456",
|
||||||
useCountLimit:0xff,
|
useCountLimit: 0xff,
|
||||||
startTime:0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime:0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor:1,
|
needAuthor: 1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token
|
token: token);
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType!.typeValue} 用户无权限");
|
print("${reply.commandType!.typeValue} 用户无权限");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
// 权限校验错误
|
// 权限校验错误
|
||||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
print("${reply.commandType!.typeValue} 失败");
|
print("${reply.commandType!.typeValue} 失败");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -78,10 +81,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getStartDate(DateTime startDate) {
|
||||||
|
getStartDateTime = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
// 设置自定义密码
|
// 设置自定义密码
|
||||||
Future<void> senderCustomPasswords() async {
|
Future<void> senderCustomPasswords() async {
|
||||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
BlueManage().judgeReconnect(
|
||||||
if (state == DeviceConnectionState.connected){
|
BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
|
||||||
|
(DeviceConnectionState state) async {
|
||||||
|
if (state == DeviceConnectionState.connected) {
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
@ -93,18 +102,17 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
print("openDoorTokenPubToken:$getTokenList");
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
|
||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID:"1",
|
keyID: "1",
|
||||||
userID:await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
pwdNo:1,
|
pwdNo: 1,
|
||||||
pwd: "123456",
|
pwd: "123456",
|
||||||
useCountLimit:0xff,
|
useCountLimit: 0xff,
|
||||||
startTime:0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime:0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor:1,
|
needAuthor: 1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList
|
token: getTokenList);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -121,7 +129,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
// TODO: implement onInit
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -129,5 +136,4 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -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_pickers/time_picker/model/date_mode.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:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -33,7 +34,10 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||||
final TextEditingController _controller = TextEditingController();
|
final TextEditingController _nameController = TextEditingController();
|
||||||
|
final TextEditingController _pwdController = TextEditingController();
|
||||||
|
final logic = Get.put(PasswordKeyPerpetualLogic());
|
||||||
|
|
||||||
late bool _isSendSuccess; //是否发送成功
|
late bool _isSendSuccess; //是否发送成功
|
||||||
late bool _isPermanent; //是否永久
|
late bool _isPermanent; //是否永久
|
||||||
late String _getPwdStr;
|
late String _getPwdStr;
|
||||||
@ -47,7 +51,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return indexChangeWidget();
|
return SingleChildScrollView(
|
||||||
|
child: indexChangeWidget(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -85,7 +91,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
_controller),
|
_nameController),
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -99,7 +105,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
_controller),
|
_nameController),
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -112,7 +118,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
_controller),
|
_nameController),
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -127,9 +133,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
_controller),
|
_nameController),
|
||||||
perpetualKeyWidget(TranslationLoader.lanKeys!.password!.tr,
|
perpetualKeyWidget(TranslationLoader.lanKeys!.password!.tr,
|
||||||
"请输入6-9位数字", _controller),
|
"请输入6-9位数字", _pwdController),
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -143,7 +149,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
_controller),
|
_nameController),
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip5!.tr)
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip5!.tr)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -156,7 +162,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
perpetualKeyWidget(
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
_controller),
|
_nameController),
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -179,7 +185,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
leftTitel: titleStr,
|
leftTitel: titleStr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(rightTitle)),
|
rightWidget: getTFWidget(rightTitle, controller)),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
],
|
],
|
||||||
@ -346,6 +352,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
|
logic.getStartDate(_effectiveDateTime);
|
||||||
getKeyboardPwdRequest();
|
getKeyboardPwdRequest();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -393,7 +400,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
//清空码
|
//清空码
|
||||||
getKeyType = '4';
|
getKeyType = '4';
|
||||||
}
|
}
|
||||||
if (widget.type == '0') {
|
if (widget.type != '0' || widget.type != '2' || widget.type == '5') {
|
||||||
getFailureDateTime =
|
getFailureDateTime =
|
||||||
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||||
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||||
@ -403,7 +410,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
var entity = await ApiRepository.to.getPasswordKey(
|
var entity = await ApiRepository.to.getPasswordKey(
|
||||||
getFailureDateTime,
|
getFailureDateTime,
|
||||||
'0',
|
'0',
|
||||||
_controller.text,
|
_nameController.text,
|
||||||
getKeyType,
|
getKeyType,
|
||||||
'0',
|
'0',
|
||||||
lockId,
|
lockId,
|
||||||
@ -466,7 +473,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '完成',
|
btnName: '完成',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pop(context);
|
_isSendSuccess = false;
|
||||||
|
Navigator.pop(context, true);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
@ -489,7 +497,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 接受者信息输入框
|
// 接受者信息输入框
|
||||||
Widget getTFWidget(String tfStr) {
|
Widget getTFWidget(String tfStr, TextEditingController editController) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
width: 300.w,
|
width: 300.w,
|
||||||
@ -499,7 +507,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
controller: _controller,
|
controller: editController,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
|||||||
@ -23,10 +23,11 @@ abstract class Api {
|
|||||||
final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称
|
final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称
|
||||||
final String modifyKeyNameForAdminURL =
|
final String modifyKeyNameForAdminURL =
|
||||||
'/key/modifyKeyNameForAdmin'; //编辑电子钥匙名字
|
'/key/modifyKeyNameForAdmin'; //编辑电子钥匙名字
|
||||||
|
final String updateKeyDateURL = '/key/updateKeyDate'; //编辑电子钥匙的有效期、有效时间、有效日
|
||||||
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //密码钥匙列表
|
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //密码钥匙列表
|
||||||
final String passwordKeyResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
final String passwordKeyResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
||||||
final String deleteElectronicKeyURL = '/keyboardPwd/reset'; //删除电子钥匙
|
final String deleteElectronicKeyURL = '/key/delete'; //删除电子钥匙
|
||||||
final String deleteKeyboardPwdURL = '/keyboardPwd/reset'; //删除密码
|
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'; // 删除锁
|
||||||
|
|
||||||
@ -35,4 +36,6 @@ abstract class Api {
|
|||||||
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
||||||
final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表
|
final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表
|
||||||
final String updateSettingURL = '/room/updateSetting'; //标记房态
|
final String updateSettingURL = '/room/updateSetting'; //标记房态
|
||||||
|
final String keyGroupListURL = '/keyGroup/list'; //分组列表
|
||||||
|
final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁
|
||||||
}
|
}
|
||||||
|
|||||||
@ -194,6 +194,28 @@ class ApiProvider extends BaseProvider {
|
|||||||
'operatorUid': operatorUid,
|
'operatorUid': operatorUid,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Future<Response> updateKeyDate(
|
||||||
|
String keyId,
|
||||||
|
String lockId,
|
||||||
|
String endDate,
|
||||||
|
String endDay,
|
||||||
|
String operatorUid,
|
||||||
|
String startDate,
|
||||||
|
String startDay,
|
||||||
|
List weekDays) =>
|
||||||
|
post(
|
||||||
|
updateKeyDateURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyId': keyId,
|
||||||
|
'lockId': lockId,
|
||||||
|
'endDate': endDate,
|
||||||
|
'endDay': endDay,
|
||||||
|
'operatorUid': operatorUid,
|
||||||
|
'startDate': startDate,
|
||||||
|
'startDay': startDay,
|
||||||
|
'weekDays': weekDays,
|
||||||
|
}));
|
||||||
|
|
||||||
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
||||||
post(resetElectronicKeyURL.toUrl,
|
post(resetElectronicKeyURL.toUrl,
|
||||||
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||||
@ -332,11 +354,11 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId}));
|
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId}));
|
||||||
|
|
||||||
Future<Response> deleteKeyboardPwd(
|
Future<Response> deleteKeyboardPwd(
|
||||||
String keyId, String keyboardPwdId, String deleteType) =>
|
String lockId, String keyboardPwdId, String deleteType) =>
|
||||||
post(
|
post(
|
||||||
deleteKeyboardPwdURL.toUrl,
|
deleteKeyboardPwdURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'lockId': lockId,
|
||||||
'keyboardPwdId': keyboardPwdId,
|
'keyboardPwdId': keyboardPwdId,
|
||||||
'deleteType': deleteType
|
'deleteType': deleteType
|
||||||
}));
|
}));
|
||||||
@ -344,6 +366,13 @@ class ApiProvider extends BaseProvider {
|
|||||||
Future<Response> updateSetting(String lockId, String isOn, String type) =>
|
Future<Response> updateSetting(String lockId, String isOn, String type) =>
|
||||||
post(updateSettingURL.toUrl,
|
post(updateSettingURL.toUrl,
|
||||||
jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type}));
|
jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type}));
|
||||||
|
|
||||||
|
Future<Response> keyGroupList(String type) =>
|
||||||
|
post(keyGroupListURL.toUrl, jsonEncode({'type': type}));
|
||||||
|
|
||||||
|
Future<Response> lockListByGroup(String type, String keyGroupId) => post(
|
||||||
|
lockListByGroupURL.toUrl,
|
||||||
|
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -192,9 +192,17 @@ class ApiRepository {
|
|||||||
required Map position,
|
required Map position,
|
||||||
required Map bluetooth,
|
required Map bluetooth,
|
||||||
required String deviceNo,
|
required String deviceNo,
|
||||||
required String lockUserNo}) async {
|
required String lockUserNo}) async {
|
||||||
final res = await apiProvider.bindingBlueAdmin(bindingDate, hotelMode,
|
final res = await apiProvider.bindingBlueAdmin(
|
||||||
lockAlias, lockData, nbInitSuccess, position, bluetooth, deviceNo, lockUserNo);
|
bindingDate,
|
||||||
|
hotelMode,
|
||||||
|
lockAlias,
|
||||||
|
lockData,
|
||||||
|
nbInitSuccess,
|
||||||
|
position,
|
||||||
|
bluetooth,
|
||||||
|
deviceNo,
|
||||||
|
lockUserNo);
|
||||||
return SaveLockEntity.fromJson(res.body);
|
return SaveLockEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +237,22 @@ class ApiRepository {
|
|||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
//编辑电子钥匙名字
|
//编辑电子钥匙有效期
|
||||||
|
Future<KeyOperationRecordEntity> updateKeyDate(
|
||||||
|
String keyId,
|
||||||
|
String lockId,
|
||||||
|
String endDate,
|
||||||
|
String endDay,
|
||||||
|
String operatorUid,
|
||||||
|
String startDate,
|
||||||
|
String startDay,
|
||||||
|
List weekDays) async {
|
||||||
|
final res = await apiProvider.updateKeyDate(keyId, lockId, endDate, endDay,
|
||||||
|
operatorUid, startDate, startDay, weekDays);
|
||||||
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//密码列表
|
||||||
Future<PasswordKeyListEntity> passwordKeyList(
|
Future<PasswordKeyListEntity> passwordKeyList(
|
||||||
String keyStatus,
|
String keyStatus,
|
||||||
String lockId,
|
String lockId,
|
||||||
@ -314,9 +337,9 @@ class ApiRepository {
|
|||||||
|
|
||||||
//删除密码
|
//删除密码
|
||||||
Future<PasswordKeyEntity> deleteKeyboardPwd(
|
Future<PasswordKeyEntity> deleteKeyboardPwd(
|
||||||
String keyId, String keyboardPwdId, String deleteType) async {
|
String lockId, String keyboardPwdId, String deleteType) async {
|
||||||
final res =
|
final res =
|
||||||
await apiProvider.deleteKeyboardPwd(keyId, keyboardPwdId, deleteType);
|
await apiProvider.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
|
||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,4 +349,17 @@ class ApiRepository {
|
|||||||
final res = await apiProvider.deleteKeyboardPwd(lockId, isOn, type);
|
final res = await apiProvider.deleteKeyboardPwd(lockId, isOn, type);
|
||||||
return PasswordKeyEntity.fromJson(res.body);
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//分组列表
|
||||||
|
Future<PasswordKeyEntity> keyGroupList(String type) async {
|
||||||
|
final res = await apiProvider.keyGroupList(type);
|
||||||
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//分组下的锁
|
||||||
|
Future<PasswordKeyEntity> lockListByGroup(
|
||||||
|
String type, String keyGroupId) async {
|
||||||
|
final res = await apiProvider.lockListByGroup(type, keyGroupId);
|
||||||
|
return PasswordKeyEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user