1,新增获取密码接口及逻辑处理

This commit is contained in:
Daisy 2023-08-25 17:06:42 +08:00
parent b80262cfcc
commit 43d79320a5
10 changed files with 426 additions and 204 deletions

View File

@ -373,14 +373,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 7NLFRKNVY3; DEVELOPMENT_TEAM = ZJ29NYHTV5;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.example.starLock456; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
@ -501,14 +501,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 7NLFRKNVY3; DEVELOPMENT_TEAM = ZJ29NYHTV5;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.example.starLock456; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
@ -522,14 +522,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 7NLFRKNVY3; DEVELOPMENT_TEAM = ZJ29NYHTV5;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.example.starLock456; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };

View File

@ -2,13 +2,10 @@ 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/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/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';

View File

@ -33,12 +33,10 @@ class _ElectronicKeyPeriodValidityPageState
]; ];
List validityDataList = []; // List validityDataList = []; //
List selectIndexList = []; // List selectIndexList = []; //
String _effectiveTime = ''; String _selectEffectiveDate = ''; //
String _failureTime = ''; String _selectFailureDate = ''; //
late DateTime _effectiveDateTime;
String _effectiveDate = ''; late DateTime _failureDateTime;
String _failureDate = '';
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -149,58 +147,59 @@ class _ElectronicKeyPeriodValidityPageState
Widget bottomWidget() { Widget bottomWidget() {
return Column( return Column(
children: [ children: [
CommonItem( // CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, // leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: _effectiveTime, // rightTitle: _effectiveTime,
isHaveDirection: true, // isHaveDirection: true,
isHaveLine: true, // isHaveLine: true,
action: () { // action: () {
Pickers.showDatePicker(context, mode: DateMode.HM, // Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) { // onConfirm: (p) {
_effectiveTime = '${intToStr(p.hour!)}:${intToStr(p.minute!)}'; // _effectiveTime = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
setState(() {}); // setState(() {});
}); // });
}), // }),
CommonItem( // CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, // leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: _failureTime, // rightTitle: _failureTime,
isHaveDirection: true, // isHaveDirection: true,
action: () { // action: () {
Pickers.showDatePicker(context, mode: DateMode.HM, // Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) { // onConfirm: (p) {
_failureTime = '${intToStr(p.hour!)}:${intToStr(p.minute!)}'; // _failureTime = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
setState(() {}); // setState(() {});
}); // });
}), // }),
Container(height: 10.h), // Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveDate!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveDate!.tr,
rightTitle: _effectiveDate, rightTitle: _selectEffectiveDate,
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: DateMode.YMD, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
DateTime getPTime = DateTime.parse( _effectiveDateTime = DateTime.parse(
'${intToStr(p.year!)}-${intToStr(p.month!)}-${intToStr(p.day!)}'); '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
_effectiveDate = formatDate(getPTime, [yyyy, '-', mm, '-', dd]); _selectEffectiveDate = formatDate(_effectiveDateTime,
[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]);
setState(() {}); setState(() {});
}); });
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureDate!.tr, leftTitel: TranslationLoader.lanKeys!.failureDate!.tr,
rightTitle: _failureDate, rightTitle: _selectFailureDate,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Pickers.showDatePicker(context, mode: DateMode.YMD, Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
DateTime getPTime = DateTime.parse( _failureDateTime = DateTime.parse(
'${intToStr(p.year!)}-${intToStr(p.month!)}-${intToStr(p.day!)}'); '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
_failureDate = formatDate(getPTime, [yyyy, '-', mm, '-', dd]); _selectFailureDate = formatDate(_failureDateTime,
[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]);
setState(() {}); setState(() {});
}); });
}), }),
@ -213,6 +212,8 @@ class _ElectronicKeyPeriodValidityPageState
onClick: () { onClick: () {
Map<String, dynamic> resultMap = {}; Map<String, dynamic> resultMap = {};
resultMap['validityValue'] = selectIndexList; resultMap['validityValue'] = selectIndexList;
resultMap['starDate'] = _effectiveDateTime;
resultMap['endDate'] = _failureDateTime;
Navigator.pop(context, resultMap); Navigator.pop(context, resultMap);
}), }),
], ],

