Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
# Conflicts: # star_lock/lib/network/api.dart # star_lock/lib/network/api_repository.dart
This commit is contained in:
commit
239ea064f6
@ -373,14 +373,14 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 7NLFRKNVY3;
|
||||
DEVELOPMENT_TEAM = ZJ29NYHTV5;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.starLock456;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
@ -501,14 +501,14 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 7NLFRKNVY3;
|
||||
DEVELOPMENT_TEAM = ZJ29NYHTV5;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.starLock456;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
@ -522,14 +522,14 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 7NLFRKNVY3;
|
||||
DEVELOPMENT_TEAM = ZJ29NYHTV5;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.starLock456;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
|
||||
@ -2,13 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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 '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
|
||||
|
||||
@ -33,12 +33,10 @@ class _ElectronicKeyPeriodValidityPageState
|
||||
];
|
||||
List validityDataList = []; //自定义数据块
|
||||
List selectIndexList = []; //选中的有效期数组
|
||||
String _effectiveTime = '';
|
||||
String _failureTime = '';
|
||||
|
||||
String _effectiveDate = '';
|
||||
String _failureDate = '';
|
||||
|
||||
String _selectEffectiveDate = ''; //生效时间
|
||||
String _selectFailureDate = ''; //失效时间
|
||||
late DateTime _effectiveDateTime;
|
||||
late DateTime _failureDateTime;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -149,58 +147,59 @@ class _ElectronicKeyPeriodValidityPageState
|
||||
Widget bottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: _effectiveTime,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
_effectiveTime = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
// CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
// rightTitle: _effectiveTime,
|
||||
// isHaveDirection: true,
|
||||
// isHaveLine: true,
|
||||
// action: () {
|
||||
// Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
// onConfirm: (p) {
|
||||
// _effectiveTime = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: _failureTime,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
_failureTime = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
// setState(() {});
|
||||
// });
|
||||
// }),
|
||||
// CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
// rightTitle: _failureTime,
|
||||
// isHaveDirection: true,
|
||||
// action: () {
|
||||
// Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
// onConfirm: (p) {
|
||||
// _failureTime = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
// setState(() {});
|
||||
// });
|
||||
// }),
|
||||
// Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveDate!.tr,
|
||||
rightTitle: _effectiveDate,
|
||||
rightTitle: _selectEffectiveDate,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
DateTime getPTime = DateTime.parse(
|
||||
'${intToStr(p.year!)}-${intToStr(p.month!)}-${intToStr(p.day!)}');
|
||||
_effectiveDate = formatDate(getPTime, [yyyy, '-', mm, '-', dd]);
|
||||
_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]);
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureDate!.tr,
|
||||
rightTitle: _failureDate,
|
||||
rightTitle: _selectFailureDate,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMD,
|
||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
DateTime getPTime = DateTime.parse(
|
||||
'${intToStr(p.year!)}-${intToStr(p.month!)}-${intToStr(p.day!)}');
|
||||
_failureDate = formatDate(getPTime, [yyyy, '-', mm, '-', dd]);
|
||||
|
||||
_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]);
|
||||
setState(() {});
|
||||
});
|
||||
}),
|
||||
@ -213,6 +212,8 @@ class _ElectronicKeyPeriodValidityPageState
|
||||
onClick: () {
|
||||
Map<String, dynamic> resultMap = {};
|
||||
resultMap['validityValue'] = selectIndexList;
|
||||
resultMap['starDate'] = _effectiveDateTime;
|
||||
resultMap['endDate'] = _failureDateTime;
|
||||
Navigator.pop(context, resultMap);
|
||||
}),
|
||||
],
|
||||
|
||||
@ -35,15 +35,17 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
bool _isRemoteUnlock = false; //是否允许远程开锁
|
||||
bool _isAuthentication = false; //是否可以实名认证
|
||||
String _selectEffectiveDate = ''; //生效时间
|
||||
String _selectFailureDate = ''; //失效时间
|
||||
late DateTime _effectiveDateTime;
|
||||
late DateTime _failureDateTime;
|
||||
String _selectFailureDate = ''; //失效时间
|
||||
TextEditingController emailOrPhoneController =
|
||||
TextEditingController(); //邮箱/手机号输入框
|
||||
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||
late bool _isSendSuccess;
|
||||
String countryName = '中国';
|
||||
String countryCode = '86';
|
||||
List weekdaysList = [];
|
||||
bool _isCreateUser = false; //用户未注册时传1 已注册传0
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -239,9 +241,15 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: "",
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.electronicKeyPeriodValidityPage);
|
||||
result as Map<String, dynamic>;
|
||||
weekdaysList = result['validityValue'];
|
||||
_effectiveDateTime = result['starDate'];
|
||||
_failureDateTime = result['endDate'];
|
||||
print(
|
||||
'得到的有效期数据:$weekdaysList $_effectiveDateTime $_failureDateTime');
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
@ -274,11 +282,15 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
//发送钥匙请求
|
||||
if (emailOrPhoneController.text.isNotEmpty &&
|
||||
keyNameController.text.isNotEmpty) {
|
||||
//失效时间大于生效时间
|
||||
if (_failureDateTime.compareTo(_effectiveDateTime) == 1) {
|
||||
sendElectronicKeyRequest();
|
||||
if (int.parse(widget.type) == 0) {
|
||||
//失效时间大于生效时间
|
||||
if (_failureDateTime.compareTo(_effectiveDateTime) == 1) {
|
||||
sendElectronicKeyRequest();
|
||||
} else {
|
||||
Toast.show(msg: '失效时间需大于生效时间');
|
||||
}
|
||||
} else {
|
||||
Toast.show(msg: '失效时间需大于生效时间');
|
||||
sendElectronicKeyRequest();
|
||||
}
|
||||
} else {
|
||||
Toast.show(msg: '请完善信息');
|
||||
@ -321,7 +333,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
.toString();
|
||||
}
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
'0',
|
||||
_isCreateUser ? "1" : "0",
|
||||
countryCode,
|
||||
'1',
|
||||
getFailureDateTime,
|
||||
@ -335,13 +347,18 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
'小吴副号',
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -210,8 +210,15 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
} 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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,15 @@
|
||||
import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/cupertino.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: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 '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -21,6 +26,12 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
|
||||
|
||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
final TextEditingController _controller = TextEditingController();
|
||||
late bool _isSendSuccess;
|
||||
late String _getPwdStr;
|
||||
String _selectEffectiveDate = ''; //生效时间
|
||||
String _selectFailureDate = ''; //失效时间
|
||||
late DateTime _effectiveDateTime;
|
||||
late DateTime _failureDateTime;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -29,98 +40,109 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement 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() {
|
||||
switch (int.parse(widget.type)) {
|
||||
case 0:
|
||||
{
|
||||
// 永久
|
||||
// return sendElectronicKeySucceed();
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: [
|
||||
keyTimeLimitWidget(),
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// 单次
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
// 自定义
|
||||
return Column(
|
||||
children: [
|
||||
keyIfPerpetualWidget(),
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
perpetualKeyWidget(TranslationLoader.lanKeys!.password!.tr,
|
||||
"请输入6-9位数字", _controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
// 循环
|
||||
return Column(
|
||||
children: [
|
||||
keyCirculationWidget(),
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip5!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
// 清空
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
default:
|
||||
return Container();
|
||||
if (_isSendSuccess) {
|
||||
return sendElectronicKeySucceed();
|
||||
} else {
|
||||
switch (int.parse(widget.type)) {
|
||||
case 0:
|
||||
{
|
||||
// 永久
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// 限时
|
||||
return Column(
|
||||
children: [
|
||||
keyTimeLimitWidget(),
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// 单次
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
// 自定义
|
||||
return Column(
|
||||
children: [
|
||||
keyIfPerpetualWidget(),
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
perpetualKeyWidget(TranslationLoader.lanKeys!.password!.tr,
|
||||
"请输入6-9位数字", _controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
// 循环
|
||||
return Column(
|
||||
children: [
|
||||
keyCirculationWidget(),
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip5!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
// 清空
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
_controller),
|
||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
|
||||
],
|
||||
);
|
||||
}
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,18 +173,34 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: "2020.06.20 11:49",
|
||||
rightTitle: _selectEffectiveDate,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
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(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: "2020.06.20 11:49",
|
||||
rightTitle: _selectFailureDate,
|
||||
isHaveDirection: true,
|
||||
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),
|
||||
],
|
||||
@ -239,17 +277,89 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
),
|
||||
SubmitBtn(
|
||||
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() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 300.h,
|
||||
height: 270.h,
|
||||
width: 1.sw,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
@ -258,30 +368,26 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
height: 30.h,
|
||||
),
|
||||
Image.asset(
|
||||
'images/main/icon_main_addLock.png',
|
||||
width: 150.w,
|
||||
height: 150.w,
|
||||
color: AppColors.mainColor,
|
||||
'images/icon_send_success.png',
|
||||
width: 100.w,
|
||||
height: 100.w,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
"操作成功,密码为",
|
||||
style: TextStyle(
|
||||
fontSize: 32.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
style: TextStyle(fontSize: 22.sp, color: Colors.black),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
"62689876",
|
||||
_getPwdStr,
|
||||
style: TextStyle(
|
||||
fontSize: 60.sp,
|
||||
fontSize: 40.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -291,34 +397,32 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
),
|
||||
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);
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
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: () {},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 接受者信息输入框
|
||||
Widget getTFWidget(String tfStr) {
|
||||
return Container(
|
||||
return SizedBox(
|
||||
height: 50.h,
|
||||
width: 300.w,
|
||||
child: Row(
|
||||
@ -327,7 +431,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
// controller: _controller,
|
||||
controller: _controller,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
@ -362,4 +466,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
String intToStr(int v) {
|
||||
return (v < 10) ? "0$v" : "$v";
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,4 +28,5 @@ abstract class Api {
|
||||
|
||||
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
||||
|
||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||
}
|
||||
|
||||
@ -276,8 +276,33 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
|
||||
resetElectronicKeyURL.toUrl,
|
||||
resetPasswordURL.toUrl,
|
||||
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 {
|
||||
|
||||
@ -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/electronicKeyList/entity/ElectronicKeyListEntity.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/SafetyVerificationEntity.dart';
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
@ -255,4 +256,28 @@ class ApiRepository {
|
||||
return LockMainEntity.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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user