Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
This commit is contained in:
commit
1a659b5579
@ -1,6 +1,7 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
||||||
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
|
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
|
||||||
@ -246,26 +247,32 @@ abstract class Routers {
|
|||||||
'/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表
|
'/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表
|
||||||
static const valueAddedServicesAddEmailTemplatePage =
|
static const valueAddedServicesAddEmailTemplatePage =
|
||||||
'/ValueAddedServicesAddEmailTemplatePage'; // 增值服务-自定义邮箱模版
|
'/ValueAddedServicesAddEmailTemplatePage'; // 增值服务-自定义邮箱模版
|
||||||
static const valueAddedServicesBuyAndUseRecordManagePage = '/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录
|
static const valueAddedServicesBuyAndUseRecordManagePage =
|
||||||
|
'/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录
|
||||||
|
|
||||||
static const lockScreenPage = '/LockScreenPage'; // 我的设置-锁屏
|
static const lockScreenPage = '/LockScreenPage'; // 我的设置-锁屏
|
||||||
static const aPPUnlockNeedMobileNetworkingLockPage = '/APPUnlockNeedMobileNetworkingLockPage'; // 我的设置-app开锁时需手机连网的锁
|
static const aPPUnlockNeedMobileNetworkingLockPage =
|
||||||
static const hideInvalidUnlockPermissionsPage = '/HideInvalidUnlockPermissionsPage'; // 我的设置-隐藏无效开锁权限
|
'/APPUnlockNeedMobileNetworkingLockPage'; // 我的设置-app开锁时需手机连网的锁
|
||||||
|
static const hideInvalidUnlockPermissionsPage =
|
||||||
|
'/HideInvalidUnlockPermissionsPage'; // 我的设置-隐藏无效开锁权限
|
||||||
|
|
||||||
static const lockUserManageLisPage = '/LockUserManageLisPage'; //我的设置-锁用户管理
|
static const lockUserManageLisPage = '/LockUserManageLisPage'; //我的设置-锁用户管理
|
||||||
static const authorizedAdministratorListPage = '/AuthorizedAdministratorListPage'; //我的设置-授权管理员
|
static const authorizedAdministratorListPage =
|
||||||
|
'/AuthorizedAdministratorListPage'; //我的设置-授权管理员
|
||||||
static const lockGroupListPage = '/LockGroupListPage'; //我的设置-锁分组
|
static const lockGroupListPage = '/LockGroupListPage'; //我的设置-锁分组
|
||||||
static const lockItemListPage = '/LockItemListPage'; //锁分组-锁列表
|
static const lockItemListPage = '/LockItemListPage'; //锁分组-锁列表
|
||||||
static const transferSmartLockPage = '/transferSmartLockPage'; //转移智能锁
|
static const transferSmartLockPage = '/transferSmartLockPage'; //转移智能锁
|
||||||
static const recipientInformationPage = '/recipientInformationPage'; //接受人信息
|
static const recipientInformationPage = '/recipientInformationPage'; //接受人信息
|
||||||
static const selectBranchPage = '/SelectBranchPage'; //选择分店
|
static const selectBranchPage = '/SelectBranchPage'; //选择分店
|
||||||
static const selectGetewayListPage = '/selectGetewayListPage'; //选择网关
|
static const selectGetewayListPage = '/selectGetewayListPage'; //选择网关
|
||||||
static const addAuthorizedAdministratorPage = '/addAuthorizedAdministratorPage'; //添加授权管理员
|
static const addAuthorizedAdministratorPage =
|
||||||
|
'/addAuthorizedAdministratorPage'; //添加授权管理员
|
||||||
static const ownedKeyListPage = '/ownedKeyListPage'; //拥有的钥匙
|
static const ownedKeyListPage = '/ownedKeyListPage'; //拥有的钥匙
|
||||||
|
|
||||||
static const starLockLoginPage = '/StarLockLoginPage'; // 登录
|
static const starLockLoginPage = '/StarLockLoginPage'; // 登录
|
||||||
static const starLockRegisterPage = '/StarLockRegisterPage'; // 注册
|
static const starLockRegisterPage = '/StarLockRegisterPage'; // 注册
|
||||||
static const starLockForgetPasswordPage = '/StarLockForgetPasswordPage'; // 忘记密码
|
static const starLockForgetPasswordPage =
|
||||||
|
'/StarLockForgetPasswordPage'; // 忘记密码
|
||||||
static const seletCountryRegionPage = '/SeletCountryRegionPage'; // 选择国家和地区
|
static const seletCountryRegionPage = '/SeletCountryRegionPage'; // 选择国家和地区
|
||||||
static const safetyVerificationPage = '/SafetyVerificationPage'; // 安全验证
|
static const safetyVerificationPage = '/SafetyVerificationPage'; // 安全验证
|
||||||
|
|
||||||
@ -395,9 +402,9 @@ abstract class AppRouters {
|
|||||||
page: () => const StarLockLoginPage(),
|
page: () => const StarLockLoginPage(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.starLockRegisterPage,
|
name: Routers.starLockRegisterPage,
|
||||||
page: () => const StarLockRegisterPage(), binding:StarLockRegisterBinding()
|
page: () => const StarLockRegisterPage(),
|
||||||
),
|
binding: StarLockRegisterBinding()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.starLockForgetPasswordPage,
|
name: Routers.starLockForgetPasswordPage,
|
||||||
page: () => const StarLockForgetPasswordPage(),
|
page: () => const StarLockForgetPasswordPage(),
|
||||||
@ -672,52 +679,46 @@ abstract class AppRouters {
|
|||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.authorizedAdministratorListPage,
|
name: Routers.authorizedAdministratorListPage,
|
||||||
page: () => const AuthorizedAdministratorListPage()
|
page: () => const AuthorizedAdministratorListPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.lockUserManageLisPage,
|
name: Routers.lockUserManageLisPage,
|
||||||
page: () => const LockUserManageListListPage()
|
page: () => const LockUserManageListListPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()
|
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.lockItemListPage, page: () => const LockItemListPage()
|
name: Routers.lockItemListPage, page: () => const LockItemListPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.transferSmartLockPage,
|
name: Routers.transferSmartLockPage,
|
||||||
page: () => const TransferSmartLockPage()
|
page: () => const TransferSmartLockPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.recipientInformationPage,
|
name: Routers.recipientInformationPage,
|
||||||
page: () => const RecipientInformationPage()
|
page: () => const RecipientInformationPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.selectBranchPage, page: () => const SelectBranchPage()
|
name: Routers.selectBranchPage, page: () => const SelectBranchPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.selectGetewayListPage,
|
name: Routers.selectGetewayListPage,
|
||||||
page: () => const SelectGetewayListPage()
|
page: () => const SelectGetewayListPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.minePersonInfoEditEmailPage,
|
name: Routers.minePersonInfoEditEmailPage,
|
||||||
page: () => const MinePersonInfoEditEmailPage()
|
page: () => const MinePersonInfoEditEmailPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.addAuthorizedAdministratorPage,
|
name: Routers.addAuthorizedAdministratorPage,
|
||||||
page: () => const AddAuthorizedAdministratorPage()
|
page: () => const AddAuthorizedAdministratorPage()),
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.safetyVerificationPage,
|
name: Routers.safetyVerificationPage,
|
||||||
page: () => const SafetyVerificationPage(),
|
page: () => const SafetyVerificationPage(),
|
||||||
binding: SafetyVerificationBinding(),
|
binding: SafetyVerificationBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()
|
name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()),
|
||||||
),
|
GetPage(
|
||||||
GetPage(name: Routers.keyOperationRecordPage, page: () => const KeyOperationRecordPage()),
|
name: Routers.keyOperationRecordPage,
|
||||||
GetPage(name: Routers.getDeviceListPage, page: () => const GetDeviceListPage()),
|
page: () => const KeyOperationRecordPage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.getDeviceListPage, page: () => const GetDeviceListPage()),
|
||||||
GetPage(name: Routers.getNameListPage, page: () => const GetNameListPage()),
|
GetPage(name: Routers.getNameListPage, page: () => const GetNameListPage()),
|
||||||
GetPage(name: Routers.authorityManagementPage, page: () => const AuthorityManagementPage()),
|
GetPage(
|
||||||
|
name: Routers.authorityManagementPage,
|
||||||
|
page: () => const AuthorityManagementPage()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import 'io_sender.dart';
|
|||||||
import 'io_type.dart';
|
import 'io_type.dart';
|
||||||
|
|
||||||
class GetPublicKeyCommand extends SenderProtocol {
|
class GetPublicKeyCommand extends SenderProtocol {
|
||||||
|
|
||||||
String? lockID;
|
String? lockID;
|
||||||
GetPublicKeyCommand({
|
GetPublicKeyCommand({
|
||||||
this.lockID,
|
this.lockID,
|
||||||
@ -22,9 +21,9 @@ class GetPublicKeyCommand extends SenderProtocol {
|
|||||||
|
|
||||||
// 指令类型
|
// 指令类型
|
||||||
int type = commandType!.typeValue;
|
int type = commandType!.typeValue;
|
||||||
double typeDouble = type/256;
|
double typeDouble = type / 256;
|
||||||
int type1 = typeDouble.toInt();
|
int type1 = typeDouble.toInt();
|
||||||
int type2 = type%256;
|
int type2 = type % 256;
|
||||||
data.add(type1);
|
data.add(type1);
|
||||||
data.add(type2);
|
data.add(type2);
|
||||||
// print("type:$type");
|
// print("type:$type");
|
||||||
@ -41,9 +40,9 @@ class GetPublicKeyCommand extends SenderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class GetPublicKeyReply extends Reply {
|
class GetPublicKeyReply extends Reply {
|
||||||
GetPublicKeyReply.parseData(CommandType commandType, List<int> dataDetail)
|
GetPublicKeyReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
: super.parseData(commandType, dataDetail) {
|
: super.parseData(commandType, dataDetail) {
|
||||||
status = dataDetail[2];
|
status = dataDetail[2];
|
||||||
data = dataDetail;
|
data = dataDetail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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/tools/jh_pop_menus.dart';
|
import 'package:star_lock/tools/jh_pop_menus.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
@ -25,6 +26,13 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
ElectronicKeyListItem itemData = ElectronicKeyListItem();
|
||||||
|
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["itemData"] != null)) {
|
||||||
|
itemData = obj["itemData"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
@ -55,7 +63,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: "魏",
|
rightTitle: itemData.keyName,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -64,7 +72,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
allHeight: 90.h,
|
allHeight: 90.h,
|
||||||
rightTitle: "2020.06.20 11:49\n2020.06.21 11:49",
|
rightTitle: getUseDateStr(itemData),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
@ -73,24 +81,27 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
rightTitle: "786612630@qq.com",
|
rightTitle: itemData.username,
|
||||||
action: () {}),
|
action: () {}),
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||||
rightTitle: "15080825640",
|
rightTitle: itemData.senderUsername,
|
||||||
action: () {}),
|
action: () {}),
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
||||||
rightTitle: "2020.06.21 11:49",
|
rightTitle: itemData.date.toString(),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
leftTitel: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: SizedBox(width: 60.w, child: _switch()),
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
child:
|
||||||
|
_switch(itemData.faceAuthentication == 1 ? true : false)),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -115,6 +126,33 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//使用期限
|
||||||
|
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (indexEntity.keyType == 1) {
|
||||||
|
//限期
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
} else if (indexEntity.keyType == 2) {
|
||||||
|
//永久
|
||||||
|
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
|
useDateStr = '${dateStr.toLocal().toString()} 永久';
|
||||||
|
} else if (indexEntity.keyType == 3) {
|
||||||
|
//单次
|
||||||
|
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
|
useDateStr = '${dateStr.toLocal().toString()} 单次';
|
||||||
|
} else if (indexEntity.keyType == 4) {
|
||||||
|
//循环
|
||||||
|
useDateStr = '循环';
|
||||||
|
}
|
||||||
|
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
Widget commonItem(String leftTitle, String rightTitle,
|
Widget commonItem(String leftTitle, String rightTitle,
|
||||||
{bool isHaveDirection = false,
|
{bool isHaveDirection = false,
|
||||||
bool isHaveLine = false,
|
bool isHaveLine = false,
|
||||||
@ -178,16 +216,15 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CupertinoSwitch _switch() {
|
CupertinoSwitch _switch(isOn) {
|
||||||
bool _isOn = false;
|
|
||||||
return CupertinoSwitch(
|
return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: _isOn,
|
value: isOn,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isOn = value;
|
isOn = value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -0,0 +1,114 @@
|
|||||||
|
class KeyOperationRecordEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
KeyOperationRecordData? data;
|
||||||
|
|
||||||
|
KeyOperationRecordEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
KeyOperationRecordEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null
|
||||||
|
? KeyOperationRecordData.fromJson(json['data'])
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['errorCode'] = errorCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['errorMsg'] = errorMsg;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data!.toJson();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class KeyOperationRecordData {
|
||||||
|
List<KeyRecordDataItem>? itemList;
|
||||||
|
int? pageNo;
|
||||||
|
int? pageSize;
|
||||||
|
int? pages;
|
||||||
|
int? total;
|
||||||
|
|
||||||
|
KeyOperationRecordData(
|
||||||
|
{this.itemList, this.pageNo, this.pageSize, this.pages, this.total});
|
||||||
|
|
||||||
|
KeyOperationRecordData.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['list'] != null) {
|
||||||
|
itemList = <KeyRecordDataItem>[];
|
||||||
|
json['list'].forEach((v) {
|
||||||
|
itemList!.add(KeyRecordDataItem.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
pageNo = json['pageNo'];
|
||||||
|
pageSize = json['pageSize'];
|
||||||
|
pages = json['pages'];
|
||||||
|
total = json['total'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (itemList != null) {
|
||||||
|
data['list'] = itemList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['pageNo'] = pageNo;
|
||||||
|
data['pageSize'] = pageSize;
|
||||||
|
data['pages'] = pages;
|
||||||
|
data['total'] = total;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class KeyRecordDataItem {
|
||||||
|
int? recordId;
|
||||||
|
int? lockId;
|
||||||
|
int? recordType;
|
||||||
|
String? recordTypeName;
|
||||||
|
int? success;
|
||||||
|
String? username;
|
||||||
|
String? lockDate;
|
||||||
|
int? operateDate;
|
||||||
|
String? keyboardPwd;
|
||||||
|
|
||||||
|
KeyRecordDataItem(
|
||||||
|
{this.recordId,
|
||||||
|
this.lockId,
|
||||||
|
this.recordType,
|
||||||
|
this.recordTypeName,
|
||||||
|
this.success,
|
||||||
|
this.username,
|
||||||
|
this.lockDate,
|
||||||
|
this.operateDate,
|
||||||
|
this.keyboardPwd});
|
||||||
|
|
||||||
|
KeyRecordDataItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
recordId = json['recordId'];
|
||||||
|
lockId = json['lockId'];
|
||||||
|
recordType = json['recordType'];
|
||||||
|
recordTypeName = json['recordTypeName'];
|
||||||
|
success = json['success'];
|
||||||
|
username = json['username'];
|
||||||
|
lockDate = json['lockDate'];
|
||||||
|
operateDate = json['operateDate'];
|
||||||
|
keyboardPwd = json['keyboardPwd'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['recordId'] = recordId;
|
||||||
|
data['lockId'] = lockId;
|
||||||
|
data['recordType'] = recordType;
|
||||||
|
data['recordTypeName'] = recordTypeName;
|
||||||
|
data['success'] = success;
|
||||||
|
data['username'] = username;
|
||||||
|
data['lockDate'] = lockDate;
|
||||||
|
data['operateDate'] = operateDate;
|
||||||
|
data['keyboardPwd'] = keyboardPwd;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,10 @@
|
|||||||
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/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 '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -25,14 +29,48 @@ class _KeyOperationRecordPageState extends State<KeyOperationRecordPage> {
|
|||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
body: Column(
|
body: FutureBuilder<List<KeyRecordDataItem>>(
|
||||||
children: [
|
// future: mockNetworkDataRequest(),
|
||||||
Expanded(child: _buildMainUI()),
|
builder: (BuildContext context,
|
||||||
],
|
AsyncSnapshot<List<KeyRecordDataItem>> snapshot) {
|
||||||
),
|
//请求结束
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.hasError) {
|
||||||
|
//请求失败
|
||||||
|
return const Text('请求失败');
|
||||||
|
} else {
|
||||||
|
//请求成功
|
||||||
|
final List<KeyRecordDataItem> itemData = snapshot.data!;
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(child: _buildMainUI()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//请求未结束 显示loading
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//请求操作记录列表
|
||||||
|
Future<List<KeyRecordDataItem>?> mockNetworkDataRequest() async {
|
||||||
|
KeyOperationRecordEntity entity = (await ApiRepository.to
|
||||||
|
.lockRecordList('0', '63', '0', '28', '1', '1', '20', '0', '', '', ''));
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("操作记录列表成功:${entity.data?.itemList}");
|
||||||
|
}
|
||||||
|
if (entity.data != null) {
|
||||||
|
return entity.data!.itemList;
|
||||||
|
} else {
|
||||||
|
List<KeyRecordDataItem> dataList = [];
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
itemCount: 5,
|
itemCount: 5,
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electr
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.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';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -24,7 +25,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
final logic = Get.put(ElectronicKeyListLogic());
|
final logic = Get.put(ElectronicKeyListLogic());
|
||||||
|
|
||||||
//请求电子钥匙列表
|
//请求电子钥匙列表
|
||||||
Future<List<ElectronicKeyListItem>> mockNetworkData() async {
|
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0');
|
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
@ -38,6 +39,18 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//电子钥匙重置请求
|
||||||
|
Future<void> resetElectronicKeyListRequest() async {
|
||||||
|
ElectronicKeyListEntity entity =
|
||||||
|
await ApiRepository.to.resetElectronicKey('28', '0');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("重置电子钥匙成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "重置成功");
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -52,12 +65,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
TranslationLoader.lanKeys!.reset!.tr,
|
TranslationLoader.lanKeys!.reset!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
resetElectronicKeyListRequest();
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: FutureBuilder<List<ElectronicKeyListItem>>(
|
body: FutureBuilder<List<ElectronicKeyListItem>>(
|
||||||
future: mockNetworkData(),
|
future: mockNetworkDataRequest(),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<List<ElectronicKeyListItem>> snapshot) {
|
AsyncSnapshot<List<ElectronicKeyListItem>> snapshot) {
|
||||||
//请求结束
|
//请求结束
|
||||||
@ -155,8 +170,9 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
isAdminKey = false;
|
isAdminKey = false;
|
||||||
}
|
}
|
||||||
return _electronicKeyItem('images/controls_user.png',
|
return _electronicKeyItem('images/controls_user.png',
|
||||||
indexEntity.senderUsername!, useDateStr, keyStatus, isAdminKey, () {
|
indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
|
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
|
||||||
|
arguments: {"itemData": indexEntity});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class ElectronicKeyListItem {
|
|||||||
int? date;
|
int? date;
|
||||||
int? remoteEnable;
|
int? remoteEnable;
|
||||||
int? appUnlockMustOnline;
|
int? appUnlockMustOnline;
|
||||||
List<int>? weekDays;
|
List? weekDays;
|
||||||
|
|
||||||
ElectronicKeyListItem(
|
ElectronicKeyListItem(
|
||||||
{this.keyId,
|
{this.keyId,
|
||||||
|
|||||||
@ -6,30 +6,62 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
|||||||
|
|
||||||
class SendElectronicKeyLogic extends BaseGetXController {
|
class SendElectronicKeyLogic extends BaseGetXController {
|
||||||
final SendElectronicKeyState state = SendElectronicKeyState();
|
final SendElectronicKeyState state = SendElectronicKeyState();
|
||||||
// final stateMyLogic = Get.put(SendElectronicKeyLogic()).state;
|
final stateMyLogic = Get.put(SendElectronicKeyLogic()).state;
|
||||||
|
|
||||||
void sendElectronicKey() async {
|
void sendElectronicKey() async {
|
||||||
var entity = await ApiRepository.to.sendElectronicKey(
|
// String getFailureDateTime = '0';
|
||||||
'0',
|
// String getEffectiveDateTime = '0';
|
||||||
'0',
|
// String getKeyType = (int.parse(state.keyType) + 1).toString();
|
||||||
'0',
|
|
||||||
'0',
|
// if (state.keyType == '1') {
|
||||||
'2',
|
// getFailureDateTime = DateTime.fromMillisecondsSinceEpoch(
|
||||||
'2',
|
// int.parse(state.failureDate.value) * 1000)
|
||||||
'2',
|
// .toString()
|
||||||
'0',
|
// .substring(0, 19);
|
||||||
'1',
|
// getEffectiveDateTime = DateTime.fromMillisecondsSinceEpoch(
|
||||||
'0',
|
// int.parse(state.effectiveDate.value) * 1000)
|
||||||
'0',
|
// .toString()
|
||||||
'小吴副号',
|
// .substring(0, 19);
|
||||||
'19128333512',
|
// }
|
||||||
'0',
|
// var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
'0',
|
// '0',
|
||||||
'0');
|
// '0',
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
// '1',
|
||||||
print('发送电子钥匙成功');
|
// getFailureDateTime,
|
||||||
Get.back();
|
// state.isRealName == true ? '1' : '2',
|
||||||
}
|
// '2',
|
||||||
|
// state.isRemoteUnlock == true ? '1' : '2',
|
||||||
|
// state.keyNameController.text,
|
||||||
|
// '1',
|
||||||
|
// getKeyType,
|
||||||
|
// '28',
|
||||||
|
// '小吴副号',
|
||||||
|
// emailOrPhoneController.text,
|
||||||
|
// '0',
|
||||||
|
// getEffectiveDateTime, []);
|
||||||
|
// if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// // print('发送电子钥匙成功');
|
||||||
|
// }
|
||||||
|
// var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
|
// '0',
|
||||||
|
// '0',
|
||||||
|
// '1',
|
||||||
|
// state.failureDate,
|
||||||
|
// state.isRealName == true ? '1' : '2',
|
||||||
|
// '2',
|
||||||
|
// state.isRemoteUnlock == true ? '1' : '2',
|
||||||
|
// state.emailOrPhoneController.text,
|
||||||
|
// '1',
|
||||||
|
// '0',
|
||||||
|
// '28',
|
||||||
|
// '小吴副号',
|
||||||
|
// '18682150237',
|
||||||
|
// '0',
|
||||||
|
// '0', []);
|
||||||
|
// if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// print('发送电子钥匙成功');
|
||||||
|
// Get.back();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// void checkNext(TextEditingController controller) {
|
// void checkNext(TextEditingController controller) {
|
||||||
|
|||||||
@ -1,10 +1,15 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
@ -24,11 +29,29 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||||
late Contact _contact;
|
late Contact _contact;
|
||||||
|
|
||||||
final logic = Get.put(SendElectronicKeyLogic());
|
// final logic = Get.put(SendElectronicKeyLogic());
|
||||||
// final state = Get.find<SendElectronicKeyLogic>().state;
|
// final state = Get.find<SendElectronicKeyLogic>().state;
|
||||||
|
|
||||||
bool _isRemoteUnlock = false; //是否允许远程开锁
|
bool _isRemoteUnlock = false; //是否允许远程开锁
|
||||||
bool _isAuthentication = false; //是否可以实名认证
|
bool _isAuthentication = false; //是否可以实名认证
|
||||||
|
var _selectEffectiveDate = ''; //生效时间
|
||||||
|
var _selectFailureDate = ''; //失效时间
|
||||||
|
TextEditingController emailOrPhoneController =
|
||||||
|
TextEditingController(); //邮箱/手机号输入框
|
||||||
|
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||||
|
late bool _isSendSuccess;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
DateTime dateTime = DateTime.now();
|
||||||
|
_selectEffectiveDate =
|
||||||
|
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||||
|
_selectFailureDate =
|
||||||
|
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||||
|
_isSendSuccess = false;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -42,53 +65,60 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// 限时
|
// 限时
|
||||||
return sendElectronicKeySucceed();
|
return _isSendSuccess
|
||||||
// return Column(
|
? sendElectronicKeySucceed()
|
||||||
// children: [
|
: Column(
|
||||||
// keyInfoWidget(),
|
children: [
|
||||||
// keyTimeWidget(),
|
keyInfoWidget(),
|
||||||
// remoteUnlockingWidget(),
|
keyTimeWidget(),
|
||||||
// keyRealNameWidget(),
|
remoteUnlockingWidget(),
|
||||||
// keyBottomWidget()
|
keyRealNameWidget(),
|
||||||
// ],
|
keyBottomWidget()
|
||||||
// );
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// 永久
|
// 永久
|
||||||
return Column(
|
return _isSendSuccess
|
||||||
children: [
|
? sendElectronicKeySucceed()
|
||||||
keyInfoWidget(),
|
: Column(
|
||||||
remoteUnlockingWidget(),
|
children: [
|
||||||
keyRealNameWidget(),
|
keyInfoWidget(),
|
||||||
keyBottomWidget()
|
remoteUnlockingWidget(),
|
||||||
],
|
keyRealNameWidget(),
|
||||||
);
|
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(
|
return _isSendSuccess
|
||||||
children: [
|
? sendElectronicKeySucceed()
|
||||||
keyInfoWidget(),
|
: Column(
|
||||||
keyPeriodValidityWidget(),
|
children: [
|
||||||
remoteUnlockingWidget(),
|
keyInfoWidget(),
|
||||||
keyRealNameWidget(),
|
keyPeriodValidityWidget(),
|
||||||
keyBottomWidget()
|
remoteUnlockingWidget(),
|
||||||
],
|
keyRealNameWidget(),
|
||||||
);
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return Container();
|
return Container();
|
||||||
@ -124,18 +154,30 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: "2020.06.20 11:49",
|
rightTitle: _selectEffectiveDate,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
// _showDatePicker();
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
_selectEffectiveDate =
|
||||||
|
'${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}';
|
||||||
|
});
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
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: () {
|
||||||
// _showDatePicker();
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
_selectFailureDate =
|
||||||
|
'${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}';
|
||||||
|
});
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
@ -199,7 +241,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
//发送钥匙请求
|
//发送钥匙请求
|
||||||
logic.sendElectronicKey();
|
if (emailOrPhoneController.text.isNotEmpty &&
|
||||||
|
keyNameController.text.isNotEmpty) {
|
||||||
|
sendElectronicKeyRequest();
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(right: 30.w),
|
padding: EdgeInsets.only(right: 30.w),
|
||||||
@ -224,6 +269,44 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> sendElectronicKeyRequest() async {
|
||||||
|
String getFailureDateTime = '0';
|
||||||
|
String getEffectiveDateTime = '0';
|
||||||
|
String deviceID = '28';
|
||||||
|
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||||
|
if (widget.type == '0') {
|
||||||
|
getFailureDateTime =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(int.parse(_selectFailureDate))
|
||||||
|
.toString()
|
||||||
|
.substring(0, 19);
|
||||||
|
getEffectiveDateTime =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(int.parse(_selectEffectiveDate))
|
||||||
|
.toString()
|
||||||
|
.substring(0, 19);
|
||||||
|
}
|
||||||
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
|
'0',
|
||||||
|
'0',
|
||||||
|
'1',
|
||||||
|
getFailureDateTime,
|
||||||
|
_isAuthentication == true ? '1' : '2',
|
||||||
|
'2',
|
||||||
|
_isRemoteUnlock == true ? '1' : '2',
|
||||||
|
keyNameController.text,
|
||||||
|
'1',
|
||||||
|
getKeyType,
|
||||||
|
deviceID,
|
||||||
|
'小吴副号',
|
||||||
|
emailOrPhoneController.text,
|
||||||
|
'0',
|
||||||
|
getEffectiveDateTime, []);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// print('发送电子钥匙成功');
|
||||||
|
_isSendSuccess = true;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
// 发送电子钥匙成功
|
||||||
Widget sendElectronicKeySucceed() {
|
Widget sendElectronicKeySucceed() {
|
||||||
return Column(
|
return Column(
|
||||||
@ -263,23 +346,35 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
SubmitBtn(btnName: '完成', onClick: () {}),
|
|
||||||
SizedBox(
|
|
||||||
height: 10.h,
|
|
||||||
),
|
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '邮件通知',
|
btnName: '完成',
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
_isSendSuccess = false;
|
||||||
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
SubmitBtn(btnName: '微信通知', onClick: () {}),
|
OutLineBtn(
|
||||||
|
btnName: '邮件通知',
|
||||||
|
onClick: () {
|
||||||
|
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||||
|
},
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
SubmitBtn(btnName: '标记为已入住', onClick: () {}),
|
OutLineBtn(
|
||||||
|
btnName: '微信通知',
|
||||||
|
onClick: () {},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
OutLineBtn(
|
||||||
|
btnName: '标记为已入住',
|
||||||
|
onClick: () {},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -293,9 +388,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
// controller: lineIndex == 1
|
controller:
|
||||||
// ? state.emailOrPhoneController
|
lineIndex == 1 ? emailOrPhoneController : keyNameController,
|
||||||
// : state.keyNameController,
|
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
// controller: _controller,
|
// controller: _controller,
|
||||||
|
|||||||
@ -2,22 +2,28 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class SendElectronicKeyState {
|
class SendElectronicKeyState {
|
||||||
var emailOrPhone = ''.obs;
|
// var emailOrPhone = ''.obs;
|
||||||
var keyName = ''.obs;
|
// var keyName = ''.obs;
|
||||||
var canNext = false.obs;
|
// var effectiveDate = ''.obs; //生效时间
|
||||||
bool get isEmailOrPhoneOK => emailOrPhone.value.isNotEmpty;
|
// var failureDate = ''.obs; //失效时间
|
||||||
bool get isKeyNameOK => keyName.value.isNotEmpty;
|
// var isRemoteUnlock = false; //远程开锁
|
||||||
|
// var isRealName = false; //实名认证
|
||||||
|
// var keyType = '1'; //钥匙类型 限期1,永久2,单次3,循环4
|
||||||
|
// var canNext = false.obs;
|
||||||
|
|
||||||
TextEditingController emailOrPhoneController =
|
// bool get isEmailOrPhoneOK => emailOrPhone.value.isNotEmpty;
|
||||||
TextEditingController(); //邮箱/手机号输入框
|
// bool get isKeyNameOK => keyName.value.isNotEmpty;
|
||||||
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
|
||||||
SendElectronicKeyState() {
|
|
||||||
emailOrPhoneController.text = emailOrPhone.value;
|
|
||||||
keyNameController.text = keyName.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void onClose() {
|
// TextEditingController emailOrPhoneController =
|
||||||
emailOrPhoneController.dispose();
|
// TextEditingController(); //邮箱/手机号输入框
|
||||||
keyNameController.dispose();
|
// TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||||
}
|
// SendElectronicKeyState() {
|
||||||
|
// emailOrPhoneController.text = emailOrPhone.value;
|
||||||
|
// keyNameController.text = keyName.value;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// void onClose() {
|
||||||
|
// emailOrPhoneController.dispose();
|
||||||
|
// keyNameController.dispose();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,8 @@ abstract class Api {
|
|||||||
final String getCountryRegionURL = '/system/listCountry'; //获取国家或地区
|
final String getCountryRegionURL = '/system/listCountry'; //获取国家或地区
|
||||||
final String electronicKeyListURL = '/key/listUser'; //电子钥匙列表
|
final String electronicKeyListURL = '/key/listUser'; //电子钥匙列表
|
||||||
final String sendElectronicKeyURL = '/key/send'; //发送电子钥匙
|
final String sendElectronicKeyURL = '/key/send'; //发送电子钥匙
|
||||||
|
final String resetElectronicKeyURL = '/key/reset'; //重置电子钥匙
|
||||||
|
final String keyOperationRecordURL = '/lockRecords/list'; //电子钥匙操作记录
|
||||||
final String uploadElectricQuantityURL =
|
final String uploadElectricQuantityURL =
|
||||||
'/room/uploadElectricQuantity'; //锁电量更新
|
'/room/uploadElectricQuantity'; //锁电量更新
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,7 +131,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
String receiverUsername,
|
String receiverUsername,
|
||||||
String remarks,
|
String remarks,
|
||||||
String startDate,
|
String startDate,
|
||||||
String weekDays) =>
|
List weekDays) =>
|
||||||
post(
|
post(
|
||||||
sendElectronicKeyURL.toUrl,
|
sendElectronicKeyURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -163,6 +163,38 @@ class ApiProvider extends BaseProvider {
|
|||||||
'electricQuantity': electricQuantity,
|
'electricQuantity': electricQuantity,
|
||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
||||||
|
post(resetElectronicKeyURL.toUrl,
|
||||||
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||||
|
|
||||||
|
Future<Response> lockRecordList(
|
||||||
|
String endDate,
|
||||||
|
String keyId,
|
||||||
|
String keyStatus,
|
||||||
|
String lockId,
|
||||||
|
String operatorUid,
|
||||||
|
String pageNo,
|
||||||
|
String pageSize,
|
||||||
|
String startDate,
|
||||||
|
String recordType,
|
||||||
|
String searchStr,
|
||||||
|
String timezoneRawOffSet) =>
|
||||||
|
post(
|
||||||
|
keyOperationRecordURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'endDate': endDate,
|
||||||
|
'keyId': keyId,
|
||||||
|
"keyStatus": keyStatus,
|
||||||
|
'lockId': lockId,
|
||||||
|
"operatorUid": operatorUid,
|
||||||
|
'pageNo': pageNo,
|
||||||
|
'pageSize': pageSize,
|
||||||
|
'startDate': startDate,
|
||||||
|
'recordType': recordType,
|
||||||
|
'searchStr': searchStr,
|
||||||
|
'timezoneRawOffSet': timezoneRawOffSet
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
statusText: res.statusText,
|
statusText: res.statusText,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
print('得到的数据======>¥res');
|
print('得到的数据======>$res');
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
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/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||||
@ -112,7 +113,7 @@ class ApiRepository {
|
|||||||
String receiverUsername,
|
String receiverUsername,
|
||||||
String remarks,
|
String remarks,
|
||||||
String startDate,
|
String startDate,
|
||||||
String weekDays) async {
|
List weekDays) async {
|
||||||
final res = await apiProvider.sendElectronicKey(
|
final res = await apiProvider.sendElectronicKey(
|
||||||
createUser,
|
createUser,
|
||||||
countryCode,
|
countryCode,
|
||||||
@ -132,4 +133,39 @@ class ApiRepository {
|
|||||||
weekDays);
|
weekDays);
|
||||||
return ElectronicKeyListEntity.fromJson(res.body);
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//重置电子钥匙
|
||||||
|
Future<ElectronicKeyListEntity> resetElectronicKey(
|
||||||
|
String lockId, String operatorUid) async {
|
||||||
|
final res = await apiProvider.resetElectronicKey(lockId, operatorUid);
|
||||||
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//钥匙详情-操作记录
|
||||||
|
Future<KeyOperationRecordEntity> lockRecordList(
|
||||||
|
String endDate,
|
||||||
|
String keyId,
|
||||||
|
String keyStatus,
|
||||||
|
String lockId,
|
||||||
|
String operatorUid,
|
||||||
|
String pageNo,
|
||||||
|
String pageSize,
|
||||||
|
String startDate,
|
||||||
|
String recordType,
|
||||||
|
String searchStr,
|
||||||
|
String timezoneRawOffSet) async {
|
||||||
|
final res = await apiProvider.lockRecordList(
|
||||||
|
endDate,
|
||||||
|
keyId,
|
||||||
|
keyStatus,
|
||||||
|
lockId,
|
||||||
|
operatorUid,
|
||||||
|
pageNo,
|
||||||
|
pageSize,
|
||||||
|
startDate,
|
||||||
|
recordType,
|
||||||
|
searchStr,
|
||||||
|
timezoneRawOffSet);
|
||||||
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -160,3 +160,41 @@ class AddBottomWhiteBtn extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 边框按钮 公用组件
|
||||||
|
* */
|
||||||
|
|
||||||
|
class OutLineBtn extends StatelessWidget {
|
||||||
|
String? btnName;
|
||||||
|
|
||||||
|
Function()? onClick;
|
||||||
|
|
||||||
|
OutLineBtn({
|
||||||
|
Key? key,
|
||||||
|
required this.btnName,
|
||||||
|
this.onClick,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return 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: () {
|
||||||
|
if (onClick != null) {
|
||||||
|
onClick!();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
btnName!,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor, fontSize: ScreenUtil().setSp(24)),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user