View File

@ -35,15 +35,17 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
bool _isRemoteUnlock = false; // bool _isRemoteUnlock = false; //
bool _isAuthentication = false; // bool _isAuthentication = false; //
String _selectEffectiveDate = ''; // String _selectEffectiveDate = ''; //
String _selectFailureDate = ''; //
late DateTime _effectiveDateTime; late DateTime _effectiveDateTime;
late DateTime _failureDateTime; late DateTime _failureDateTime;
String _selectFailureDate = ''; //
TextEditingController emailOrPhoneController = TextEditingController emailOrPhoneController =
TextEditingController(); /// TextEditingController(); ///
TextEditingController keyNameController = TextEditingController(); // TextEditingController keyNameController = TextEditingController(); //
late bool _isSendSuccess; late bool _isSendSuccess;
String countryName = '中国'; String countryName = '中国';
String countryCode = '86'; String countryCode = '86';
List weekdaysList = [];
bool _isCreateUser = false; //1 0
@override @override
void initState() { void initState() {
@ -239,9 +241,15 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle: "", rightTitle: "",
isHaveDirection: true, isHaveDirection: true,
action: () { action: () async {
Navigator.pushNamed( var result = await Navigator.pushNamed(
context, Routers.electronicKeyPeriodValidityPage); context, Routers.electronicKeyPeriodValidityPage);
result as Map<String, dynamic>;
weekdaysList = result['validityValue'];
_effectiveDateTime = result['starDate'];
_failureDateTime = result['endDate'];
print(
'得到的有效期数据:$weekdaysList $_effectiveDateTime $_failureDateTime');
}), }),
SizedBox( SizedBox(
height: 10.h, height: 10.h,
@ -274,11 +282,15 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
// //
if (emailOrPhoneController.text.isNotEmpty && if (emailOrPhoneController.text.isNotEmpty &&
keyNameController.text.isNotEmpty) { keyNameController.text.isNotEmpty) {
// if (int.parse(widget.type) == 0) {
if (_failureDateTime.compareTo(_effectiveDateTime) == 1) { //
sendElectronicKeyRequest(); if (_failureDateTime.compareTo(_effectiveDateTime) == 1) {
sendElectronicKeyRequest();
} else {
Toast.show(msg: '失效时间需大于生效时间');
}
} else { } else {
Toast.show(msg: '失效时间需大于生效时间'); sendElectronicKeyRequest();
} }
} else { } else {
Toast.show(msg: '请完善信息'); Toast.show(msg: '请完善信息');
@ -321,7 +333,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
.toString(); .toString();
} }
var entity = await ApiRepository.to.sendElectronicKey( var entity = await ApiRepository.to.sendElectronicKey(
'0', _isCreateUser ? "1" : "0",
countryCode, countryCode,
'1', '1',
getFailureDateTime, getFailureDateTime,
@ -335,13 +347,18 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
'小吴副号', '小吴副号',
emailOrPhoneController.text, emailOrPhoneController.text,
'0', '0',
getEffectiveDateTime, []); getEffectiveDateTime,
weekdaysList);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
print('发送电子钥匙成功'); print('发送电子钥匙成功');
_isSendSuccess = true; _isSendSuccess = true;
setState(() {}); setState(() {});
} else { } else {
Toast.show(msg: '${entity.errorMsg}'); Toast.show(msg: '${entity.errorMsg}');
if (entity.errorCode == 425) {
//
_isCreateUser = true;
}
} }
} }

View File

@ -210,8 +210,15 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
} else if (indexEntity.keyboardPwdType == 4) { } else if (indexEntity.keyboardPwdType == 4) {
//
DateTime dateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 清空码';
} else {
// //
useDateStr = '循环'; DateTime dateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 循环';
} }
return useDateStr; return useDateStr;

View File

