1,修复密码选择日期的问题
2,修复类型不一致导致的电子钥匙点击无法发送问题
This commit is contained in:
parent
b57c18a9c0
commit
31e3250cec
@ -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;
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user