1,修复密码选择日期的问题

2,修复类型不一致导致的电子钥匙点击无法发送问题
This commit is contained in:
Daisy 2023-12-13 17:42:08 +08:00
parent b57c18a9c0
commit 31e3250cec
5 changed files with 78 additions and 29 deletions

View File

@ -27,7 +27,7 @@ class AuthorizedAdminSendEntity {
}
class Data {
int? receiverUid;
String? receiverUid;
ReceiverUser? receiverUser;
int? keyId;
@ -149,15 +149,16 @@ class Phone {
class Cloud {
String? username;
String? password;
int? cloudUid;
// String? cloudUid;
int? userId;
String? updatedAt;
String? createdAt;
int? id;
Cloud({this.username,
Cloud(
{this.username,
this.password,
this.cloudUid,
// this.cloudUid,
this.userId,
this.updatedAt,
this.createdAt,
@ -166,7 +167,7 @@ class Cloud {
Cloud.fromJson(Map<String, dynamic> json) {
username = json['username'];
password = json['password'];
cloudUid = json['cloud_uid'];
// cloudUid = json['cloud_uid'];
userId = json['user_id'];
updatedAt = json['updated_at'];
createdAt = json['created_at'];
@ -177,7 +178,7 @@ class Cloud {
final Map<String, dynamic> data = <String, dynamic>{};
data['username'] = username;
data['password'] = password;
data['cloud_uid'] = cloudUid;
// data['cloud_uid'] = cloudUid;
data['user_id'] = userId;
data['updated_at'] = updatedAt;
data['created_at'] = createdAt;

View File

@ -1,13 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
import 'package:star_lock/translations/trans_lib.dart';
class SendElectronicKeyLogic extends BaseGetXController {
@ -43,7 +41,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
String getKeyType = typeValue.toString();
var entity = await ApiRepository.to.sendElectronicKey(
createUser: state.isCreateUser.value ? "1" : "0",
createUser: state.isCreateUser.value == true ? "1" : "0",
countryCode: state.countryCode.value,
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
? '1'

View File

@ -31,10 +31,17 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
final logic = Get.put(SendElectronicKeyLogic());
final state = Get.find<SendElectronicKeyLogic>().state;
static const methodChannel = MethodChannel('talkPlugin');
bool isDemoMode = false;
@override
void initState() {
initState() {
super.initState();
getDemoMode();
}
Future<void> getDemoMode() async {
isDemoMode = (await Storage.getBool(ifIsDemoModeOrNot))!;
}
@override
@ -260,9 +267,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.send!.tr,
onClick: () async {
//
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
onClick: () {
if (isDemoMode == false) {
//
if (state.emailOrPhoneController.text.isNotEmpty &&
@ -283,6 +288,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
Toast.show(msg: '请完善信息');
}
} else {
//
Toast.show(msg: '演示模式');
}
}),
@ -293,9 +299,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () async {
onPressed: () {
//
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
Navigator.pushNamed(
context, Routers.massSendElectronicKeyManagePage);

View File

@ -54,7 +54,9 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
//
} else if (passwordType == 4) {
//
if (state.loopModeStr.value == '每日') {
if (state.loopModeStr.value == '周末') {
getKeyType = '5';
} else if (state.loopModeStr.value == '每日') {
getKeyType = '6';
} else if (state.loopModeStr.value == '工作日') {
getKeyType = '7';

View File

@ -290,13 +290,32 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
isHaveLine: true,
isHaveDirection: true,
action: () {
// Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
// state.effectiveDateTime.value = DateTime.parse(
// '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}');
// state.loopEffectiveDate.value =
// "${formatDate(state.effectiveDateTime.value, [HH])}:00";
// state.loopStartHours.value = p.hour!;
// state.selectEffectiveDate.value = state.loopEffectiveDate.value;
// });
Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
state.effectiveDateTime.value =
DateTime.parse('${intToStr(p.hour!)}:00');
state.loopEffectiveDate.value =
"${formatDate(state.effectiveDateTime.value, [HH])}:00";
state.loopStartHours.value = p.hour!;
state.selectEffectiveDate.value = state.loopEffectiveDate.value;
DateTime selectedDateTime = DateTime(
p.year!,
p.month!,
p.day!,
p.hour!,
);
if (isValidDateTime(selectedDateTime)) {
state.effectiveDateTime.value = selectedDateTime;
state.loopEffectiveDate.value =
"${formatDate(state.effectiveDateTime.value, [HH])}:00";
state.loopStartHours.value = p.hour!;
state.selectEffectiveDate.value =
state.loopEffectiveDate.value;
} else {
// 使
}
});
}),
CommonItem(
@ -304,19 +323,43 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
rightTitle: state.loopFailureDate.value,
isHaveDirection: true,
action: () {
// Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
// state.failureDateTime.value = DateTime.parse(
// '${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}');
// state.loopFailureDate.value =
// "${formatDate(state.failureDateTime.value, [HH])}:00";
// state.loopEndHours.value = p.hour!;
// state.selectFailureDate.value = state.loopFailureDate.value;
// });
Pickers.showDatePicker(context, mode: DateMode.H, onConfirm: (p) {
state.failureDateTime.value =
DateTime.parse('${intToStr(p.hour!)}:00');
state.loopEffectiveDate.value =
"${formatDate(state.failureDateTime.value, [HH])}:00";
state.loopEndHours.value = p.hour!;
state.selectFailureDate.value = state.loopFailureDate.value;
DateTime selectedDateTime = DateTime(
p.year!,
p.month!,
p.day!,
p.hour!,
);
if (isValidDateTime(selectedDateTime)) {
state.failureDateTime.value = selectedDateTime;
state.loopFailureDate.value =
"${formatDate(state.failureDateTime.value, [HH])}:00";
state.loopEndHours.value = p.hour!;
state.selectFailureDate.value = state.loopFailureDate.value;
} else {
// 使
}
});
}),
],
);
}
bool isValidDateTime(DateTime dateTime) {
//
// true false
return true; // true
}
//pickerView
showPickerView(BuildContext context, List dataList) {
Pickers.showSinglePicker(context,
@ -358,7 +401,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
}
//||
if (getWidgetNumber == 1 || getWidgetNumber == 4) {
if (getWidgetNumber == 1) {
if (state.failureDateTime.value
.compareTo(state.effectiveDateTime.value) !=
1) {