@ -0,0 +1,46 @@
class PasswordKeyEntity {
int? errorCode;
String? description;
String? errorMsg;
PasswordKeyData? data;
PasswordKeyEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
PasswordKeyEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? PasswordKeyData.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 PasswordKeyData {
String? keyboardPwd;
int? keyboardPwdId;
PasswordKeyData({this.keyboardPwd, this.keyboardPwdId});
PasswordKeyData.fromJson(Map<String, dynamic> json) {
keyboardPwd = json['keyboardPwd'];
keyboardPwdId = json['keyboardPwdId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['keyboardPwd'] = keyboardPwd;
data['keyboardPwdId'] = keyboardPwdId;
return data;
}
}

View File

@ -1,10 +1,15 @@
import 'package:date_format/date_format.dart';
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:get/get.dart'; import 'package:get/get.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 '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
@ -21,6 +26,12 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> { class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
final TextEditingController _controller = TextEditingController(); final TextEditingController _controller = TextEditingController();
late bool _isSendSuccess;
late String _getPwdStr;
String _selectEffectiveDate = ''; //
String _selectFailureDate = ''; //
late DateTime _effectiveDateTime;
late DateTime _failureDateTime;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -29,98 +40,109 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
_isSendSuccess = false;
DateTime dateTime = DateTime.now();
_effectiveDateTime = dateTime;
_failureDateTime = dateTime;
_selectEffectiveDate = formatDate(
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //
_selectFailureDate = formatDate(
dateTime, [yyyy, '-', mm, '-', dd, ' ', HH, ':', nn]); //
} }
Widget indexChangeWidget() { Widget indexChangeWidget() {
switch (int.parse(widget.type)) { if (_isSendSuccess) {
case 0: return sendElectronicKeySucceed();
{ } else {
// switch (int.parse(widget.type)) {
// return sendElectronicKeySucceed(); case 0:
return Column( {
children: [ //
perpetualKeyWidget( return Column(
TranslationLoader.lanKeys!.name!.tr, children: [
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, perpetualKeyWidget(
_controller), TranslationLoader.lanKeys!.name!.tr,
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr) TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
], _controller),
); keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
} ],
case 1: );
{ }
// case 1:
return Column( {
children: [ //
keyTimeLimitWidget(), return Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, keyTimeLimitWidget(),
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, perpetualKeyWidget(
_controller), TranslationLoader.lanKeys!.name!.tr,
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr) TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
], _controller),
); keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
} ],
case 2: );
{ }
// case 2:
return Column( {
children: [ //
perpetualKeyWidget( return Column(
TranslationLoader.lanKeys!.name!.tr, children: [
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, perpetualKeyWidget(
_controller), TranslationLoader.lanKeys!.name!.tr,
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr) TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
], _controller),
); keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
} ],
case 3: );
{ }
// case 3:
return Column( {
children: [ //
keyIfPerpetualWidget(), return Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, keyIfPerpetualWidget(),
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, perpetualKeyWidget(
_controller), TranslationLoader.lanKeys!.name!.tr,
perpetualKeyWidget(TranslationLoader.lanKeys!.password!.tr, TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
"请输入6-9位数字", _controller), _controller),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr) perpetualKeyWidget(TranslationLoader.lanKeys!.password!.tr,
], "请输入6-9位数字", _controller),
); keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
} ],
case 4: );
{ }
// case 4:
return Column( {
children: [ //
keyCirculationWidget(), return Column(
perpetualKeyWidget( children: [
TranslationLoader.lanKeys!.name!.tr, keyCirculationWidget(),
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, perpetualKeyWidget(
_controller), TranslationLoader.lanKeys!.name!.tr,
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip5!.tr) TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
], _controller),
); keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip5!.tr)
} ],
case 5: );
{ }
// case 5:
return Column( {
children: [ //
perpetualKeyWidget( return Column(
TranslationLoader.lanKeys!.name!.tr, children: [
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, perpetualKeyWidget(
_controller), TranslationLoader.lanKeys!.name!.tr,
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr) TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
], _controller),
); keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
} ],
default: );
return Container(); }
default:
return Container();
}
} }
} }
@ -151,18 +173,34 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
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(() {
_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]);
});
});
}), }),
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(() {
_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]);
});
});
}), }),
Container(height: 10.h), Container(height: 10.h),
], ],
@ -239,17 +277,89 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
), ),
SubmitBtn( SubmitBtn(
btnName: TranslationLoader.lanKeys!.getPassword!.tr, btnName: TranslationLoader.lanKeys!.getPassword!.tr,
onClick: () {}), onClick: () {
getKeyboardPwdRequest();
}),
], ],
); );
} }
/**
1 6使
2 24使
3 24使
4 使使
5
6
7
8
9
10
11
12
13
14
*/
//
Future<void> getKeyboardPwdRequest() async {
String getFailureDateTime = '0';
String getEffectiveDateTime = '0';
String lockId = '28';
int passwordType = int.parse(widget.type);
String getKeyType = passwordType.toString();
if (passwordType == 0) {
//
getKeyType = '2';
} else if (passwordType == 1) {
//
getKeyType = '3';
} else if (passwordType == 2) {
//
getKeyType = '1';
} else if (passwordType == 3) {
//
} else if (passwordType == 4) {
//
getKeyType = '6';
} else if (passwordType == 5) {
//
getKeyType = '4';
}
if (widget.type == '0') {
getFailureDateTime =
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
.millisecondsSinceEpoch
.toString();
}
var entity = await ApiRepository.to.getPasswordKey(
getFailureDateTime,
'0',
_controller.text,
getKeyType,
'0',
lockId,
'0',
getEffectiveDateTime,
'0');
if (entity.errorCode!.codeIsSuccessful) {
print('获取密码成功');
_isSendSuccess = true;
if (entity.data != null) {
_getPwdStr = entity.data!.keyboardPwd!;
setState(() {});
}
} else {
Toast.show(msg: '${entity.errorMsg}');
}
}
// //
Widget sendElectronicKeySucceed() { Widget sendElectronicKeySucceed() {
return Column( return Column(
children: [ children: [
Container( Container(
height: 300.h, height: 270.h,
width: 1.sw, width: 1.sw,
color: Colors.white, color: Colors.white,
child: Column( child: Column(
@ -258,30 +368,26 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
height: 30.h, height: 30.h,
), ),
Image.asset( Image.asset(
'images/main/icon_main_addLock.png', 'images/icon_send_success.png',
width: 150.w, width: 100.w,
height: 150.w, height: 100.w,
color: AppColors.mainColor,
), ),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
Text( Text(
"操作成功,密码为", "操作成功,密码为",
style: TextStyle( style: TextStyle(fontSize: 22.sp, color: Colors.black),
fontSize: 32.sp,
color: Colors.black,
fontWeight: FontWeight.w500),
), ),
SizedBox( SizedBox(
height: 10.h, height: 10.h,
), ),
Text( Text(
"62689876", _getPwdStr,
style: TextStyle( style: TextStyle(
fontSize: 60.sp, fontSize: 40.sp,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w600),
), ),
], ],
), ),
@ -291,34 +397,32 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
), ),
SubmitBtn( SubmitBtn(
btnName: '完成', 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: () { onClick: () {
Navigator.pushNamed(context, Routers.sendEmailNotificationPage); Navigator.pop(context);
}), }),
SubmitBtn( SizedBox(
btnName: '标记为:已入住', height: 10.h,
fontSize: 28.sp, ),
borderRadius: 20.w, OutLineBtn(
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w), btnName: '分享',
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), onClick: () {
onClick: () {}), Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
},
),
SizedBox(
height: 10.h,
),
OutLineBtn(
btnName: '标记为:已入住',
onClick: () {},
),
], ],
); );
} }
// //
Widget getTFWidget(String tfStr) { Widget getTFWidget(String tfStr) {
return Container( return SizedBox(
height: 50.h, height: 50.h,
width: 300.w, width: 300.w,
child: Row( child: Row(
@ -327,7 +431,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
child: TextField( child: TextField(
// //
maxLines: 1, maxLines: 1,
// controller: _controller, controller: _controller,
autofocus: false, autofocus: false,
textAlign: TextAlign.end, textAlign: TextAlign.end,
decoration: InputDecoration( decoration: InputDecoration(
@ -362,4 +466,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
}, },
); );
} }
String intToStr(int v) {
return (v < 10) ? "0$v" : "$v";
}
} }

View File

@ -25,4 +25,5 @@ abstract class Api {
'/key/modifyKeyNameForAdmin'; // '/key/modifyKeyNameForAdmin'; //
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; // final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //
final String passwordKeyResetURL = '/keyboardPwd/reset'; // final String passwordKeyResetURL = '/keyboardPwd/reset'; //
final String passwordKeyGetURL = '/keyboardPwd/get'; //
} }

View File

@ -264,8 +264,33 @@ class ApiProvider extends BaseProvider {
})); }));
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post( Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
resetElectronicKeyURL.toUrl, resetPasswordURL.toUrl,
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
Future<Response> getKeyboardPwd(
String endDate,
String isExclusive,
String keyboardPwdName,
String keyboardPwdType,
String keyboardPwdVersion,
String lockId,
String operatorUid,
String startDate,
String timezoneRawOffSet,
) =>
post(
passwordKeyGetURL.toUrl,
jsonEncode({
'endDate': endDate,
'isExclusive': isExclusive,
'keyboardPwdName': keyboardPwdName,
'keyboardPwdType': keyboardPwdType,
'keyboardPwdVersion': keyboardPwdVersion,
'lockId': lockId,
'operatorUid': operatorUid,
'startDate': startDate,
'timezoneRawOffSet': timezoneRawOffSet
}));
} }
extension ExtensionString on String { extension ExtensionString on String {

View File

@ -3,6 +3,7 @@ import 'package:star_lock/login/seletCountryRegion/common/countryRegionEntity.da
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.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 '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 '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart'; import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart'; import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
import '../login/login/entity/LoginEntity.dart'; import '../login/login/entity/LoginEntity.dart';
@ -174,22 +175,16 @@ class ApiRepository {
} }
// //
Future<SaveLockEntity> bindingBlueAdmin({ Future<SaveLockEntity> bindingBlueAdmin(
required String bindingDate, {required String bindingDate,
required String hotelMode, required String hotelMode,
required String lockAlias, required String lockAlias,
required String lockData, required String lockData,
required String nbInitSuccess, required String nbInitSuccess,
required String position, required String position,
required String deviceNo}) async { required String deviceNo}) async {
final res = await apiProvider.bindingBlueAdmin( final res = await apiProvider.bindingBlueAdmin(bindingDate, hotelMode,
bindingDate, lockAlias, lockData, nbInitSuccess, position, deviceNo);
hotelMode,
lockAlias,
lockData,
nbInitSuccess,
position,
deviceNo);
return SaveLockEntity.fromJson(res.body); return SaveLockEntity.fromJson(res.body);
} }
@ -243,4 +238,29 @@ class ApiRepository {
final res = await apiProvider.resetPasswordKey(lockId, operatorUid); final res = await apiProvider.resetPasswordKey(lockId, operatorUid);
return PasswordKeyListEntity.fromJson(res.body); return PasswordKeyListEntity.fromJson(res.body);
} }
//
Future<PasswordKeyEntity> getPasswordKey(
String endDate,
String isExclusive,
String keyboardPwdName,
String keyboardPwdType,
String keyboardPwdVersion,
String lockId,
String operatorUid,
String startDate,
String timezoneRawOffSet,
) async {
final res = await apiProvider.getKeyboardPwd(
endDate,
isExclusive,
keyboardPwdName,
keyboardPwdType,
keyboardPwdVersion,
lockId,
operatorUid,
startDate,
timezoneRawOffSet);
return PasswordKeyEntity.fromJson(res.body);
}
} }