Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
This commit is contained in:
commit
b3b711020c
@ -1,3 +1,4 @@
|
||||
import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
@ -5,8 +6,10 @@ 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:get/get.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
@ -29,22 +32,30 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
|
||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||
late Contact _contact;
|
||||
|
||||
// bool _isRemoteUnlock = false; //是否允许远程开锁
|
||||
late KeyInfos keyInfo;
|
||||
late LockMainEntity lockMainEntity;
|
||||
bool _isAuthentication = false; //是否可以实名认证
|
||||
var _selectEffectiveDate = ''; //生效时间
|
||||
var _selectFailureDate = ''; //失效时间
|
||||
late DateTime _effectiveDateTime;
|
||||
late DateTime _failureDateTime;
|
||||
final TextEditingController _emailOrPhoneController =
|
||||
TextEditingController(); //邮箱/手机号输入框
|
||||
final TextEditingController _keyNameController =
|
||||
TextEditingController(); //钥匙名输入框
|
||||
late bool _isSendSuccess;
|
||||
String countryName = '中国';
|
||||
String countryCode = '86';
|
||||
List weekdaysList = [];
|
||||
bool _isCreateUser = false; //用户未注册时传1 已注册传0
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
DateTime dateTime = DateTime.now();
|
||||
_effectiveDateTime = dateTime;
|
||||
_failureDateTime = dateTime;
|
||||
_selectEffectiveDate =
|
||||
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||
_selectFailureDate =
|
||||
@ -54,33 +65,47 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return indexChangeWidget();
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||
lockMainEntity = obj["lockMainEntity"];
|
||||
}
|
||||
if (obj != null && (obj["keyInfo"] != null)) {
|
||||
keyInfo = obj["keyInfo"];
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: indexChangeWidget(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexChangeWidget() {
|
||||
switch (int.parse(widget.type)) {
|
||||
case 0:
|
||||
{
|
||||
// 限时
|
||||
// return sendElectronicKeySucceed();
|
||||
if (_isSendSuccess) {
|
||||
return sendElectronicKeySucceed();
|
||||
} else {
|
||||
switch (int.parse(widget.type)) {
|
||||
case 0:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyTimeWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(
|
||||
TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
default:
|
||||
// 永久
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyTimeWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
default:
|
||||
// 永久
|
||||
return Column(
|
||||
children: [
|
||||
keyInfoWidget(),
|
||||
keyRealNameWidget(),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,12 +121,33 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: getTFWidget(true,
|
||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, 1)),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
rightWidget: Text(
|
||||
'$countryName +$countryCode',
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.seletCountryRegionPage);
|
||||
result as Map<String, dynamic>;
|
||||
countryCode = result['code'];
|
||||
countryName = result['countryName'];
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: getTFWidget(
|
||||
false, TranslationLoader.lanKeys!.pleaseEnter!.tr, 2)),
|
||||
false, TranslationLoader.lanKeys!.enterYourName!.tr, 2)),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
);
|
||||
@ -121,7 +167,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_selectEffectiveDate =
|
||||
'${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}';
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
||||
});
|
||||
});
|
||||
}),
|
||||
@ -134,7 +181,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_selectFailureDate =
|
||||
'${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}';
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
_failureDateTime = DateTime.parse(_selectFailureDate);
|
||||
});
|
||||
});
|
||||
}),
|
||||
@ -226,8 +274,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
),
|
||||
Image.asset(
|
||||
'images/icon_send_success.png',
|
||||
width: 150.w,
|
||||
height: 150.w,
|
||||
width: 100.w,
|
||||
height: 100.w,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
@ -238,7 +286,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
Text(
|
||||
"发送成功",
|
||||
style: TextStyle(
|
||||
fontSize: 32.sp,
|
||||
fontSize: 26.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
@ -252,38 +300,51 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
SubmitBtn(
|
||||
btnName: '邮件通知',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
_isSendSuccess = false;
|
||||
setState(() {});
|
||||
}),
|
||||
SubmitBtn(
|
||||
btnName: '微信通知',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
SubmitBtn(
|
||||
btnName: '标记为已入住',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '邮件通知',
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '微信通知',
|
||||
onClick: () {},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '标记为已入住',
|
||||
onClick: () {
|
||||
updateRoomCheckIn();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
//标记房间为已入住 isOn:已入住: 1 空闲:2
|
||||
Future<void> updateRoomCheckIn() async {
|
||||
var entity = await ApiRepository.to.updateSetting('0', '1', '13');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("标记为已入住成功啦啦啦啦啦");
|
||||
Toast.show(msg: "标记成功");
|
||||
setState(() {});
|
||||
} else {
|
||||
Toast.show(msg: '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 接受者信息输入框
|
||||
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
|
||||
return SizedBox(
|
||||
@ -340,22 +401,20 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
);
|
||||
}
|
||||
|
||||
//发送钥匙请求
|
||||
//发送授权管理员列表请求
|
||||
Future<void> sendElectronicKeyRequest() async {
|
||||
String getFailureDateTime = '0';
|
||||
String getEffectiveDateTime = '0';
|
||||
String deviceID = '28';
|
||||
String lockID = keyInfo.lockId.toString();
|
||||
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||
if (widget.type == '0') {
|
||||
getFailureDateTime =
|
||||
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||
.millisecondsSinceEpoch
|
||||
.toString();
|
||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime =
|
||||
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
||||
}
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
'0',
|
||||
'0',
|
||||
_isCreateUser ? "1" : "0",
|
||||
countryCode,
|
||||
'1',
|
||||
getFailureDateTime,
|
||||
_isAuthentication == true ? '1' : '2',
|
||||
@ -364,15 +423,22 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
_keyNameController.text,
|
||||
'1',
|
||||
getKeyType,
|
||||
deviceID,
|
||||
'小吴副号',
|
||||
lockID,
|
||||
'',
|
||||
_emailOrPhoneController.text,
|
||||
'0',
|
||||
getEffectiveDateTime, []);
|
||||
'',
|
||||
getEffectiveDateTime,
|
||||
weekdaysList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('发送电子钥匙成功');
|
||||
_isSendSuccess = true;
|
||||
setState(() {});
|
||||
} else {
|
||||
Toast.show(msg: '${entity.errorMsg}');
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
_isCreateUser = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,4 +456,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
String intToStr(int v) {
|
||||
return (v < 10) ? "0$v" : "$v";
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
@ -20,8 +21,19 @@ class AuthorizedAdminListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
late KeyInfos keyInfo;
|
||||
late LockMainEntity lockMainEntity;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||
lockMainEntity = obj["lockMainEntity"];
|
||||
}
|
||||
if (obj != null && (obj["keyInfo"] != null)) {
|
||||
keyInfo = obj["keyInfo"];
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
@ -53,7 +65,11 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.authorizedAdminManagePage);
|
||||
context, Routers.authorizedAdminManagePage,
|
||||
arguments: {
|
||||
"lockMainEntity": lockMainEntity,
|
||||
"keyInfo": keyInfo
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@ -72,8 +88,16 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
|
||||
//请求授权管理员列表 跟电子钥匙列表的接口一样,但必须在参数中加keyRight=1为授权管理员
|
||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0', '1');
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||
'0',
|
||||
keyInfo.keyId.toString(),
|
||||
'',
|
||||
keyInfo.lockId.toString(),
|
||||
'',
|
||||
'1',
|
||||
'20',
|
||||
'0',
|
||||
'1');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
@ -23,36 +23,19 @@ class ElectronicKeyListPage extends StatefulWidget {
|
||||
|
||||
class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
final logic = Get.put(ElectronicKeyListLogic());
|
||||
|
||||
//请求电子钥匙列表
|
||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0', '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||
}
|
||||
if (entity.data != null) {
|
||||
return entity.data!.itemList;
|
||||
} else {
|
||||
List<ElectronicKeyListItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
||||
//电子钥匙重置请求
|
||||
Future<void> resetElectronicKeyListRequest() async {
|
||||
ElectronicKeyListEntity entity =
|
||||
await ApiRepository.to.resetElectronicKey('28', '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("重置电子钥匙成功啦啦啦啦啦");
|
||||
Toast.show(msg: "重置成功");
|
||||
mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
late KeyInfos keyInfo;
|
||||
late LockMainEntity lockMainEntity;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||
lockMainEntity = obj["lockMainEntity"];
|
||||
}
|
||||
if (obj != null && (obj["keyInfo"] != null)) {
|
||||
keyInfo = obj["keyInfo"];
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
@ -95,7 +78,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.sendElectronicKeyManagePage);
|
||||
context, Routers.sendElectronicKeyManagePage,
|
||||
arguments: {
|
||||
"lockMainEntity": lockMainEntity,
|
||||
"keyInfo": keyInfo
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@ -184,6 +171,41 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
//请求电子钥匙列表
|
||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||
'0',
|
||||
keyInfo.keyId.toString(),
|
||||
'',
|
||||
keyInfo.lockId.toString(),
|
||||
'',
|
||||
'1',
|
||||
'20',
|
||||
'0',
|
||||
'0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||
}
|
||||
if (entity.data != null) {
|
||||
return entity.data!.itemList;
|
||||
} else {
|
||||
List<ElectronicKeyListItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
||||
//电子钥匙重置请求
|
||||
Future<void> resetElectronicKeyListRequest() async {
|
||||
ElectronicKeyListEntity entity =
|
||||
await ApiRepository.to.resetElectronicKey('28', '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("重置电子钥匙成功啦啦啦啦啦");
|
||||
Toast.show(msg: "重置成功");
|
||||
mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
//使用期限
|
||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
|
||||
@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
@ -28,6 +29,8 @@ class SendElectronicKeyPage extends StatefulWidget {
|
||||
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||
late Contact _contact;
|
||||
late KeyInfos keyInfo;
|
||||
late LockMainEntity lockMainEntity;
|
||||
|
||||
// final logic = Get.put(SendElectronicKeyLogic());
|
||||
// final state = Get.find<SendElectronicKeyLogic>().state;
|
||||
@ -63,6 +66,14 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||
lockMainEntity = obj["lockMainEntity"];
|
||||
}
|
||||
if (obj != null && (obj["keyInfo"] != null)) {
|
||||
keyInfo = obj["keyInfo"];
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: indexChangeWidget(),
|
||||
);
|
||||
@ -190,10 +201,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_effectiveDateTime = DateTime.parse(
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
||||
_selectEffectiveDate = formatDate(_effectiveDateTime,
|
||||
[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]);
|
||||
_selectEffectiveDate =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
_effectiveDateTime = DateTime.parse(_selectEffectiveDate);
|
||||
});
|
||||
});
|
||||
}),
|
||||
@ -205,10 +215,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
_failureDateTime = DateTime.parse(
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
|
||||
_selectFailureDate = formatDate(_failureDateTime,
|
||||
[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]);
|
||||
_selectFailureDate =
|
||||
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
_failureDateTime = DateTime.parse(_selectFailureDate);
|
||||
});
|
||||
});
|
||||
}),
|
||||
@ -323,14 +332,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
Future<void> sendElectronicKeyRequest() async {
|
||||
String getFailureDateTime = '0';
|
||||
String getEffectiveDateTime = '0';
|
||||
String deviceID = '28';
|
||||
String lockID = keyInfo.lockId.toString();
|
||||
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||
if (widget.type == '0') {
|
||||
getFailureDateTime =
|
||||
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||
.millisecondsSinceEpoch
|
||||
.toString();
|
||||
getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime =
|
||||
_effectiveDateTime.millisecondsSinceEpoch.toString();
|
||||
}
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
_isCreateUser ? "1" : "0",
|
||||
@ -341,12 +348,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
'2',
|
||||
_isRemoteUnlock == true ? '1' : '2',
|
||||
keyNameController.text,
|
||||
'1',
|
||||
getKeyType,
|
||||
deviceID,
|
||||
'小吴副号',
|
||||
emailOrPhoneController.text,
|
||||
'0',
|
||||
getKeyType,
|
||||
lockID,
|
||||
'',
|
||||
emailOrPhoneController.text,
|
||||
'',
|
||||
getEffectiveDateTime,
|
||||
weekdaysList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
|
||||
@ -174,7 +174,11 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
||||
}),
|
||||
bottomItem('images/main/icon_main_electronicKey.png',
|
||||
TranslationLoader.lanKeys!.electronicKey!.tr, () {
|
||||
Navigator.pushNamed(context, Routers.electronicKeyListPage);
|
||||
Navigator.pushNamed(context, Routers.electronicKeyListPage,
|
||||
arguments: {
|
||||
"lockMainEntity": widget.lockMainEntity,
|
||||
"keyInfo": widget.keyInfo
|
||||
});
|
||||
}),
|
||||
bottomItem('images/main/icon_main_password.png',
|
||||
TranslationLoader.lanKeys!.password!.tr, () {
|
||||
@ -206,7 +210,11 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
||||
}),
|
||||
bottomItem('images/main/icon_main_authorizedAdmin.png',
|
||||
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminListPage);
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminListPage,
|
||||
arguments: {
|
||||
"lockMainEntity": widget.lockMainEntity,
|
||||
"keyInfo": widget.keyInfo
|
||||
});
|
||||
}),
|
||||
bottomItem('images/main/icon_main_operatingRecord.png',
|
||||
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
|
||||
@ -214,7 +222,8 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
||||
}),
|
||||
bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, () {
|
||||
Navigator.pushNamed(context, Routers.lockSetPage, arguments: widget.keyInfo);
|
||||
Navigator.pushNamed(context, Routers.lockSetPage,
|
||||
arguments: widget.keyInfo);
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user